Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

show multiple times will cause exception #9

Closed
dujianchi opened this issue Sep 8, 2018 · 5 comments
Closed

show multiple times will cause exception #9

dujianchi opened this issue Sep 8, 2018 · 5 comments
Labels
bug Something isn't working

Comments

@dujianchi
Copy link

First, sorry for my English...
There are three exception:
1.quick click button twice, then click navigator bar back icon, it will not pop at first time ,need click back twice.
2.click 'toast' button once, when flushbar dismissing, click 'toast' again, it doesn't show.
3.click 'toast' and wait a second, before it dismiss, click 'toast' again, then wait, about one second after, it whill cause a exception.
Then, here is my code:


import 'package:flutter/material.dart';
import 'package:flushbar/flushbar.dart';

void main() => runApp(MaterialApp(
      home: MyApp(),
      routes: <String, WidgetBuilder>{
        '/two': (context) => TwoButton(),
      },
    ));

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) => Scaffold(
        appBar: AppBar(
          title: Text('test'),
        ),
        body: Center(
          child: RaisedButton(
            child: Text('go'),
            onPressed: () {
              Navigator.pushNamed(context, '/two');
            },
          ),
        ),
      );
}

class TwoButton extends StatefulWidget {
  @override
  State<StatefulWidget> createState() => _TwoButtonState();
}

class _TwoButtonState extends State<TwoButton> {
  @override
  Widget build(BuildContext context) => Scaffold(
        appBar: AppBar(
          title: Text('twp'),
        ),
        body: ListView(
          children: <Widget>[
            RaisedButton(
              child: Text('toast'),
              onPressed: () {
                Flushbar(
                  message: 'toast',
                  duration: const Duration(seconds: 2),
                  isDismissible: true,
                ).show(context);
              },
            ),
            Text("""

    1.quick click button twice, then click navigator bar back icon, it will not pop at first time ,need click back twice.

    2.click 'toast' button once, when flushbar dismissing, click 'toast' again, it doesn't show.

    3.click 'toast' and wait a second, before it dismiss, click 'toast' again, then wait, about one second after, it whill cause a exception:
        E/flutter (31575): [ERROR:flutter/shell/common/shell.cc(181)] Dart Error: Unhandled exception:
        E/flutter (31575): NoSuchMethodError: The method 'stop' was called on null.
        E/flutter (31575): Receiver: null
        E/flutter (31575): Tried calling: stop(canceled: true)
        E/flutter (31575): #0      Object.noSuchMethod (dart:core/runtime/libobject_patch.dart:48:5)
        E/flutter (31575): #1      AnimationController.stop (package:flutter/src/animation/animation_controller.dart:556:13)
        E/flutter (31575): #2      AnimationController._animateToInternal (package:flutter/src/animation/animation_controller.dart:433:5)
        E/flutter (31575): #3      AnimationController.reverse (package:flutter/src/animation/animation_controller.dart:381:12)
        E/flutter (31575): #4      _FlushbarState._configureTimer.<anonymous closure> (package:flushbar/flushbar.dart:252:24)
        E/flutter (31575): #5      Timer._createTimer.<anonymous closure> (dart:async/runtime/libtimer_patch.dart:21:15)

            """),
          ],
        ),
      );
}

and my flutter doctor:

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel beta, v0.7.3, on Microsoft Windows [Version 10.0.17134.228], locale zh-CN)
[√] Android toolchain - develop for Android devices (Android SDK 28.0.2)
[√] Android Studio (version 3.1)
[!] IntelliJ IDEA Ultimate Edition (version 2018.2)
    X Flutter plugin not installed; this adds Flutter specific functionality.
    X Dart plugin not installed; this adds Dart specific functionality.
[√] Connected devices (1 available)

! Doctor found issues in 1 category.

flushbar: ^0.8.3

@dujianchi
Copy link
Author

my device:
Xiaomi Redmi 4X
MIUI 10 8.8.30 beta
Android 7.1.2
RAM 2GB
CPU Octa-core Max 1.4GHz
Kernel version 3.18.31-perf-g52975e0
Available storage 1.44GB
Total storeage 16GB

@AndreHaueisen
Copy link
Owner

Hi @dujianchi
I'm aware of this problem. It happens when you have more than one Flushbar showing, and you dismiss them without dismissing the top one first. I'm trying hard to fix it, but I do not have the solution yet.

I will probably have to animate the route itself instead of animating the widget when Flushbar.show(context) is called. I will notify you when it is ready.

@AndreHaueisen AndreHaueisen added the bug Something isn't working label Sep 8, 2018
@dujianchi
Copy link
Author

Thank you very much.

@dujianchi
Copy link
Author

dujianchi commented Sep 9, 2018

I may be fix those bug... It took me a whole day. https://github.com/dujianchi/flushbar . I don't push a pr because I afraid I was wrong.
I use PopupRoute replace OverlayRoute, so it can only show once...

@AndreHaueisen
Copy link
Owner

@dujianchi
Version 0.9 is out. See if it provides a more reliable Flushbar and fixes this problem. Make sure you read the Changelog

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants