chore: Simplify input row buttons

pull/2997/head
Christian Kußowski 1 day ago
parent af7bc6cafa
commit 87feafd9b4
No known key found for this signature in database

@ -52,8 +52,8 @@ class ChatEventList extends StatelessWidget {
return SelectionArea( return SelectionArea(
child: ListView.custom( child: ListView.custom(
padding: EdgeInsets.only( padding: EdgeInsets.only(
top: 16, top: 8 + (theme.appBarTheme.toolbarHeight ?? 56),
bottom: 8, bottom: 8 + 72,
left: horizontalPadding, left: horizontalPadding,
right: horizontalPadding, right: horizontalPadding,
), ),

@ -176,6 +176,38 @@ class ChatInputRow extends StatelessWidget {
contentPadding: const EdgeInsets.all(0), contentPadding: const EdgeInsets.all(0),
), ),
), ),
PopupMenuDivider(),
if (PlatformInfos.isMobile) ...[
PopupMenuItem(
value: AddPopupMenuActions.videoCamera,
child: ListTile(
leading: CircleAvatar(
backgroundColor:
theme.colorScheme.onPrimaryContainer,
foregroundColor:
theme.colorScheme.primaryContainer,
child: const Icon(Icons.videocam_outlined),
),
title: Text(L10n.of(context).recordAVideo),
contentPadding: const EdgeInsets.all(0),
),
),
PopupMenuItem(
value: AddPopupMenuActions.photoCamera,
child: ListTile(
leading: CircleAvatar(
backgroundColor:
theme.colorScheme.onPrimaryContainer,
foregroundColor:
theme.colorScheme.primaryContainer,
child: const Icon(Icons.camera_alt_outlined),
),
title: Text(L10n.of(context).takeAPhoto),
contentPadding: const EdgeInsets.all(0),
),
),
PopupMenuDivider(),
],
PopupMenuItem( PopupMenuItem(
value: AddPopupMenuActions.image, value: AddPopupMenuActions.image,
child: ListTile( child: ListTile(
@ -223,52 +255,6 @@ class ChatInputRow extends StatelessWidget {
], ],
), ),
), ),
if (PlatformInfos.isMobile)
AnimatedContainer(
duration: FluffyThemes.animationDuration,
curve: FluffyThemes.animationCurve,
width: textMessageOnly ? 0 : 48,
height: height,
alignment: Alignment.center,
decoration: const BoxDecoration(),
clipBehavior: Clip.hardEdge,
child: PopupMenuButton(
useRootNavigator: true,
icon: const Icon(Icons.camera_alt_outlined),
onSelected: controller.onAddPopupMenuButtonSelected,
iconColor: theme.colorScheme.onPrimaryContainer,
itemBuilder: (context) => [
PopupMenuItem(
value: AddPopupMenuActions.videoCamera,
child: ListTile(
leading: CircleAvatar(
backgroundColor:
theme.colorScheme.onPrimaryContainer,
foregroundColor:
theme.colorScheme.primaryContainer,
child: const Icon(Icons.videocam_outlined),
),
title: Text(L10n.of(context).recordAVideo),
contentPadding: const EdgeInsets.all(0),
),
),
PopupMenuItem(
value: AddPopupMenuActions.photoCamera,
child: ListTile(
leading: CircleAvatar(
backgroundColor:
theme.colorScheme.onPrimaryContainer,
foregroundColor:
theme.colorScheme.primaryContainer,
child: const Icon(Icons.camera_alt_outlined),
),
title: Text(L10n.of(context).takeAPhoto),
contentPadding: const EdgeInsets.all(0),
),
),
],
),
),
Container( Container(
height: height, height: height,
width: 48, width: 48,

@ -90,6 +90,8 @@ class ChatView extends StatelessWidget {
} }
return Scaffold( return Scaffold(
key: Key('chat_page'), key: Key('chat_page'),
extendBodyBehindAppBar: true,
appBar: AppBar( appBar: AppBar(
actionsIconTheme: IconThemeData( actionsIconTheme: IconThemeData(
color: controller.selectedEvents.isEmpty color: controller.selectedEvents.isEmpty
@ -99,7 +101,7 @@ class ChatView extends StatelessWidget {
backgroundColor: controller.selectedEvents.isEmpty backgroundColor: controller.selectedEvents.isEmpty
? controller.activeThreadId != null ? controller.activeThreadId != null
? theme.colorScheme.secondaryContainer ? theme.colorScheme.secondaryContainer
: null : theme.colorScheme.surfaceBright.withAlpha(240)
: theme.colorScheme.tertiaryContainer, : theme.colorScheme.tertiaryContainer,
automaticallyImplyLeading: false, automaticallyImplyLeading: false,
leading: controller.selectMode leading: controller.selectMode
@ -298,7 +300,9 @@ class ChatView extends StatelessWidget {
controller.showScrollDownButton && controller.showScrollDownButton &&
controller.selectedEvents.isEmpty controller.selectedEvents.isEmpty
? Padding( ? Padding(
padding: const EdgeInsets.only(bottom: 56.0), padding: EdgeInsets.only(
bottom: theme.appBarTheme.toolbarHeight ?? 56,
),
child: FloatingActionButton( child: FloatingActionButton(
onPressed: controller.scrollDown, onPressed: controller.scrollDown,
heroTag: null, heroTag: null,
@ -335,81 +339,98 @@ class ChatView extends StatelessWidget {
), ),
), ),
SafeArea( SafeArea(
child: Column( top: false,
children: <Widget>[ child: GestureDetector(
Expanded( onTap: controller.clearSingleSelectedEvent,
child: GestureDetector( child: ChatEventList(controller: controller),
onTap: controller.clearSingleSelectedEvent, ),
child: ChatEventList(controller: controller), ),
), Positioned(
bottom: 0,
left: 0,
right: 0,
child: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
theme.colorScheme.surfaceBright.withAlpha(0),
theme.colorScheme.surfaceBright,
theme.colorScheme.surfaceBright,
],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
), ),
if (controller.showScrollDownButton) ),
Divider(height: 1, color: theme.dividerColor), alignment: Alignment.center,
if (controller.room.isExtinct) child: Container(
Container( margin: EdgeInsets.all(bottomSheetPadding),
margin: EdgeInsets.all(bottomSheetPadding), constraints: const BoxConstraints(
width: double.infinity, maxWidth: FluffyThemes.maxTimelineWidth,
child: ElevatedButton.icon( ),
icon: const Icon(Icons.chevron_right), child: controller.room.isExtinct
label: Text(L10n.of(context).enterNewChat), ? ElevatedButton.icon(
onPressed: controller.goToNewRoomAction, icon: const Icon(Icons.chevron_right),
), label: Text(L10n.of(context).enterNewChat),
) onPressed: controller.goToNewRoomAction,
else if (controller.room.canSendDefaultMessages && )
controller.room.membership == Membership.join) : controller.room.canSendDefaultMessages &&
Container( controller.room.membership ==
margin: EdgeInsets.all(bottomSheetPadding), Membership.join
constraints: const BoxConstraints( ? Material(
maxWidth: FluffyThemes.maxTimelineWidth, clipBehavior: Clip.hardEdge,
), color: controller.selectedEvents.isNotEmpty
alignment: Alignment.center, ? theme.colorScheme.tertiaryContainer
child: Material( : theme.colorScheme.surfaceContainer,
clipBehavior: Clip.hardEdge, borderRadius: BorderRadius.circular(32),
color: controller.selectedEvents.isNotEmpty child:
? theme.colorScheme.tertiaryContainer controller.room.isAbandonedDMRoom == true
: theme.colorScheme.surfaceContainerHigh, ? Row(
borderRadius: BorderRadius.circular(32), mainAxisAlignment: .spaceEvenly,
child: controller.room.isAbandonedDMRoom == true children: [
? Row( TextButton.icon(
mainAxisAlignment: .spaceEvenly, style: TextButton.styleFrom(
children: [ padding: const EdgeInsets.all(
TextButton.icon( 16,
style: TextButton.styleFrom( ),
padding: const EdgeInsets.all(16), foregroundColor:
foregroundColor: theme.colorScheme.error,
theme.colorScheme.error, ),
), icon: const Icon(
icon: const Icon( Icons.archive_outlined,
Icons.archive_outlined, ),
), onPressed: controller.leaveChat,
onPressed: controller.leaveChat, label: Text(
label: Text(L10n.of(context).leave), L10n.of(context).leave,
), ),
TextButton.icon(
style: TextButton.styleFrom(
padding: const EdgeInsets.all(16),
),
icon: const Icon(
Icons.forum_outlined,
), ),
onPressed: controller.recreateChat, TextButton.icon(
label: Text( style: TextButton.styleFrom(
L10n.of(context).reopenChat, padding: const EdgeInsets.all(
16,
),
),
icon: const Icon(
Icons.forum_outlined,
),
onPressed:
controller.recreateChat,
label: Text(
L10n.of(context).reopenChat,
),
), ),
), ],
], )
) : Column(
: Column( mainAxisSize: .min,
mainAxisSize: .min, children: [
children: [ ReplyDisplay(controller),
ReplyDisplay(controller), ChatInputRow(controller),
ChatInputRow(controller), ChatEmojiPicker(controller),
ChatEmojiPicker(controller), ],
], ),
), )
), : SizedBox.shrink(),
), ),
],
), ),
), ),
if (controller.dragging) if (controller.dragging)

Loading…
Cancel
Save