Skip to content

Programmatically stop and start fails #47

Description

@alexlipa91

I would like to start the button animation and stop it after a ModalBottom has been shown.

When the modal is shown, if I press outside the modal (basically it pops it from the stack) the button would continue to run. That is why I added controller.reset().

This works fine the first time. However if I do this same thing twice I get

I/flutter (25672): LateInitializationError: Field '_stopListener@67160650' has not been initialized.
I/flutter (25672): 
I/flutter (25672): #0      RoundedLoadingButtonController._stopListener (package:rounded_loading_button/rounded_loading_button.dart)
I/flutter (25672): #1      RoundedLoadingButtonController.stop (package:rounded_loading_button/rounded_loading_button.dart:313:5)
I/flutter (25672): #2      JoinGameButton.onPressed (package:nutmeg/screens/MatchDetailsModals.dart:575:16)
I/flutter (25672): <asynchronous suspension>

This is the onTap function for the button

Future<void> onTap(
      BuildContext context, RoundedLoadingButtonController controller) async {
      var paymentRecap = await PaymentController.generatePaymentRecap(
        matchesState, match.documentId, userState);
    await showModalBottomSheet(
         context: context,
         builder: (context) => PrepaymentBottomBar(
               match: match,
               recap: paymentRecap,
             ));

    controller.stop();

I have tried controller.stop() as well as controller.reset() but same outcome

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions