Skip to content

Instantly share code, notes, and snippets.

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 foxanna/90de4fbb73f7fc28fde3c0cc7ba7c65a to your computer and use it in GitHub Desktop.
Save foxanna/90de4fbb73f7fc28fde3c0cc7ba7c65a to your computer and use it in GitHub Desktop.
class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key}) : super(key: key);
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
void _incrementCounter() => setState(() => _counter++);
@override
Widget build(BuildContext context) {
final translations = ExampleLocalizations.of(context);
return Scaffold(
appBar: AppBar(
title: Text(translations.homePageTitle),
),
body: Center(
child: Text(translations.homePageCenterText(_counter)),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: translations.incrementTooltip,
child: Icon(Icons.add),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment