brix_ui 1.2.0
brix_ui: ^1.2.0 copied to clipboard
Flutter widgets that follow your theme: buttons, text fields, select and search, cards, sheets, dialogs, toasts and a loader, in light and dark. Part of the brix family.
example/lib/main.dart
import 'package:brix_ui/brix_ui.dart';
import 'package:flutter/material.dart';
import 'brands.dart';
import 'gallery_screen.dart';
/// Every brix_ui widget on one screen. Switch light / dark and three brands
/// live, the widgets never change, only the theme.
void main() => runApp(const BrixUiExampleApp());
class BrixUiExampleApp extends StatefulWidget {
const BrixUiExampleApp({super.key});
@override
State<BrixUiExampleApp> createState() => _BrixUiExampleAppState();
}
class _BrixUiExampleAppState extends State<BrixUiExampleApp> {
Brand _brand = Brand.standard;
bool _dark = false;
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'brix_ui',
debugShowCheckedModeBanner: false,
// Lets dialogs and toasts open without a BuildContext.
navigatorKey: BrixUi.navigatorKey ??= GlobalKey<NavigatorState>(),
theme: _brand.theme(Brightness.light).toThemeData(),
darkTheme: _brand.theme(Brightness.dark).toThemeData(),
themeMode: _dark ? ThemeMode.dark : ThemeMode.light,
home: GalleryScreen(
brand: _brand,
dark: _dark,
onBrand: (brand) => setState(() => _brand = brand),
onDark: (dark) => setState(() => _dark = dark),
),
);
}
}