diff --git a/CHANGELOG.md b/CHANGELOG.md index 12af7d50d..6fad04e99 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. ## [Unreleased] +### Added + +- improved support for system font scale + ### Fixed - permission confusion when removable volume changes diff --git a/lib/widgets/common/basic/popup/container.dart b/lib/widgets/common/basic/popup/container.dart index eaa767536..30a0323c3 100644 --- a/lib/widgets/common/basic/popup/container.dart +++ b/lib/widgets/common/basic/popup/container.dart @@ -16,10 +16,10 @@ class PopupMenuItemContainer extends PopupMenuEntry { bool represents(void value) => false; @override - State createState() => _TransitionPopupMenuItemState(); + State createState() => _PopupMenuItemContainerState(); } -class _TransitionPopupMenuItemState extends State { +class _PopupMenuItemContainerState extends State { @override Widget build(BuildContext context) { return TooltipTheme( diff --git a/lib/widgets/dialogs/pick_dialogs/location_pick_page.dart b/lib/widgets/dialogs/pick_dialogs/location_pick_page.dart index a14a15fad..fd9ef84cc 100644 --- a/lib/widgets/dialogs/pick_dialogs/location_pick_page.dart +++ b/lib/widgets/dialogs/pick_dialogs/location_pick_page.dart @@ -168,7 +168,6 @@ class _LocationInfo extends StatelessWidget { final ValueNotifier locationNotifier; static const double iconPadding = 8.0; - static const double iconSize = 16.0; static const double _interRowPadding = 2.0; const _LocationInfo({ @@ -217,6 +216,8 @@ class _LocationInfo extends StatelessWidget { }, ); } + + static double getIconSize(BuildContext context) => 16.0 * context.select((mq) => mq.textScaleFactor); } class _AddressRow extends StatefulWidget { @@ -253,7 +254,7 @@ class _AddressRowState extends State<_AddressRow> { mainAxisSize: MainAxisSize.min, children: [ const SizedBox(width: _LocationInfo.iconPadding), - const Icon(AIcons.location, size: _LocationInfo.iconSize), + Icon(AIcons.location, size: _LocationInfo.getIconSize(context)), const SizedBox(width: _LocationInfo.iconPadding), Expanded( child: Container( @@ -312,11 +313,16 @@ class _CoordinateRow extends StatelessWidget { return Row( children: [ const SizedBox(width: _LocationInfo.iconPadding), - const Icon(AIcons.geoBounds, size: _LocationInfo.iconSize), + Icon(AIcons.geoBounds, size: _LocationInfo.getIconSize(context)), const SizedBox(width: _LocationInfo.iconPadding), - Text( - location != null ? settings.coordinateFormat.format(context.l10n, location!) : Constants.overlayUnknown, - strutStyle: Constants.overflowStrutStyle, + Expanded( + child: Text( + location != null ? settings.coordinateFormat.format(context.l10n, location!) : Constants.overlayUnknown, + strutStyle: Constants.overflowStrutStyle, + softWrap: false, + overflow: TextOverflow.fade, + maxLines: 1, + ), ), ], ); diff --git a/lib/widgets/map/map_info_row.dart b/lib/widgets/map/map_info_row.dart index 4939002b7..a92336613 100644 --- a/lib/widgets/map/map_info_row.dart +++ b/lib/widgets/map/map_info_row.dart @@ -176,9 +176,14 @@ class _DateRow extends StatelessWidget { const SizedBox(width: MapInfoRow.iconPadding), Icon(AIcons.date, size: MapInfoRow.getIconSize(context)), const SizedBox(width: MapInfoRow.iconPadding), - Text( - dateText, - strutStyle: Constants.overflowStrutStyle, + Expanded( + child: Text( + dateText, + strutStyle: Constants.overflowStrutStyle, + softWrap: false, + overflow: TextOverflow.fade, + maxLines: 1, + ), ), ], ); diff --git a/lib/widgets/viewer/overlay/details/rating_tags.dart b/lib/widgets/viewer/overlay/details/rating_tags.dart index 9a837f478..7cebcea4d 100644 --- a/lib/widgets/viewer/overlay/details/rating_tags.dart +++ b/lib/widgets/viewer/overlay/details/rating_tags.dart @@ -31,6 +31,7 @@ class OverlayRatingTagsRow extends AnimatedWidget { break; } + final textScaleFactor = MediaQuery.textScaleFactorOf(context); final tags = entry.tags.toList()..sort(compareAsciiUpperCaseNatural); final hasTags = tags.isNotEmpty; @@ -46,7 +47,7 @@ class OverlayRatingTagsRow extends AnimatedWidget { padding: const EdgeInsetsDirectional.only(end: ViewerDetailOverlayContent.iconPadding), child: DecoratedIcon( AIcons.tag, - size: ViewerDetailOverlayContent.iconSize, + size: ViewerDetailOverlayContent.iconSize / textScaleFactor, shadows: ViewerDetailOverlayContent.shadows(context), ), ), diff --git a/lib/widgets/viewer/overlay/video/progress_bar.dart b/lib/widgets/viewer/overlay/video/progress_bar.dart index aac65fe25..f8e4f27ba 100644 --- a/lib/widgets/viewer/overlay/video/progress_bar.dart +++ b/lib/widgets/viewer/overlay/video/progress_bar.dart @@ -73,59 +73,64 @@ class _VideoProgressBarState extends State { border: AvesBorder.border(context), borderRadius: const BorderRadius.all(Radius.circular(radius)), ), - child: Column( - key: _progressBarKey, - mainAxisSize: MainAxisSize.min, - children: [ - Row( - children: [ - StreamBuilder( - stream: positionStream, - builder: (context, snapshot) { - // do not use stream snapshot because it is obsolete when switching between videos - final position = controller?.currentPosition.floor() ?? 0; - return Text( - formatFriendlyDuration(Duration(milliseconds: position)), - style: textStyle, - ); - }), - const Spacer(), - Text( - formatFriendlyDuration(Duration(milliseconds: controller?.duration ?? 0)), - style: textStyle, - ), - ], - ), - ClipRRect( - borderRadius: const BorderRadius.all(Radius.circular(4)), - child: Directionality( - // force directionality for `LinearProgressIndicator` - textDirection: TextDirection.ltr, - child: StreamBuilder( - stream: positionStream, - builder: (context, snapshot) { - // do not use stream snapshot because it is obsolete when switching between videos - var progress = controller?.progress ?? 0.0; - if (!progress.isFinite) progress = 0.0; - return LinearProgressIndicator( - value: progress, - backgroundColor: Theme.of(context).colorScheme.onSurface.withOpacity(.2), - ); - }), + child: MediaQuery( + data: MediaQuery.of(context).copyWith( + textScaleFactor: 1, + ), + child: Column( + key: _progressBarKey, + mainAxisSize: MainAxisSize.min, + children: [ + Row( + children: [ + StreamBuilder( + stream: positionStream, + builder: (context, snapshot) { + // do not use stream snapshot because it is obsolete when switching between videos + final position = controller?.currentPosition.floor() ?? 0; + return Text( + formatFriendlyDuration(Duration(milliseconds: position)), + style: textStyle, + ); + }), + const Spacer(), + Text( + formatFriendlyDuration(Duration(milliseconds: controller?.duration ?? 0)), + style: textStyle, + ), + ], ), - ), - Row( - children: [ - _buildSpeedIndicator(), - _buildMuteIndicator(), - Text( - // fake text below to match the height of the text above and center the whole thing - '', - style: textStyle, + ClipRRect( + borderRadius: const BorderRadius.all(Radius.circular(4)), + child: Directionality( + // force directionality for `LinearProgressIndicator` + textDirection: TextDirection.ltr, + child: StreamBuilder( + stream: positionStream, + builder: (context, snapshot) { + // do not use stream snapshot because it is obsolete when switching between videos + var progress = controller?.progress ?? 0.0; + if (!progress.isFinite) progress = 0.0; + return LinearProgressIndicator( + value: progress, + backgroundColor: Theme.of(context).colorScheme.onSurface.withOpacity(.2), + ); + }), ), - ], - ), - ], + ), + Row( + children: [ + _buildSpeedIndicator(), + _buildMuteIndicator(), + Text( + // fake text below to match the height of the text above and center the whole thing + '', + style: textStyle, + ), + ], + ), + ], + ), ), ), ), diff --git a/lib/widgets/viewer/overlay/viewer_buttons.dart b/lib/widgets/viewer/overlay/viewer_buttons.dart index b2a9b2191..bd575afd7 100644 --- a/lib/widgets/viewer/overlay/viewer_buttons.dart +++ b/lib/widgets/viewer/overlay/viewer_buttons.dart @@ -286,6 +286,7 @@ class ViewerButtonRowContent extends StatelessWidget { onCanceled: () { _popupExpandedNotifier.value = null; }, + iconSize: IconTheme.of(context).size, onMenuOpened: () { // if the menu is opened while overlay is hiding, // the popup menu button is disposed and menu items are ineffective,