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,
accentColor: Colors.indigoAccent,
scaffoldBackgroundColor: Colors.grey[900],
tooltipTheme: const TooltipThemeData(
verticalOffset: 32,
),
appBarTheme: const AppBarTheme(
textTheme: TextTheme(
headline6: TextStyle(

View file

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

View file

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

View file

@ -207,23 +207,28 @@ class ImageMapState extends State<ImageMap> 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...',
),
]),
)
],
);
}

View file

@ -115,36 +115,41 @@ class VideoControlOverlayState extends State<VideoControlOverlay> 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',
),
),
],
),
);
}),
),