Skip to content

Instantly share code, notes, and snippets.

@kasperpeulen
Created November 27, 2021 10:26
Show Gist options
  • Save kasperpeulen/7e5bd6330752f63c3a7d86a7b0dd64f0 to your computer and use it in GitHub Desktop.
Save kasperpeulen/7e5bd6330752f63c3a7d86a7b0dd64f0 to your computer and use it in GitHub Desktop.
import 'package:flutter_hooks/flutter_hooks.dart';
class MyScaffold extends HookWidget {
const MyScaffold({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
final count = useState(0);
return Scaffold(
appBar: AppBar(title: Text('Title')),
body: Center(child: Text('Count: ${count.value}')),
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