katana_theme 3.0.5 copy "katana_theme: ^3.0.5" to clipboard
katana_theme: ^3.0.5 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

/// Application theme configuration.
final theme = AppThemeData.light(
  primary: Colors.red,
  secondary: Colors.orange,
  tertiary: Colors.teal,
);

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

/// Main application widget that provides the root of the widget tree.
class MyApp extends StatelessWidget {
  /// Creates a [MyApp].
  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,
        ),
      ),
    );
  }
}

/// Home page widget that displays a counter.
@immutable
class MyHomePage extends StatefulWidget {
  /// Creates a [MyHomePage].
  const MyHomePage({required this.title, super.key});

  /// The title to display in the app bar.
  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
5.84k
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