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

Pressing Back button cause visible frontLayer #132

Closed
pishguy opened this issue Sep 4, 2023 · 10 comments · Fixed by #133
Closed

Pressing Back button cause visible frontLayer #132

pishguy opened this issue Sep 4, 2023 · 10 comments · Fixed by #133

Comments

@pishguy
Copy link

pishguy commented Sep 4, 2023

I'm not sure why this issue happened but when frontLayer isn't visible when i pressing on android back button that cause visible frontLayer

my tested code:

class SplashScreenWidget extends StatefulWidget {
  /// Default constructor for [SplashScreenWidget].
  const SplashScreenWidget({Key? key}) : super(key: key);

  @override
  _SplashScreenWidgetState createState() => _SplashScreenWidgetState();
}

class _SplashScreenWidgetState extends State<SplashScreenWidget> {
  @override
  Widget build(BuildContext context) => MaterialApp(
        title: 'Backdrop Demo',
        home: BackdropScaffold(
          appBar: BackdropAppBar(
            actions: const <Widget>[
              BackdropToggleButton(
                icon: AnimatedIcons.list_view,
              )
            ],
          ),
          backLayer: Center(
            child: Text("Back Layer"),
          ),
          frontLayer: Center(
            child: Text("Front Layer"),
          ),
        ),
      );
}
Tf5D05_r.mp4
@pishguy pishguy changed the title Pressing Back button cause opening frontLayer Pressing Back button cause visible frontLayer Sep 4, 2023
@WieFel
Copy link
Collaborator

WieFel commented Sep 5, 2023

In my opinion this is the expected behavior.
@daadu what do you think?

@pishguy
Copy link
Author

pishguy commented Sep 5, 2023

@WieFel You may right, how can i prevent this behavior now?

@daadu
Copy link
Member

daadu commented Sep 6, 2023

Yes, it is expected behaviour.

The code that does it is at -

return WillPopScope(
onWillPop: () => _willPopCallback(context),
child: Scaffold(

Wrapping another WillPopScope around BackdropScaffold, might not work - because I think flutter will also call the code inside backdrop lib. Although you can give it a try.

As of now, you can fork and remove this widget from the library and use it.

@daadu
Copy link
Member

daadu commented Sep 6, 2023

OR

You can file a PR to make this behaviour optional adding option bool concealBacklayerOnBackButton = true to BackdropScafold

@daadu
Copy link
Member

daadu commented Sep 6, 2023

@WieFel What do you think of this option?

@WieFel
Copy link
Collaborator

WieFel commented Sep 6, 2023

@daadu yeah we can add the option

@pishguy
Copy link
Author

pishguy commented Sep 6, 2023

Yes, it is expected behaviour.

The code that does it is at -

return WillPopScope(
onWillPop: () => _willPopCallback(context),
child: Scaffold(

Wrapping another WillPopScope around BackdropScaffold, might not work - because I think flutter will also call the code inside backdrop lib. Although you can give it a try.

As of now, you can fork and remove this widget from the library and use it.

i checked before it doesn't work correctly

@daadu
Copy link
Member

daadu commented Sep 6, 2023

@WieFel filled PR please review

@daadu daadu closed this as completed in #133 Sep 6, 2023
@daadu
Copy link
Member

daadu commented Sep 6, 2023

@pishguy Thanks for filling the issue, the concealBacklayerOnBackButton option has been added and published to pub.dev with v0.9.1. Please check, you can disable this behaviour, by setting it false.

Also, check yourself out in the README.md!!

@pishguy
Copy link
Author

pishguy commented Sep 23, 2023

i solved closing frontLayer when visibility of that is true

pull request: 135

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants