simple_theme 1.0.0
simple_theme: ^1.0.0 copied to clipboard
A simple & complete theme builder from 1, 2 or 3 colors
simple_theme_example #
This example shows how it's simple to theme a Flutter app.
main.dart #
import 'package:flutter/material.dart';
import 'package:simple_theme/simple_theme.dart';
void main() {
runApp(
MaterialApp(
theme: buildTheme(
Palette(
primary: Colors.teal,
secondary: Colors.purpleAccent,
tertiary: Colors.amber,
),
),
home: const HomeView(),
),
);
}
class HomeView extends StatefulWidget {
const HomeView({super.key});
@override
State<HomeView> createState() => _HomeViewState();
}
class _HomeViewState extends State<HomeView> with SingleTickerProviderStateMixin {
late final _tabController = TabController(length: 2, vsync: this);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Home page')),
body: Center(
child: SizedBox(
width: MaxItemWidth.xxs,
child: SingleChildScrollView(
child: Column(
spacing: Margin.m,
children: [
const AboutListTile(child: Text('Hello I\'m a AboutListTile')),
const ActionChip(label: Text('Hello I\'m a ActionChip')),
AppBar(title: const Text('Hello I\'m a AppBar')),
const Badge(child: Text('Hello I\'m a Badge')),
const Banner(message: 'Hello I\'m a Banner', location: BannerLocation.bottomEnd),
const BottomAppBar(child: Text('Hello I\'m a BottomAppBar')),
const Card(child: Text('Hello I\'m a Card')),
const Chip(label: Text('Hello I\'m a Chip')),
const ChoiceChip(label: Text('Hello I\'m a ChoiceChip'), selected: false),
const CircleAvatar(
radius: AvatarSize.xxl,
child: Text('Hello I\'m a CircleAvatar'),
),
const Text('Hello Here is a CircularProgressIndicator:'),
const CircularProgressIndicator(),
const Text('Hello Here is a DataTable:'),
DataTable(
columns: const [
DataColumn(label: Text('Hello I\'m a DataColumn')),
DataColumn(label: Text('Me too')),
],
rows: const [
DataRow(cells: [
DataCell(Text('Hello I\'m a DataCell')),
DataCell(Text('Me too')),
])
],
),
const Text('Hello Here is a Divider:'),
const Divider(),
const Text('Hello Here is a DropdownButton:'),
DropdownButton(items: const [
DropdownMenuItem(
value: 0,
child: Text('Hello I\'m a DropdownMenuItem'),
),
DropdownMenuItem(
value: 1,
child: Text('Me too'),
),
], onChanged: (_) {}),
ElevatedButton(child: const Text('Hello I\'m a ListTile'), onPressed: () {}),
const ExpansionTile(title: Text('Hello I\'m a ExpansionTile')),
FilledButton(onPressed: () {}, child: const Text('Hello I\'m a FilledButton')),
FilterChip(label: const Text('Hello I\'m a ListTile'), onSelected: (value) {}),
FloatingActionButton(onPressed: () {}, child: const Text('Hello I\'m a FloatingActionButton')),
const GridTile(child: Text('Hello I\'m a GridTile')),
const InputChip(label: Text('Hello I\'m a InputChip')),
const Text('Hello Here is a Icon:'),
const Icon(Icons.ac_unit),
InputDatePickerFormField(
fieldLabelText: 'Hello I\'m a InputDatePickerFormField',
firstDate: DateTime.now().subtract(const Duration(days: 365)),
lastDate: DateTime.now().add(const Duration(days: 365)),
),
const ListTile(title: Text('Hello I\'m a ListTile')),
const Material(child: Text('Hello I\'m a Material')),
MaterialButton(onPressed: () {}, child: const Text('Hello I\'m a MaterialButton')),
const MenuAnchor(menuChildren: [Text('Hello I\'m a MenuAnchor'), Text('Me too')]),
NavigationBar(destinations: const [
Text('Hello I\'m a NavigationBar'),
Text('Me too'),
]),
SizedBox(
height: GridItemSize.m,
child: NavigationRail(
selectedIndex: 0,
destinations: const [
NavigationRailDestination(icon: Icon(Icons.ac_unit), label: Text('Hello I\'m a NavigationRail')),
NavigationRailDestination(icon: Icon(Icons.sunny), label: Text('Me too')),
],
),
),
OutlinedButton(child: const Text('Hello I\'m a OutlinedButton'), onPressed: () {}),
PopupMenuButton(
itemBuilder: (BuildContext context) => [
const PopupMenuItem(child: Text('Hello I\'m a PopupMenuItem')),
const PopupMenuItem(child: Text('Me too')),
],
child: const Text('Hello I\'m a PopupMenuButton')),
const Text('Hello Here is a LinearProgressIndicator:'),
const LinearProgressIndicator(),
const Text('Hello Here is a Radio:'),
const Radio(value: null),
const RadioListTile(value: null, title: Text('Hello I\'m a RadioListTile')),
RangeSlider(
labels: const RangeLabels('Hello I\'m a RangeSlider', 'Me too'),
values: const RangeValues(0.0, 1.0),
onChanged: (RangeValues value) {},
),
const SearchBar(hintText: 'Hello I\'m a SearchBar'),
SegmentedButton(
multiSelectionEnabled: true,
segments: const [
ButtonSegment(value: 1, label: Text('Hello I\'m a ButtonSegment')),
ButtonSegment(value: 2, label: Text('Me too')),
],
selected: const {1, 2},
),
Slider(value: 0, onChanged: (double value) {}, label: 'Hello I\'m a Slider'),
// const SnackBar(content: Text('Hello I\'m a SnackBar')),
SizedBox(
height: GridItemSize.m,
child: SpellCheckSuggestionsToolbar(
anchor: Offset.zero,
buttonItems: [
ContextMenuButtonItem(onPressed: () {}, label: 'Hello I\'m a ContextMenuButtonItem'),
ContextMenuButtonItem(onPressed: () {}, label: 'Me too'),
],
),
),
Stepper(
steps: const [
Step(title: Text('Hello I\'m a Step'), content: Text('Hello I\'m a Step content')),
Step(title: Text('Me too'), content: Text('Me too too')),
],
),
const Text('Hello Here is a Switch:'),
Switch(value: false, onChanged: (_) {}),
TabBar(
controller: _tabController,
tabs: const [Tab(text: 'Hello I\'m a Step Tab'), Tab(text: 'Me too')],
),
TextButton(child: const Text('Hello I\'m a TextButton'), onPressed: () {}),
const TextField(decoration: InputDecoration(hint: Text('Hello I\'m a InputDecoration'))),
TextFormField(decoration: const InputDecoration(hint: Text('Hello I\'m a TextFormField'))),
ToggleButtons(
isSelected: const [false, false],
children: const [Text('Hello I\'m a ToggleButtons'), Text('Me too')]),
const Tooltip(message: 'Me too', child: Text('Hello I\'m a Tooltip')),
const UserAccountsDrawerHeader(
accountName: Text('Hello I\'m a UserAccountsDrawerHeader'),
accountEmail: Text('Me too'),
),
],
),
),
),
),
);
}
}