Skip to content

Commit ffaae47

Browse files
committed
update v2.1.0 (#59, #61)
1 parent af11880 commit ffaae47

14 files changed

Lines changed: 359 additions & 252 deletions

File tree

.vscode/launch.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@
55
"version": "0.2.0",
66
"configurations": [
77
{
8-
"name": "Flutter",
8+
"name": "flutter_easyloading",
9+
"request": "launch",
10+
"type": "dart"
11+
},
12+
{
13+
"name": "example",
14+
"cwd": "example",
915
"request": "launch",
1016
"type": "dart"
1117
}

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## [2.1.0] - 2020.11.11
2+
3+
* add loading status callback
4+
* add dismissOnTap option [#59](https://github.com/huangjianke/flutter_easyloading/issues/59)
5+
* fixed [#61](https://github.com/huangjianke/flutter_easyloading/issues/61)
6+
* fixed bugs
7+
18
## [2.0.1] - 2020.11.06
29

310
* fixed [#58](https://github.com/huangjianke/flutter_easyloading/issues/58)

README-zh_CN.md

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# flutter_easyloading
1+
# Flutter EasyLoading
22

33
[![pub package](https://img.shields.io/pub/v/flutter_easyloading?style=flat)](https://pub.dev/packages/flutter_easyloading) [![pub points](https://badges.bar/flutter_easyloading/pub%20points)](https://pub.dev/packages/flutter_easyloading/score) [![popularity](https://badges.bar/flutter_easyloading/popularity)](https://pub.dev/packages/flutter_easyloading/score) [![likes](https://badges.bar/flutter_easyloading/likes)](https://pub.dev/packages/flutter_easyloading/score) [![license](https://img.shields.io/github/license/huangjianke/flutter_easyloading?style=flat)](https://github.com/huangjianke/flutter_easyloading) [![stars](https://img.shields.io/github/stars/huangjianke/flutter_easyloading?style=social)](https://github.com/huangjianke/flutter_easyloading)
44

@@ -16,7 +16,7 @@
1616

1717
```yaml
1818
dependencies:
19-
flutter_easyloading: ^2.0.1
19+
flutter_easyloading: ^2.1.0
2020
```
2121
2222
## 导入
@@ -66,8 +66,30 @@ EasyLoading.showToast('Toast');
6666
EasyLoading.dismiss();
6767
```
6868

69+
添加 Loading 状态回调
70+
71+
```dart
72+
EasyLoading.addStatusCallback((status) {
73+
print('EasyLoading Status $status');
74+
});
75+
```
76+
77+
移除 Loading 状态回调
78+
79+
```dart
80+
EasyLoading.removeCallback(statusCallback);
81+
82+
EasyLoading.removeAllCallbacks();
83+
```
84+
6985
## 自定义
7086

87+
❗️**注意:**
88+
89+
- **`textColor``indicatorColor``progressColor``backgroundColor` 仅对 `EasyLoadingStyle.custom`有效。**
90+
91+
- **`maskColor` 仅对 `EasyLoadingMaskType.custom`有效。**
92+
7193
```dart
7294
/// loading的样式, 默认[EasyLoadingStyle.dark].
7395
EasyLoadingStyle loadingStyle;
@@ -138,6 +160,9 @@ Color maskColor;
138160
/// 当loading展示的时候,是否允许用户操作.
139161
bool userInteractions;
140162
163+
/// 点击背景是否关闭.
164+
bool dismissOnTap;
165+
141166
/// 指示器自定义组件
142167
Widget indicatorWidget;
143168
@@ -151,12 +176,6 @@ Widget errorWidget;
151176
Widget infoWidget;
152177
```
153178

154-
❗️**注意:**
155-
156-
- **`textColor``indicatorColor``progressColor``backgroundColor` 仅对 `EasyLoadingStyle.custom`有效。**
157-
158-
- **`maskColor` 仅对 `EasyLoadingMaskType.custom`有效。**
159-
160179
因为 `EasyLoading` 是一个全局单例, 所以你可以在任意一个地方自定义它的样式:
161180

162181
```dart
@@ -166,11 +185,14 @@ EasyLoading.instance
166185
..loadingStyle = EasyLoadingStyle.dark
167186
..indicatorSize = 45.0
168187
..radius = 10.0
188+
..progressColor = Colors.yellow
169189
..backgroundColor = Colors.green
170190
..indicatorColor = Colors.yellow
171191
..textColor = Colors.yellow
172192
..maskColor = Colors.blue.withOpacity(0.5)
173-
..userInteractions = true;
193+
..userInteractions = true
194+
..dismissOnTap = false
195+
..customAnimation = CustomAnimation();
174196
```
175197

176198
更多的指示器类型可查看 👉 [flutter_spinkit showcase](https://github.com/jogboms/flutter_spinkit#-showcase)

README.md

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# flutter_easyloading
1+
# Flutter EasyLoading
22

33
[![pub package](https://img.shields.io/pub/v/flutter_easyloading?style=flat)](https://pub.dev/packages/flutter_easyloading) [![pub points](https://badges.bar/flutter_easyloading/pub%20points)](https://pub.dev/packages/flutter_easyloading/score) [![popularity](https://badges.bar/flutter_easyloading/popularity)](https://pub.dev/packages/flutter_easyloading/score) [![likes](https://badges.bar/flutter_easyloading/likes)](https://pub.dev/packages/flutter_easyloading/score) [![license](https://img.shields.io/github/license/huangjianke/flutter_easyloading?style=flat)](https://github.com/huangjianke/flutter_easyloading) [![stars](https://img.shields.io/github/stars/huangjianke/flutter_easyloading?style=social)](https://github.com/huangjianke/flutter_easyloading)
44

@@ -16,7 +16,7 @@ Add this to your package's `pubspec.yaml` file:
1616

1717
```yaml
1818
dependencies:
19-
flutter_easyloading: ^2.0.1
19+
flutter_easyloading: ^2.1.0
2020
```
2121
2222
## Import
@@ -67,8 +67,30 @@ EasyLoading.showToast('Toast');
6767
EasyLoading.dismiss();
6868
```
6969

70+
Add loading status callback
71+
72+
```dart
73+
EasyLoading.addStatusCallback((status) {
74+
print('EasyLoading Status $status');
75+
});
76+
```
77+
78+
Remove loading status callback(s)
79+
80+
```dart
81+
EasyLoading.removeCallback(statusCallback);
82+
83+
EasyLoading.removeAllCallbacks();
84+
```
85+
7086
## Customize
7187

88+
❗️**Note:**
89+
90+
- **`textColor``indicatorColor``progressColor``backgroundColor` only used for `EasyLoadingStyle.custom`.**
91+
92+
- **`maskColor` only used for `EasyLoadingMaskType.custom`.**
93+
7294
```dart
7395
/// loading style, default [EasyLoadingStyle.dark].
7496
EasyLoadingStyle loadingStyle;
@@ -139,6 +161,9 @@ Color maskColor;
139161
/// should allow user interactions while loading is displayed.
140162
bool userInteractions;
141163
164+
/// should dismiss on user tap.
165+
bool dismissOnTap;
166+
142167
/// indicator widget of loading
143168
Widget indicatorWidget;
144169
@@ -152,13 +177,6 @@ Widget errorWidget;
152177
Widget infoWidget;
153178
```
154179

155-
❗️**Note:**
156-
157-
- **`textColor``indicatorColor``progressColor``backgroundColor` only used for `EasyLoadingStyle.custom`.**
158-
159-
- **`maskColor` only used for `EasyLoadingMaskType.custom`.**
160-
161-
162180
Because of `EasyLoading` is a singleton, so you can custom loading style any where like this:
163181

164182
```dart
@@ -168,11 +186,14 @@ EasyLoading.instance
168186
..loadingStyle = EasyLoadingStyle.dark
169187
..indicatorSize = 45.0
170188
..radius = 10.0
189+
..progressColor = Colors.yellow
171190
..backgroundColor = Colors.green
172191
..indicatorColor = Colors.yellow
173192
..textColor = Colors.yellow
174193
..maskColor = Colors.blue.withOpacity(0.5)
175-
..userInteractions = true;
194+
..userInteractions = true
195+
..dismissOnTap = false
196+
..customAnimation = CustomAnimation();
176197
```
177198

178199
More indicatorType can see in 👉 [flutter_spinkit showcase](https://github.com/jogboms/flutter_spinkit#-showcase)

example/ios/Flutter/.last_build_id

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
967974c66177fcaca35ee5d47917254d

example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,6 @@
245245
/* Begin XCBuildConfiguration section */
246246
249021D3217E4FDB00AE95B9 /* Profile */ = {
247247
isa = XCBuildConfiguration;
248-
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
249248
buildSettings = {
250249
ALWAYS_SEARCH_USER_PATHS = NO;
251250
CLANG_ANALYZER_NONNULL = YES;
@@ -320,7 +319,6 @@
320319
};
321320
97C147031CF9000F007C117D /* Debug */ = {
322321
isa = XCBuildConfiguration;
323-
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
324322
buildSettings = {
325323
ALWAYS_SEARCH_USER_PATHS = NO;
326324
CLANG_ANALYZER_NONNULL = YES;
@@ -376,7 +374,6 @@
376374
};
377375
97C147041CF9000F007C117D /* Release */ = {
378376
isa = XCBuildConfiguration;
379-
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
380377
buildSettings = {
381378
ALWAYS_SEARCH_USER_PATHS = NO;
382379
CLANG_ANALYZER_NONNULL = YES;

example/lib/main.dart

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ void configLoading() {
2626
..textColor = Colors.yellow
2727
..maskColor = Colors.blue.withOpacity(0.5)
2828
..userInteractions = true
29+
..dismissOnTap = false
2930
..customAnimation = CustomAnimation();
3031
}
3132

@@ -63,7 +64,14 @@ class _MyHomePageState extends State<MyHomePage> {
6364
@override
6465
void initState() {
6566
super.initState();
67+
EasyLoading.addStatusCallback((status) {
68+
print('EasyLoading Status $status');
69+
if (status == EasyLoadingStatus.dismiss) {
70+
_timer?.cancel();
71+
}
72+
});
6673
EasyLoading.showSuccess('Use in initState');
74+
// EasyLoading.removeCallbacks();
6775
}
6876

6977
@override
@@ -100,17 +108,22 @@ class _MyHomePageState extends State<MyHomePage> {
100108
FlatButton(
101109
textColor: Colors.blue,
102110
child: Text('dismiss'),
103-
onPressed: () {
111+
onPressed: () async {
104112
_timer?.cancel();
105-
EasyLoading.dismiss();
113+
await EasyLoading.dismiss();
114+
print('EasyLoading dismiss');
106115
},
107116
),
108117
FlatButton(
109118
textColor: Colors.blue,
110119
child: Text('show'),
111-
onPressed: () {
120+
onPressed: () async {
112121
_timer?.cancel();
113-
EasyLoading.show(status: 'loading...');
122+
await EasyLoading.show(
123+
status: 'loading...',
124+
maskType: EasyLoadingMaskType.black,
125+
);
126+
print('EasyLoading show');
114127
},
115128
),
116129
FlatButton(
@@ -126,9 +139,10 @@ class _MyHomePageState extends State<MyHomePage> {
126139
FlatButton(
127140
textColor: Colors.blue,
128141
child: Text('showSuccess'),
129-
onPressed: () {
142+
onPressed: () async {
130143
_timer?.cancel();
131-
EasyLoading.showSuccess('Great Success!');
144+
await EasyLoading.showSuccess('Great Success!');
145+
print('EasyLoading showSuccess');
132146
},
133147
),
134148
FlatButton(

example/lib/test.dart

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,22 @@ class _TestPageState extends State<TestPage> {
1111
@override
1212
void initState() {
1313
super.initState();
14-
// EasyLoading.show();
14+
// EasyLoading.dismiss();
15+
EasyLoading.showSuccess('Use in initState');
16+
EasyLoading.addStatusCallback(statusCallback);
1517
}
1618

1719
@override
1820
void deactivate() {
1921
EasyLoading.dismiss();
22+
EasyLoading.removeCallback(statusCallback);
2023
super.deactivate();
2124
}
2225

26+
void statusCallback(EasyLoadingStatus status) {
27+
print('Test EasyLoading Status $status');
28+
}
29+
2330
void loadData() async {
2431
try {
2532
EasyLoading.show();

0 commit comments

Comments
 (0)