flutter - Flutter Upgrade 破坏了按钮转换,使一些按钮不可见。
问题描述
最近我运行了一个flutter upgrade
,一个我用浮动操作按钮构建的按钮转换,以前可以正常工作,现在不再工作了。动画隐藏了除最后一个按钮之外的所有按钮。关于什么变化导致这个问题的任何想法?
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, v0.5.6-pre.55, on Linux, locale en_US.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
[✓] Android Studio (version 3.0)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] IntelliJ IDEA Ultimate Edition (version 2018.1)
[!] VS Code (version 1.23.1)
[✓] Connected devices (1 available)
看看一个示例项目:https ://github.com/abarrafo/flutter_button_animation
@override
Widget build(BuildContext context) {
return new Scaffold(
body: new Container(),
floatingActionButton: new SingleChildScrollView(
child: new Container(
padding: new EdgeInsets.fromLTRB(
0.0,
_showMenu ? 50.0 : 0.0,
0.0,
0.0),
child: new Column(
mainAxisSize: MainAxisSize.min,
children:
!_showMenu ? new List()
: new List.generate(widget.icons.length, (int index) {
Widget child = new Container(
height: 70.0,
width: 56.0,
alignment: FractionalOffset.topCenter,
child: new ScaleTransition(
scale: new CurvedAnimation(
parent: _animationController,
curve: new Interval(
0.0,
1.0 - index / widget.icons.length / 2.0,
curve: Curves.easeOut
),
),
child: index == 2 || index == 3 ? new GestureDetector(
onDoubleTap: (){
//do stuff
},
onLongPress: (){
//do other stuff
},
child: new FloatingActionButton(
heroTag: index,
mini: true,
child: new Icon(widget.icons[index]),
onPressed: () {
//do other stuff
},
),
) :
new FloatingActionButton(
heroTag: index,
mini: true,
child: new Icon(widget.icons[index]),
onPressed: () {
//do stuff
},
)
,
),
);
return child;
}).toList()..add(
new Opacity(opacity: 0.5,
child: new FloatingActionButton(
elevation: 3.0,
child: new AnimatedBuilder(
animation: _animationController,
builder: (BuildContext context, Widget child) {
return new Transform(
transform: new Matrix4.rotationZ(
_animationController.value * 0.5 * math.pi),
alignment: FractionalOffset.center,
child: new Icon(_animationController.isDismissed
? Icons.menu
: Icons.close),
);
},
),
onPressed: () {
if (_animationController.isDismissed) {
setState(() {
_showMenu = true;
});
_animationController.forward();
} else {
new Timer(new Duration(milliseconds: 500), (){
setState(() {
_showMenu = false;
});
});
_animationController.reverse();
}
},
)
),
)),
)
),
);
}
解决方案
好的,我再次运行flutter upgrade,它已修复。我的猜测是这是在颤振构建中引入的一个错误,并很快得到解决。
推荐阅读
- angular - 编译时角树组件错误
- quickfix - 使用 quickfix 检索在 FxAll 平台上执行的交易
- mysql - 如何在 MySQL 中使用动态数据动态更新所有行?
- reactjs - 添加价值道具“锁定”选择
- ios - 如何在 iOS 中以终止/终止模式调用 API
- asp.net-mvc - 我不断收到错误消息:“对象引用未设置为对象的实例。”
- xamarin.android - 在 Xamarin.UiTest 中访问视图的自定义属性
- javascript - 如何修复来自 Jquery Ajax 发布请求的“net::ERR_EMPTY_RESPONSE”错误?
- python - 为什么我在以下代码的输出末尾没有得到任何内容以及如何避免它?
- xaml - 如何在 CollectionView 中存储值