flutter_helper_utils 4.3.0 copy "flutter_helper_utils: ^4.3.0" to clipboard
flutter_helper_utils: ^4.3.0 copied to clipboard

The Flutter Helper Utils Package offers various extensions and helper methods that can make development more efficient.

example/lib/main.dart

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

void main() => runApp(const MyApp());

final themeModeNotifier = ThemeMode.light.notifier;

class MyApp extends StatelessWidget {
  // Create a ValueNotifier for the theme mode.

  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return themeModeNotifier.listenableBuilder(
      (themeMode) {
        return MaterialApp(
          title: 'Flutter Demo',
          theme: ThemeData.light(),
          darkTheme: ThemeData.dark(),
          themeMode: themeMode,
          // Use the value from the ValueNotifier
          home: const MyHomePage(),
        );
      },
    );
  }
}

class MyHomePage extends StatelessWidget {
  const MyHomePage({super.key});

  @override
  Widget build(BuildContext context) {
    final theme = context.themeData;
    return Scaffold(
      appBar: AppBar(
        title: const Text("Theme Mode Switcher"),
        actions: [
          Switch(
            value: theme.isDark,
            onChanged: (value) => value
                ? themeModeNotifier.setDart()
                : themeModeNotifier.setLight(),
          ),
        ],
      ),
      body: Center(
        child: Text(
          "Theme Mode is: ${theme.brightness.name}",
          style: theme.displayMedium,
        ),
      ),
    );
  }
}
38
likes
0
points
2.24k
downloads

Publisher

unverified uploader

Weekly Downloads

The Flutter Helper Utils Package offers various extensions and helper methods that can make development more efficient.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

dart_helper_utils, flutter

More

Packages that depend on flutter_helper_utils