Commit 85ae7098 authored by 郑智刚's avatar 郑智刚

tesePage路由修改,同志街面增加loading和错误处理

parent 09da21c9
...@@ -123,6 +123,27 @@ class _AttentionPageState extends BasePage<AttentionPage> { ...@@ -123,6 +123,27 @@ class _AttentionPageState extends BasePage<AttentionPage> {
); );
} }
Widget loadingItem() {
return Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
CircularProgressIndicator(),
Padding(
padding: const EdgeInsets.all(10.0),
child: Text('加载中...'),
)
],
),
);
}
Widget errorItem(String reason) {
return Center(
child: Text("$reason"),
);
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
...@@ -145,6 +166,12 @@ class _AttentionPageState extends BasePage<AttentionPage> { ...@@ -145,6 +166,12 @@ class _AttentionPageState extends BasePage<AttentionPage> {
stream: _model.zzgLive.stream, stream: _model.zzgLive.stream,
initialData: _model.zzgLive.data, initialData: _model.zzgLive.data,
builder: (context, data) { builder: (context, data) {
if (data.data == null) {
return loadingItem();
}
if (data.data.error != 0 || data.data.data == null) {
return errorItem(data.data.message);
}
noData = data.data.noData; noData = data.data.noData;
_noticeLists = data.data.data; _noticeLists = data.data.data;
isPerformingRequest = false; isPerformingRequest = false;
......
...@@ -46,12 +46,13 @@ class TestPage extends StatelessWidget { ...@@ -46,12 +46,13 @@ class TestPage extends StatelessWidget {
} }
testMessagePage(BuildContext context) { testMessagePage(BuildContext context) {
return base( return base(context, () {
Navigator.push(
context, context,
RouterCenterImpl() new CustomRoute(RouterCenterImpl()
.findNewMessageRouter() .findNewMessageRouter()?.getMessagePage(''))
?.getMessagePage(''), );
"消息页面"); }, "消息页面");
} }
testReportPage(BuildContext context) { testReportPage(BuildContext context) {
...@@ -94,10 +95,12 @@ class TestPage extends StatelessWidget { ...@@ -94,10 +95,12 @@ class TestPage extends StatelessWidget {
} }
attentionPage(BuildContext context) { attentionPage(BuildContext context) {
return base( return base(context, () {
Navigator.push(
context, context,
RouterCenterImpl() new CustomRoute(RouterCenterImpl()
.findNewMessageRouter()?.getAttentionPage('message_home'), .findNewMessageRouter()?.getAttentionPage('message_home'))
"通知页面"); );
}, "通知页面");
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment