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

outdated

A plugin to get the current system theme info

example/lib/main.dart

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,
      ),
    );
  }
}