mirror of
https://github.com/hackku21/loc-chain-app.git
synced 2024-10-27 20:34:05 +00:00
53 lines
1.4 KiB
Dart
53 lines
1.4 KiB
Dart
|
import 'package:flutter/material.dart';
|
||
|
|
||
|
class HomePage extends StatefulWidget {
|
||
|
HomePage({Key? key, required this.title}) : super(key: key);
|
||
|
final String title;
|
||
|
|
||
|
@override
|
||
|
_HomePageState createState() => _HomePageState();
|
||
|
}
|
||
|
|
||
|
class _HomePageState extends State<HomePage> {
|
||
|
int _counter = 0;
|
||
|
|
||
|
void _incrementCounter() {
|
||
|
setState(() {
|
||
|
// This call to setState tells the Flutter framework that something has
|
||
|
// changed in this State, which causes it to rerun the build method below
|
||
|
// so that the display can reflect the updated values. If we changed
|
||
|
// _counter without calling setState(), then the build method would not be
|
||
|
// called again, and so nothing would appear to happen.
|
||
|
_counter++;
|
||
|
});
|
||
|
}
|
||
|
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
|
return Scaffold(
|
||
|
appBar: AppBar(
|
||
|
title: Text(widget.title),
|
||
|
),
|
||
|
body: Center(
|
||
|
child: Column(
|
||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||
|
children: <Widget>[
|
||
|
Text(
|
||
|
'You have pushed the button this many times:',
|
||
|
),
|
||
|
Text(
|
||
|
'$_counter',
|
||
|
style: Theme.of(context).textTheme.headline4,
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
),
|
||
|
floatingActionButton: FloatingActionButton(
|
||
|
onPressed: _incrementCounter,
|
||
|
tooltip: 'Increment',
|
||
|
child: Icon(Icons.add),
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
}
|