day_night_themed_switcher 2.0.2 copy "day_night_themed_switcher: ^2.0.2" to clipboard
day_night_themed_switcher: ^2.0.2 copied to clipboard

Elevate your app's charm with a sleek day/night switcher widget in pure Dart – because toggling between light and dark modes should be as effortless as a flicker of magic!

example/lib/main.dart

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

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

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

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

class _MyAppState extends State<MyApp> {
  ThemeMode theme = ThemeMode.light;

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData.light(),
      darkTheme: ThemeData.dark(),
      themeMode: theme,
      home: Scaffold(
        body: Center(
          child: DayNightSwitch(
            // duration: Duration(milliseconds: 800),
            // initiallyDark: true,
            size: 80,
            onChange: (dark) => setState(() {
              if (dark) {
                theme = ThemeMode.dark;
              } else {
                theme = ThemeMode.light;
              }
            }),
          ),
        ),
      ),
    );
  }
}
6
likes
160
points
151
downloads

Publisher

verified publisheryashashm.dev

Weekly Downloads

Elevate your app's charm with a sleek day/night switcher widget in pure Dart – because toggling between light and dark modes should be as effortless as a flicker of magic!

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, flutter_inset_shadow, flutter_svg

More

Packages that depend on day_night_themed_switcher