system_theme 1.0.1 copy "system_theme: ^1.0.1" to clipboard
system_theme: ^1.0.1 copied to clipboard

outdated

A plugin to get the current system theme info. Supports Android, Web and Windows

system_theme

A plugin to get the current system theme info

Platoforms #

✔️ Android
✔️ Web
✔️ Windows (Thanks to @alexmercerind)

Usage #

Import it:

import 'package:system_theme/system_theme.dart';

Get system accent color #

Use the getter SystemTheme.accentInstance.accent to get the system accent color.

final accentColor = SystemTheme.accentInstance.accent;

To reload the accent colors, use the method load():

await SystemTheme.accentInstance.load();

You can load the colors on main, so the colors can't be wrong at runtime:

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await SystemTheme.accentInstance.load();
  runApp(MyApp());
}

Check dark mode #

Use the getter SystemTheme.darkMode to check if the device is in dark mode.

final darkMode = await SystemTheme.darkMode;

Contribution #

Feel free to open an issue if you find an error or make pull requests.

101
likes
140
pub points
96%
popularity

Publisher

verified publisherbdlukaa.dev

A plugin to get the current system theme info. Supports Android, Web and Windows

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter, system_theme_web

More

Packages that depend on system_theme