fixes for font scale

This commit is contained in:
Thibault Deckers 2023-03-20 19:35:31 +01:00
parent 07e13bc8ac
commit cc95416efc
7 changed files with 85 additions and 63 deletions

View file

@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
## <a id="unreleased"></a>[Unreleased]
### Added
- improved support for system font scale
### Fixed
- permission confusion when removable volume changes

View file

@ -16,10 +16,10 @@ class PopupMenuItemContainer<T> extends PopupMenuEntry<T> {
bool represents(void value) => false;
@override
State<PopupMenuItemContainer> createState() => _TransitionPopupMenuItemState();
State<PopupMenuItemContainer> createState() => _PopupMenuItemContainerState();
}
class _TransitionPopupMenuItemState extends State<PopupMenuItemContainer> {
class _PopupMenuItemContainerState extends State<PopupMenuItemContainer> {
@override
Widget build(BuildContext context) {
return TooltipTheme(

View file

@ -168,7 +168,6 @@ class _LocationInfo extends StatelessWidget {
final ValueNotifier<LatLng?> 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<MediaQueryData, double>((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(
Expanded(
child: Text(
location != null ? settings.coordinateFormat.format(context.l10n, location!) : Constants.overlayUnknown,
strutStyle: Constants.overflowStrutStyle,
softWrap: false,
overflow: TextOverflow.fade,
maxLines: 1,
),
),
],
);

View file

@ -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(
Expanded(
child: Text(
dateText,
strutStyle: Constants.overflowStrutStyle,
softWrap: false,
overflow: TextOverflow.fade,
maxLines: 1,
),
),
],
);

View file

@ -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),
),
),

View file

@ -73,6 +73,10 @@ class _VideoProgressBarState extends State<VideoProgressBar> {
border: AvesBorder.border(context),
borderRadius: const BorderRadius.all(Radius.circular(radius)),
),
child: MediaQuery(
data: MediaQuery.of(context).copyWith(
textScaleFactor: 1,
),
child: Column(
key: _progressBarKey,
mainAxisSize: MainAxisSize.min,
@ -131,6 +135,7 @@ class _VideoProgressBarState extends State<VideoProgressBar> {
),
),
),
),
);
}

View file

@ -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,