fix: ChatView safearea on iPad

This commit is contained in:
Krille Fear 2021-11-27 10:33:21 +01:00
parent 0852d31ac2
commit 00caaa719d

View File

@ -177,7 +177,8 @@ class ChatView extends StatelessWidget {
height: double.infinity, height: double.infinity,
fit: BoxFit.cover, fit: BoxFit.cover,
), ),
Column( SafeArea(
child: Column(
children: <Widget>[ children: <Widget>[
TombstoneDisplay(controller), TombstoneDisplay(controller),
Expanded( Expanded(
@ -229,15 +230,16 @@ class ChatView extends StatelessWidget {
: controller.canLoadMore : controller.canLoadMore
? Center( ? Center(
child: OutlinedButton( child: OutlinedButton(
style: OutlinedButton.styleFrom( style:
OutlinedButton.styleFrom(
backgroundColor: Theme.of( backgroundColor: Theme.of(
context) context)
.scaffoldBackgroundColor, .scaffoldBackgroundColor,
), ),
onPressed: onPressed:
controller.requestHistory, controller.requestHistory,
child: Text( child: Text(L10n.of(context)
L10n.of(context).loadMore), .loadMore),
), ),
) )
: Container() : Container()
@ -257,13 +259,14 @@ class ChatView extends StatelessWidget {
controller.scrollController, controller.scrollController,
child: Swipeable( child: Swipeable(
key: ValueKey(controller key: ValueKey(controller
.filteredEvents[i - 1].eventId), .filteredEvents[i - 1]
.eventId),
background: const Padding( background: const Padding(
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
horizontal: 12.0), horizontal: 12.0),
child: Center( child: Center(
child: child: Icon(
Icon(Icons.reply_outlined), Icons.reply_outlined),
), ),
), ),
direction: direction:
@ -271,7 +274,8 @@ class ChatView extends StatelessWidget {
onSwipe: (direction) => onSwipe: (direction) =>
controller.replyAction( controller.replyAction(
replyTo: controller replyTo: controller
.filteredEvents[i - 1]), .filteredEvents[
i - 1]),
child: Message( child: Message(
controller controller
.filteredEvents[i - 1], .filteredEvents[i - 1],
@ -291,11 +295,10 @@ class ChatView extends StatelessWidget {
), ),
), ),
unfold: controller.unfold, unfold: controller.unfold,
onSelect: onSelect: controller
controller.onSelectMessage, .onSelectMessage,
scrollToEventId: (String eventId) => scrollToEventId: (String eventId) => controller
controller.scrollToEventId( .scrollToEventId(eventId),
eventId),
longPressSelect: controller longPressSelect: controller
.selectedEvents.isEmpty, .selectedEvents.isEmpty,
selected: controller.selectedEvents.any((e) => selected: controller.selectedEvents.any((e) =>
@ -304,17 +307,19 @@ class ChatView extends StatelessWidget {
.filteredEvents[i - 1] .filteredEvents[i - 1]
.eventId), .eventId),
timeline: controller.timeline, timeline: controller.timeline,
nextEvent: nextEvent: i <
i < controller.filteredEvents.length controller
? controller .filteredEvents
.filteredEvents[i] .length
? controller.filteredEvents[i]
: null), : null),
), ),
); );
}, },
childCount: controller.filteredEvents.length + 2, childCount: controller.filteredEvents.length + 2,
findChildIndexCallback: (key) => controller findChildIndexCallback: (key) =>
.findChildIndexCallback(key, thisEventsKeyMap), controller.findChildIndexCallback(
key, thisEventsKeyMap),
), ),
); );
}, },
@ -334,7 +339,8 @@ class ChatView extends StatelessWidget {
child: Material( child: Material(
borderRadius: const BorderRadius.only( borderRadius: const BorderRadius.only(
bottomLeft: Radius.circular(AppConfig.borderRadius), bottomLeft: Radius.circular(AppConfig.borderRadius),
bottomRight: Radius.circular(AppConfig.borderRadius), bottomRight:
Radius.circular(AppConfig.borderRadius),
), ),
elevation: 6, elevation: 6,
shadowColor: Theme.of(context) shadowColor: Theme.of(context)
@ -342,7 +348,6 @@ class ChatView extends StatelessWidget {
.withAlpha(100), .withAlpha(100),
clipBehavior: Clip.hardEdge, clipBehavior: Clip.hardEdge,
color: Theme.of(context).appBarTheme.backgroundColor, color: Theme.of(context).appBarTheme.backgroundColor,
child: SafeArea(
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
@ -355,9 +360,9 @@ class ChatView extends StatelessWidget {
), ),
), ),
), ),
),
], ],
), ),
),
], ],
), ),
), ),