update example

master
小赖 4 years ago
parent 34e828dfed
commit 93a47d0b3c

@ -10,8 +10,8 @@ class MyApp extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return MaterialApp( return MaterialApp(
title: 'Flutter Demo', title: 'PowerLogger\nDemo',
home: MyHomePage(title: 'Flutter Demo Home Page'), home: MyHomePage(title: 'PowerLogger Demo'),
); );
} }
} }
@ -42,6 +42,8 @@ class _MyHomePageState extends State<MyHomePage> {
LoggerData.addData('TEST'); LoggerData.addData('TEST');
} }
bool loading = false;
@override @override
void dispose() { void dispose() {
_textController?.dispose(); _textController?.dispose();
@ -64,10 +66,21 @@ class _MyHomePageState extends State<MyHomePage> {
), ),
), ),
), ),
floatingActionButton: FloatingActionButton( floatingActionButton: FloatingActionButton.extended(
onPressed: () { icon: loading
NetTool.dio.get(_textController.text); ? CircularProgressIndicator(
}, valueColor: AlwaysStoppedAnimation(Colors.white))
: Icon(Icons.send),
label: Text('发送'),
onPressed: loading
? null
: () async {
loading = true;
setState(() {});
await NetTool.dio.get(_textController.text);
loading = false;
setState(() {});
},
), ),
); );
} }

Loading…
Cancel
Save