diff --git a/lib/config/setting_keys.dart b/lib/config/setting_keys.dart index b7269f64d..7011e8645 100644 --- a/lib/config/setting_keys.dart +++ b/lib/config/setting_keys.dart @@ -37,7 +37,7 @@ enum AppSettings { sendPublicReadReceipts('chat.fluffy.send_public_read_receipts', true), swipeRightToLeftToReply('chat.fluffy.swipeRightToLeftToReply', true), sendOnEnter('chat.fluffy.send_on_enter', false), - showPresences('chat.fluffy.show_presences', false), + showPresences('chat.fluffy.show_presences', true), displayNavigationRail('chat.fluffy.display_navigation_rail', false), experimentalVoip('chat.fluffy.experimental_voip', false), shareKeysWith('chat.fluffy.share_keys_with_2', 'all'), diff --git a/lib/pages/chat/chat_input_row.dart b/lib/pages/chat/chat_input_row.dart index 57eb5f27b..2ec8402f2 100644 --- a/lib/pages/chat/chat_input_row.dart +++ b/lib/pages/chat/chat_input_row.dart @@ -19,13 +19,17 @@ import 'input_bar.dart'; class ChatInputRow extends StatelessWidget { final ChatController controller; + static const double height = 56.0; + const ChatInputRow(this.controller, {super.key}); @override Widget build(BuildContext context) { final theme = Theme.of(context); - - const height = 48.0; + final textMessageOnly = + controller.sendController.text.isNotEmpty || + controller.replyEvent != null || + controller.editEvent != null; if (!controller.room.otherPartyCanReceiveMessages) { return Center( @@ -128,9 +132,7 @@ class ChatInputRow extends StatelessWidget { AnimatedContainer( duration: FluffyThemes.animationDuration, curve: FluffyThemes.animationCurve, - width: controller.sendController.text.isNotEmpty - ? 0 - : height, + width: textMessageOnly ? 0 : 48, height: height, alignment: Alignment.center, decoration: const BoxDecoration(), @@ -221,9 +223,7 @@ class ChatInputRow extends StatelessWidget { AnimatedContainer( duration: FluffyThemes.animationDuration, curve: FluffyThemes.animationCurve, - width: controller.sendController.text.isNotEmpty - ? 0 - : height, + width: textMessageOnly ? 0 : 48, height: height, alignment: Alignment.center, decoration: const BoxDecoration(), @@ -267,7 +267,7 @@ class ChatInputRow extends StatelessWidget { ), Container( height: height, - width: height, + width: 48, alignment: Alignment.center, child: IconButton( tooltip: L10n.of(context).emojis, @@ -302,13 +302,13 @@ class ChatInputRow extends StatelessWidget { Matrix.of(context).currentBundle!.length > 1) Container( height: height, - width: height, + width: 48, alignment: Alignment.center, child: _ChatAccountPicker(controller), ), Expanded( child: Padding( - padding: const EdgeInsets.symmetric(vertical: 0.0), + padding: const EdgeInsets.symmetric(vertical: 2.0), child: InputBar( room: controller.room, minLines: 1, @@ -358,9 +358,7 @@ class ChatInputRow extends StatelessWidget { height: height, width: height, alignment: Alignment.center, - child: - PlatformInfos.platformCanRecord && - controller.sendController.text.isEmpty + child: PlatformInfos.platformCanRecord && !textMessageOnly ? IconButton( tooltip: L10n.of(context).voiceMessage, onPressed: () => diff --git a/lib/pages/chat/recording_input_row.dart b/lib/pages/chat/recording_input_row.dart index 2a88a7845..b7edf3fe8 100644 --- a/lib/pages/chat/recording_input_row.dart +++ b/lib/pages/chat/recording_input_row.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:fluffychat/config/themes.dart'; import 'package:fluffychat/l10n/l10n.dart'; +import 'package:fluffychat/pages/chat/chat_input_row.dart'; import 'package:fluffychat/pages/chat/recording_view_model.dart'; class RecordingInputRow extends StatelessWidget { @@ -19,71 +20,81 @@ class RecordingInputRow extends StatelessWidget { const maxDecibalWidth = 36.0; final time = '${state.duration.inMinutes.toString().padLeft(2, '0')}:${(state.duration.inSeconds % 60).toString().padLeft(2, '0')}'; - return Row( - children: [ - IconButton( - tooltip: L10n.of(context).cancel, - icon: const Icon(Icons.delete_outlined), - color: theme.colorScheme.error, - onPressed: state.cancel, - ), - if (state.isPaused) - IconButton( - tooltip: L10n.of(context).resume, - icon: const Icon(Icons.play_circle_outline_outlined), - onPressed: state.resume, - ) - else - IconButton( - tooltip: L10n.of(context).pause, - icon: const Icon(Icons.pause_circle_outline_outlined), - onPressed: state.pause, - ), - Text(time), - const SizedBox(width: 8), - Expanded( - child: LayoutBuilder( - builder: (context, constraints) { - const width = 4; - return Row( - mainAxisSize: .min, - mainAxisAlignment: .end, - children: state.amplitudeTimeline.reversed - .take((constraints.maxWidth / (width + 2)).floor()) - .toList() - .reversed - .map( - (amplitude) => Container( - margin: const EdgeInsets.only(left: 2), - width: width.toDouble(), - decoration: BoxDecoration( - color: theme.colorScheme.primary, - borderRadius: BorderRadius.circular(2), - ), - height: maxDecibalWidth * (amplitude / 100), - ), + return SizedBox( + height: ChatInputRow.height, + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 8.0), + child: Row( + crossAxisAlignment: .center, + mainAxisAlignment: .spaceBetween, + spacing: 8, + children: [ + IconButton( + tooltip: L10n.of(context).cancel, + icon: const Icon(Icons.delete_outlined), + color: theme.colorScheme.error, + onPressed: state.cancel, + ), + if (state.isPaused) + IconButton( + tooltip: L10n.of(context).resume, + icon: const Icon(Icons.play_circle_outline_outlined), + onPressed: state.resume, + ) + else + IconButton( + tooltip: L10n.of(context).pause, + icon: const Icon(Icons.pause_circle_outline_outlined), + onPressed: state.pause, + ), + Text(time), + Expanded( + child: LayoutBuilder( + builder: (context, constraints) { + const width = 4; + return Row( + mainAxisSize: .min, + mainAxisAlignment: .end, + children: state.amplitudeTimeline.reversed + .take((constraints.maxWidth / (width + 2)).floor()) + .toList() + .reversed + .map( + (amplitude) => Container( + margin: const EdgeInsets.only(left: 2), + width: width.toDouble(), + decoration: BoxDecoration( + color: theme.colorScheme.primary, + borderRadius: BorderRadius.circular(2), + ), + height: maxDecibalWidth * (amplitude / 100), + ), + ) + .toList(), + ); + }, + ), + ), + IconButton( + style: IconButton.styleFrom( + disabledBackgroundColor: theme.bubbleColor.withAlpha(128), + backgroundColor: theme.bubbleColor, + foregroundColor: theme.onBubbleColor, + ), + tooltip: L10n.of(context).sendAudio, + icon: state.isSending + ? const SizedBox.square( + dimension: 24, + child: CircularProgressIndicator.adaptive(), ) - .toList(), - ); - }, - ), + : const Icon(Icons.send_outlined), + onPressed: state.isSending + ? null + : () => state.stopAndSend(onSend), + ), + ], ), - IconButton( - style: IconButton.styleFrom( - disabledBackgroundColor: theme.bubbleColor.withAlpha(128), - backgroundColor: theme.bubbleColor, - foregroundColor: theme.onBubbleColor, - ), - tooltip: L10n.of(context).sendAudio, - icon: state.isSending - ? const SizedBox.square( - dimension: 24, - child: CircularProgressIndicator.adaptive(), - ) - : const Icon(Icons.send_outlined), - onPressed: state.isSending ? null : () => state.stopAndSend(onSend), - ), - ], + ), ); } } diff --git a/lib/pages/chat_list/chat_list_view.dart b/lib/pages/chat_list/chat_list_view.dart index 36a4f67b8..56b04a1b3 100644 --- a/lib/pages/chat_list/chat_list_view.dart +++ b/lib/pages/chat_list/chat_list_view.dart @@ -49,13 +49,14 @@ class ChatListView extends StatelessWidget { body: ChatListViewBody(controller), floatingActionButton: !controller.isSearchMode && controller.activeSpaceId == null - ? FloatingActionButton.extended( + ? FloatingActionButton( + backgroundColor: Theme.of(context).colorScheme.primary, + foregroundColor: Theme.of( + context, + ).colorScheme.onPrimary, onPressed: () => context.go('/rooms/newprivatechat'), - icon: const Icon(Icons.add_outlined), - label: Text( - L10n.of(context).chat, - overflow: TextOverflow.fade, - ), + tooltip: L10n.of(context).newChat, + child: const Icon(Icons.edit_square), ) : const SizedBox.shrink(), ), diff --git a/pubspec.lock b/pubspec.lock index 8ed6d094e..0322ee740 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -157,10 +157,10 @@ packages: dependency: transitive description: name: characters - sha256: faf38497bda5ead2a8c7615f4f7939df04333478bf32e4173fcb06d428b5716b + sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 url: "https://pub.dev" source: hosted - version: "1.4.1" + version: "1.4.0" charcode: dependency: transitive description: @@ -1072,18 +1072,18 @@ packages: dependency: transitive description: name: matcher - sha256: "12956d0ad8390bbcc63ca2e1469c0619946ccb52809807067a7020d57e647aa6" + sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 url: "https://pub.dev" source: hosted - version: "0.12.18" + version: "0.12.17" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: "9c337007e82b1889149c82ed242ed1cb24a66044e30979c44912381e9be4c48b" + sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec url: "https://pub.dev" source: hosted - version: "0.13.0" + version: "0.11.1" matrix: dependency: "direct main" description: @@ -1813,26 +1813,26 @@ packages: dependency: transitive description: name: test - sha256: "77cc98ea27006c84e71a7356cf3daf9ddbde2d91d84f77dbfe64cf0e4d9611ae" + sha256: "75906bf273541b676716d1ca7627a17e4c4070a3a16272b7a3dc7da3b9f3f6b7" url: "https://pub.dev" source: hosted - version: "1.28.0" + version: "1.26.3" test_api: dependency: transitive description: name: test_api - sha256: "19a78f63e83d3a61f00826d09bc2f60e191bf3504183c001262be6ac75589fb8" + sha256: ab2726c1a94d3176a45960b6234466ec367179b87dd74f1611adb1f3b5fb9d55 url: "https://pub.dev" source: hosted - version: "0.7.8" + version: "0.7.7" test_core: dependency: transitive description: name: test_core - sha256: f1072617a6657e5fc09662e721307f7fb009b4ed89b19f47175d11d5254a62d4 + sha256: "0cc24b5ff94b38d2ae73e1eb43cc302b77964fbf67abad1e296025b78deb53d0" url: "https://pub.dev" source: hosted - version: "0.6.14" + version: "0.6.12" timezone: dependency: transitive description: