Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add text messages to widget arguments #7

Merged
merged 1 commit into from
Jun 11, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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