|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
|
|
import 'package:desktop_drop/desktop_drop.dart';
|
|
|
|
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
|
|
|
|
import 'package:future_loading_dialog/future_loading_dialog.dart';
|
|
|
|
|
import 'package:matrix/matrix.dart';
|
|
|
|
@ -168,7 +169,11 @@ class ChatView extends StatelessWidget {
|
|
|
|
|
)
|
|
|
|
|
: null,
|
|
|
|
|
backgroundColor: Theme.of(context).colorScheme.surface,
|
|
|
|
|
body: Stack(
|
|
|
|
|
body: DropTarget(
|
|
|
|
|
onDragDone: controller.onDragDone,
|
|
|
|
|
onDragEntered: controller.onDragEntered,
|
|
|
|
|
onDragExited: controller.onDragExited,
|
|
|
|
|
child: Stack(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
if (Matrix.of(context).wallpaper != null)
|
|
|
|
|
Image.file(
|
|
|
|
@ -221,7 +226,8 @@ class ChatView extends StatelessWidget {
|
|
|
|
|
: ScrollViewKeyboardDismissBehavior.manual,
|
|
|
|
|
childrenDelegate: SliverChildBuilderDelegate(
|
|
|
|
|
(BuildContext context, int i) {
|
|
|
|
|
return i == controller.filteredEvents.length + 1
|
|
|
|
|
return i ==
|
|
|
|
|
controller.filteredEvents.length + 1
|
|
|
|
|
? controller.timeline.isRequestingHistory
|
|
|
|
|
? const Center(
|
|
|
|
|
child: CircularProgressIndicator
|
|
|
|
@ -230,14 +236,14 @@ class ChatView extends StatelessWidget {
|
|
|
|
|
: controller.canLoadMore
|
|
|
|
|
? Center(
|
|
|
|
|
child: OutlinedButton(
|
|
|
|
|
style:
|
|
|
|
|
OutlinedButton.styleFrom(
|
|
|
|
|
style: OutlinedButton
|
|
|
|
|
.styleFrom(
|
|
|
|
|
backgroundColor: Theme.of(
|
|
|
|
|
context)
|
|
|
|
|
.scaffoldBackgroundColor,
|
|
|
|
|
),
|
|
|
|
|
onPressed:
|
|
|
|
|
controller.requestHistory,
|
|
|
|
|
onPressed: controller
|
|
|
|
|
.requestHistory,
|
|
|
|
|
child: Text(L10n.of(context)
|
|
|
|
|
.loadMore),
|
|
|
|
|
),
|
|
|
|
@ -253,7 +259,8 @@ class ChatView extends StatelessWidget {
|
|
|
|
|
)
|
|
|
|
|
: AutoScrollTag(
|
|
|
|
|
key: ValueKey(controller
|
|
|
|
|
.filteredEvents[i - 1].eventId),
|
|
|
|
|
.filteredEvents[i - 1]
|
|
|
|
|
.eventId),
|
|
|
|
|
index: i - 1,
|
|
|
|
|
controller:
|
|
|
|
|
controller.scrollController,
|
|
|
|
@ -279,15 +286,16 @@ class ChatView extends StatelessWidget {
|
|
|
|
|
child: Message(
|
|
|
|
|
controller
|
|
|
|
|
.filteredEvents[i - 1],
|
|
|
|
|
onInfoTab:
|
|
|
|
|
controller.showEventInfo,
|
|
|
|
|
onInfoTab: controller
|
|
|
|
|
.showEventInfo,
|
|
|
|
|
onAvatarTab: (Event event) =>
|
|
|
|
|
showModalBottomSheet(
|
|
|
|
|
context: context,
|
|
|
|
|
builder: (c) =>
|
|
|
|
|
UserBottomSheet(
|
|
|
|
|
user: event.sender,
|
|
|
|
|
outerContext: context,
|
|
|
|
|
outerContext:
|
|
|
|
|
context,
|
|
|
|
|
onMention: () => controller
|
|
|
|
|
.sendController
|
|
|
|
|
.text +=
|
|
|
|
@ -297,26 +305,26 @@ class ChatView extends StatelessWidget {
|
|
|
|
|
unfold: controller.unfold,
|
|
|
|
|
onSelect: controller
|
|
|
|
|
.onSelectMessage,
|
|
|
|
|
scrollToEventId: (String eventId) => controller
|
|
|
|
|
.scrollToEventId(eventId),
|
|
|
|
|
scrollToEventId:
|
|
|
|
|
(String eventId) =>
|
|
|
|
|
controller.scrollToEventId(
|
|
|
|
|
eventId),
|
|
|
|
|
longPressSelect: controller
|
|
|
|
|
.selectedEvents.isEmpty,
|
|
|
|
|
selected: controller.selectedEvents.any((e) =>
|
|
|
|
|
selected: controller
|
|
|
|
|
.selectedEvents
|
|
|
|
|
.any((e) =>
|
|
|
|
|
e.eventId ==
|
|
|
|
|
controller
|
|
|
|
|
.filteredEvents[i - 1]
|
|
|
|
|
.eventId),
|
|
|
|
|
timeline: controller.timeline,
|
|
|
|
|
nextEvent: i <
|
|
|
|
|
controller
|
|
|
|
|
.filteredEvents
|
|
|
|
|
.length
|
|
|
|
|
? controller.filteredEvents[i]
|
|
|
|
|
: null),
|
|
|
|
|
nextEvent: i < controller.filteredEvents.length ? controller.filteredEvents[i] : null),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
childCount: controller.filteredEvents.length + 2,
|
|
|
|
|
childCount:
|
|
|
|
|
controller.filteredEvents.length + 2,
|
|
|
|
|
findChildIndexCallback: (key) =>
|
|
|
|
|
controller.findChildIndexCallback(
|
|
|
|
|
key, thisEventsKeyMap),
|
|
|
|
@ -338,7 +346,8 @@ class ChatView extends StatelessWidget {
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
child: Material(
|
|
|
|
|
borderRadius: const BorderRadius.only(
|
|
|
|
|
bottomLeft: Radius.circular(AppConfig.borderRadius),
|
|
|
|
|
bottomLeft:
|
|
|
|
|
Radius.circular(AppConfig.borderRadius),
|
|
|
|
|
bottomRight:
|
|
|
|
|
Radius.circular(AppConfig.borderRadius),
|
|
|
|
|
),
|
|
|
|
@ -347,7 +356,8 @@ class ChatView extends StatelessWidget {
|
|
|
|
|
.secondaryHeaderColor
|
|
|
|
|
.withAlpha(100),
|
|
|
|
|
clipBehavior: Clip.hardEdge,
|
|
|
|
|
color: Theme.of(context).appBarTheme.backgroundColor,
|
|
|
|
|
color:
|
|
|
|
|
Theme.of(context).appBarTheme.backgroundColor,
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
children: [
|
|
|
|
@ -363,10 +373,22 @@ class ChatView extends StatelessWidget {
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
if (controller.dragging)
|
|
|
|
|
Container(
|
|
|
|
|
color: Theme.of(context)
|
|
|
|
|
.scaffoldBackgroundColor
|
|
|
|
|
.withOpacity(0.9),
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
child: const Icon(
|
|
|
|
|
Icons.upload_outlined,
|
|
|
|
|
size: 100,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|