flutter_helper_utils 4.4.0 copy "flutter_helper_utils: ^4.4.0" to clipboard
flutter_helper_utils: ^4.4.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,
        ),
      ),
    );
  }
}
35
likes
160
pub points
80%
popularity

Publisher

unverified uploader

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

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

dart_helper_utils, flutter

More

Packages that depend on flutter_helper_utils