Skip to content

Commit

Permalink
Merge pull request #7 from merdovash/msg_arguments
Browse files Browse the repository at this point in the history
这个非常好,如果使用现有的 UI 样式,可以直接修改文字内容,变为自己的风格
  • Loading branch information
ZeroBytesX authored Jun 11, 2020
2 parents a48ea65 + bb032e2 commit f0bc6ab
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions lib/loadany_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ class LoadAny extends StatefulWidget {
///Footer key
final Key _keyLastItem = Key("__LAST_ITEM");

///Text displayed during load
final String loadingMsg;

///Text displayed in case of error
final String errorMsg;

///Text displayed when loading is finished
final String finishMsg;

LoadAny({
@required this.status,
@required this.child,
Expand All @@ -49,6 +58,9 @@ class LoadAny extends StatefulWidget {
this.bottomTriggerDistance = 200,
this.footerHeight = 40,
this.loadMoreBuilder,
this.loadingMsg='加载中...',
this.errorMsg='加载失败,点击重试',
this.finishMsg='没有更多了',
});

@override
Expand Down Expand Up @@ -121,7 +133,7 @@ class _LoadAnyState extends State<LoadAny> {
),
SizedBox(width: 10),
Text(
'加载中...',
widget.loadingMsg,
style: TextStyle(
fontSize: 12,
color: Colors.grey,
Expand Down Expand Up @@ -155,7 +167,7 @@ class _LoadAnyState extends State<LoadAny> {
),
SizedBox(width: 10),
Text(
'加载失败,点击重试',
widget.errorMsg,
style: TextStyle(
fontSize: 12,
color: Colors.grey,
Expand Down Expand Up @@ -183,7 +195,7 @@ class _LoadAnyState extends State<LoadAny> {
),
SizedBox(width: 6),
Text(
'没有更多了',
widget.finishMsg,
style: TextStyle(
fontSize: 12,
color: Colors.grey,
Expand Down

0 comments on commit f0bc6ab

Please sign in to comment.