Skip to content

Commit 64a49b0

Browse files
committed
update version 1.3.0
1 parent ea9ec66 commit 64a49b0

11 files changed

Lines changed: 160 additions & 118 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## [1.3.0] - 2020.09.24
2+
3+
* fixed bugs
4+
15
## [1.2.1] - 2020.09.22
26

37
* add indicatorWidget option [#45](https://github.com/huangjianke/flutter_easyloading/issues/45)

README-zh_CN.md

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
```yaml
1414
dependencies:
15-
flutter_easyloading: ^1.2.1
15+
flutter_easyloading: ^1.3.0
1616
```
1717
1818
## 导入
@@ -23,7 +23,7 @@ import 'package:flutter_easyloading/flutter_easyloading.dart';
2323

2424
## 如何使用
2525

26-
首先, 使用 `FlutterEasyLoading` 组件包裹您的App组件:
26+
首先, `MaterialApp`/`CupertinoApp`中初始化`FlutterEasyLoading`:
2727

2828
```dart
2929
class MyApp extends StatelessWidget {
@@ -34,11 +34,10 @@ class MyApp extends StatelessWidget {
3434
theme: ThemeData(
3535
primarySwatch: Colors.blue,
3636
),
37+
home: MyHomePage(title: 'Flutter EasyLoading'),
3738
builder: (BuildContext context, Widget child) {
3839
/// 确保 loading 组件能覆盖在其他组件之上.
39-
return FlutterEasyLoading(
40-
child: MyHomePage(title: 'Flutter EasyLoading'),
41-
);
40+
return FlutterEasyLoading(child: child);
4241
},
4342
);
4443
}
@@ -142,14 +141,6 @@ Widget infoWidget;
142141

143142
- **`maskColor` 仅对 `EasyLoadingMaskType.custom`有效。**
144143

145-
- **如果你想在 `initState` 方法里面使用 `EasyLoading`, 你应该这样做:**
146-
```dart
147-
/// 帧绘制完成回调通知
148-
WidgetsBinding.instance.addPostFrameCallback((_) {
149-
EasyLoading.showSuccess('Great Success!');
150-
});
151-
```
152-
153144
因为 `EasyLoading` 是一个全局单例, 所以你可以在任意一个地方自定义它的样式:
154145

155146
```dart

README.md

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Add this to your package's `pubspec.yaml` file:
1212

1313
```yaml
1414
dependencies:
15-
flutter_easyloading: ^1.2.1
15+
flutter_easyloading: ^1.3.0
1616
```
1717
1818
## Import
@@ -23,22 +23,22 @@ import 'package:flutter_easyloading/flutter_easyloading.dart';
2323

2424
## How to use
2525

26-
First, warp your app widget with `FlutterEasyLoading`:
26+
First, initialize `FlutterEasyLoading` in `MaterialApp`/`CupertinoApp`:
2727

2828
```dart
2929
class MyApp extends StatelessWidget {
30+
// This widget is the root of your application.
3031
@override
3132
Widget build(BuildContext context) {
3233
return MaterialApp(
3334
title: 'Flutter EasyLoading',
3435
theme: ThemeData(
3536
primarySwatch: Colors.blue,
3637
),
38+
home: MyHomePage(title: 'Flutter EasyLoading'),
3739
builder: (BuildContext context, Widget child) {
3840
/// make sure that loading can be displayed in front of all other widgets
39-
return FlutterEasyLoading(
40-
child: MyHomePage(title: 'Flutter EasyLoading'),
41-
);
41+
return FlutterEasyLoading(child: child);
4242
},
4343
);
4444
}
@@ -142,13 +142,6 @@ Widget infoWidget;
142142

143143
- **`maskColor` only used for `EasyLoadingMaskType.custom`.**
144144

145-
- **if you want use `EasyLoading` in `initState` method, you should do like this:**
146-
```dart
147-
/// Schedule a callback for the end of this frame
148-
WidgetsBinding.instance.addPostFrameCallback((_) {
149-
EasyLoading.showSuccess('Great Success!');
150-
});
151-
```
152145

153146
Because of `EasyLoading` is a singleton, so you can custom loading style any where like this:
154147

example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@
99
/* Begin PBXBuildFile section */
1010
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
1111
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
12-
3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; };
13-
3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
14-
9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; };
15-
9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
1612
978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; };
1713
97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; };
1814
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
@@ -27,8 +23,6 @@
2723
dstPath = "";
2824
dstSubfolderSpec = 10;
2925
files = (
30-
3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */,
31-
9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */,
3226
);
3327
name = "Embed Frameworks";
3428
runOnlyForDeploymentPostprocessing = 0;
@@ -39,13 +33,11 @@
3933
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
4034
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
4135
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
42-
3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = "<group>"; };
4336
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
4437
7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
4538
7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
4639
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
4740
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
48-
9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = "<group>"; };
4941
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
5042
97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
5143
97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
@@ -59,8 +51,6 @@
5951
isa = PBXFrameworksBuildPhase;
6052
buildActionMask = 2147483647;
6153
files = (
62-
9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */,
63-
3B80C3941E831B6300D905FE /* App.framework in Frameworks */,
6454
);
6555
runOnlyForDeploymentPostprocessing = 0;
6656
};
@@ -70,9 +60,7 @@
7060
9740EEB11CF90186004384FC /* Flutter */ = {
7161
isa = PBXGroup;
7262
children = (
73-
3B80C3931E831B6300D905FE /* App.framework */,
7463
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
75-
9740EEBA1CF902C7004384FC /* Flutter.framework */,
7664
9740EEB21CF90195004384FC /* Debug.xcconfig */,
7765
7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
7866
9740EEB31CF90195004384FC /* Generated.xcconfig */,
@@ -204,7 +192,7 @@
204192
);
205193
runOnlyForDeploymentPostprocessing = 0;
206194
shellPath = /bin/sh;
207-
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin";
195+
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
208196
};
209197
9740EEB61CF901F6004384FC /* Run Script */ = {
210198
isa = PBXShellScriptBuildPhase;

example/lib/main.dart

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import 'package:flutter/material.dart';
44
import 'package:flutter/cupertino.dart';
55
import 'package:flutter_easyloading/flutter_easyloading.dart';
66

7+
import './test.dart';
8+
79
void main() {
810
runApp(MyApp());
911
configLoading();
@@ -33,10 +35,10 @@ class MyApp extends StatelessWidget {
3335
theme: ThemeData(
3436
primarySwatch: Colors.blue,
3537
),
38+
home: MyHomePage(title: 'Flutter EasyLoading'),
3639
builder: (BuildContext context, Widget child) {
37-
return FlutterEasyLoading(
38-
child: MyHomePage(title: 'Flutter EasyLoading'),
39-
);
40+
/// make sure that loading can be displayed in front of all other widgets
41+
return FlutterEasyLoading(child: child);
4042
},
4143
);
4244
}
@@ -58,11 +60,7 @@ class _MyHomePageState extends State<MyHomePage> {
5860
@override
5961
void initState() {
6062
super.initState();
61-
62-
/// Schedule a callback for the end of this frame
63-
WidgetsBinding.instance.addPostFrameCallback((_) {
64-
EasyLoading.showSuccess('Use in initState!');
65-
});
63+
EasyLoading.showSuccess('Use in initState');
6664
}
6765

6866
@override
@@ -78,9 +76,22 @@ class _MyHomePageState extends State<MyHomePage> {
7876
crossAxisAlignment: CrossAxisAlignment.center,
7977
mainAxisAlignment: MainAxisAlignment.start,
8078
children: <Widget>[
81-
TextField(),
8279
Column(
8380
children: <Widget>[
81+
TextField(),
82+
FlatButton(
83+
textColor: Colors.blue,
84+
child: Text('push test page'),
85+
onPressed: () {
86+
_timer?.cancel();
87+
Navigator.push(
88+
context,
89+
MaterialPageRoute(
90+
builder: (BuildContext context) => TestPage(),
91+
),
92+
);
93+
},
94+
),
8495
FlatButton(
8596
textColor: Colors.blue,
8697
child: Text('dismiss'),

example/lib/test.dart

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:flutter_easyloading/flutter_easyloading.dart';
3+
4+
class TestPage extends StatefulWidget {
5+
@override
6+
_TestPageState createState() => _TestPageState();
7+
}
8+
9+
class _TestPageState extends State<TestPage> {
10+
@override
11+
void initState() {
12+
super.initState();
13+
EasyLoading.showSuccess('Use in initState');
14+
}
15+
16+
@override
17+
void deactivate() {
18+
super.deactivate();
19+
EasyLoading.dismiss();
20+
}
21+
22+
@override
23+
Widget build(BuildContext context) {
24+
return Scaffold(
25+
appBar: AppBar(
26+
title: Text('Test Page'),
27+
),
28+
body: Center(
29+
child: FlatButton(
30+
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();
37+
},
38+
),
39+
),
40+
);
41+
}
42+
}

example/pubspec.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ packages:
7575
path: ".."
7676
relative: true
7777
source: path
78-
version: "1.2.1"
78+
version: "1.3.0"
7979
flutter_spinkit:
8080
dependency: transitive
8181
description:

0 commit comments

Comments
 (0)