From c131e179ee91da984cfc3911f23644fe230751ad Mon Sep 17 00:00:00 2001 From: Thibault Deckers Date: Thu, 14 May 2020 15:26:36 +0900 Subject: [PATCH] improved tooltip positions --- lib/main.dart | 3 + lib/widgets/album/grid/header_generic.dart | 39 ++++++------ lib/widgets/common/aves_filter_chip.dart | 1 + .../fullscreen/info/location_section.dart | 37 ++++++----- lib/widgets/fullscreen/overlay/video.dart | 61 ++++++++++--------- 5 files changed, 80 insertions(+), 61 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index df2e04262..4a1a963da 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -29,6 +29,9 @@ class AvesApp extends StatelessWidget { brightness: Brightness.dark, accentColor: Colors.indigoAccent, scaffoldBackgroundColor: Colors.grey[900], + tooltipTheme: const TooltipThemeData( + verticalOffset: 32, + ), appBarTheme: const AppBarTheme( textTheme: TextTheme( headline6: TextStyle( diff --git a/lib/widgets/album/grid/header_generic.dart b/lib/widgets/album/grid/header_generic.dart index f9370918b..6fc27aa13 100644 --- a/lib/widgets/album/grid/header_generic.dart +++ b/lib/widgets/album/grid/header_generic.dart @@ -187,23 +187,28 @@ class SectionSelectableLeading extends StatelessWidget { builder: (context, child) { final sectionEntries = collection.sections[sectionKey]; final selected = collection.isSelected(sectionEntries); - final child = IconButton( - key: ValueKey(selected), - iconSize: 26, - padding: const EdgeInsets.only(top: 1), - alignment: Alignment.topLeft, - icon: Icon(selected ? AIcons.selected : AIcons.unselected), - onPressed: () { - if (selected) { - collection.removeFromSelection(sectionEntries); - } else { - collection.addToSelection(sectionEntries); - } - }, - tooltip: selected ? 'Deselect section' : 'Select section', - constraints: const BoxConstraints( - minHeight: leadingDimension, - minWidth: leadingDimension, + final child = TooltipTheme( + data: TooltipTheme.of(context).copyWith( + preferBelow: false, + ), + child: IconButton( + key: ValueKey(selected), + iconSize: 26, + padding: const EdgeInsets.only(top: 1), + alignment: Alignment.topLeft, + icon: Icon(selected ? AIcons.selected : AIcons.unselected), + onPressed: () { + if (selected) { + collection.removeFromSelection(sectionEntries); + } else { + collection.addToSelection(sectionEntries); + } + }, + tooltip: selected ? 'Deselect section' : 'Select section', + constraints: const BoxConstraints( + minHeight: leadingDimension, + minWidth: leadingDimension, + ), ), ); return AnimatedSwitcher( diff --git a/lib/widgets/common/aves_filter_chip.dart b/lib/widgets/common/aves_filter_chip.dart index 548804189..ab7fa4bc4 100644 --- a/lib/widgets/common/aves_filter_chip.dart +++ b/lib/widgets/common/aves_filter_chip.dart @@ -105,6 +105,7 @@ class _AvesFilterChipState extends State { decoration: widget.decoration, child: Tooltip( message: filter.tooltip, + preferBelow: false, child: FutureBuilder( future: _colorFuture, builder: (context, AsyncSnapshot snapshot) { diff --git a/lib/widgets/fullscreen/info/location_section.dart b/lib/widgets/fullscreen/info/location_section.dart index 691f5abcd..c2f83a0cd 100644 --- a/lib/widgets/fullscreen/info/location_section.dart +++ b/lib/widgets/fullscreen/info/location_section.dart @@ -207,23 +207,28 @@ class ImageMapState extends State with AutomaticKeepAliveClientMixin { ), ), const SizedBox(width: 8), - Column(children: [ - IconButton( - icon: const Icon(AIcons.zoomIn), - onPressed: _controller == null ? null : () => _zoomBy(1), - tooltip: 'Zoom in', + TooltipTheme( + data: TooltipTheme.of(context).copyWith( + preferBelow: false, ), - IconButton( - icon: const Icon(AIcons.zoomOut), - onPressed: _controller == null ? null : () => _zoomBy(-1), - tooltip: 'Zoom out', - ), - IconButton( - icon: const Icon(AIcons.openInNew), - onPressed: () => AndroidAppService.openMap(widget.geoUri), - tooltip: 'Show on map...', - ), - ]) + child: Column(children: [ + IconButton( + icon: const Icon(AIcons.zoomIn), + onPressed: _controller == null ? null : () => _zoomBy(1), + tooltip: 'Zoom in', + ), + IconButton( + icon: const Icon(AIcons.zoomOut), + onPressed: _controller == null ? null : () => _zoomBy(-1), + tooltip: 'Zoom out', + ), + IconButton( + icon: const Icon(AIcons.openInNew), + onPressed: () => AndroidAppService.openMap(widget.geoUri), + tooltip: 'Show on map...', + ), + ]), + ) ], ); } diff --git a/lib/widgets/fullscreen/overlay/video.dart b/lib/widgets/fullscreen/overlay/video.dart index f5bf6b45e..27c903b91 100644 --- a/lib/widgets/fullscreen/overlay/video.dart +++ b/lib/widgets/fullscreen/overlay/video.dart @@ -115,36 +115,41 @@ class VideoControlOverlayState extends State with SingleTic builder: (context, snapshot) { // do not use stream snapshot because it is obsolete when switching between videos final status = controller.ijkStatus; - return Row( - mainAxisAlignment: MainAxisAlignment.end, - children: status == IjkStatus.error - ? [ - OverlayButton( - scale: scale, - child: IconButton( - icon: const Icon(AIcons.openInNew), - onPressed: () => AndroidAppService.open(entry.uri, entry.mimeTypeAnySubtype), - tooltip: 'Open', - ), - ), - ] - : [ - Expanded( - child: _buildProgressBar(), - ), - const SizedBox(width: 8), - OverlayButton( - scale: scale, - child: IconButton( - icon: AnimatedIcon( - icon: AnimatedIcons.play_pause, - progress: _playPauseAnimation, + return TooltipTheme( + data: TooltipTheme.of(context).copyWith( + preferBelow: false, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: status == IjkStatus.error + ? [ + OverlayButton( + scale: scale, + child: IconButton( + icon: const Icon(AIcons.openInNew), + onPressed: () => AndroidAppService.open(entry.uri, entry.mimeTypeAnySubtype), + tooltip: 'Open', ), - onPressed: _playPause, - tooltip: isPlaying ? 'Pause' : 'Play', ), - ), - ], + ] + : [ + Expanded( + child: _buildProgressBar(), + ), + const SizedBox(width: 8), + OverlayButton( + scale: scale, + child: IconButton( + icon: AnimatedIcon( + icon: AnimatedIcons.play_pause, + progress: _playPauseAnimation, + ), + onPressed: _playPause, + tooltip: isPlaying ? 'Pause' : 'Play', + ), + ), + ], + ), ); }), ),