Last updated:
0 purchases
flutter dynamic theme
flutter_dynamic_theme #
Vous permet de spécifier un certain nombre de thèmes de couleurs parmi lesquels l'utilisateur peut choisir. Persiste le thème sélectionné lors des redémarrages de l'application.
Allows you to specify a number of color themes from which the user can choose. The selected theme persists when the application is restarted.
Include in your project #
dependencies:
flutter_dynamic_theme: <lastedVersion>
copied to clipboard
run packages get and import it
import 'package:flutter_dynamic_theme/flutter_dynamic_theme.dart';
copied to clipboard
if you want the dialog:
import 'package:flutter_dynamic_theme/theme_switcher_widgets.dart';
copied to clipboard
if you want the list of colors:
import 'package:flutter_dynamic_theme/dynamic_colors.dart';
copied to clipboard
Getting Started #
Follow the instructions here.
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return FlutterDynamicTheme(
defaultBrightness: Brightness.light,
data: (Brightness brightness) => ThemeData(
primarySwatch: Colors.purple,
brightness: brightness,
),
loadBrightnessOnStart: true,
themedWidgetBuilder: (BuildContext context, ThemeData theme) {
return MaterialApp(
title: 'Flutter Demo',
theme: theme,
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
},
);
}
}
copied to clipboard
To change the color theme
FlutterDynamicTheme.of(context)?.setThemeData(new ThemeData(primarySwatch: Colors.red));
copied to clipboard
or
FlutterDynamicTheme.of(context)?.setThemeData(new ThemeData(primaryColor: Colors.red));
copied to clipboard
Show popUp to change Brightness or and Color at the same time.
void showChooser() {
showDialog<void>(
context: context,
builder: (BuildContext context) {
return BrightnessSwitcherDialog(
activeToggleMode: true,
activeColor: true,
textDarkMode: 'Mode Dark :(',
textLightMode: 'Light Mode :)',
onSelectedTheme: (Brightness brightness) {
FlutterDynamicTheme.of(context).setBrightness(brightness);
},
);
},
);
}
copied to clipboard
set activeColor: true to Activate option list of color
activeColor: true
copied to clipboard
Maintainer #
Jean Fritz DUVERSEAU
If you experience any problems using this package, please create an issue on Github. Pull requests are also very welcome.
Many thanks to the dynamic_theme package from
Norbert Kozsir this package was inspired by!
For help getting started with Flutter, view our
online documentation, which offers tutorials,
samples, guidance on mobile development, and a full API reference.
This project is a starting point for a Flutter
plug-in package,
a specialized package that includes platform-specific implementation code for
Android and/or iOS.
For help getting started with Flutter, view our
online documentation, which offers tutorials,
samples, guidance on mobile development, and a full API reference.
Publishing package
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.