Skip to content

Commit 5839429

Browse files
committed
add indicatorWidget option (#45)
1 parent ffb6169 commit 5839429

4 files changed

Lines changed: 16 additions & 1 deletion

File tree

README-zh_CN.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ Color maskColor;
123123
/// 当loading展示的时候,是否允许用户操作.
124124
bool userInteractions;
125125
126+
/// 指示器自定义组件
127+
Widget indicatorWidget;
128+
126129
/// 展示成功状态的自定义组件
127130
Widget successWidget;
128131

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ Color maskColor;
123123
/// should allow user interactions while loading is displayed.
124124
bool userInteractions;
125125
126+
/// indicator widget of loading
127+
Widget indicatorWidget;
128+
126129
/// success widget of loading
127130
Widget successWidget;
128131

lib/src/easy_loading.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ class EasyLoading {
110110
/// should allow user interactions while loading is displayed.
111111
bool userInteractions;
112112

113+
/// indicator widget of loading
114+
Widget indicatorWidget;
115+
113116
/// success widget of loading
114117
Widget successWidget;
115118

@@ -168,7 +171,8 @@ class EasyLoading {
168171
String status,
169172
Widget indicator,
170173
}) {
171-
Widget w = indicator ?? LoadingIndicator();
174+
Widget w =
175+
indicator ?? (_getInstance().indicatorWidget ?? LoadingIndicator());
172176
_getInstance()._show(
173177
status: status,
174178
w: w,

lib/src/widgets/indicator.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,11 @@ class _LoadingIndicatorState extends State<LoadingIndicator> {
180180
);
181181
break;
182182
default:
183+
_indicator = SpinKitFadingCircle(
184+
color: _indicatorColor,
185+
size: _size,
186+
);
187+
break;
183188
}
184189

185190
return Container(

0 commit comments

Comments
 (0)