flutter_dynamic_theme_engine 1.0.0 copy "flutter_dynamic_theme_engine: ^1.0.0" to clipboard
flutter_dynamic_theme_engine: ^1.0.0 copied to clipboard

Dynamic multi-theme palette engine for Flutter generating accessible themes from seed colors with HSL math and animated transitions.

example/lib/main.dart

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

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  final notifier = DynamicThemeNotifier();

  MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return DynamicThemeBuilder(
      notifier: notifier,
      builder: (context, lightTheme, darkTheme, themeMode) {
        return MaterialApp(
          title: 'flutter_dynamic_theme_engine Demo',
          theme: lightTheme,
          darkTheme: darkTheme,
          themeMode: themeMode,
          home: HomeScreen(notifier: notifier),
        );
      },
    );
  }
}

class HomeScreen extends StatelessWidget {
  final DynamicThemeNotifier notifier;

  const HomeScreen({super.key, required this.notifier});

  @override
  Widget build(BuildContext context) {
    final colors = [
      Colors.deepPurple,
      Colors.teal,
      Colors.amber,
      Colors.indigo,
      Colors.roseAccent,
    ];

    return Scaffold(
      appBar: AppBar(
        title: const Text('Dynamic Theme Engine'),
        actions: [
          IconButton(
            icon: const Icon(Icons.brightness_6),
            onPressed: () => notifier.toggleThemeMode(),
          ),
        ],
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            const Text(
              'Select Seed Accent Color:',
              style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
            ),
            const SizedBox(height: 16),
            Row(
              mainAxisAlignment: MainAxisAlignment.center,
              children: colors.map((color) {
                return GestureDetector(
                  onTap: () => notifier.setSeedColor(color),
                  child: Container(
                    margin: const EdgeInsets.symmetric(horizontal: 8),
                    width: 48,
                    height: 48,
                    decoration: BoxDecoration(
                      color: color,
                      shape: BoxShape.circle,
                      border: Border.all(
                        color: notifier.seedColor == color ? Colors.white : Colors.transparent,
                        width: 3,
                      ),
                    ),
                  ),
                );
              }).toList(),
            ),
          ],
        ),
      ),
    );
  }
}
0
likes
150
points
22
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Dynamic multi-theme palette engine for Flutter generating accessible themes from seed colors with HSL math and animated transitions.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

flutter

More

Packages that depend on flutter_dynamic_theme_engine