最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Flutter實(shí)現(xiàn)旋轉(zhuǎn)掃描效果

 更新時(shí)間:2022年01月21日 10:34:10   作者:易寒  
這篇文章主要介紹了通過Flutter RotationTransition實(shí)現(xiàn)雷達(dá)旋轉(zhuǎn)掃描的效果,文中的示例代碼講解詳細(xì),感興趣的同學(xué)可以動(dòng)手試一試

效果圖:

1 .測(cè)試Demo啟動(dòng)文件

main() {
  runApp(MaterialApp(
    home: SignSwiperPage(),
  ));
}

class SignSwiperPage extends StatefulWidget {
  @override
  _SignSwiperPageState createState() => _SignSwiperPageState();
}

class _SignSwiperPageState extends State<SignSwiperPage>
    with SingleTickerProviderStateMixin {

}

接下來的代碼都在 _SignSwiperPageState中編寫

2 .動(dòng)畫控制器用來實(shí)現(xiàn)旋轉(zhuǎn)

//動(dòng)畫控制器
  AnimationController _animationController;

  @override
  void initState() {
    super.initState();

    //創(chuàng)建
    _animationController = new AnimationController(
        vsync: this, duration: Duration(milliseconds: 2000));
    //添加到事件隊(duì)列中
    Future.delayed(Duration.zero, () {
      //動(dòng)畫重復(fù)執(zhí)行
      _animationController.repeat();
    });
  }

  @override
  void dispose() {
    //銷毀
    _animationController.dispose();
    super.dispose();
  }

3 .旋轉(zhuǎn)掃描效果

@override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("Swiper Demo"),
      ),
      backgroundColor: Colors.white,
      //居中
      body: Center(
        //層疊布局
        child: Stack(
          children: [
            //第一層的背景 圓形剪裁
            ClipOval(
              child: Container(
                width: 200,
                height: 200,
                color: Colors.green,
              ),
            ),
            //第二層的掃描
            buildRotationTransition(),
          ],
        ),
      ),
    );
  }

RotationTransition用來實(shí)現(xiàn)旋轉(zhuǎn)動(dòng)畫

RotationTransition buildRotationTransition() {
    //旋轉(zhuǎn)動(dòng)畫 
    return RotationTransition(
      //動(dòng)畫控制器
      turns: _animationController,
      //圓形裁剪
      child: ClipOval(
        //掃描漸變
        child: Container(
          width: 200,
          height: 200,
          decoration: BoxDecoration(
            //掃描漸變
            gradient: SweepGradient(colors: [
              Colors.white.withOpacity(0.2),
              Colors.white.withOpacity(0.6),
            ]),
          ),
        ),
      ),
    );
  }

到此這篇關(guān)于Flutter實(shí)現(xiàn)旋轉(zhuǎn)掃描效果的文章就介紹到這了,更多相關(guān)Flutter旋轉(zhuǎn)掃描效果內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評(píng)論

蒲江县| 黄大仙区| 浏阳市| 天气| 武夷山市| 彰化市| 鄯善县| 慈利县| 积石山| 三都| 东阳市| 余庆县| 麻栗坡县| 喀喇沁旗| 沙坪坝区| 搜索| 神池县| 新竹县| 博白县| 辽阳市| 麦盖提县| 怀宁县| 三都| 华宁县| 台南县| 平湖市| 靖宇县| 合江县| 高平市| 安阳县| 日土县| 松滋市| 衡阳市| 邵阳市| 罗甸县| 平泉县| 邹城市| 进贤县| 清新县| 辽源市| 临江市|