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]
|
## <a id="unreleased"></a>[Unreleased]
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- improved support for system font scale
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- permission confusion when removable volume changes
|
- permission confusion when removable volume changes
|
||||||
|
|
|
@ -16,10 +16,10 @@ class PopupMenuItemContainer<T> extends PopupMenuEntry<T> {
|
||||||
bool represents(void value) => false;
|
bool represents(void value) => false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<PopupMenuItemContainer> createState() => _TransitionPopupMenuItemState();
|
State<PopupMenuItemContainer> createState() => _PopupMenuItemContainerState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _TransitionPopupMenuItemState extends State<PopupMenuItemContainer> {
|
class _PopupMenuItemContainerState extends State<PopupMenuItemContainer> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return TooltipTheme(
|
return TooltipTheme(
|
||||||
|
|
|
@ -168,7 +168,6 @@ class _LocationInfo extends StatelessWidget {
|
||||||
final ValueNotifier<LatLng?> locationNotifier;
|
final ValueNotifier<LatLng?> locationNotifier;
|
||||||
|
|
||||||
static const double iconPadding = 8.0;
|
static const double iconPadding = 8.0;
|
||||||
static const double iconSize = 16.0;
|
|
||||||
static const double _interRowPadding = 2.0;
|
static const double _interRowPadding = 2.0;
|
||||||
|
|
||||||
const _LocationInfo({
|
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 {
|
class _AddressRow extends StatefulWidget {
|
||||||
|
@ -253,7 +254,7 @@ class _AddressRowState extends State<_AddressRow> {
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
const SizedBox(width: _LocationInfo.iconPadding),
|
const SizedBox(width: _LocationInfo.iconPadding),
|
||||||
const Icon(AIcons.location, size: _LocationInfo.iconSize),
|
Icon(AIcons.location, size: _LocationInfo.getIconSize(context)),
|
||||||
const SizedBox(width: _LocationInfo.iconPadding),
|
const SizedBox(width: _LocationInfo.iconPadding),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Container(
|
child: Container(
|
||||||
|
@ -312,11 +313,16 @@ class _CoordinateRow extends StatelessWidget {
|
||||||
return Row(
|
return Row(
|
||||||
children: [
|
children: [
|
||||||
const SizedBox(width: _LocationInfo.iconPadding),
|
const SizedBox(width: _LocationInfo.iconPadding),
|
||||||
const Icon(AIcons.geoBounds, size: _LocationInfo.iconSize),
|
Icon(AIcons.geoBounds, size: _LocationInfo.getIconSize(context)),
|
||||||
const SizedBox(width: _LocationInfo.iconPadding),
|
const SizedBox(width: _LocationInfo.iconPadding),
|
||||||
Text(
|
Expanded(
|
||||||
location != null ? settings.coordinateFormat.format(context.l10n, location!) : Constants.overlayUnknown,
|
child: Text(
|
||||||
strutStyle: Constants.overflowStrutStyle,
|
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),
|
const SizedBox(width: MapInfoRow.iconPadding),
|
||||||
Icon(AIcons.date, size: MapInfoRow.getIconSize(context)),
|
Icon(AIcons.date, size: MapInfoRow.getIconSize(context)),
|
||||||
const SizedBox(width: MapInfoRow.iconPadding),
|
const SizedBox(width: MapInfoRow.iconPadding),
|
||||||
Text(
|
Expanded(
|
||||||
dateText,
|
child: Text(
|
||||||
strutStyle: Constants.overflowStrutStyle,
|
dateText,
|
||||||
|
strutStyle: Constants.overflowStrutStyle,
|
||||||
|
softWrap: false,
|
||||||
|
overflow: TextOverflow.fade,
|
||||||
|
maxLines: 1,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
|
@ -31,6 +31,7 @@ class OverlayRatingTagsRow extends AnimatedWidget {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final textScaleFactor = MediaQuery.textScaleFactorOf(context);
|
||||||
final tags = entry.tags.toList()..sort(compareAsciiUpperCaseNatural);
|
final tags = entry.tags.toList()..sort(compareAsciiUpperCaseNatural);
|
||||||
final hasTags = tags.isNotEmpty;
|
final hasTags = tags.isNotEmpty;
|
||||||
|
|
||||||
|
@ -46,7 +47,7 @@ class OverlayRatingTagsRow extends AnimatedWidget {
|
||||||
padding: const EdgeInsetsDirectional.only(end: ViewerDetailOverlayContent.iconPadding),
|
padding: const EdgeInsetsDirectional.only(end: ViewerDetailOverlayContent.iconPadding),
|
||||||
child: DecoratedIcon(
|
child: DecoratedIcon(
|
||||||
AIcons.tag,
|
AIcons.tag,
|
||||||
size: ViewerDetailOverlayContent.iconSize,
|
size: ViewerDetailOverlayContent.iconSize / textScaleFactor,
|
||||||
shadows: ViewerDetailOverlayContent.shadows(context),
|
shadows: ViewerDetailOverlayContent.shadows(context),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -73,59 +73,64 @@ class _VideoProgressBarState extends State<VideoProgressBar> {
|
||||||
border: AvesBorder.border(context),
|
border: AvesBorder.border(context),
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(radius)),
|
borderRadius: const BorderRadius.all(Radius.circular(radius)),
|
||||||
),
|
),
|
||||||
child: Column(
|
child: MediaQuery(
|
||||||
key: _progressBarKey,
|
data: MediaQuery.of(context).copyWith(
|
||||||
mainAxisSize: MainAxisSize.min,
|
textScaleFactor: 1,
|
||||||
children: [
|
),
|
||||||
Row(
|
child: Column(
|
||||||
children: [
|
key: _progressBarKey,
|
||||||
StreamBuilder<int>(
|
mainAxisSize: MainAxisSize.min,
|
||||||
stream: positionStream,
|
children: [
|
||||||
builder: (context, snapshot) {
|
Row(
|
||||||
// do not use stream snapshot because it is obsolete when switching between videos
|
children: [
|
||||||
final position = controller?.currentPosition.floor() ?? 0;
|
StreamBuilder<int>(
|
||||||
return Text(
|
stream: positionStream,
|
||||||
formatFriendlyDuration(Duration(milliseconds: position)),
|
builder: (context, snapshot) {
|
||||||
style: textStyle,
|
// do not use stream snapshot because it is obsolete when switching between videos
|
||||||
);
|
final position = controller?.currentPosition.floor() ?? 0;
|
||||||
}),
|
return Text(
|
||||||
const Spacer(),
|
formatFriendlyDuration(Duration(milliseconds: position)),
|
||||||
Text(
|
style: textStyle,
|
||||||
formatFriendlyDuration(Duration(milliseconds: controller?.duration ?? 0)),
|
);
|
||||||
style: textStyle,
|
}),
|
||||||
),
|
const Spacer(),
|
||||||
],
|
Text(
|
||||||
),
|
formatFriendlyDuration(Duration(milliseconds: controller?.duration ?? 0)),
|
||||||
ClipRRect(
|
style: textStyle,
|
||||||
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),
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
),
|
),
|
||||||
),
|
ClipRRect(
|
||||||
Row(
|
borderRadius: const BorderRadius.all(Radius.circular(4)),
|
||||||
children: [
|
child: Directionality(
|
||||||
_buildSpeedIndicator(),
|
// force directionality for `LinearProgressIndicator`
|
||||||
_buildMuteIndicator(),
|
textDirection: TextDirection.ltr,
|
||||||
Text(
|
child: StreamBuilder<int>(
|
||||||
// fake text below to match the height of the text above and center the whole thing
|
stream: positionStream,
|
||||||
'',
|
builder: (context, snapshot) {
|
||||||
style: textStyle,
|
// 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: () {
|
onCanceled: () {
|
||||||
_popupExpandedNotifier.value = null;
|
_popupExpandedNotifier.value = null;
|
||||||
},
|
},
|
||||||
|
iconSize: IconTheme.of(context).size,
|
||||||
onMenuOpened: () {
|
onMenuOpened: () {
|
||||||
// if the menu is opened while overlay is hiding,
|
// if the menu is opened while overlay is hiding,
|
||||||
// the popup menu button is disposed and menu items are ineffective,
|
// the popup menu button is disposed and menu items are ineffective,
|
||||||
|
|
Loading…
Reference in a new issue