Skip to content
pubscout

theme_mode_handler

3.0.0, released 6 years ago by an unverified publisher

Widget to switch and persist ThemeMode at runtime.

WASM-ready
$ flutter pub add theme_mode_handler
Source repository

What it does

Provides a ThemeModeHandler widget that loads, saves and applies a ThemeMode using a user‑provided manager. It can show a placeholder while loading and offers a helper dialog for selection.

AI-written summary of version 3.0.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need runtime theme switching with persistence
  • You want a simple API without external state‑management solutions

Skip it when

  • You already use a full state‑management library (e.g., Bloc, Provider) for theming
  • You need advanced theming features like color scheme generation

Strengths

  • Minimal API, easy to integrate
  • Supports null‑safety and custom placeholder widget
  • No extra dependencies beyond Flutter

Weaknesses

  • Only handles ThemeMode, not full theming customization
  • Requires you to implement IThemeModeManager for persistence
  • Limited to light/dark/system modes

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
0
import 'package:theme_mode_handler/theme_mode_handler.dart';

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return ThemeModeHandler(
      manager: MyManager(),
      builder: (themeMode) => MaterialApp(
        themeMode: themeMode,
        darkTheme: ThemeData.dark(),
        theme: ThemeData.light(),
        home: MyHomePage(),
      ),
    );
  }
}

Alternatives

Packages that do the same job and could replace theme_mode_handler.

  • flex_seed_scheme

    Provides comprehensive theming and color scheme generation, useful if you need more than just ThemeMode switching