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(
child: ListView.custom(
padding: EdgeInsets.only(
top: 16,
bottom: 8,
top: 8 + (theme.appBarTheme.toolbarHeight ?? 56),
bottom: 8 + 72,
left: horizontalPadding,
right: horizontalPadding,
),

@ -176,6 +176,38 @@ class ChatInputRow extends StatelessWidget {
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(
value: AddPopupMenuActions.image,
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(
height: height,
width: 48,

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

Loading…
Cancel
Save