fixes for font scale
This commit is contained in:
parent
07e13bc8ac
commit
cc95416efc
7 changed files with 85 additions and 63 deletions
|
@ -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
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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(
|
||||
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,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
|
|
@ -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,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
|
|
@ -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),
|
||||
),
|
||||
),
|
||||
|
|
|
@ -73,59 +73,64 @@ class _VideoProgressBarState extends State<VideoProgressBar> {
|
|||
border: AvesBorder.border(context),
|
||||
borderRadius: const BorderRadius.all(Radius.circular(radius)),
|
||||
),
|
||||
child: Column(
|
||||
key: _progressBarKey,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
StreamBuilder<int>(
|
||||
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<int>(
|
||||
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<int>(
|
||||
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<int>(
|
||||
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,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue