大佬教程收集整理的这篇文章主要介绍了飞镖 – 颤动 – 浮动动作按钮 – 隐藏物品的可见性,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
但是我无法在项目中插入不透明度.在任何地方我都会发生某种错误.我不知道不透明度是否是最好的方法.
要隐藏我相信动画的项目,可以控制它们出现的时间.
以下是我迄今取得的成就:
你能帮我解决这个问题吗?
以下是上面的gif代码:
import 'package:Flutter/animation.dart'; import 'package:Flutter/material.dart'; void main() { runApp(new MaterialApp(home: new HomePage())); } class HomePage extends StatefulWidget { @override HomePageState createState() => new HomePageState(); } class HomePageState extends State<HomePage> with TickerProviderStatemixin { int _angle = 90; bool _isRotated = true; void _rotate(){ setState((){ if(_isRotated) { _angle = 45; _isRotated = false; } else { _angle = 90; _isRotated = true; } }); } @override Widget build(BuildContext context) { return new Scaffold( body: new Stack( children: <Widget>[ new Positioned( bottom: 200.0,right: 24.0,child: new Container( child: new Row( children: <Widget>[ new Container( margin: new EdgeInsets.only(right: 16.0),child: new Text( 'foo1',style: new TextStyle( fontSize: 13.0,fontFamily: 'Roboto',color: new Color(0xFF9E9E9E),fontWeight: FontWeight.bold,),new Material( color: new Color(0xFF9E9E9E),type: MaterialType.circle,elevation: 6.0,child: new GestureDetector( child: new Container( width: 40.0,height: 40.0,child: new InkWell( onTap: (){},child: new Center( child: new Icon( Icons.add,color: new Color(0xFFFFFFFF),) ),) ),],) ),new Positioned( bottom: 144.0,child: new Container( child: new Row( children: <Widget>[ new Container( margin: new EdgeInsets.only(right: 16.0),child: new Text( 'foo2',style: new TextStyle( fontSize: 13.0,new Material( color: new Color(0xFF00BFA5),child: new GestureDetector( child: new Container( width: 40.0,child: new InkWell( onTap: (){},child: new Center( child: new Icon( Icons.add,) ),) ),) ),new Positioned( bottom: 88.0,child: new Text( 'foo3',new Material( color: new Color(0xFFE57373),new Positioned( bottom: 16.0,right: 16.0,child: new Material( color: new Color(0xFFE57373),child: new GestureDetector( child: new Container( width: 56.0,height: 56.00,child: new InkWell( onTap: _rotate,child: new Center( child: new RotationTransition( turns: new AlwaysStoppedAnimation(_angle / 360),child: new Icon( Icons.add,) ),] ) ); } }
以下是代码及其结果:
import 'package:Flutter/animation.dart'; import 'package:Flutter/material.dart'; void main() { runApp(new MaterialApp(home: new HomePage())); } class HomePage extends StatefulWidget { @override HomePageState createState() => new HomePageState(); } class HomePageState extends State<HomePage> with TickerProviderStatemixin { int _angle = 90; bool _isRotated = true; AnimationController _controller; Animation<double> _animation; Animation<double> _animation2; Animation<double> _animation3; @override void initState() { _controller = new AnimationController( vsync: this,duration: const Duration(milliseconds: 180),); _animation = new CurvedAnimation( parent: _controller,curve: new Interval(0.0,1.0,curve: Curves.linear),); _animation2 = new CurvedAnimation( parent: _controller,curve: new Interval(0.5,); _animation3 = new CurvedAnimation( parent: _controller,curve: new Interval(0.8,); _controller.reverse(); super.initState(); } void _rotate(){ setState((){ if(_isRotated) { _angle = 45; _isRotated = false; _controller.forWARD(); } else { _angle = 90; _isRotated = true; _controller.reverse(); } }); } @override Widget build(BuildContext context) { return new Scaffold( body: new Stack( children: <Widget>[ new Positioned( bottom: 200.0,child: new Container( child: new Row( children: <Widget>[ new ScaleTransition( scale: _animation3,alignment: FractionalOffset.center,child: new Container( margin: new EdgeInsets.only(right: 16.0),child: new Text( 'foo1',style: new TextStyle( fontSize: 13.0,new ScaleTransition( scale: _animation3,child: new Material( color: new Color(0xFF9E9E9E),child: new GestureDetector( child: new Container( width: 40.0,child: new InkWell( onTap: (){ if(_angle == 45.0){ print("foo1"); } },child: new Center( child: new Icon( Icons.add,) ),child: new Container( child: new Row( children: <Widget>[ new ScaleTransition( scale: _animation2,child: new Container( margin: new EdgeInsets.only(right: 16.0),child: new Text( 'foo2',new ScaleTransition( scale: _animation2,child: new Material( color: new Color(0xFF00BFA5),child: new InkWell( onTap: (){ if(_angle == 45.0){ print("foo2"); } },child: new Container( child: new Row( children: <Widget>[ new ScaleTransition( scale: _animation,child: new Text( 'foo3',new ScaleTransition( scale: _animation,child: new Material( color: new Color(0xFFE57373),child: new InkWell( onTap: (){ if(_angle == 45.0){ print("foo3"); } },] ) ); } }
以上是大佬教程为你收集整理的飞镖 – 颤动 – 浮动动作按钮 – 隐藏物品的可见性全部内容,希望文章能够帮你解决飞镖 – 颤动 – 浮动动作按钮 – 隐藏物品的可见性所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。