yako_theme_switch 1.0.0+1 copy "yako_theme_switch: ^1.0.0+1" to clipboard
yako_theme_switch: ^1.0.0+1 copied to clipboard

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

example/lib/main.dart

import 'package:flutter/material.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? changed}) {
                  if (changed != null) {
                    setState(() {
                      themeMode = changed ? ThemeMode.light : ThemeMode.dark;
                    });
                  }
                },
              ),
            ],
          ),
        ),
      ),
    );
  }
}
20
likes
140
pub points
61%
popularity
screenshot

Publisher

verified publisheryako.io

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

Repository (GitHub)
View/report issues

Topics

#ui

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter, flutter_svg

More

Packages that depend on yako_theme_switch