system_theme 1.0.0 system_theme: ^1.0.0 copied to clipboard
A plugin to get the current system theme info
import 'package:flutter/material.dart';
import 'package:system_theme/system_theme.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await SystemTheme.accentInstance.load();
runApp(MyApp());
}
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
void initState() {
super.initState();
SystemTheme.darkMode.then((value) {
print(value);
});
print(SystemTheme.accentInstance.accent);
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
backgroundColor: SystemTheme.accentInstance.accent,
),
);
}
}