add scrollPhysics to messagelistview

This commit is contained in:
Salvatore Giordano
2020-04-30 11:55:03 +02:00
parent cd1ae7d2ef
commit 02d97893c1
+6 -1
View File
@@ -73,6 +73,7 @@ class MessageListView extends StatefulWidget {
this.attachmentBuilders, this.attachmentBuilders,
this.dateDividerBuilder, this.dateDividerBuilder,
this.showAvatar = true, this.showAvatar = true,
this.scrollPhysics = const AlwaysScrollableScrollPhysics(),
}) : super(key: key); }) : super(key: key);
/// Function used to build a custom message widget /// Function used to build a custom message widget
@@ -115,6 +116,9 @@ class MessageListView extends StatefulWidget {
/// if true shows the user avatar /// if true shows the user avatar
final bool showAvatar; final bool showAvatar;
/// The ScrollPhysics used by the ListView
final ScrollPhysics scrollPhysics;
@override @override
_MessageListViewState createState() => _MessageListViewState(); _MessageListViewState createState() => _MessageListViewState();
} }
@@ -145,7 +149,8 @@ class _MessageListViewState extends State<MessageListView> {
}, },
child: ListView.custom( child: ListView.custom(
key: Key('messageListView'), key: Key('messageListView'),
physics: AlwaysScrollableScrollPhysics(), shrinkWrap: true,
physics: widget.scrollPhysics,
controller: _scrollController, controller: _scrollController,
reverse: true, reverse: true,
childrenDelegate: SliverChildBuilderDelegate( childrenDelegate: SliverChildBuilderDelegate(