Merge branch 'feature/new-ui' into qa-fix-dj
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"
|
||||||
|
|||||||
@@ -224,7 +224,10 @@ class MessageActionsModal extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
'Edit message',
|
'Edit message',
|
||||||
style: Theme.of(context).textTheme.headline6.copyWith(fontWeight: FontWeight.bold),
|
style: Theme.of(context)
|
||||||
|
.textTheme
|
||||||
|
.headline6
|
||||||
|
.copyWith(fontWeight: FontWeight.bold),
|
||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import 'package:stream_chat/stream_chat.dart';
|
|||||||
import 'package:stream_chat_flutter/src/message_widget.dart';
|
import 'package:stream_chat_flutter/src/message_widget.dart';
|
||||||
import 'package:stream_chat_flutter/src/system_message.dart';
|
import 'package:stream_chat_flutter/src/system_message.dart';
|
||||||
import 'package:visibility_detector/visibility_detector.dart';
|
import 'package:visibility_detector/visibility_detector.dart';
|
||||||
|
import 'package:widgets_visibility_provider/widgets_visibility_provider.dart';
|
||||||
|
|
||||||
import '../stream_chat_flutter.dart';
|
import '../stream_chat_flutter.dart';
|
||||||
import 'date_divider.dart';
|
import 'date_divider.dart';
|
||||||
@@ -155,11 +156,17 @@ class _MessageListViewState extends State<MessageListView> {
|
|||||||
final streamChannel = StreamChannel.of(context);
|
final streamChannel = StreamChannel.of(context);
|
||||||
|
|
||||||
/// 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 Stack(
|
return WidgetsVisibilityProvider(
|
||||||
|
condition: (positionData) =>
|
||||||
|
positionData.endPosition >= 20 &&
|
||||||
|
positionData.startPosition <= positionData.viewportSize,
|
||||||
|
child: Stack(
|
||||||
|
alignment: Alignment.center,
|
||||||
children: [
|
children: [
|
||||||
NotificationListener<ScrollNotification>(
|
NotificationListener<ScrollNotification>(
|
||||||
onNotification: (_) {
|
onNotification: (_) {
|
||||||
if (_scrollController.offset < 150 && _newMessageList.isNotEmpty) {
|
if (_scrollController.offset < 150 &&
|
||||||
|
_newMessageList.isNotEmpty) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_messages.insertAll(0, _newMessageList);
|
_messages.insertAll(0, _newMessageList);
|
||||||
_newMessageList.clear();
|
_newMessageList.clear();
|
||||||
@@ -188,7 +195,8 @@ class _MessageListViewState extends State<MessageListView> {
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
buildParentMessage(widget.parentMessage),
|
buildParentMessage(widget.parentMessage),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 32),
|
padding:
|
||||||
|
const EdgeInsets.symmetric(horizontal: 32),
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: const EdgeInsets.all(8),
|
padding: const EdgeInsets.all(8),
|
||||||
child: Text(
|
child: Text(
|
||||||
@@ -257,6 +265,18 @@ class _MessageListViewState extends State<MessageListView> {
|
|||||||
messageWidget,
|
messageWidget,
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 12.0),
|
padding: const EdgeInsets.symmetric(vertical: 12.0),
|
||||||
|
child: VisibleNotifierWidget(
|
||||||
|
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())
|
||||||
@@ -264,11 +284,15 @@ class _MessageListViewState extends State<MessageListView> {
|
|||||||
dateTime: nextMessage.createdAt.toLocal(),
|
dateTime: nextMessage.createdAt.toLocal(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return messageWidget;
|
return VisibleNotifierWidget(
|
||||||
|
child: messageWidget,
|
||||||
|
data: i,
|
||||||
|
);
|
||||||
},
|
},
|
||||||
childCount: _messages.length + 2,
|
childCount: _messages.length + 2,
|
||||||
findChildIndexCallback: (key) {
|
findChildIndexCallback: (key) {
|
||||||
@@ -292,7 +316,29 @@ class _MessageListViewState extends State<MessageListView> {
|
|||||||
}
|
}
|
||||||
return _buildScrollToBottom(streamChannel);
|
return _buildScrollToBottom(streamChannel);
|
||||||
}),
|
}),
|
||||||
|
Positioned(
|
||||||
|
top: 20.0,
|
||||||
|
child: WidgetsVisibilityConsumer(
|
||||||
|
listener: (
|
||||||
|
context,
|
||||||
|
event,
|
||||||
|
) {},
|
||||||
|
builder: (context, event) {
|
||||||
|
if (event.positionDataList == null ||
|
||||||
|
event.positionDataList.isEmpty) {
|
||||||
|
return Container();
|
||||||
|
}
|
||||||
|
|
||||||
|
return DateDivider(
|
||||||
|
dateTime: _messages[event.positionDataList.last.data]
|
||||||
|
.createdAt
|
||||||
|
.toLocal(),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ dependencies:
|
|||||||
flutter_slidable: ^0.5.4
|
flutter_slidable: ^0.5.4
|
||||||
carousel_slider: ^2.2.1
|
carousel_slider: ^2.2.1
|
||||||
clipboard: ^0.1.2+8
|
clipboard: ^0.1.2+8
|
||||||
|
widgets_visibility_provider: ^2.0.2
|
||||||
|
|
||||||
flutter:
|
flutter:
|
||||||
fonts:
|
fonts:
|
||||||
|
|||||||
Reference in New Issue
Block a user