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

Black screen before opening the first screen #8

Closed
docbohanh opened this issue Jan 22, 2020 · 1 comment
Closed

Black screen before opening the first screen #8

docbohanh opened this issue Jan 22, 2020 · 1 comment
Labels
good first issue Good for newcomers

Comments

@docbohanh
Copy link

Hello,
I am trying to build the app with custom theme using ValueBuilder and AppStateProvider.

Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.14.6 18G103, locale en-VN)
• Flutter version 1.12.13+hotfix.5 at /Users/thanhla/flutter
• Framework revision 27321ebbad (6 weeks ago), 2019-12-10 18:15:01 -0800
• Engine revision 2994f7e1e6
• Dart version 2.7.0

But my app appear black screen before opening the first screen.

    final theme = AppStateProvider.of<AppState>(context).currentTheme;

    return ValueBuilder<MyTheme>(
      streamed: theme,
      builder: (context, snapshot) => MaterialApp(
        title: 'Flutter Demo',
        theme: _buildThemeData(snapshot.data),
        onGenerateRoute: generateRoute,
        debugShowCheckedModeBanner: false,
        navigatorKey: navigatorKey,
        initialRoute: Routes.home,
      ),
    );

Please check my demo code, thank you!
quiz.zip

@frideosapps frideosapps added the good first issue Good for newcomers label Jan 22, 2020
@docbohanh
Copy link
Author

maybe I am missing initialData

    final theme = AppStateProvider.of<AppState>(context).currentTheme;

    return ValueBuilder<MyTheme>(
      streamed: theme,
      initialData: AppTheme.defaultLight, // add this line
      builder: (context, snapshot) => MaterialApp(
        title: 'Flutter Demo',
        theme: _buildThemeData(snapshot.data),
        onGenerateRoute: generateRoute,
        debugShowCheckedModeBanner: false,
        navigatorKey: navigatorKey,
        initialRoute: Routes.home,
      ),
    );

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

No branches or pull requests

2 participants