playx_theme 0.2.0 copy "playx_theme: ^0.2.0" to clipboard
playx_theme: ^0.2.0 copied to clipboard

Easily change and configure current app theme with a lot of features like having custom colors for each theme and more.

example/lib/main.dart

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

void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  /// * boot the core
  await PlayXCore.bootCore();

  /// boot the AppTheme
  await PlayxTheme.boot();

  /// run the real app
  runApp(const MaterialApp(home: MyApp()));
}

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

  @override
  Widget build(BuildContext context) {
    final locale = Localizations.localeOf(context);
    return PlayXThemeBuilder(
      builder: (xTheme) {
        return MaterialApp(
          title: 'Flutter Demo',
          theme: xTheme.theme(locale),
          home: const MyHomePage(),
        );
      },
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key});

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('PlayX Themes Demo Home Page'),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: PlayxTheme.next,
        tooltip: 'Next Theme',
        child: Icon(
          Icons.add,
          color: context.colorScheme.onPrimary,
        ),
      ),
    );
  }
}

XColors get colorScheme => PlayxTheme.colors;
1
likes
0
pub points
25%
popularity

Publisher

verified publisherplayx.sourcya.io

Easily change and configure current app theme with a lot of features like having custom colors for each theme and more.

Repository (GitHub)
View/report issues

Topics

#theme #colorscheme #material3 #playx

License

unknown (license)

Dependencies

flex_seed_scheme, flutter, playx_core

More

Packages that depend on playx_theme