Skip to content

Instantly share code, notes, and snippets.

@h4p
Created September 16, 2020 14:14
Show Gist options
  • Save h4p/e2ce210c24ba107fb38f7d501b586334 to your computer and use it in GitHub Desktop.
Save h4p/e2ce210c24ba107fb38f7d501b586334 to your computer and use it in GitHub Desktop.
Flutter - Minimal Stateful App
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