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

Deprecated theme change property of floating action button #47

Open
Fayiz-A opened this issue Sep 30, 2020 · 1 comment
Open

Deprecated theme change property of floating action button #47

Fayiz-A opened this issue Sep 30, 2020 · 1 comment

Comments

@Fayiz-A
Copy link

Fayiz-A commented Sep 30, 2020

I am using this package to change the theme of my app from light to dark or vice-versa. It is working well with most of the widgets except the floating action button. I am getting this warning in the console: flutter: Warning: The support for configuring the foreground color of FloatingActionButtons using ThemeData.accentIconTheme has been deprecated. Please use ThemeData.floatingActionButtonTheme instead. See https://flutter.dev/go/remove-fab-accent-theme-dependency. This feature was deprecated after v1.13.2.
Any help would be appreciated

@JMartinezCL
Copy link

Hi, you can fix that adding floatingActionButtonTheme: FloatingActionButtonThemeData( foregroundColor: Colors.greenAccent ) to ThemeData on DynamicTheme
it looks like

Widget build(BuildContext context) {
      return DynamicTheme(
        defaultBrightness: Brightness.light,
        data: (brightness) => ThemeData(
              primarySwatch: Colors.indigo,
              brightness: brightness,
              floatingActionButtonTheme: FloatingActionButtonThemeData(
                  foregroundColor: Colors.greenAccent), //<-- HERE
           ),
        themedWidgetBuilder: (context, theme) {
          return MaterialApp(
            title: 'Flutter Demo',
            theme: theme,
            home: MyHomePage(title: 'Flutter Demo Home Page'),
          );
        });

it works for me, i hope it's helps you.

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