fix: scrolling searchbar with conversation view
parent
7269c1aad5
commit
94ed8227f8
|
@ -30,32 +30,29 @@ class _ConversationViewState extends State<ConversationView> {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(top: 10.0),
|
||||
child: Column(mainAxisSize: MainAxisSize.min, children: <Widget>[
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 20.0, right: 20.0, bottom: 10.0),
|
||||
child: SearchInput(
|
||||
controller: searchController,
|
||||
hintText: "Search for messages or users")),
|
||||
Flexible(
|
||||
child: StreamBuilder(
|
||||
stream: conversationsBloc.conversations,
|
||||
builder:
|
||||
(context, AsyncSnapshot<List<Conversation>> snapshot) {
|
||||
if (snapshot.hasData) {
|
||||
return buildList(snapshot.data);
|
||||
} else if (snapshot.hasError) {
|
||||
return Text(snapshot.error.toString());
|
||||
}
|
||||
return Center(child: CircularProgressIndicator());
|
||||
}))
|
||||
]));
|
||||
return ListView(padding: EdgeInsets.only(top: 10.0), children: <Widget>[
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 20.0, right: 20.0, bottom: 10.0),
|
||||
child: SearchInput(
|
||||
controller: searchController,
|
||||
hintText: "Search for messages or users")),
|
||||
StreamBuilder(
|
||||
stream: conversationsBloc.conversations,
|
||||
builder: (context, AsyncSnapshot<List<Conversation>> snapshot) {
|
||||
if (snapshot.hasData) {
|
||||
return buildList(snapshot.data);
|
||||
} else if (snapshot.hasError) {
|
||||
return Text(snapshot.error.toString());
|
||||
}
|
||||
return Center(child: CircularProgressIndicator());
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
||||
Widget buildList(List<Conversation> data) {
|
||||
return ListView.builder(
|
||||
padding: EdgeInsets.only(top: 0.0),
|
||||
shrinkWrap: true,
|
||||
itemCount: data.length,
|
||||
itemBuilder: (context, index) {
|
||||
return ConversationItem(conversation: data[index]);
|
||||
|
|
Loading…
Reference in New Issue