tasteful 0.0.3
tasteful: ^0.0.3 copied to clipboard
a different take on stateful widgets.
import 'package:flutter/material.dart';
import 'package:tasteful/tasteful.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const Counter(title: 'Flutter Demo Home Page'),
);
}
}
class Counter extends TastefulWidget<int> {
const Counter({required this.title});
final String title;
@override
int createInitialState() => 0;
@override
Widget build(TastefulBuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
title: Text(title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text(
'You have pushed the button this many times:',
),
Text(
'${context.state}',
style: Theme.of(context).textTheme.headlineMedium,
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: () {
context.state++;
},
tooltip: 'Increment',
child: const Icon(Icons.add),
),
);
}
}