Flutter Upgrade破坏了按钮的断面,使某些按钮不可见。

时间:2018-06-23 16:59:40

标签: flutter

最近,我运行了flutter upgrade,这是我使用浮动操作按钮构建的按钮过渡功能,该按钮操作过去可以正常工作,但不再起作用。动画将隐藏除最后一个按钮以外的所有按钮。关于导致此问题的更改有什么想法?

enter image description here

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();
                        }
                        },
                    )
                ),
                )),
        )
    ),
    );
}

1 个答案:

答案 0 :(得分:0)

好,我再次运行了flutter升级,它已修复。我的猜测是,这是在Flutter版本中引入的错误,很快就解决了。