BirjuVachhani / adaptive_theme

Easiest way to add support for light and dark theme in your flutter app.
https://pub.dev/packages/adaptive_theme
Apache License 2.0
464 stars 37 forks source link

Not working when copying demo StatelessWidget code #44

Closed dodderss closed 2 years ago

dodderss commented 2 years ago

Hi, I changed the code slightly so that it ignores bold text in iOS accessibility and now it doesn't work even if i take away the modifications. here is my code:

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

  @override
  Widget build(BuildContext context) {
    return AdaptiveTheme(
        light: ThemeData(
          brightness: Brightness.light,
          primaryColor: Colors.red,
        ),
        dark: ThemeData(
          brightness: Brightness.dark,
          primaryColor: Colors.red,
        ),
        initial: AdaptiveThemeMode.dark,
        builder: (theme, darkTheme) => MediaQuery(
            data: MediaQueryData.fromWindow(WidgetsBinding.instance.window)
                .copyWith(boldText: false),
            child: MaterialApp(
              useInheritedMediaQuery: true,
              title: 'Reggie',
              theme: theme,
              darkTheme: darkTheme,
              home: const MyHomePage(title: 'Reggie'),
            )));
  }
}

Screenshot 2022-07-29 at 21 18 47

Here are simulator screenshots. Running in debug mode using VSCode to start

The accent colour which should be on the top appbar does not appear as red and neither does the floatingActionButton.

BirjuVachhani commented 2 years ago

@WilliamD47 I checked the code you have provided. It's not a problem with the package. You're setting your theme wrong, that's why it's not meeting your expectations. Replace primaryColor with primarySwatch and it should work the way you're expecting it to work.