Return at end of body

parent b60ee71c
......@@ -279,16 +279,19 @@ class ChatPageState extends State<ChatPage> {
return FutureOrBuilder<List<ChatItem>>(
futureOr: bloc.getPage(index),
builder: (BuildContext context, AsyncSnapshot<List<ChatItem>> snapshot) {
Widget widget;
switch(snapshot.connectionState) {
case ConnectionState.none:
case ConnectionState.waiting:
return SizedBox(
widget = SizedBox(
height: MediaQuery.of(context).size.height * 2,
child: Align(
alignment: Alignment.bottomCenter,
child: PlatformCircularProgressIndicator()
),
);
break;
case ConnectionState.active:
case ConnectionState.done:
......@@ -332,13 +335,16 @@ class ChatPageState extends State<ChatPage> {
i++;
}
return ListView(
widget = ListView(
reverse: true,
primary: false,
shrinkWrap: true,
children: widgets,
);
break;
}
return widget;
},
);
},
......
......@@ -97,10 +97,13 @@ class ChatOverviewPageState extends State<ChatOverviewPage> {
return StreamBuilder<List<ChatOverview>>(
stream: bloc.chats,
builder: (BuildContext context, AsyncSnapshot<List<ChatOverview>> snapshot) {
Widget widget;
switch(snapshot.connectionState) {
case ConnectionState.none:
case ConnectionState.waiting:
return Center(child: PlatformCircularProgressIndicator());
widget = Center(child: PlatformCircularProgressIndicator());
break;
case ConnectionState.active:
case ConnectionState.done:
final chats = snapshot.data;
......@@ -109,7 +112,7 @@ class ChatOverviewPageState extends State<ChatOverviewPage> {
return Center(child: PlatformCircularProgressIndicator());
}
return ListView.separated(
widget = ListView.separated(
separatorBuilder: (context, index) => Divider(
height: 1,
indent: 64,
......@@ -119,7 +122,10 @@ class ChatOverviewPageState extends State<ChatOverviewPage> {
return _buildChatOverview(chats[index]);
}
);
break;
}
return widget;
}
);
}
......
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