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

How can I show a flash on top of an alert dialog? #8

Closed
CurrySenpai opened this issue May 16, 2020 · 3 comments
Closed

How can I show a flash on top of an alert dialog? #8

CurrySenpai opened this issue May 16, 2020 · 3 comments

Comments

@CurrySenpai
Copy link

Currently the flash is shown behind the dialog

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

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      home: Home(),
    );
  }
}

class Home extends StatelessWidget {
  const Home({Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: RaisedButton(
          onPressed: () {
            showDialog(
              context: context,
              builder: (_) => AlertDialog(
                content: RaisedButton(
                  onPressed: () {
                    showFlash(
                      context: context,
                      duration: Duration(seconds: 3),
                      persistent: true,
                      builder: (_, controller) {
                        return Flash(
                          controller: controller,
                          child: FlashBar(
                            message: Text('Hello Flash'),
                          ),
                        );
                      },
                    );
                  },
                  child: Text('Show Flash'),
                ),
              ),
            );
          },
          child: Text('Show Dialog'),
        ),
      ),
    );
  }
}

flash

@sososdk
Copy link
Owner

sososdk commented May 18, 2020

Hi @CurrySenpai , I ran your code, Flash is at the top.

CEADB5CA08E0992BDBEAC3E60C9B703E

@CurrySenpai
Copy link
Author

@sososdk thanks for check,
Are you using flutter stable 1.17 - 1.17.1 ?
I would believe that the error arose in this version, because before updating I did not notice it

@sososdk
Copy link
Owner

sososdk commented May 18, 2020

@CurrySenpai

flutter doctor -v

[✓] Flutter (Channel stable, v1.17.1, on Mac OS X 10.15.3 19D76, locale zh-Hans-CN)
    • Flutter version 1.17.1 at /Users/xxx/fvm/versions/stable
    • Framework revision f7a6a7906b (5 days ago), 2020-05-12 18:39:00 -0700
    • Engine revision 6bc433c6b6
    • Dart version 2.8.2

@sososdk sososdk closed this as completed May 22, 2020
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

No branches or pull requests

2 participants