diff --git a/lib/account_manager/views/profile_widget.dart b/lib/account_manager/views/profile_widget.dart index c026856..af7cf30 100644 --- a/lib/account_manager/views/profile_widget.dart +++ b/lib/account_manager/views/profile_widget.dart @@ -20,7 +20,6 @@ class ProfileWidget extends StatelessWidget { // @override - // ignore: prefer_expression_function_bodies Widget build(BuildContext context) { final theme = Theme.of(context); final scale = theme.extension()!; @@ -54,7 +53,7 @@ class ProfileWidget extends StatelessWidget { ? scale.primaryScale.border : scale.primaryScale.borderText), textAlign: TextAlign.left, - ).paddingAll(8), + ).paddingAll(8.scaled(context)), if (_profile.pronouns.isNotEmpty && _showPronouns) Text('(${_profile.pronouns})', textAlign: TextAlign.right, @@ -62,7 +61,7 @@ class ProfileWidget extends StatelessWidget { color: scaleConfig.preferBorders ? scale.primaryScale.border : scale.primaryScale.primary)) - .paddingAll(8), + .paddingAll(8.scaled(context)), const Spacer() ]), ); diff --git a/lib/chat/views/chat_component_widget.dart b/lib/chat/views/chat_component_widget.dart index 8106a48..8cb4edc 100644 --- a/lib/chat/views/chat_component_widget.dart +++ b/lib/chat/views/chat_component_widget.dart @@ -161,7 +161,7 @@ class _ChatComponentWidgetState extends State { return Column( children: [ Container( - height: 48, + height: 40.scaledNoShrink(context), decoration: BoxDecoration( color: scale.border, ), @@ -177,7 +177,7 @@ class _ChatComponentWidgetState extends State { )), const Spacer(), IconButton( - iconSize: 24, + iconSize: 24.scaledNoShrink(context), icon: Icon(Icons.close, color: scale.borderText), onPressed: widget._onClose) .paddingLTRB(0, 0, 8, 0) diff --git a/lib/chat_list/views/chat_list_widget.dart b/lib/chat_list/views/chat_list_widget.dart index cce416c..04720e8 100644 --- a/lib/chat_list/views/chat_list_widget.dart +++ b/lib/chat_list/views/chat_list_widget.dart @@ -63,30 +63,34 @@ class ChatListWidget extends StatelessWidget { title: translate('chat_list.chats'), child: (chatList.isEmpty) ? const SizedBox.expand(child: EmptyChatListWidget()) - : SearchableList( - initialList: chatList.map((x) => x.value).toList(), - itemBuilder: (c) { - switch (c.whichKind()) { - case proto.Chat_Kind.direct: - return _itemBuilderDirect( - c.direct, - contactMap, - ); - case proto.Chat_Kind.group: - return const Text( - 'group chats not yet supported!'); - case proto.Chat_Kind.notSet: - throw StateError('unknown chat kind'); - } + : TapRegion( + onTapOutside: (_) { + FocusScope.of(context).unfocus(); }, - filter: (value) => - _itemFilter(contactMap, chatList, value), - searchFieldPadding: - const EdgeInsets.fromLTRB(0, 0, 0, 4), - inputDecoration: InputDecoration( - labelText: translate('chat_list.search'), - ), - ).paddingAll(8), + child: SearchableList( + initialList: chatList.map((x) => x.value).toList(), + itemBuilder: (c) { + switch (c.whichKind()) { + case proto.Chat_Kind.direct: + return _itemBuilderDirect( + c.direct, + contactMap, + ); + case proto.Chat_Kind.group: + return const Text( + 'group chats not yet supported!'); + case proto.Chat_Kind.notSet: + throw StateError('unknown chat kind'); + } + }, + filter: (value) => + _itemFilter(contactMap, chatList, value), + searchFieldPadding: + const EdgeInsets.fromLTRB(0, 0, 0, 4), + inputDecoration: InputDecoration( + labelText: translate('chat_list.search'), + ), + )).paddingAll(8), ))) .paddingLTRB(8, 0, 8, 8); }); diff --git a/lib/contacts/views/contacts_browser.dart b/lib/contacts/views/contacts_browser.dart index 0504a7a..10b207f 100644 --- a/lib/contacts/views/contacts_browser.dart +++ b/lib/contacts/views/contacts_browser.dart @@ -5,7 +5,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_translate/flutter_translate.dart'; import 'package:searchable_listview/searchable_listview.dart'; -import 'package:star_menu/star_menu.dart'; import 'package:veilid_support/veilid_support.dart'; import '../../contact_invitation/contact_invitation.dart'; @@ -90,75 +89,62 @@ class _ContactsBrowserState extends State final menuBorderColor = scaleScheme.primaryScale.hoverBorder; - final menuParams = StarMenuParameters( - shape: MenuShape.linear, - centerOffset: Offset(0, 64.scaled(context)), - boundaryBackground: BoundaryBackground( - color: menuBackgroundColor, - decoration: ShapeDecoration( - color: menuBackgroundColor, - shape: RoundedRectangleBorder( - side: scaleConfig.useVisualIndicators - ? BorderSide( - width: 2, color: menuBorderColor, strokeAlign: 0) - : BorderSide.none, - borderRadius: BorderRadius.circular( - 8 * scaleConfig.borderRadiusScale))))); - - ElevatedButton makeMenuButton( + PopupMenuEntry makeMenuButton( {required IconData iconData, required String text, - required void Function()? onPressed}) => - ElevatedButton.icon( - onPressed: onPressed, - icon: Icon( - iconData, - size: 32.scaled(context), - ).paddingSTEB(0, 8.scaled(context), 0, 8.scaled(context)), - label: Text( - text, - textScaler: MediaQuery.of(context).textScaler, - maxLines: 2, - textAlign: TextAlign.center, - ).paddingSTEB(0, 8.scaled(context), 0, 8.scaled(context))); + void Function()? onTap}) => + PopupMenuItem( + onTap: onTap, + child: DecoratedBox( + decoration: ShapeDecoration( + color: menuBackgroundColor, + shape: RoundedRectangleBorder( + side: scaleConfig.useVisualIndicators + ? BorderSide( + width: 2, + color: menuBorderColor, + strokeAlign: 0) + : BorderSide.none, + borderRadius: BorderRadius.circular( + 8 * scaleConfig.borderRadiusScale))), + child: Row(spacing: 4.scaled(context), children: [ + Icon(iconData, size: 32.scaled(context)), + Text( + text, + textScaler: MediaQuery.of(context).textScaler, + maxLines: 2, + textAlign: TextAlign.center, + ) + ]).paddingAll(4.scaled(context))) + .paddingLTRB(0, 2.scaled(context), 0, 2.scaled(context))); final inviteMenuItems = [ makeMenuButton( - iconData: Icons.paste, - text: translate('add_contact_sheet.paste_invite'), - onPressed: () async { - _invitationMenuController.closeMenu!(); - await PasteInvitationDialog.show(context); + iconData: Icons.contact_page, + text: translate('add_contact_sheet.create_invite'), + onTap: () async { + await CreateInvitationDialog.show(context); }), makeMenuButton( iconData: Icons.qr_code_scanner, text: translate('add_contact_sheet.scan_invite'), - onPressed: () async { - _invitationMenuController.closeMenu!(); + onTap: () async { await ScanInvitationDialog.show(context); - }).paddingLTRB(0, 0, 0, 8.scaled(context)), + }), makeMenuButton( - iconData: Icons.contact_page, - text: translate('add_contact_sheet.create_invite'), - onPressed: () async { - _invitationMenuController.closeMenu!(); - await CreateInvitationDialog.show(context); - }).paddingLTRB(0, 0, 0, 8.scaled(context)), + iconData: Icons.paste, + text: translate('add_contact_sheet.paste_invite'), + onTap: () async { + await PasteInvitationDialog.show(context); + }), ]; - return StarMenu( - items: inviteMenuItems, - onItemTapped: (_, controller) { - controller.closeMenu!(); - }, - controller: _invitationMenuController, - params: menuParams, - child: IconButton( - onPressed: () {}, - iconSize: 24.scaled(context), - icon: Icon(Icons.person_add, color: menuIconColor), - tooltip: translate('add_contact_sheet.add_contact')), - ); + return PopupMenuButton( + itemBuilder: (_) => inviteMenuItems, + menuPadding: const EdgeInsets.symmetric(vertical: 4).scaled(context), + tooltip: translate('add_contact_sheet.add_contact'), + child: Icon( + size: 32.scaled(context), Icons.person_add, color: menuIconColor)); } @override @@ -253,12 +239,11 @@ class _ContactsBrowserState extends State text: translate('contact_list.loading_contacts')) : const EmptyContactListWidget(), defaultSuffixIconColor: scale.primaryScale.border, - closeKeyboardWhenScrolling: true, searchFieldEnabled: contactList != null, inputDecoration: InputDecoration(labelText: translate('contact_list.search')), secondaryWidget: buildInvitationButton(context) - .paddingLTRB(4.scaled(context), 0, 0, 0)) + .paddingLTRB(8.scaled(context), 0, 0, 0)) .expanded() ]); } @@ -276,5 +261,4 @@ class _ContactsBrowserState extends State } //////////////////////////////////////////////////////////////////////////// - final _invitationMenuController = StarMenuController(); } diff --git a/lib/layout/default_app_bar.dart b/lib/layout/default_app_bar.dart index 7742dad..d13fec9 100644 --- a/lib/layout/default_app_bar.dart +++ b/lib/layout/default_app_bar.dart @@ -13,7 +13,7 @@ class DefaultAppBar extends AppBar { Widget? leading, super.actions}) : super( - toolbarHeight: 40.scaled(context), + toolbarHeight: 48.scaled(context), leadingWidth: 40.scaled(context), leading: leading ?? Container( diff --git a/lib/layout/home/home_account_ready.dart b/lib/layout/home/home_account_ready.dart index 5ae1180..50a43c8 100644 --- a/lib/layout/home/home_account_ready.dart +++ b/lib/layout/home/home_account_ready.dart @@ -31,9 +31,9 @@ class _HomeAccountReadyState extends State { return AspectRatio( aspectRatio: 1, child: IconButton( - icon: const Icon( + icon: Icon( + size: 32.scaled(context), Icons.menu, - applyTextScaling: true, ), color: scaleConfig.preferBorders ? scale.primaryScale.border @@ -70,9 +70,9 @@ class _HomeAccountReadyState extends State { return AspectRatio( aspectRatio: 1, child: IconButton( - icon: const Icon( + icon: Icon( + size: 32.scaled(context), Icons.contacts, - applyTextScaling: true, ), color: scaleConfig.preferBorders ? scale.primaryScale.border diff --git a/lib/layout/home/home_screen.dart b/lib/layout/home/home_screen.dart index e774790..c9f1ecb 100644 --- a/lib/layout/home/home_screen.dart +++ b/lib/layout/home/home_screen.dart @@ -5,7 +5,6 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter_translate/flutter_translate.dart'; import 'package:flutter_zoom_drawer/flutter_zoom_drawer.dart'; -import 'package:keyboard_avoider/keyboard_avoider.dart'; import 'package:provider/provider.dart'; import 'package:transitioned_indexed_stack/transitioned_indexed_stack.dart'; import 'package:url_launcher/url_launcher_string.dart'; @@ -207,36 +206,34 @@ class HomeScreenState extends State .indexWhere((x) => x.superIdentity.recordKey == activeLocalAccount); final canClose = activeIndex != -1; - final drawer = ZoomDrawer( - controller: _zoomDrawerController, - menuScreen: Builder(builder: (context) { - final zoomDrawer = ZoomDrawer.of(context); - zoomDrawer!.stateNotifier.addListener(() { - if (zoomDrawer.isOpen()) { - FocusManager.instance.primaryFocus?.unfocus(); - } - }); - return const DrawerMenu(); - }), - mainScreen: Provider.value( - value: _zoomDrawerController, - child: Builder(builder: _buildAccountPageView)), - borderRadius: 0, - angle: 0, - openCurve: Curves.fastEaseInToSlowEaseOut, - closeCurve: Curves.fastEaseInToSlowEaseOut, - menuScreenTapClose: canClose, - mainScreenTapClose: canClose, - disableDragGesture: !canClose, - mainScreenScale: .25, - slideWidth: min(360, MediaQuery.of(context).size.width * 0.9), - ); + final drawer = Scaffold( + backgroundColor: Colors.transparent, + body: ZoomDrawer( + controller: _zoomDrawerController, + menuScreen: Builder(builder: (context) { + final zoomDrawer = ZoomDrawer.of(context); + zoomDrawer!.stateNotifier.addListener(() { + if (zoomDrawer.isOpen()) { + FocusManager.instance.primaryFocus?.unfocus(); + } + }); + return const DrawerMenu(); + }), + mainScreen: Provider.value( + value: _zoomDrawerController, + child: Builder(builder: _buildAccountPageView)), + borderRadius: 0, + angle: 0, + openCurve: Curves.fastEaseInToSlowEaseOut, + closeCurve: Curves.fastEaseInToSlowEaseOut, + menuScreenTapClose: canClose, + mainScreenTapClose: canClose, + disableDragGesture: !canClose, + mainScreenScale: .25, + slideWidth: min(360, MediaQuery.of(context).size.width * 0.9), + )); - final drawerWithAvoider = - isWeb ? drawer : KeyboardAvoider(curve: Curves.ease, child: drawer); - - return DefaultTextStyle( - style: theme.textTheme.bodySmall!, child: drawerWithAvoider); + return DefaultTextStyle(style: theme.textTheme.bodySmall!, child: drawer); } //////////////////////////////////////////////////////////////////////////// diff --git a/lib/notifications/views/notifications_preferences.dart b/lib/notifications/views/notifications_preferences.dart index 8918fa9..ba06699 100644 --- a/lib/notifications/views/notifications_preferences.dart +++ b/lib/notifications/views/notifications_preferences.dart @@ -69,7 +69,7 @@ Widget buildSettingsPageNotificationPreferences( softWrap: false, style: textTheme.labelMedium, textAlign: TextAlign.center, - ))); + ).fit(fit: BoxFit.scaleDown))); } return out; } @@ -108,170 +108,147 @@ Widget buildSettingsPageNotificationPreferences( return out; } - return InputDecorator( - decoration: InputDecoration( - labelText: translate('settings_page.notifications'), - border: OutlineInputBorder( - borderRadius: BorderRadius.circular(8 * scaleConfig.borderRadiusScale), - borderSide: BorderSide(width: 2, color: scale.primaryScale.border), - ), - ), - child: Column(mainAxisSize: MainAxisSize.min, children: [ - // Display Beta Warning - StyledCheckbox( - label: translate('settings_page.display_beta_warning'), - value: notificationsPreference.displayBetaWarning, - onChanged: (value) async { - final newNotificationsPreference = - notificationsPreference.copyWith(displayBetaWarning: value); - - await updatePreferences(newNotificationsPreference); - }), - // Enable Badge - StyledCheckbox( - label: translate('settings_page.enable_badge'), - value: notificationsPreference.enableBadge, - onChanged: (value) async { - final newNotificationsPreference = - notificationsPreference.copyWith(enableBadge: value); - await updatePreferences(newNotificationsPreference); - }), - // Enable Notifications - StyledCheckbox( - label: translate('settings_page.enable_notifications'), - value: notificationsPreference.enableNotifications, - onChanged: (value) async { - final newNotificationsPreference = - notificationsPreference.copyWith(enableNotifications: value); - await updatePreferences(newNotificationsPreference); - }), - StyledDropdown( - items: messageNotificationContentItems(), - value: notificationsPreference.messageNotificationContent, - decoratorLabel: translate('settings_page.message_notification_content'), - onChanged: !notificationsPreference.enableNotifications - ? null - : (value) async { - final newNotificationsPreference = notificationsPreference - .copyWith(messageNotificationContent: value); - await updatePreferences(newNotificationsPreference); - }, - ).paddingLTRB(0, 4.scaled(context), 0, 4.scaled(context)), - - // Notifications - Table( - defaultVerticalAlignment: TableCellVerticalAlignment.middle, + // Invitation accepted + Widget notificationSettingsItem( + {required String title, + required bool notificationsEnabled, + NotificationMode? deliveryValue, + SoundEffect? soundValue, + Future Function(NotificationMode)? onNotificationModeChanged, + Future Function(SoundEffect)? onSoundChanged}) => + Column( + crossAxisAlignment: CrossAxisAlignment.start, + spacing: 8.scaled(context), children: [ - TableRow(children: [ - Text(translate('settings_page.event'), - textAlign: TextAlign.center, - style: textTheme.titleMedium!.copyWith( - color: scale.primaryScale.border, - decorationColor: scale.primaryScale.border, - decoration: TextDecoration.underline)) - .paddingAll(8.scaled(context)), - Text(translate('settings_page.delivery'), - textAlign: TextAlign.center, - style: textTheme.titleMedium!.copyWith( - color: scale.primaryScale.border, - decorationColor: scale.primaryScale.border, - decoration: TextDecoration.underline)) - .paddingAll(8.scaled(context)), - Text(translate('settings_page.sound'), - textAlign: TextAlign.center, - style: textTheme.titleMedium!.copyWith( - color: scale.primaryScale.border, - decorationColor: scale.primaryScale.border, - decoration: TextDecoration.underline)) - .paddingAll(8.scaled(context)), - ]), - TableRow(children: [ - // Invitation accepted - Text( - textAlign: TextAlign.right, - translate('settings_page.invitation_accepted')) - .paddingAll(4.scaled(context)), - StyledDropdown( - items: notificationModeItems(), - value: notificationsPreference.onInvitationAcceptedMode, - onChanged: !notificationsPreference.enableNotifications - ? null - : (value) async { - final newNotificationsPreference = - notificationsPreference.copyWith( - onInvitationAcceptedMode: value); - await updatePreferences(newNotificationsPreference); - }, - ).paddingAll(4.scaled(context)), - StyledDropdown( - items: soundEffectItems(), - value: notificationsPreference.onInvitationAcceptedSound, - onChanged: !notificationsPreference.enableNotifications - ? null - : (value) async { - final newNotificationsPreference = - notificationsPreference.copyWith( - onInvitationAcceptedSound: value); - await updatePreferences(newNotificationsPreference); - }, - ).paddingLTRB( - 4.scaled(context), 4.scaled(context), 0, 4.scaled(context)) - ]), + Text('$title:', style: textTheme.titleMedium), + Wrap( + spacing: 8.scaled(context), // gap between adjacent chips + runSpacing: 8.scaled(context), // gap between lines + children: [ + if (deliveryValue != null) + IntrinsicWidth( + child: StyledDropdown( + decoratorLabel: translate('settings_page.delivery'), + items: notificationModeItems(), + value: deliveryValue, + onChanged: !notificationsEnabled + ? null + : onNotificationModeChanged, + )), + if (soundValue != null) + IntrinsicWidth( + child: StyledDropdown( + decoratorLabel: translate('settings_page.sound'), + items: soundEffectItems(), + value: soundValue, + onChanged: !notificationsEnabled ? null : onSoundChanged, + )) + ]) + ]).paddingAll(4.scaled(context)); + + return InputDecorator( + decoration: InputDecoration( + labelText: translate('settings_page.notifications'), + border: OutlineInputBorder( + borderRadius: + BorderRadius.circular(8 * scaleConfig.borderRadiusScale), + borderSide: BorderSide(width: 2, color: scale.primaryScale.border), + ), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + spacing: 8.scaled(context), + children: [ + // Display Beta Warning + StyledCheckbox( + label: translate('settings_page.display_beta_warning'), + value: notificationsPreference.displayBetaWarning, + onChanged: (value) async { + final newNotificationsPreference = notificationsPreference + .copyWith(displayBetaWarning: value); + + await updatePreferences(newNotificationsPreference); + }), + // Enable Badge + StyledCheckbox( + label: translate('settings_page.enable_badge'), + value: notificationsPreference.enableBadge, + onChanged: (value) async { + final newNotificationsPreference = + notificationsPreference.copyWith(enableBadge: value); + await updatePreferences(newNotificationsPreference); + }), + // Enable Notifications + StyledCheckbox( + label: translate('settings_page.enable_notifications'), + value: notificationsPreference.enableNotifications, + onChanged: (value) async { + final newNotificationsPreference = notificationsPreference + .copyWith(enableNotifications: value); + await updatePreferences(newNotificationsPreference); + }), + StyledDropdown( + items: messageNotificationContentItems(), + value: notificationsPreference.messageNotificationContent, + decoratorLabel: + translate('settings_page.message_notification_content'), + onChanged: !notificationsPreference.enableNotifications + ? null + : (value) async { + final newNotificationsPreference = notificationsPreference + .copyWith(messageNotificationContent: value); + await updatePreferences(newNotificationsPreference); + }, + ).paddingAll(4.scaled(context)), + + // Notifications + + // Invitation accepted + notificationSettingsItem( + title: translate('settings_page.invitation_accepted'), + notificationsEnabled: + notificationsPreference.enableNotifications, + deliveryValue: notificationsPreference.onInvitationAcceptedMode, + soundValue: notificationsPreference.onInvitationAcceptedSound, + onNotificationModeChanged: (value) async { + final newNotificationsPreference = notificationsPreference + .copyWith(onInvitationAcceptedMode: value); + await updatePreferences(newNotificationsPreference); + }, + onSoundChanged: (value) async { + final newNotificationsPreference = notificationsPreference + .copyWith(onInvitationAcceptedSound: value); + await updatePreferences(newNotificationsPreference); + }), + // Message received - TableRow(children: [ - Text( - textAlign: TextAlign.right, - translate('settings_page.message_received')) - .paddingAll(4.scaled(context)), - StyledDropdown( - items: notificationModeItems(), - value: notificationsPreference.onMessageReceivedMode, - onChanged: !notificationsPreference.enableNotifications - ? null - : (value) async { - final newNotificationsPreference = - notificationsPreference.copyWith( - onMessageReceivedMode: value); - await updatePreferences(newNotificationsPreference); - }, - ).paddingAll(4), - StyledDropdown( - items: soundEffectItems(), - value: notificationsPreference.onMessageReceivedSound, - onChanged: !notificationsPreference.enableNotifications - ? null - : (value) async { - final newNotificationsPreference = - notificationsPreference.copyWith( - onMessageReceivedSound: value); - await updatePreferences(newNotificationsPreference); - }, - ).paddingLTRB( - 4.scaled(context), 4.scaled(context), 0, 4.scaled(context)) - ]), + notificationSettingsItem( + title: translate('settings_page.message_received'), + notificationsEnabled: + notificationsPreference.enableNotifications, + deliveryValue: notificationsPreference.onMessageReceivedMode, + soundValue: notificationsPreference.onMessageReceivedSound, + onNotificationModeChanged: (value) async { + final newNotificationsPreference = notificationsPreference + .copyWith(onMessageReceivedMode: value); + await updatePreferences(newNotificationsPreference); + }, + onSoundChanged: (value) async { + final newNotificationsPreference = notificationsPreference + .copyWith(onMessageReceivedSound: value); + await updatePreferences(newNotificationsPreference); + }), // Message sent - TableRow(children: [ - Text( - textAlign: TextAlign.right, - translate('settings_page.message_sent')) - .paddingAll(4.scaled(context)), - const SizedBox.shrink(), - StyledDropdown( - items: soundEffectItems(), - value: notificationsPreference.onMessageSentSound, - onChanged: !notificationsPreference.enableNotifications - ? null - : (value) async { - final newNotificationsPreference = - notificationsPreference.copyWith( - onMessageSentSound: value); - await updatePreferences(newNotificationsPreference); - }, - ).paddingLTRB( - 4.scaled(context), 4.scaled(context), 0, 4.scaled(context)) - ]), - ]) - ]).paddingAll(8.scaled(context)), - ); + notificationSettingsItem( + title: translate('settings_page.message_sent'), + notificationsEnabled: + notificationsPreference.enableNotifications, + soundValue: notificationsPreference.onMessageSentSound, + onSoundChanged: (value) async { + final newNotificationsPreference = notificationsPreference + .copyWith(onMessageSentSound: value); + await updatePreferences(newNotificationsPreference); + }), + ]).paddingAll(4.scaled(context))); } diff --git a/lib/settings/settings_page.dart b/lib/settings/settings_page.dart index 810b20e..bb6ee3e 100644 --- a/lib/settings/settings_page.dart +++ b/lib/settings/settings_page.dart @@ -23,7 +23,7 @@ class SettingsPage extends StatelessWidget { title: Text(translate('settings_page.titlebar')), leading: IconButton( iconSize: 24.scaled(context), - icon: Icon(Icons.arrow_back), + icon: const Icon(Icons.arrow_back), onPressed: () => GoRouterHelper(context).pop(), ), actions: [ @@ -56,7 +56,6 @@ class SettingsPage extends StatelessWidget { .map((x) => x.paddingLTRB(0, 0, 0, 8.scaled(context))) .toList(), ).paddingSymmetric(vertical: 4.scaled(context)), - ).paddingSymmetric( - horizontal: 8.scaled(context), vertical: 8.scaled(context)), + ), )); } diff --git a/lib/theme/models/scale_theme/scale_theme.dart b/lib/theme/models/scale_theme/scale_theme.dart index 755bd54..a428c2c 100644 --- a/lib/theme/models/scale_theme/scale_theme.dart +++ b/lib/theme/models/scale_theme/scale_theme.dart @@ -191,6 +191,12 @@ class ScaleTheme extends ThemeExtension { inputDecorationTheme: ScaleInputDecoratorTheme(scheme, config, textTheme), sliderTheme: sliderTheme, + popupMenuTheme: PopupMenuThemeData( + color: scheme.primaryScale.subtleBackground, + shadowColor: Colors.transparent, + shape: RoundedRectangleBorder( + borderRadius: + BorderRadius.circular(8 * config.borderRadiusScale))), extensions: >[scheme, config, this]); return themeData; diff --git a/lib/theme/views/preferences/display_scale_preferences.dart b/lib/theme/views/preferences/display_scale_preferences.dart index 84bf97d..c056280 100644 --- a/lib/theme/views/preferences/display_scale_preferences.dart +++ b/lib/theme/views/preferences/display_scale_preferences.dart @@ -38,6 +38,16 @@ const _scaleNumMult = [ 1 + 1 / 1, ]; +const _scaleNumMultNoShrink = [ + 1, + 1, + 1, + 1, + 1 + 1 / 4, + 1 + 1 / 2, + 1 + 1 / 1, +]; + int displayScaleToIndex(double displayScale) { final idx = _scales.indexWhere((elem) => elem > displayScale); final currentScaleIdx = idx == -1 ? _scales.length - 1 : max(0, idx - 1); @@ -92,6 +102,14 @@ extension DisplayScaledNum on num { displayScaleToIndex(prefs.themePreference.displayScale); return this * _scaleNumMult[currentScaleIdx]; } + + double scaledNoShrink(BuildContext context) { + final prefs = context.watch().state.asData?.value ?? + PreferencesRepository.instance.value; + final currentScaleIdx = + displayScaleToIndex(prefs.themePreference.displayScale); + return this * _scaleNumMultNoShrink[currentScaleIdx]; + } } extension DisplayScaledEdgeInsets on EdgeInsets { diff --git a/lib/theme/views/styled_widgets/styled_checkbox.dart b/lib/theme/views/styled_widgets/styled_checkbox.dart index 7eb3649..0213db2 100644 --- a/lib/theme/views/styled_widgets/styled_checkbox.dart +++ b/lib/theme/views/styled_widgets/styled_checkbox.dart @@ -43,7 +43,11 @@ class StyledCheckbox extends StatelessWidget { await _onChanged(value); }); })), - Text(_label, style: textStyle).paddingAll(4.scaled(context)), + Text( + _label, + style: textStyle, + overflow: TextOverflow.clip, + ).paddingLTRB(4.scaled(context), 0, 0, 0).flexible(), ]); if (_decoratorLabel != null) { diff --git a/lib/theme/views/styled_widgets/styled_scaffold.dart b/lib/theme/views/styled_widgets/styled_scaffold.dart index 82f27f5..9a32640 100644 --- a/lib/theme/views/styled_widgets/styled_scaffold.dart +++ b/lib/theme/views/styled_widgets/styled_scaffold.dart @@ -27,7 +27,7 @@ class StyledScaffold extends StatelessWidget { return GestureDetector( onTap: () => FocusManager.instance.primaryFocus?.unfocus(), - child: scaffold /*.paddingAll(enableBorder ? 32 : 0) */); + child: scaffold); } //////////////////////////////////////////////////////////////////////////// diff --git a/lib/theme/views/styled_widgets/styled_slide_tile.dart b/lib/theme/views/styled_widgets/styled_slide_tile.dart index 43b3fd8..59f8a7b 100644 --- a/lib/theme/views/styled_widgets/styled_slide_tile.dart +++ b/lib/theme/views/styled_widgets/styled_slide_tile.dart @@ -132,7 +132,7 @@ class StyledSlideTile extends StatelessWidget { softWrap: false, ), subtitle: subtitle.isNotEmpty ? Text(subtitle) : null, - contentPadding: const EdgeInsets.fromLTRB(8, 4, 8, 4) + contentPadding: const EdgeInsets.fromLTRB(8, 2, 8, 2) .scaled(context), iconColor: scaleTileTheme.textColor, textColor: scaleTileTheme.textColor, diff --git a/lib/theme/views/widget_helpers.dart b/lib/theme/views/widget_helpers.dart index 910074e..a02f207 100644 --- a/lib/theme/views/widget_helpers.dart +++ b/lib/theme/views/widget_helpers.dart @@ -571,6 +571,7 @@ Container clipBorder({ required Color borderColor, required Widget child, }) => + // We want to return a container here // ignore: avoid_unnecessary_containers, use_decorated_box Container( decoration: ShapeDecoration( diff --git a/pubspec.lock b/pubspec.lock index aa97499..ad7857c 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -848,14 +848,6 @@ packages: url: "https://pub.dev" source: hosted version: "6.9.5" - keyboard_avoider: - dependency: "direct main" - description: - name: keyboard_avoider - sha256: d2917bd52c6612bf8d1ff97f74049ddf3592a81d44e814f0e7b07dcfd245b75c - url: "https://pub.dev" - source: hosted - version: "0.2.0" lint_hard: dependency: "direct dev" description: diff --git a/pubspec.yaml b/pubspec.yaml index 519714b..e933661 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -56,7 +56,6 @@ dependencies: image: ^4.5.3 intl: ^0.19.0 json_annotation: ^4.9.0 - keyboard_avoider: ^0.2.0 loggy: ^2.0.3 meta: ^1.16.0 mobile_scanner: ^7.0.0