From 93a47d0b3c21df14cfaaee6797662228cb69ead7 Mon Sep 17 00:00:00 2001 From: laiiihz Date: Tue, 30 Mar 2021 16:05:38 +0800 Subject: [PATCH] update example --- example/lib/main.dart | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/example/lib/main.dart b/example/lib/main.dart index e144fc8..1d78a8d 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -10,8 +10,8 @@ class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( - title: 'Flutter Demo', - home: MyHomePage(title: 'Flutter Demo Home Page'), + title: 'PowerLogger\nDemo', + home: MyHomePage(title: 'PowerLogger Demo'), ); } } @@ -42,6 +42,8 @@ class _MyHomePageState extends State { LoggerData.addData('TEST'); } + bool loading = false; + @override void dispose() { _textController?.dispose(); @@ -64,10 +66,21 @@ class _MyHomePageState extends State { ), ), ), - floatingActionButton: FloatingActionButton( - onPressed: () { - NetTool.dio.get(_textController.text); - }, + floatingActionButton: FloatingActionButton.extended( + icon: loading + ? 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(() {}); + }, ), ); }