Last active
October 10, 2021 16:31
-
-
Save foxanna/90de4fbb73f7fc28fde3c0cc7ba7c65a to your computer and use it in GitHub Desktop.
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
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