Flutter package
Cus Theme
A complete light/dark theming system for Flutter, with persistence built in.
Apache-2.0
AndroidiOSLinuxmacOSWebWindows
Overview
cus_theme is the theming layer we reach for on client projects: pre-configured light and dark themes, a consistent typography and spacing scale, and dynamic theme switching that remembers the user's choice between sessions, all accessed through simple context extensions.
Features
- Pre-configured light and dark themes with custom color scheme presets
- A typography system with consistent text styles
- Spacing, sizing and animation constants
- Dynamic theme switching, persisted via shared_preferences
- Theme extensions and context helpers for type-safe theme access
Installation
pubspec.yaml
dependencies:
cus_theme: ^1.8.2
provider: ^6.1.5
shared_preferences: ^2.5.3or
flutter pub add cus_themeUsage
Basic
import 'package:cus_theme/cus_theme.dart';
final appTheme = AppTheme();
// MaterialApp(theme: appTheme.themeData, ...)Dynamic switching
return wrapWithThemeProvider(
initialDarkMode: false,
child: Consumer<ThemeProvider>(
builder: (context, themeProvider, _) {
return MaterialApp(theme: themeProvider.themeData);
},
),
);
// Toggle with context.toggleTheme()
// Read with context.isDarkModeRead this offline
The same write-up as a .docx file, if you'd rather share it or keep a copy.