Skip to content

Instantly share code, notes, and snippets.

@kasperpeulen
Created December 3, 2021 10:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kasperpeulen/201ef3a8a1a9c571e74d2d8ad5f960fc to your computer and use it in GitHub Desktop.
Save kasperpeulen/201ef3a8a1a9c571e74d2d8ad5f960fc to your computer and use it in GitHub Desktop.
class MyScaffold extends HookWidget {
const MyScaffold({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
final count = useState(0);
final theme = Theme.of(context);
return Scaffold(
appBar: AppBar(title: Text('Title')),
body: Center(child: Text('Count: ${count.value}')),
drawer: Drawer(
child: ListView(
padding: EdgeInsets.zero,
children: [
DrawerHeader(
decoration: BoxDecoration(color: theme.primaryColor),
child: Text(
'Drawer Header',
style: theme.primaryTextTheme.headline5,
),
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: () => count.value += 1,
child: Icon(Icons.add),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment