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

A customizable animated Material switch for toggling between light and dark theme modes in Flutter apps.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:theme_mode_toggle/theme_mode_toggle.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  bool isDarkMode = false;

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      themeMode: isDarkMode ? ThemeMode.dark : ThemeMode.light,

      theme: ThemeData.light(),

      darkTheme: ThemeData.dark(),

      home: Scaffold(
        appBar: AppBar(title: const Text('Theme Mode Toggle')),

        body: Center(
          child: ThemeModeToggle(
            value: isDarkMode,
            onChanged: (value) {
              setState(() {
                isDarkMode = value;
              });
            },
          ),
        ),
      ),
    );
  }
}
0
likes
160
points
--
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A customizable animated Material switch for toggling between light and dark theme modes in Flutter apps.

Repository (GitHub)
View/report issues

Topics

#flutter #theme #dark-mode #light-mode #toggle

License

MIT (license)

Dependencies

flutter

More

Packages that depend on theme_mode_toggle