yako_theme_switch 3.0.1 copy "yako_theme_switch: ^3.0.1" to clipboard
yako_theme_switch: ^3.0.1 copied to clipboard

Custom switch that looks good for changing the theme of the app

example/lib/main.dart

import 'package:material_ui/material_ui.dart';
import 'package:yako_theme_switch/yako_theme_switch.dart';

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

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

  @override
  State<MainApp> createState() => _MainAppState();
}

class _MainAppState extends State<MainApp> {
  ThemeMode themeMode = ThemeMode.light;

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      darkTheme: ThemeData(scaffoldBackgroundColor: Colors.black),
      themeMode: themeMode,
      home: Scaffold(
        body: Center(
          child: Row(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              YakoThemeSwitch(
                enabled: themeMode == ThemeMode.light,
                onChanged: (bool value) {
                  setState(() {
                    themeMode = value ? ThemeMode.light : ThemeMode.dark;
                  });
                },
              ),
            ],
          ),
        ),
      ),
    );
  }
}
31
likes
160
points
209
downloads
screenshot

Documentation

API reference

Publisher

verified publisheryako.dev

Weekly Downloads

Custom switch that looks good for changing the theme of the app

Repository (GitHub)
View/report issues

Topics

#ui #widget #switch #theme #dark-mode

License

MIT (license)

Dependencies

flutter, flutter_svg, material_ui

More

Packages that depend on yako_theme_switch