Skip to content

Commit 4bc6605

Browse files
committed
update example
1 parent 2f47e66 commit 4bc6605

4 files changed

Lines changed: 37 additions & 7 deletions

File tree

example/android/app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
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"

example/lib/test.dart

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'package:flutter/material.dart';
22
import 'package:flutter_easyloading/flutter_easyloading.dart';
3+
import 'package:dio/dio.dart';
34

45
class 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
),

example/pubspec.lock

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff 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:

example/pubspec.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ dependencies:
2020
flutter:
2121
sdk: flutter
2222

23+
dio: ^3.0.10
2324
flutter_easyloading:
2425
path: ../
2526

0 commit comments

Comments
 (0)