Created
September 16, 2020 14:14
-
-
Save h4p/e2ce210c24ba107fb38f7d501b586334 to your computer and use it in GitHub Desktop.
Flutter - Minimal Stateful App
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
main() => runApp(MinimalStatefulApp()); | |
class MinimalStatefulApp extends StatefulWidget { | |
@override | |
_MinimalState createState() => _MinimalState(); | |
} | |
class _MinimalState extends State<MinimalStatefulApp> { | |
int _counter = 0; | |
@override | |
Widget build(BuildContext context) { | |
return GestureDetector( | |
onDoubleTap: () => setState(() => _counter++), | |
child: Center( | |
child: Text( | |
'Counter: $_counter', | |
textDirection: TextDirection.ltr, | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment