feat: add flag for floating date divider
This commit is contained in:
@@ -161,6 +161,7 @@ class MessageListView extends StatefulWidget {
|
|||||||
this.pinPermissions = const [],
|
this.pinPermissions = const [],
|
||||||
this.textBuilder,
|
this.textBuilder,
|
||||||
this.usernameBuilder,
|
this.usernameBuilder,
|
||||||
|
this.showFloatingDateDivider = true,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
/// Function used to build a custom message widget
|
/// Function used to build a custom message widget
|
||||||
@@ -227,6 +228,9 @@ class MessageListView extends StatefulWidget {
|
|||||||
/// Flag for showing tile on header
|
/// Flag for showing tile on header
|
||||||
final bool showConnectionStateTile;
|
final bool showConnectionStateTile;
|
||||||
|
|
||||||
|
/// Flag for showing the floating date divider
|
||||||
|
final bool showFloatingDateDivider;
|
||||||
|
|
||||||
/// Function called when messages are fetched
|
/// Function called when messages are fetched
|
||||||
final Widget Function(BuildContext, List<Message>)? messageListBuilder;
|
final Widget Function(BuildContext, List<Message>)? messageListBuilder;
|
||||||
|
|
||||||
@@ -567,7 +571,12 @@ class _MessageListViewState extends State<MessageListView> {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
if (widget.showScrollToBottom) _buildScrollToBottom(),
|
if (widget.showScrollToBottom) _buildScrollToBottom(),
|
||||||
Positioned(
|
if (widget.showFloatingDateDivider) _buildFloatingDateDivider(),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Positioned _buildFloatingDateDivider() => Positioned(
|
||||||
top: 20,
|
top: 20,
|
||||||
child: BetterStreamBuilder<Iterable<ItemPosition>>(
|
child: BetterStreamBuilder<Iterable<ItemPosition>>(
|
||||||
initialData: _itemPositionListener.itemPositions.value,
|
initialData: _itemPositionListener.itemPositions.value,
|
||||||
@@ -605,10 +614,7 @@ class _MessageListViewState extends State<MessageListView> {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> _paginateData(
|
Future<void> _paginateData(
|
||||||
StreamChannelState? channel, QueryDirection direction) =>
|
StreamChannelState? channel, QueryDirection direction) =>
|
||||||
|
|||||||
Reference in New Issue
Block a user