katana_theme 2.6.7 copy "katana_theme: ^2.6.7" to clipboard
katana_theme: ^2.6.7 copied to clipboard

Base package for providing simple and straightforward theme definitions on Flutter.

example/lib/main.dart

// Flutter imports:
import 'package:flutter/material.dart';

// Package imports:
import 'package:katana_theme/katana_theme.dart';

part 'main.theme.dart';

@appTheme
final theme = AppThemeData.light(
  primary: Colors.red,
  secondary: Colors.orange,
  tertiary: Colors.teal,
);

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

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

  @override
  Widget build(BuildContext context) {
    return AppThemeScope(
      theme: theme,
      child: MaterialApp(
        home: const MyHomePage(
          title: "Flutter Demo",
        ),
        title: "Flutter Demo",
        theme: theme.toThemeData(
          defaultFontFamily: theme.font.notoSerifJP,
        ),
      ),
    );
  }
}

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

  final String title;

  @override
  State<StatefulWidget> 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: theme.text.labelMedium,
            ),
            Text(
              "$_counter",
              style: theme.text.displayMedium,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        backgroundColor: theme.color.tertiary,
        onPressed: _incrementCounter,
        tooltip: "Increment",
        child: Icon(Icons.add, color: theme.color.onTertiary),
      ),
    );
  }
}
0
likes
160
points
6.61k
downloads

Publisher

verified publishermathru.net

Weekly Downloads

Base package for providing simple and straightforward theme definitions on Flutter.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, flutter_svg, katana, katana_theme_annotation, meta, path_provider

More

Packages that depend on katana_theme