easy_settings 1.0.2 copy "easy_settings: ^1.0.2" to clipboard
easy_settings: ^1.0.2 copied to clipboard

A package to make settings management easier with a beautiful and appealing user interface.

example/lib/main.dart

import 'package:easy_settings/easy_settings.dart';
import 'package:example/settings.dart';
import 'package:flutter/material.dart';
import 'package:property_change_notifier/property_change_notifier.dart';

void main() async {
  await initializeSettings(settingsCategories);
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return PropertyChangeProvider<SettingsPropertyChangedNotifier, String>(
        value: settingsPropertyChangedNotifier,
        child: PropertyChangeConsumer<SettingsPropertyChangedNotifier, String>(
            properties: const [isDarkKey],
            builder: (p0, p1, p2) => MaterialApp(
                  title: 'Settings',
                  themeMode: getSettingsPropertyValue<bool>(isDarkKey)
                      ? ThemeMode.dark
                      : ThemeMode.light,
                  theme: ThemeData(brightness: Brightness.light),
                  darkTheme: ThemeData(brightness: Brightness.dark),
                  home: const MyHomePage(),
                )));
  }
}

class MyHomePage extends StatelessWidget {
  const MyHomePage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: const Text("Settings"),
        ),
        body: const EasySettingsWidget());
  }
}
copied to clipboard
7
likes
160
points
333
downloads

Publisher

unverified uploader

Weekly Downloads

2024.09.16 - 2025.03.31

A package to make settings management easier with a beautiful and appealing user interface.

Repository (GitHub)

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

collection, flutter, property_change_notifier, shared_preferences

More

Packages that depend on easy_settings