modify condition
This commit is contained in:
@@ -1 +1 @@
|
|||||||
0289cdadbd29bab804f275e3c5907d07
|
89eb023669fee58472de747080d78b5a
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
name: example
|
name: example
|
||||||
description: A new Flutter project.
|
description: A new Flutter project.
|
||||||
version: 1.0.31+33
|
version: 1.0.32+34
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.2.2 <3.0.0"
|
sdk: ">=2.2.2 <3.0.0"
|
||||||
|
|||||||
@@ -157,7 +157,9 @@ class _MessageListViewState extends State<MessageListView> {
|
|||||||
|
|
||||||
/// TODO: find a better solution when (https://github.com/flutter/flutter/issues/21023) is fixed
|
/// TODO: find a better solution when (https://github.com/flutter/flutter/issues/21023) is fixed
|
||||||
return WidgetsVisibilityProvider(
|
return WidgetsVisibilityProvider(
|
||||||
condition: (c) => null,
|
condition: (positionData) =>
|
||||||
|
positionData.endPosition >= 20 &&
|
||||||
|
positionData.startPosition <= positionData.viewportSize,
|
||||||
child: Stack(
|
child: Stack(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
children: [
|
children: [
|
||||||
@@ -257,14 +259,24 @@ class _MessageListViewState extends State<MessageListView> {
|
|||||||
if (nextMessage != null &&
|
if (nextMessage != null &&
|
||||||
!Jiffy(message.createdAt.toLocal())
|
!Jiffy(message.createdAt.toLocal())
|
||||||
.isSame(nextMessage.createdAt.toLocal(), Units.DAY)) {
|
.isSame(nextMessage.createdAt.toLocal(), Units.DAY)) {
|
||||||
return VisibleNotifierWidget(
|
return Column(
|
||||||
data: i,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
child: Column(
|
children: <Widget>[
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
messageWidget,
|
||||||
children: <Widget>[
|
Padding(
|
||||||
messageWidget,
|
padding: const EdgeInsets.symmetric(vertical: 12.0),
|
||||||
Padding(
|
child: VisibleNotifierWidget(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 12.0),
|
condition: (
|
||||||
|
ScrollNotification previousNotification,
|
||||||
|
PositionData previousPositionData,
|
||||||
|
ScrollNotification currentNotification,
|
||||||
|
PositionData currentPositionData,
|
||||||
|
) {
|
||||||
|
print(
|
||||||
|
'currentPositionData.endPosition: ${currentPositionData.endPosition}');
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
data: i,
|
||||||
child: widget.dateDividerBuilder != null
|
child: widget.dateDividerBuilder != null
|
||||||
? widget.dateDividerBuilder(
|
? widget.dateDividerBuilder(
|
||||||
nextMessage.createdAt.toLocal())
|
nextMessage.createdAt.toLocal())
|
||||||
@@ -272,8 +284,8 @@ class _MessageListViewState extends State<MessageListView> {
|
|||||||
dateTime: nextMessage.createdAt.toLocal(),
|
dateTime: nextMessage.createdAt.toLocal(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -307,14 +319,20 @@ class _MessageListViewState extends State<MessageListView> {
|
|||||||
Positioned(
|
Positioned(
|
||||||
top: 20.0,
|
top: 20.0,
|
||||||
child: WidgetsVisibilityConsumer(
|
child: WidgetsVisibilityConsumer(
|
||||||
listener: (context, event,) {},
|
listener: (
|
||||||
|
context,
|
||||||
|
event,
|
||||||
|
) {},
|
||||||
builder: (context, event) {
|
builder: (context, event) {
|
||||||
if(event.positionDataList == null || event.positionDataList.isEmpty) {
|
if (event.positionDataList == null ||
|
||||||
|
event.positionDataList.isEmpty) {
|
||||||
return Container();
|
return Container();
|
||||||
}
|
}
|
||||||
|
|
||||||
return DateDivider(
|
return DateDivider(
|
||||||
dateTime: _messages[event.positionDataList.last.data].createdAt.toLocal(),
|
dateTime: _messages[event.positionDataList.last.data]
|
||||||
|
.createdAt
|
||||||
|
.toLocal(),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user