File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55 In most cases you can leave this as-is, but you if you want to provide
66 additional functionality it is fine to subclass or reimplement
77 FlutterApplication and put your custom class here. -->
8+ <uses-permission android : name =" android.permission.INTERNET" />
89 <application
910 android : name =" io.flutter.app.FlutterApplication"
1011 android : label =" example"
Original file line number Diff line number Diff line change 11import 'package:flutter/material.dart' ;
22import 'package:flutter_easyloading/flutter_easyloading.dart' ;
3+ import 'package:dio/dio.dart' ;
34
45class TestPage extends StatefulWidget {
56 @override
@@ -10,7 +11,7 @@ class _TestPageState extends State<TestPage> {
1011 @override
1112 void initState () {
1213 super .initState ();
13- EasyLoading .show ();
14+ // EasyLoading.show();
1415 }
1516
1617 @override
@@ -19,6 +20,18 @@ class _TestPageState extends State<TestPage> {
1920 super .deactivate ();
2021 }
2122
23+ void loadData () async {
24+ try {
25+ EasyLoading .show ();
26+ Response response = await Dio ().get ('https://github.com' );
27+ print (response);
28+ EasyLoading .dismiss ();
29+ } catch (e) {
30+ EasyLoading .showError (e.toString ());
31+ print (e);
32+ }
33+ }
34+
2235 @override
2336 Widget build (BuildContext context) {
2437 return Scaffold (
@@ -28,12 +41,13 @@ class _TestPageState extends State<TestPage> {
2841 body: Center (
2942 child: FlatButton (
3043 textColor: Colors .blue,
31- child: Text ('async show' ),
32- onPressed: () async {
33- await Future .delayed (Duration (seconds: 2 ));
34- EasyLoading .show (status: 'loading...' );
35- await Future .delayed (Duration (seconds: 5 ));
36- EasyLoading .dismiss ();
44+ child: Text ('loadData' ),
45+ onPressed: () {
46+ loadData ();
47+ // await Future.delayed(Duration(seconds: 2));
48+ // EasyLoading.show(status: 'loading...');
49+ // await Future.delayed(Duration(seconds: 5));
50+ // EasyLoading.dismiss();
3751 },
3852 ),
3953 ),
Original file line number Diff line number Diff line change @@ -64,6 +64,13 @@ packages:
6464 url: "https://pub.flutter-io.cn"
6565 source: hosted
6666 version: "0.1.3"
67+ dio:
68+ dependency: "direct main"
69+ description:
70+ name: dio
71+ url: "https://pub.flutter-io.cn"
72+ source: hosted
73+ version: "3.0.10"
6774 flutter:
6875 dependency: "direct main"
6976 description: flutter
@@ -88,6 +95,13 @@ packages:
8895 description: flutter
8996 source: sdk
9097 version: "0.0.0"
98+ http_parser:
99+ dependency: transitive
100+ description:
101+ name: http_parser
102+ url: "https://pub.flutter-io.cn"
103+ source: hosted
104+ version: "3.1.4"
91105 image:
92106 dependency: transitive
93107 description:
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ dependencies:
2020 flutter :
2121 sdk : flutter
2222
23+ dio : ^3.0.10
2324 flutter_easyloading :
2425 path : ../
2526
You can’t perform that action at this time.
0 commit comments