improved tooltip positions

This commit is contained in:
Thibault Deckers 2020-05-14 15:26:36 +09:00
parent e7086481a4
commit c131e179ee
5 changed files with 80 additions and 61 deletions

View file

@ -29,6 +29,9 @@ class AvesApp extends StatelessWidget {
brightness: Brightness.dark, brightness: Brightness.dark,
accentColor: Colors.indigoAccent, accentColor: Colors.indigoAccent,
scaffoldBackgroundColor: Colors.grey[900], scaffoldBackgroundColor: Colors.grey[900],
tooltipTheme: const TooltipThemeData(
verticalOffset: 32,
),
appBarTheme: const AppBarTheme( appBarTheme: const AppBarTheme(
textTheme: TextTheme( textTheme: TextTheme(
headline6: TextStyle( headline6: TextStyle(

View file

@ -187,23 +187,28 @@ class SectionSelectableLeading extends StatelessWidget {
builder: (context, child) { builder: (context, child) {
final sectionEntries = collection.sections[sectionKey]; final sectionEntries = collection.sections[sectionKey];
final selected = collection.isSelected(sectionEntries); final selected = collection.isSelected(sectionEntries);
final child = IconButton( final child = TooltipTheme(
key: ValueKey(selected), data: TooltipTheme.of(context).copyWith(
iconSize: 26, preferBelow: false,
padding: const EdgeInsets.only(top: 1), ),
alignment: Alignment.topLeft, child: IconButton(
icon: Icon(selected ? AIcons.selected : AIcons.unselected), key: ValueKey(selected),
onPressed: () { iconSize: 26,
if (selected) { padding: const EdgeInsets.only(top: 1),
collection.removeFromSelection(sectionEntries); alignment: Alignment.topLeft,
} else { icon: Icon(selected ? AIcons.selected : AIcons.unselected),
collection.addToSelection(sectionEntries); onPressed: () {
} if (selected) {
}, collection.removeFromSelection(sectionEntries);
tooltip: selected ? 'Deselect section' : 'Select section', } else {
constraints: const BoxConstraints( collection.addToSelection(sectionEntries);
minHeight: leadingDimension, }
minWidth: leadingDimension, },
tooltip: selected ? 'Deselect section' : 'Select section',
constraints: const BoxConstraints(
minHeight: leadingDimension,
minWidth: leadingDimension,
),
), ),
); );
return AnimatedSwitcher( return AnimatedSwitcher(

View file

@ -105,6 +105,7 @@ class _AvesFilterChipState extends State<AvesFilterChip> {
decoration: widget.decoration, decoration: widget.decoration,
child: Tooltip( child: Tooltip(
message: filter.tooltip, message: filter.tooltip,
preferBelow: false,
child: FutureBuilder( child: FutureBuilder(
future: _colorFuture, future: _colorFuture,
builder: (context, AsyncSnapshot<Color> snapshot) { builder: (context, AsyncSnapshot<Color> snapshot) {

View file

@ -207,23 +207,28 @@ class ImageMapState extends State<ImageMap> with AutomaticKeepAliveClientMixin {
), ),
), ),
const SizedBox(width: 8), const SizedBox(width: 8),
Column(children: [ TooltipTheme(
IconButton( data: TooltipTheme.of(context).copyWith(
icon: const Icon(AIcons.zoomIn), preferBelow: false,
onPressed: _controller == null ? null : () => _zoomBy(1),
tooltip: 'Zoom in',
), ),
IconButton( child: Column(children: [
icon: const Icon(AIcons.zoomOut), IconButton(
onPressed: _controller == null ? null : () => _zoomBy(-1), icon: const Icon(AIcons.zoomIn),
tooltip: 'Zoom out', onPressed: _controller == null ? null : () => _zoomBy(1),
), tooltip: 'Zoom in',
IconButton( ),
icon: const Icon(AIcons.openInNew), IconButton(
onPressed: () => AndroidAppService.openMap(widget.geoUri), icon: const Icon(AIcons.zoomOut),
tooltip: 'Show on map...', onPressed: _controller == null ? null : () => _zoomBy(-1),
), tooltip: 'Zoom out',
]) ),
IconButton(
icon: const Icon(AIcons.openInNew),
onPressed: () => AndroidAppService.openMap(widget.geoUri),
tooltip: 'Show on map...',
),
]),
)
], ],
); );
} }

View file

@ -115,36 +115,41 @@ class VideoControlOverlayState extends State<VideoControlOverlay> with SingleTic
builder: (context, snapshot) { builder: (context, snapshot) {
// do not use stream snapshot because it is obsolete when switching between videos // do not use stream snapshot because it is obsolete when switching between videos
final status = controller.ijkStatus; final status = controller.ijkStatus;
return Row( return TooltipTheme(
mainAxisAlignment: MainAxisAlignment.end, data: TooltipTheme.of(context).copyWith(
children: status == IjkStatus.error preferBelow: false,
? [ ),
OverlayButton( child: Row(
scale: scale, mainAxisAlignment: MainAxisAlignment.end,
child: IconButton( children: status == IjkStatus.error
icon: const Icon(AIcons.openInNew), ? [
onPressed: () => AndroidAppService.open(entry.uri, entry.mimeTypeAnySubtype), OverlayButton(
tooltip: 'Open', 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,
), ),
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',
),
),
],
),
); );
}), }),
), ),