flutter_theme_manager 0.0.6+1 copy "flutter_theme_manager: ^0.0.6+1" to clipboard
flutter_theme_manager: ^0.0.6+1 copied to clipboard

We Provide light and dark theme in very simple way. we Know that passing the theme in whole app is very difficult and we need to write lot of code only for theme.

example/lib/main.dart

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

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

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return themeManager(themeBuilder: (theme) {
      return MaterialApp(
        home: const Home(),
        theme: theme,
      );
    });
  }
}

class Home extends StatefulWidget {
  const Home({Key? key}) : super(key: key);

  @override
  State<Home> createState() => _HomeState();
}

class _HomeState extends State<Home> {
  bool switchThemes = false;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: AppTheme.theme(
            context: context, lightTheme: Colors.blue, darkTheme: Colors.blue),
        title: Text(
          "AppBar",
          style: TextStyle(
              color: AppTheme.theme(
                  context: context,
                  darkTheme: Colors.black,
                  lightTheme: Colors.black)),
        ),
        actions: [
          Switch(
              value: switchThemes,
              onChanged: (val) {
                setState(() {
                  switchThemes = !switchThemes;
                });
                changeTheme(context);
              }),
        ],
      ),
      body: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          Center(
              child: Text(
            " Flutter.dev ",
            style: TextStyle(
                color: AppTheme.theme(
                    context: context,
                    lightTheme: Colors.black,
                    darkTheme: const Color(0xffffffff))),
          )),
        ],
      ),
    );
  }
}
8
likes
140
pub points
54%
popularity

Publisher

unverified uploader

We Provide light and dark theme in very simple way. we Know that passing the theme in whole app is very difficult and we need to write lot of code only for theme.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter, flutter_bloc

More

Packages that depend on flutter_theme_manager