acme_theme 0.6.0 copy "acme_theme: ^0.6.0" to clipboard
acme_theme: ^0.6.0 copied to clipboard

outdated

A package to use the themes and components extracted from Acme Theme Builder.

example/lib/main.dart

import 'package:acme_theme/acme_theme.dart';
import 'package:example/brand_colors.dart';
import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return Directionality(
      textDirection: TextDirection.ltr,
      child: Row(
        children: [
          Expanded(
            child: AcmeThemeScope<BrandColors>.asset(
              path: 'assets/example-theme.acme',
              overrideFn: (theme) => theme.copyWith(themeMode: ThemeMode.light),
              customColorsConverterCreator: BrandColorsConverter.new,
              builder: (context, theme) {
                return MaterialApp(
                  title: 'Asset Theme Example',
                  theme: theme.lightTheme,
                  darkTheme: theme.darkTheme,
                  themeMode: theme.themeMode,
                  home: const MyHomePage(title: 'Asset Theme Example'),
                );
              },
            ),
          ),
          Expanded(
            child: AcmeThemeScope<BrandColors>.network(
              url:
                  'https://raw.githubusercontent.com/MattHamburger/acme_theme_provider/sarbagya/custom-colors/example/assets/example-theme.acme',
              overrideFn: (theme) => theme.copyWith(themeMode: ThemeMode.dark),
              customColorsConverterCreator: BrandColorsConverter.new,
              builder: (context, theme) {
                return MaterialApp(
                  title: 'Network Theme Example',
                  theme: theme.lightTheme,
                  darkTheme: theme.darkTheme,
                  themeMode: theme.themeMode,
                  home: const MyHomePage(title: 'Network Theme Example'),
                );
              },
            ),
          ),
        ],
      ),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

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

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Text(
              'You have pushed the button this many times:',
              style: TextStyle(color: BrandColors.of(context).live.color),
            ),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.headline4!.copyWith(
                    color: BrandColors.of(context).dead.color,
                  ),
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: const Icon(Icons.add),
      ),
    );
  }
}
3
likes
0
points
188
downloads

Publisher

verified publisheracmesoftware.com

Weekly Downloads

A package to use the themes and components extracted from Acme Theme Builder.

Homepage

License

unknown (license)

Dependencies

flutter, google_fonts, http, json_class, json_theme, meta, nsd, path, path_provider, shared_preferences, web_socket_channel

More

Packages that depend on acme_theme