playx_theme 0.2.3 copy "playx_theme: ^0.2.3" to clipboard
playx_theme: ^0.2.3 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:example/config/config.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(config: const ThemeConfig());

  /// 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'),
      ),
      body: Center(
        child: Text(
          'Playx Theme',
          style: TextStyle(
              color: colorScheme.primary,
              fontWeight: FontWeight.bold,
              fontSize: 20),
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: PlayxTheme.next,
        tooltip: 'Next Theme',
        child: Icon(
          Icons.add,
          color: context.colorScheme.onPrimary,
        ),
      ),
    );
  }
}

XColors get colorScheme => PlayxTheme.colors;
0
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

#playx #theme #colorscheme #material3

License

unknown (LICENSE)

Dependencies

flex_seed_scheme, flutter, playx_core

More

Packages that depend on playx_theme