diff --git a/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md new file mode 100644 index 000000000..c92536427 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE/pull_request_template.md @@ -0,0 +1,21 @@ +*Thank you so much for your contribution to FluffyChat ❤️❤️❤️* + +Please make sure that your Pull Request meet the following **acceptance criteria**: + +- [ ] Code formatting and import sorting has been done with `dart format lib/ test/` and `dart run import_sorter:main --no-comments` +- [ ] The commit message uses the format of [Conventional Commits](https://www.conventionalcommits.org) +- [ ] The commit message describes what has been changed, why it has been changed and how it has been changed +- [ ] Every new feature or change of the design/GUI is linked to an approved design proposal in an issue +- [ ] Every new feature in the app or the build system has a strategy how this will be tested and maintained from now on for every release, e.g. a volunteer who takes over maintainership + + +### Pull Request has been tested on: + +- [ ] Android +- [ ] iOS +- [ ] Browser (Chromium based) +- [ ] Browser (Firefox based) +- [ ] Browser (WebKit based) +- [ ] Desktop Linux +- [ ] Desktop Windows +- [ ] Desktop macOS \ No newline at end of file diff --git a/.github/workflows/integrate.yaml b/.github/workflows/integrate.yaml index 784736a4d..d487d6b4b 100644 --- a/.github/workflows/integrate.yaml +++ b/.github/workflows/integrate.yaml @@ -15,6 +15,7 @@ jobs: flutter-version: ${{ env.FLUTTER_VERSION }} cache: true - run: flutter pub get + - run: flutter gen-l10n - name: Check formatting run: dart format lib/ test/ --set-exit-if-changed - name: Check import formatting diff --git a/.github/workflows/versions.env b/.github/workflows/versions.env index 7656c5f67..12f38094d 100644 --- a/.github/workflows/versions.env +++ b/.github/workflows/versions.env @@ -1,2 +1,2 @@ -FLUTTER_VERSION=3.19.6 +FLUTTER_VERSION=3.22.1 JAVA_VERSION=17 diff --git a/lib/config/themes.dart b/lib/config/themes.dart index c359a105a..90dfefe68 100644 --- a/lib/config/themes.dart +++ b/lib/config/themes.dart @@ -90,7 +90,7 @@ abstract class FluffyThemes { ), ), textSelectionTheme: TextSelectionThemeData( - selectionColor: colorScheme.onBackground.withAlpha(128), + selectionColor: colorScheme.onSurface.withAlpha(128), selectionHandleColor: colorScheme.secondary, ), inputDecorationTheme: InputDecorationTheme( @@ -107,13 +107,15 @@ abstract class FluffyThemes { ? Colors.grey.withAlpha(64) : null, surfaceTintColor: - FluffyThemes.isColumnMode(context) ? colorScheme.background : null, + FluffyThemes.isColumnMode(context) ? colorScheme.surface : null, + backgroundColor: + FluffyThemes.isColumnMode(context) ? colorScheme.surface : null, systemOverlayStyle: SystemUiOverlayStyle( statusBarColor: Colors.transparent, statusBarIconBrightness: brightness.reversed, statusBarBrightness: brightness, systemNavigationBarIconBrightness: brightness.reversed, - systemNavigationBarColor: colorScheme.background, + systemNavigationBarColor: colorScheme.surface, ), ), textButtonTheme: TextButtonThemeData( diff --git a/lib/pages/chat/chat_emoji_picker.dart b/lib/pages/chat/chat_emoji_picker.dart index 516084d99..3f424ab37 100644 --- a/lib/pages/chat/chat_emoji_picker.dart +++ b/lib/pages/chat/chat_emoji_picker.dart @@ -58,11 +58,11 @@ class ChatEmojiPicker extends StatelessWidget { ), skinToneConfig: SkinToneConfig( dialogBackgroundColor: Color.lerp( - theme.colorScheme.background, + theme.colorScheme.surface, theme.colorScheme.primaryContainer, 0.75, )!, - indicatorColor: theme.colorScheme.onBackground, + indicatorColor: theme.colorScheme.onSurface, ), ), ), diff --git a/lib/pages/chat/chat_view.dart b/lib/pages/chat/chat_view.dart index e09997fda..5ee52c46b 100644 --- a/lib/pages/chat/chat_view.dart +++ b/lib/pages/chat/chat_view.dart @@ -128,7 +128,6 @@ class ChatView extends StatelessWidget { ), ]; } - // else if (!controller.room.isArchived) { // return [ // if (Matrix.of(context).voipPlugin != null && @@ -213,7 +212,7 @@ class ChatView extends StatelessWidget { // #Pangea && !r.isAnalyticsRoom, - // Pangea#, + // Pangea# badgePosition: BadgePosition.topEnd(end: 8, top: 4), child: const Center(child: BackButton()), ), @@ -365,6 +364,7 @@ class ChatView extends StatelessWidget { clipBehavior: Clip.hardEdge, color: Theme.of(context) .colorScheme + // ignore: deprecated_member_use .surfaceVariant, borderRadius: const BorderRadius.all( Radius.circular(24), @@ -457,8 +457,8 @@ class ChatView extends StatelessWidget { // #Pangea // if (controller.dragging) // Container( - // color: Theme.of(context) - // .scaffoldBackgroundColor + // color: Theme.of(context) + // .scaffoldBackgroundColor // .withOpacity(0.9), // alignment: Alignment.center, // child: const Icon( @@ -512,4 +512,4 @@ class ConditionalScroll extends StatelessWidget { return child; } } -// #Pangea +// Pangea# diff --git a/lib/pages/chat/events/message.dart b/lib/pages/chat/events/message.dart index dc129a192..15ae96ee9 100644 --- a/lib/pages/chat/events/message.dart +++ b/lib/pages/chat/events/message.dart @@ -107,8 +107,7 @@ class Message extends StatelessWidget { final client = Matrix.of(context).client; final ownMessage = event.senderId == client.userID; final alignment = ownMessage ? Alignment.topRight : Alignment.topLeft; - // ignore: deprecated_member_use - var color = Theme.of(context).colorScheme.surfaceVariant; + var color = Theme.of(context).colorScheme.surfaceContainerHighest; final displayTime = event.type == EventTypes.RoomCreate || nextEvent == null || !event.originServerTs.sameEnvironment(nextEvent!.originServerTs); diff --git a/lib/pages/chat/events/message_reactions.dart b/lib/pages/chat/events/message_reactions.dart index c786af59f..56286cae0 100644 --- a/lib/pages/chat/events/message_reactions.dart +++ b/lib/pages/chat/events/message_reactions.dart @@ -111,7 +111,7 @@ class _Reaction extends StatelessWidget { final textColor = Theme.of(context).brightness == Brightness.dark ? Colors.white : Colors.black; - final color = Theme.of(context).colorScheme.background; + final color = Theme.of(context).colorScheme.surface; Widget content; if (reactionKey.startsWith('mxc://')) { content = Row( diff --git a/lib/pages/chat/events/reply_content.dart b/lib/pages/chat/events/reply_content.dart index c4813f585..945ae22ac 100644 --- a/lib/pages/chat/events/reply_content.dart +++ b/lib/pages/chat/events/reply_content.dart @@ -39,7 +39,7 @@ class ReplyContent extends StatelessWidget { color: backgroundColor ?? Theme.of(context) .colorScheme - .background + .surface .withOpacity(ownMessage ? 0.2 : 0.33), borderRadius: borderRadius, child: Row( @@ -82,7 +82,7 @@ class ReplyContent extends StatelessWidget { style: TextStyle( color: ownMessage ? Theme.of(context).colorScheme.onPrimary - : Theme.of(context).colorScheme.onBackground, + : Theme.of(context).colorScheme.onSurface, fontSize: fontSize, ), ), diff --git a/lib/pages/chat/events/state_message.dart b/lib/pages/chat/events/state_message.dart index 79ab9a617..0aa5d9dc2 100644 --- a/lib/pages/chat/events/state_message.dart +++ b/lib/pages/chat/events/state_message.dart @@ -18,7 +18,7 @@ class StateMessage extends StatelessWidget { child: Container( padding: const EdgeInsets.all(8), decoration: BoxDecoration( - color: Theme.of(context).colorScheme.background, + color: Theme.of(context).colorScheme.surface, borderRadius: BorderRadius.circular(AppConfig.borderRadius / 2), ), child: Text( diff --git a/lib/pages/chat/events/verification_request_content.dart b/lib/pages/chat/events/verification_request_content.dart index 5a0c75f4b..b6ec3fd09 100644 --- a/lib/pages/chat/events/verification_request_content.dart +++ b/lib/pages/chat/events/verification_request_content.dart @@ -39,7 +39,7 @@ class VerificationRequestContent extends StatelessWidget { color: Theme.of(context).dividerColor, ), borderRadius: BorderRadius.circular(AppConfig.borderRadius), - color: Theme.of(context).colorScheme.background, + color: Theme.of(context).colorScheme.surface, ), child: Row( mainAxisSize: MainAxisSize.min, diff --git a/lib/pages/chat/events/video_player.dart b/lib/pages/chat/events/video_player.dart index 2cdbbc84c..1b0983bd4 100644 --- a/lib/pages/chat/events/video_player.dart +++ b/lib/pages/chat/events/video_player.dart @@ -123,8 +123,7 @@ class EventVideoPlayerState extends State { Center( child: IconButton( style: IconButton.styleFrom( - backgroundColor: - Theme.of(context).colorScheme.background, + backgroundColor: Theme.of(context).colorScheme.surface, ), icon: _isDownloading ? const SizedBox( diff --git a/lib/pages/chat/seen_by_row.dart b/lib/pages/chat/seen_by_row.dart index faac0db4d..af8b82069 100644 --- a/lib/pages/chat/seen_by_row.dart +++ b/lib/pages/chat/seen_by_row.dart @@ -1,10 +1,9 @@ -import 'package:flutter/material.dart'; - import 'package:fluffychat/config/themes.dart'; import 'package:fluffychat/pages/chat/chat.dart'; import 'package:fluffychat/utils/room_status_extension.dart'; import 'package:fluffychat/widgets/avatar.dart'; import 'package:fluffychat/widgets/matrix.dart'; +import 'package:flutter/material.dart'; class SeenByRow extends StatelessWidget { final ChatController controller; @@ -42,7 +41,6 @@ class SeenByRow extends StatelessWidget { mxContent: user.avatarUrl, name: user.calcDisplayname(), size: 16, - fontSize: 9, ), ), if (seenByUsers.length > maxAvatars) @@ -50,7 +48,7 @@ class SeenByRow extends StatelessWidget { width: 16, height: 16, child: Material( - color: Theme.of(context).colorScheme.background, + color: Theme.of(context).colorScheme.surface, borderRadius: BorderRadius.circular(32), child: Center( child: Text( diff --git a/lib/pages/chat/typing_indicators.dart b/lib/pages/chat/typing_indicators.dart index e816f465d..0eb2c0803 100644 --- a/lib/pages/chat/typing_indicators.dart +++ b/lib/pages/chat/typing_indicators.dart @@ -14,80 +14,91 @@ class TypingIndicators extends StatelessWidget { @override Widget build(BuildContext context) { - final typingUsers = controller.room.typingUsers - ..removeWhere((u) => u.stateKey == Matrix.of(context).client.userID); - const topPadding = 20.0; - const bottomPadding = 4.0; - - return Container( - width: double.infinity, - alignment: Alignment.center, - child: AnimatedContainer( - constraints: - const BoxConstraints(maxWidth: FluffyThemes.columnWidth * 2.5), - height: typingUsers.isEmpty ? 0 : Avatar.defaultSize + bottomPadding, - duration: FluffyThemes.animationDuration, - curve: FluffyThemes.animationCurve, - alignment: controller.timeline!.events.isNotEmpty && - controller.timeline!.events.first.senderId == - Matrix.of(context).client.userID - ? Alignment.topRight - : Alignment.topLeft, - clipBehavior: Clip.hardEdge, - decoration: const BoxDecoration(), - padding: const EdgeInsets.only( - left: 8.0, - bottom: bottomPadding, - ), - child: Row( - children: [ - SizedBox( - height: Avatar.defaultSize, - width: typingUsers.length < 2 - ? Avatar.defaultSize - : Avatar.defaultSize + 16, - child: Stack( - children: [ - if (typingUsers.isNotEmpty) - Avatar( - mxContent: typingUsers.first.avatarUrl, - name: typingUsers.first.calcDisplayname(), - ), - if (typingUsers.length == 2) - Padding( - padding: const EdgeInsets.only(left: 16), - child: Avatar( - mxContent: typingUsers.length == 2 - ? typingUsers.last.avatarUrl - : null, - name: typingUsers.length == 2 - ? typingUsers.last.calcDisplayname() - : '+${typingUsers.length - 1}', - ), - ), - ], - ), - ), - const SizedBox(width: 8), - Padding( - padding: const EdgeInsets.only(top: topPadding), - child: Material( - color: Theme.of(context).colorScheme.surfaceVariant, - borderRadius: const BorderRadius.only( - topLeft: Radius.circular(2), - topRight: Radius.circular(AppConfig.borderRadius), - bottomLeft: Radius.circular(AppConfig.borderRadius), - bottomRight: Radius.circular(AppConfig.borderRadius), - ), - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 8), - child: typingUsers.isEmpty ? null : const _TypingDots(), - ), - ), - ), - ], - ), + return StreamBuilder( + stream: controller.room.client.onSync.stream.where( + (syncUpdate) => + syncUpdate.rooms?.join?[controller.room.id]?.ephemeral + ?.any((ephemeral) => ephemeral.type == 'm.typing') ?? + false, ), + builder: (context, _) { + final typingUsers = controller.room.typingUsers + ..removeWhere((u) => u.stateKey == Matrix.of(context).client.userID); + const topPadding = 20.0; + const bottomPadding = 4.0; + return Container( + width: double.infinity, + alignment: Alignment.center, + child: AnimatedContainer( + constraints: + const BoxConstraints(maxWidth: FluffyThemes.columnWidth * 2.5), + height: + typingUsers.isEmpty ? 0 : Avatar.defaultSize + bottomPadding, + duration: FluffyThemes.animationDuration, + curve: FluffyThemes.animationCurve, + alignment: controller.timeline!.events.isNotEmpty && + controller.timeline!.events.first.senderId == + Matrix.of(context).client.userID + ? Alignment.topRight + : Alignment.topLeft, + clipBehavior: Clip.hardEdge, + decoration: const BoxDecoration(), + padding: const EdgeInsets.only( + left: 8.0, + bottom: bottomPadding, + ), + child: Row( + children: [ + SizedBox( + height: Avatar.defaultSize, + width: typingUsers.length < 2 + ? Avatar.defaultSize + : Avatar.defaultSize + 16, + child: Stack( + children: [ + if (typingUsers.isNotEmpty) + Avatar( + mxContent: typingUsers.first.avatarUrl, + name: typingUsers.first.calcDisplayname(), + ), + if (typingUsers.length == 2) + Padding( + padding: const EdgeInsets.only(left: 16), + child: Avatar( + mxContent: typingUsers.length == 2 + ? typingUsers.last.avatarUrl + : null, + name: typingUsers.length == 2 + ? typingUsers.last.calcDisplayname() + : '+${typingUsers.length - 1}', + ), + ), + ], + ), + ), + const SizedBox(width: 8), + Padding( + padding: const EdgeInsets.only(top: topPadding), + child: Material( + color: + Theme.of(context).colorScheme.surfaceContainerHighest, + borderRadius: const BorderRadius.only( + topLeft: Radius.circular(2), + topRight: Radius.circular(AppConfig.borderRadius), + bottomLeft: Radius.circular(AppConfig.borderRadius), + bottomRight: Radius.circular(AppConfig.borderRadius), + ), + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 8), + child: typingUsers.isEmpty ? null : const _TypingDots(), + ), + ), + ), + ], + ), + ), + ); + }, ); } } diff --git a/lib/pages/chat_list/chat_list_view.dart b/lib/pages/chat_list/chat_list_view.dart index fa2841464..74eef375c 100644 --- a/lib/pages/chat_list/chat_list_view.dart +++ b/lib/pages/chat_list/chat_list_view.dart @@ -195,7 +195,6 @@ class ChatListView extends StatelessWidget { MatrixLocals(L10n.of(context)!), ), size: 32, - fontSize: 12, // #Pangea littleIcon: room?.roomTypeIcon, // Pangea# @@ -225,6 +224,8 @@ class ChatListView extends StatelessWidget { NavigationDestinationLabelBehavior.alwaysShow, shadowColor: Theme.of(context).colorScheme.onSurface, + backgroundColor: + Theme.of(context).colorScheme.surface, surfaceTintColor: Theme.of(context).colorScheme.surface, selectedIndex: controller.selectedIndex, diff --git a/lib/pages/chat_list/navi_rail_item.dart b/lib/pages/chat_list/navi_rail_item.dart index 2004f3568..d09659f88 100644 --- a/lib/pages/chat_list/navi_rail_item.dart +++ b/lib/pages/chat_list/navi_rail_item.dart @@ -67,7 +67,7 @@ class _NaviRailItemState extends State { borderRadius: borderRadius, color: widget.isSelected ? Theme.of(context).colorScheme.primaryContainer - : Theme.of(context).colorScheme.background, + : Theme.of(context).colorScheme.surface, child: Tooltip( message: widget.toolTip, child: InkWell( diff --git a/lib/pages/chat_list/space_view.dart b/lib/pages/chat_list/space_view.dart index 355b3f796..66c07b135 100644 --- a/lib/pages/chat_list/space_view.dart +++ b/lib/pages/chat_list/space_view.dart @@ -824,7 +824,6 @@ class _SpaceViewState extends State { size: 24, mxContent: spaceChild.avatarUrl, name: spaceChild.name, - fontSize: 9, ), ), color: Theme.of(context) diff --git a/lib/pages/chat_list/status_msg_list.dart b/lib/pages/chat_list/status_msg_list.dart index db347292f..9b69e2a16 100644 --- a/lib/pages/chat_list/status_msg_list.dart +++ b/lib/pages/chat_list/status_msg_list.dart @@ -125,7 +125,7 @@ class PresenceAvatar extends StatelessWidget { final statusMsgBubbleElevation = Theme.of(context).appBarTheme.scrolledUnderElevation ?? 4; final statusMsgBubbleShadowColor = - Theme.of(context).colorScheme.onBackground; + Theme.of(context).colorScheme.onSurface; final statusMsgBubbleColor = Colors.white.withAlpha(245); return Padding( padding: const EdgeInsets.symmetric(horizontal: 8.0), diff --git a/lib/pages/homeserver_picker/homeserver_app_bar.dart b/lib/pages/homeserver_picker/homeserver_app_bar.dart index 060235beb..f122a1b14 100644 --- a/lib/pages/homeserver_picker/homeserver_app_bar.dart +++ b/lib/pages/homeserver_picker/homeserver_app_bar.dart @@ -91,8 +91,8 @@ class HomeserverAppBar extends StatelessWidget { ) : null, fillColor: FluffyThemes.isColumnMode(context) - ? Theme.of(context).colorScheme.background - : Theme.of(context).colorScheme.surfaceVariant, + ? Theme.of(context).colorScheme.surface + : Theme.of(context).colorScheme.surfaceContainerHighest, prefixText: '${L10n.of(context)!.homeserver}: ', hintText: L10n.of(context)!.enterYourHomeserver, suffixIcon: const Icon(Icons.search), diff --git a/lib/pages/login/login_view.dart b/lib/pages/login/login_view.dart index 65a297c66..a50567eea 100644 --- a/lib/pages/login/login_view.dart +++ b/lib/pages/login/login_view.dart @@ -39,14 +39,11 @@ class LoginView extends StatelessWidget { child: ElevatedButton( onPressed: () => Navigator.of(context).pop(), style: ButtonStyle( - padding: MaterialStateProperty.all(EdgeInsets.zero), - backgroundColor: MaterialStateProperty.all( - Theme.of(context) - .colorScheme - .background - .withOpacity(0.75), + padding: WidgetStateProperty.all(EdgeInsets.zero), + backgroundColor: WidgetStateProperty.all( + Theme.of(context).colorScheme.surface.withOpacity(0.75), ), - shape: MaterialStateProperty.all( + shape: WidgetStateProperty.all( const CircleBorder(), ), ), @@ -112,7 +109,7 @@ class LoginView extends StatelessWidget { // fillColor: textFieldFillColor, fillColor: Theme.of(context) .colorScheme - .background + .surface .withOpacity(0.75), // Pangea# ), @@ -168,7 +165,7 @@ class LoginView extends StatelessWidget { // #Pangea fillColor: Theme.of(context) .colorScheme - .background + .surface .withOpacity(0.75), // Pangea# ), diff --git a/lib/pages/new_group/new_group_view.dart b/lib/pages/new_group/new_group_view.dart index ddf55dfbd..277a7402f 100644 --- a/lib/pages/new_group/new_group_view.dart +++ b/lib/pages/new_group/new_group_view.dart @@ -125,12 +125,12 @@ class NewGroupView extends StatelessWidget { // SwitchListTile.adaptive( // secondary: Icon( // Icons.lock_outlined, - // color: Theme.of(context).colorScheme.onBackground, + // color: Theme.of(context).colorScheme.onSurface, // ), // title: Text( // L10n.of(context)!.enableEncryption, // style: TextStyle( - // color: Theme.of(context).colorScheme.onBackground, + // color: Theme.of(context).colorScheme.onSurface, // ), // ), // value: !controller.publicGroup, diff --git a/lib/pages/settings/settings_view.dart b/lib/pages/settings/settings_view.dart index 094f3797d..c4a57a267 100644 --- a/lib/pages/settings/settings_view.dart +++ b/lib/pages/settings/settings_view.dart @@ -76,7 +76,6 @@ class SettingsView extends StatelessWidget { mxContent: profile?.avatarUrl, name: displayname, size: Avatar.defaultSize * 2.5, - fontSize: 18 * 2.5, ), ), if (profile != null) diff --git a/lib/pages/settings_password/settings_password_view.dart b/lib/pages/settings_password/settings_password_view.dart index dd81fa122..813bebd18 100644 --- a/lib/pages/settings_password/settings_password_view.dart +++ b/lib/pages/settings_password/settings_password_view.dart @@ -23,7 +23,7 @@ class SettingsPasswordView extends StatelessWidget { ], ), body: ListTileTheme( - iconColor: Theme.of(context).colorScheme.onBackground, + iconColor: Theme.of(context).colorScheme.onSurface, child: MaxWidthBody( child: Padding( padding: const EdgeInsets.all(16.0), diff --git a/lib/pages/settings_security/settings_security_view.dart b/lib/pages/settings_security/settings_security_view.dart index 8af35a7ad..58746bd9e 100644 --- a/lib/pages/settings_security/settings_security_view.dart +++ b/lib/pages/settings_security/settings_security_view.dart @@ -20,7 +20,7 @@ class SettingsSecurityView extends StatelessWidget { return Scaffold( appBar: AppBar(title: Text(L10n.of(context)!.security)), body: ListTileTheme( - iconColor: Theme.of(context).colorScheme.onBackground, + iconColor: Theme.of(context).colorScheme.onSurface, child: MaxWidthBody( child: FutureBuilder( future: Matrix.of(context) diff --git a/lib/pages/settings_style/settings_style_view.dart b/lib/pages/settings_style/settings_style_view.dart index cf7348021..0286ff700 100644 --- a/lib/pages/settings_style/settings_style_view.dart +++ b/lib/pages/settings_style/settings_style_view.dart @@ -90,7 +90,7 @@ class SettingsStyleView extends StatelessWidget { size: 16, color: Theme.of(context) .colorScheme - .onBackground, + .onSurface, ), ), Text( @@ -99,7 +99,7 @@ class SettingsStyleView extends StatelessWidget { style: TextStyle( color: Theme.of(context) .colorScheme - .onBackground, + .onSurface, ), ), ], diff --git a/lib/pages/user_bottom_sheet/user_bottom_sheet_view.dart b/lib/pages/user_bottom_sheet/user_bottom_sheet_view.dart index eb3ce54d3..982a3e26b 100644 --- a/lib/pages/user_bottom_sheet/user_bottom_sheet_view.dart +++ b/lib/pages/user_bottom_sheet/user_bottom_sheet_view.dart @@ -1,15 +1,14 @@ -import 'package:flutter/material.dart'; - -import 'package:flutter_gen/gen_l10n/l10n.dart'; -import 'package:flutter_linkify/flutter_linkify.dart'; -import 'package:matrix/matrix.dart'; - import 'package:fluffychat/config/app_config.dart'; import 'package:fluffychat/utils/date_time_extension.dart'; import 'package:fluffychat/utils/fluffy_share.dart'; import 'package:fluffychat/utils/url_launcher.dart'; import 'package:fluffychat/widgets/avatar.dart'; import 'package:fluffychat/widgets/presence_builder.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_gen/gen_l10n/l10n.dart'; +import 'package:flutter_linkify/flutter_linkify.dart'; +import 'package:matrix/matrix.dart'; + import '../../widgets/matrix.dart'; import 'user_bottom_sheet.dart'; @@ -119,7 +118,8 @@ class UserBottomSheetView extends StatelessWidget { Padding( padding: const EdgeInsets.all(12.0), child: Material( - color: Theme.of(context).colorScheme.surfaceVariant, + color: + Theme.of(context).colorScheme.surfaceContainerHighest, borderRadius: BorderRadius.circular(AppConfig.borderRadius), child: ListTile( @@ -136,7 +136,7 @@ class UserBottomSheetView extends StatelessWidget { TextButton.icon( style: TextButton.styleFrom( backgroundColor: - Theme.of(context).colorScheme.background, + Theme.of(context).colorScheme.surface, foregroundColor: Theme.of(context).colorScheme.primary, ), @@ -185,7 +185,6 @@ class UserBottomSheetView extends StatelessWidget { mxContent: avatarUrl, name: displayname, size: Avatar.defaultSize * 2.5, - fontSize: 18 * 2.5, ), ), ), @@ -205,7 +204,7 @@ class UserBottomSheetView extends StatelessWidget { ), style: TextButton.styleFrom( foregroundColor: - Theme.of(context).colorScheme.onBackground, + Theme.of(context).colorScheme.onSurface, ), label: Text( displayname, diff --git a/lib/utils/client_manager.dart b/lib/utils/client_manager.dart index 6eba16eb1..1422c0dc1 100644 --- a/lib/utils/client_manager.dart +++ b/lib/utils/client_manager.dart @@ -130,7 +130,7 @@ abstract class ClientManager { }, nativeImplementations: nativeImplementations, customImageResizer: PlatformInfos.isMobile ? customImageResizer : null, - defaultNetworkRequestTimeout: const Duration(minutes: 5), + defaultNetworkRequestTimeout: const Duration(minutes: 30), enableDehydratedDevices: true, ); } diff --git a/lib/utils/matrix_sdk_extensions/flutter_matrix_dart_sdk_database/builder.dart b/lib/utils/matrix_sdk_extensions/flutter_matrix_dart_sdk_database/builder.dart index 826f49c78..655fea198 100644 --- a/lib/utils/matrix_sdk_extensions/flutter_matrix_dart_sdk_database/builder.dart +++ b/lib/utils/matrix_sdk_extensions/flutter_matrix_dart_sdk_database/builder.dart @@ -47,6 +47,12 @@ Future flutterMatrixSdkDatabaseBuilder(Client client) async { // Pangea# ); + // Delete database file: + if (database == null && !kIsWeb) { + final dbFile = File(await _getDatabasePath(client.clientName)); + if (await dbFile.exists()) await dbFile.delete(); + } + try { // Send error notification: // #Pangea @@ -75,9 +81,6 @@ Future _constructDatabase(Client client) async { final cipher = await getDatabaseCipher(); - final databaseDirectory = PlatformInfos.isIOS || PlatformInfos.isMacOS - ? await getLibraryDirectory() - : await getApplicationSupportDirectory(); Directory? fileStorageLocation; try { fileStorageLocation = await getTemporaryDirectory(); @@ -87,7 +90,7 @@ Future _constructDatabase(Client client) async { ); } - final path = join(databaseDirectory.path, '${client.clientName}.sqlite'); + final path = await _getDatabasePath(client.clientName); // fix dlopen for old Android await applyWorkaroundToOpenSqlCipherOnOldAndroidVersions(); @@ -132,6 +135,14 @@ Future _constructDatabase(Client client) async { ); } +Future _getDatabasePath(String clientName) async { + final databaseDirectory = PlatformInfos.isIOS || PlatformInfos.isMacOS + ? await getLibraryDirectory() + : await getApplicationSupportDirectory(); + + return join(databaseDirectory.path, '$clientName.sqlite'); +} + Future _migrateLegacyLocation( String sqlFilePath, String clientName, diff --git a/lib/widgets/avatar.dart b/lib/widgets/avatar.dart index 516a340b6..2a80451ca 100644 --- a/lib/widgets/avatar.dart +++ b/lib/widgets/avatar.dart @@ -10,7 +10,6 @@ class Avatar extends StatelessWidget { final void Function()? onTap; static const double defaultSize = 44; final Client? client; - final double fontSize; final String? presenceUserId; final Color? presenceBackgroundColor; //#Pangea @@ -23,7 +22,6 @@ class Avatar extends StatelessWidget { this.size = defaultSize, this.onTap, this.client, - this.fontSize = 18, this.presenceUserId, this.presenceBackgroundColor, //#Pangea @@ -51,16 +49,14 @@ class Avatar extends StatelessWidget { fallbackLetters, style: TextStyle( color: noPic ? Colors.white : null, - fontSize: fontSize, + fontSize: (size / 2.5).roundToDouble(), ), ), ); final borderRadius = BorderRadius.circular(size / 2); - // #Pangea - // final presenceUserId = this.presenceUserId; - // final color = - // noPic ? name?.lightColorAvatar : Theme.of(context).secondaryHeaderColor; - // Pangea# + final presenceUserId = this.presenceUserId; + final color = + noPic ? name?.lightColorAvatar : Theme.of(context).secondaryHeaderColor; final container = Stack( children: [ ClipRRect( @@ -68,9 +64,7 @@ class Avatar extends StatelessWidget { child: Container( width: size, height: size, - color: noPic - ? name?.lightColorAvatar - : Theme.of(context).secondaryHeaderColor, + color: color, child: noPic ? textWidget : MxcImage( @@ -105,6 +99,7 @@ class Avatar extends StatelessWidget { ), ), ), + // #Pangea // PresenceBuilder( // client: client, // userId: presenceUserId, @@ -120,23 +115,27 @@ class Avatar extends StatelessWidget { // ? Colors.orange // : Colors.grey; // return Positioned( - // bottom: -4, - // right: -4, + // bottom: -3, + // right: -3, // child: Container( // width: 16, // height: 16, // decoration: BoxDecoration( // color: presenceBackgroundColor ?? - // Theme.of(context).colorScheme.background, + // Theme.of(context).colorScheme.surface, // borderRadius: BorderRadius.circular(32), // ), // alignment: Alignment.center, // child: Container( - // width: 8, - // height: 8, + // width: 10, + // height: 10, // decoration: BoxDecoration( // color: dotColor, // borderRadius: BorderRadius.circular(16), + // border: Border.all( + // width: 1, + // color: Theme.of(context).colorScheme.surface, + // ), // ), // ), // ), diff --git a/lib/widgets/layouts/login_scaffold.dart b/lib/widgets/layouts/login_scaffold.dart index c8de3f8a0..46b1a9c08 100644 --- a/lib/widgets/layouts/login_scaffold.dart +++ b/lib/widgets/layouts/login_scaffold.dart @@ -40,29 +40,16 @@ class LoginScaffold extends StatelessWidget { backgroundColor: Colors.transparent, // Pangea# ), - extendBodyBehindAppBar: true, // #Pangea + extendBodyBehindAppBar: true, // body: body, - body: Container( - decoration: const BoxDecoration( - image: DecorationImage( - fit: BoxFit.cover, - image: AssetImage('assets/login_wallpaper.png'), - ), - ), - alignment: Alignment.center, - child: ConstrainedBox( - constraints: const BoxConstraints(maxWidth: 480), - child: body, - ), - ), // backgroundColor: isMobileMode // ? null - // : Theme.of(context).colorScheme.background.withOpacity(0.8), + // : Theme.of(context).colorScheme.surface.withOpacity(0.8), // bottomNavigationBar: isMobileMode // ? Material( // elevation: 4, - // shadowColor: Theme.of(context).colorScheme.onBackground, + // shadowColor: Theme.of(context).colorScheme.onSurface, // child: const _PrivacyButtons( // mainAxisAlignment: MainAxisAlignment.center, // ), diff --git a/lib/widgets/profile_bottom_sheet.dart b/lib/widgets/profile_bottom_sheet.dart index c6dab9fbc..a23773102 100644 --- a/lib/widgets/profile_bottom_sheet.dart +++ b/lib/widgets/profile_bottom_sheet.dart @@ -90,7 +90,6 @@ class ProfileBottomSheet extends StatelessWidget { mxContent: profile?.avatarUrl, name: profile?.displayName ?? userId, size: Avatar.defaultSize * 3, - fontSize: 36, ), ), ), diff --git a/lib/widgets/public_room_bottom_sheet.dart b/lib/widgets/public_room_bottom_sheet.dart index aec6c5167..b60b5a1ee 100644 --- a/lib/widgets/public_room_bottom_sheet.dart +++ b/lib/widgets/public_room_bottom_sheet.dart @@ -139,7 +139,6 @@ class PublicRoomBottomSheet extends StatelessWidget { mxContent: profile.avatarUrl, name: profile.name ?? roomAlias, size: Avatar.defaultSize * 3, - fontSize: 36, ), ), ), diff --git a/lib/widgets/unread_rooms_badge.dart b/lib/widgets/unread_rooms_badge.dart index 72f14b76c..332fa42a1 100644 --- a/lib/widgets/unread_rooms_badge.dart +++ b/lib/widgets/unread_rooms_badge.dart @@ -47,7 +47,7 @@ class UnreadRoomsBadge extends StatelessWidget { badgeColor: Theme.of(context).colorScheme.primary, elevation: 4, borderSide: BorderSide( - color: Theme.of(context).colorScheme.background, + color: Theme.of(context).colorScheme.surface, width: 2, ), ),