fix peer tab Tooltip persist via move it up (#7510)
Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
parent
c0c110fe7e
commit
376bcefc14
@ -153,17 +153,17 @@ class _PeerTabPageState extends State<PeerTabPage>
|
|||||||
border: Border(
|
border: Border(
|
||||||
bottom: BorderSide(width: 2, color: color!),
|
bottom: BorderSide(width: 2, color: color!),
|
||||||
));
|
));
|
||||||
return Obx(() => InkWell(
|
return Obx(() => Tooltip(
|
||||||
|
preferBelow: false,
|
||||||
|
message: model.tabTooltip(t),
|
||||||
|
onTriggered: isMobile ? mobileShowTabVisibilityMenu : null,
|
||||||
|
child: InkWell(
|
||||||
child: Container(
|
child: Container(
|
||||||
decoration: (hover.value
|
decoration: (hover.value
|
||||||
? (selected ? decoBorder : deco)
|
? (selected ? decoBorder : deco)
|
||||||
: (selected ? decoBorder : null)),
|
: (selected ? decoBorder : null)),
|
||||||
child: Tooltip(
|
child: Icon(model.tabIcon(t), color: color)
|
||||||
preferBelow: false,
|
.paddingSymmetric(horizontal: 4),
|
||||||
message: model.tabTooltip(t),
|
|
||||||
onTriggered: isMobile ? mobileShowTabVisibilityMenu : null,
|
|
||||||
child: Icon(model.tabIcon(t), color: color),
|
|
||||||
).paddingSymmetric(horizontal: 4),
|
|
||||||
).paddingSymmetric(horizontal: 4),
|
).paddingSymmetric(horizontal: 4),
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
await handleTabSelection(t);
|
await handleTabSelection(t);
|
||||||
@ -171,6 +171,7 @@ class _PeerTabPageState extends State<PeerTabPage>
|
|||||||
k: 'peer-tab-index', v: t.toString());
|
k: 'peer-tab-index', v: t.toString());
|
||||||
},
|
},
|
||||||
onHover: (value) => hover.value = value,
|
onHover: (value) => hover.value = value,
|
||||||
|
),
|
||||||
));
|
));
|
||||||
}).toList());
|
}).toList());
|
||||||
}
|
}
|
||||||
@ -203,6 +204,8 @@ class _PeerTabPageState extends State<PeerTabPage>
|
|||||||
final textColor = Theme.of(context).textTheme.titleLarge?.color;
|
final textColor = Theme.of(context).textTheme.titleLarge?.color;
|
||||||
return Offstage(
|
return Offstage(
|
||||||
offstage: model.currentTab != index.index,
|
offstage: model.currentTab != index.index,
|
||||||
|
child: Tooltip(
|
||||||
|
message: translate('Refresh'),
|
||||||
child: RefreshWidget(
|
child: RefreshWidget(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
if (gFFI.peerTabModel.currentTab < entries.length) {
|
if (gFFI.peerTabModel.currentTab < entries.length) {
|
||||||
@ -212,13 +215,12 @@ class _PeerTabPageState extends State<PeerTabPage>
|
|||||||
spinning: loading,
|
spinning: loading,
|
||||||
child: RotatedBox(
|
child: RotatedBox(
|
||||||
quarterTurns: 2,
|
quarterTurns: 2,
|
||||||
child: Tooltip(
|
|
||||||
message: translate('Refresh'),
|
|
||||||
child: Icon(
|
child: Icon(
|
||||||
Icons.refresh,
|
Icons.refresh,
|
||||||
size: 18,
|
size: 18,
|
||||||
color: textColor,
|
color: textColor,
|
||||||
)))),
|
))),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -230,6 +232,7 @@ class _PeerTabPageState extends State<PeerTabPage>
|
|||||||
final textColor = Theme.of(context).textTheme.titleLarge?.color;
|
final textColor = Theme.of(context).textTheme.titleLarge?.color;
|
||||||
final model = Provider.of<PeerTabModel>(context);
|
final model = Provider.of<PeerTabModel>(context);
|
||||||
return _hoverAction(
|
return _hoverAction(
|
||||||
|
toolTip: translate('Select'),
|
||||||
context: context,
|
context: context,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
model.setMultiSelectionMode(true);
|
model.setMultiSelectionMode(true);
|
||||||
@ -237,14 +240,12 @@ class _PeerTabPageState extends State<PeerTabPage>
|
|||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: Tooltip(
|
|
||||||
message: translate('Select'),
|
|
||||||
child: SvgPicture.asset(
|
child: SvgPicture.asset(
|
||||||
"assets/checkbox-outline.svg",
|
"assets/checkbox-outline.svg",
|
||||||
width: 18,
|
width: 18,
|
||||||
height: 18,
|
height: 18,
|
||||||
colorFilter: svgColor(textColor),
|
colorFilter: svgColor(textColor),
|
||||||
)),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -370,6 +371,7 @@ class _PeerTabPageState extends State<PeerTabPage>
|
|||||||
}
|
}
|
||||||
return _hoverAction(
|
return _hoverAction(
|
||||||
context: context,
|
context: context,
|
||||||
|
toolTip: translate('Delete'),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
onSubmit() async {
|
onSubmit() async {
|
||||||
final peers = model.selectedPeers;
|
final peers = model.selectedPeers;
|
||||||
@ -406,9 +408,7 @@ class _PeerTabPageState extends State<PeerTabPage>
|
|||||||
|
|
||||||
deleteConfirmDialog(onSubmit, translate('Delete'));
|
deleteConfirmDialog(onSubmit, translate('Delete'));
|
||||||
},
|
},
|
||||||
child: Tooltip(
|
child: Icon(Icons.delete, color: Colors.red));
|
||||||
message: translate('Delete'),
|
|
||||||
child: Icon(Icons.delete, color: Colors.red)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget addSelectionToFav() {
|
Widget addSelectionToFav() {
|
||||||
@ -418,6 +418,7 @@ class _PeerTabPageState extends State<PeerTabPage>
|
|||||||
model.currentTab != PeerTabIndex.recent.index, // show based on recent
|
model.currentTab != PeerTabIndex.recent.index, // show based on recent
|
||||||
child: _hoverAction(
|
child: _hoverAction(
|
||||||
context: context,
|
context: context,
|
||||||
|
toolTip: translate('Add to Favorites'),
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
final peers = model.selectedPeers;
|
final peers = model.selectedPeers;
|
||||||
final favs = (await bind.mainGetFav()).toList();
|
final favs = (await bind.mainGetFav()).toList();
|
||||||
@ -430,9 +431,7 @@ class _PeerTabPageState extends State<PeerTabPage>
|
|||||||
model.setMultiSelectionMode(false);
|
model.setMultiSelectionMode(false);
|
||||||
showToast(translate('Successful'));
|
showToast(translate('Successful'));
|
||||||
},
|
},
|
||||||
child: Tooltip(
|
child: Icon(model.icons[PeerTabIndex.fav.index]),
|
||||||
message: translate('Add to Favorites'),
|
|
||||||
child: Icon(model.icons[PeerTabIndex.fav.index])),
|
|
||||||
).marginOnly(left: isMobile ? 11 : 6),
|
).marginOnly(left: isMobile ? 11 : 6),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -447,14 +446,13 @@ class _PeerTabPageState extends State<PeerTabPage>
|
|||||||
offstage: !gFFI.userModel.isLogin || addressbooks.isEmpty,
|
offstage: !gFFI.userModel.isLogin || addressbooks.isEmpty,
|
||||||
child: _hoverAction(
|
child: _hoverAction(
|
||||||
context: context,
|
context: context,
|
||||||
|
toolTip: translate('Add to address book'),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
final peers = model.selectedPeers.map((e) => Peer.copy(e)).toList();
|
final peers = model.selectedPeers.map((e) => Peer.copy(e)).toList();
|
||||||
addPeersToAbDialog(peers);
|
addPeersToAbDialog(peers);
|
||||||
model.setMultiSelectionMode(false);
|
model.setMultiSelectionMode(false);
|
||||||
},
|
},
|
||||||
child: Tooltip(
|
child: Icon(model.icons[PeerTabIndex.ab.index]),
|
||||||
message: translate('Add to address book'),
|
|
||||||
child: Icon(model.icons[PeerTabIndex.ab.index])),
|
|
||||||
).marginOnly(left: isMobile ? 11 : 6),
|
).marginOnly(left: isMobile ? 11 : 6),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -467,6 +465,7 @@ class _PeerTabPageState extends State<PeerTabPage>
|
|||||||
gFFI.abModel.currentAbTags.isEmpty,
|
gFFI.abModel.currentAbTags.isEmpty,
|
||||||
child: _hoverAction(
|
child: _hoverAction(
|
||||||
context: context,
|
context: context,
|
||||||
|
toolTip: translate('Edit Tag'),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
editAbTagDialog(List.empty(), (selectedTags) async {
|
editAbTagDialog(List.empty(), (selectedTags) async {
|
||||||
final peers = model.selectedPeers;
|
final peers = model.selectedPeers;
|
||||||
@ -476,8 +475,7 @@ class _PeerTabPageState extends State<PeerTabPage>
|
|||||||
showToast(translate('Successful'));
|
showToast(translate('Successful'));
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
child: Tooltip(
|
child: Icon(Icons.tag))
|
||||||
message: translate('Edit Tag'), child: Icon(Icons.tag)))
|
|
||||||
.marginOnly(left: isMobile ? 11 : 6),
|
.marginOnly(left: isMobile ? 11 : 6),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -496,11 +494,11 @@ class _PeerTabPageState extends State<PeerTabPage>
|
|||||||
model.selectedPeers.length >= model.currentTabCachedPeers.length,
|
model.selectedPeers.length >= model.currentTabCachedPeers.length,
|
||||||
child: _hoverAction(
|
child: _hoverAction(
|
||||||
context: context,
|
context: context,
|
||||||
|
toolTip: translate('Select All'),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
model.selectAll();
|
model.selectAll();
|
||||||
},
|
},
|
||||||
child: Tooltip(
|
child: Icon(Icons.select_all),
|
||||||
message: translate('Select All'), child: Icon(Icons.select_all)),
|
|
||||||
).marginOnly(left: 6),
|
).marginOnly(left: 6),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -509,24 +507,23 @@ class _PeerTabPageState extends State<PeerTabPage>
|
|||||||
final model = Provider.of<PeerTabModel>(context);
|
final model = Provider.of<PeerTabModel>(context);
|
||||||
return _hoverAction(
|
return _hoverAction(
|
||||||
context: context,
|
context: context,
|
||||||
|
toolTip: translate('Close'),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
model.setMultiSelectionMode(false);
|
model.setMultiSelectionMode(false);
|
||||||
},
|
},
|
||||||
child:
|
child: Icon(Icons.clear))
|
||||||
Tooltip(message: translate('Close'), child: Icon(Icons.clear)))
|
|
||||||
.marginOnly(left: 6);
|
.marginOnly(left: 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _toggleTags() {
|
Widget _toggleTags() {
|
||||||
return _hoverAction(
|
return _hoverAction(
|
||||||
context: context,
|
context: context,
|
||||||
|
toolTip: translate('Close'),
|
||||||
hoverableWhenfalse: hideAbTagsPanel,
|
hoverableWhenfalse: hideAbTagsPanel,
|
||||||
child: Tooltip(
|
|
||||||
message: translate('Toggle Tags'),
|
|
||||||
child: Icon(
|
child: Icon(
|
||||||
Icons.tag_rounded,
|
Icons.tag_rounded,
|
||||||
size: 18,
|
size: 18,
|
||||||
)),
|
),
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
await bind.mainSetLocalOption(
|
await bind.mainSetLocalOption(
|
||||||
key: "hideAbTagsPanel", value: hideAbTagsPanel.value ? "" : "Y");
|
key: "hideAbTagsPanel", value: hideAbTagsPanel.value ? "" : "Y");
|
||||||
@ -576,14 +573,13 @@ class _PeerTabPageState extends State<PeerTabPage>
|
|||||||
(BuildContext context, Future<void> Function() showMenu) {
|
(BuildContext context, Future<void> Function() showMenu) {
|
||||||
return _hoverAction(
|
return _hoverAction(
|
||||||
context: context,
|
context: context,
|
||||||
child: Tooltip(
|
toolTip: translate('More'),
|
||||||
message: translate('More'),
|
|
||||||
child: SvgPicture.asset(
|
child: SvgPicture.asset(
|
||||||
"assets/chevron_up_chevron_down.svg",
|
"assets/chevron_up_chevron_down.svg",
|
||||||
width: 18,
|
width: 18,
|
||||||
height: 18,
|
height: 18,
|
||||||
colorFilter: svgColor(textColor),
|
colorFilter: svgColor(textColor),
|
||||||
)),
|
),
|
||||||
onTap: showMenu,
|
onTap: showMenu,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@ -658,18 +654,17 @@ class _PeerSearchBarState extends State<PeerSearchBar> {
|
|||||||
? _buildSearchBar()
|
? _buildSearchBar()
|
||||||
: _hoverAction(
|
: _hoverAction(
|
||||||
context: context,
|
context: context,
|
||||||
|
toolTip: translate('Search'),
|
||||||
padding: const EdgeInsets.only(right: 2),
|
padding: const EdgeInsets.only(right: 2),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
drawer = true;
|
drawer = true;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
child: Tooltip(
|
|
||||||
message: translate('Search'),
|
|
||||||
child: Icon(
|
child: Icon(
|
||||||
Icons.search_rounded,
|
Icons.search_rounded,
|
||||||
color: Theme.of(context).hintColor,
|
color: Theme.of(context).hintColor,
|
||||||
)));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildSearchBar() {
|
Widget _buildSearchBar() {
|
||||||
@ -810,8 +805,7 @@ class _PeerViewDropdownState extends State<PeerViewDropdown> {
|
|||||||
var menuPos = RelativeRect.fromLTRB(0, 0, 0, 0);
|
var menuPos = RelativeRect.fromLTRB(0, 0, 0, 0);
|
||||||
return _hoverAction(
|
return _hoverAction(
|
||||||
context: context,
|
context: context,
|
||||||
child: Tooltip(
|
toolTip: translate('Change view'),
|
||||||
message: translate('Change view'),
|
|
||||||
child: Icon(
|
child: Icon(
|
||||||
peerCardUiType.value == PeerUiType.grid
|
peerCardUiType.value == PeerUiType.grid
|
||||||
? Icons.grid_view_rounded
|
? Icons.grid_view_rounded
|
||||||
@ -819,7 +813,7 @@ class _PeerViewDropdownState extends State<PeerViewDropdown> {
|
|||||||
? Icons.view_list_rounded
|
? Icons.view_list_rounded
|
||||||
: Icons.view_agenda_rounded,
|
: Icons.view_agenda_rounded,
|
||||||
size: 18,
|
size: 18,
|
||||||
)),
|
),
|
||||||
onTapDown: (details) {
|
onTapDown: (details) {
|
||||||
final x = details.globalPosition.dx;
|
final x = details.globalPosition.dx;
|
||||||
final y = details.globalPosition.dy;
|
final y = details.globalPosition.dy;
|
||||||
@ -889,12 +883,11 @@ class _PeerSortDropdownState extends State<PeerSortDropdown> {
|
|||||||
var menuPos = RelativeRect.fromLTRB(0, 0, 0, 0);
|
var menuPos = RelativeRect.fromLTRB(0, 0, 0, 0);
|
||||||
return _hoverAction(
|
return _hoverAction(
|
||||||
context: context,
|
context: context,
|
||||||
child: Tooltip(
|
toolTip: translate('Sort by'),
|
||||||
message: translate('Sort by'),
|
|
||||||
child: Icon(
|
child: Icon(
|
||||||
Icons.sort_rounded,
|
Icons.sort_rounded,
|
||||||
size: 18,
|
size: 18,
|
||||||
)),
|
),
|
||||||
onTapDown: (details) {
|
onTapDown: (details) {
|
||||||
final x = details.globalPosition.dx;
|
final x = details.globalPosition.dx;
|
||||||
final y = details.globalPosition.dy;
|
final y = details.globalPosition.dy;
|
||||||
@ -976,6 +969,7 @@ Widget _hoverAction(
|
|||||||
{required BuildContext context,
|
{required BuildContext context,
|
||||||
required Widget child,
|
required Widget child,
|
||||||
required Function() onTap,
|
required Function() onTap,
|
||||||
|
required String toolTip,
|
||||||
GestureTapDownCallback? onTapDown,
|
GestureTapDownCallback? onTapDown,
|
||||||
RxBool? hoverableWhenfalse,
|
RxBool? hoverableWhenfalse,
|
||||||
EdgeInsetsGeometry padding = const EdgeInsets.all(4.0)}) {
|
EdgeInsetsGeometry padding = const EdgeInsets.all(4.0)}) {
|
||||||
@ -984,7 +978,9 @@ Widget _hoverAction(
|
|||||||
color: Theme.of(context).colorScheme.background,
|
color: Theme.of(context).colorScheme.background,
|
||||||
borderRadius: BorderRadius.circular(6),
|
borderRadius: BorderRadius.circular(6),
|
||||||
);
|
);
|
||||||
return Obx(
|
return Tooltip(
|
||||||
|
message: toolTip,
|
||||||
|
child: Obx(
|
||||||
() => Container(
|
() => Container(
|
||||||
margin: EdgeInsets.symmetric(horizontal: 1),
|
margin: EdgeInsets.symmetric(horizontal: 1),
|
||||||
decoration:
|
decoration:
|
||||||
@ -994,6 +990,7 @@ Widget _hoverAction(
|
|||||||
onTap: onTap,
|
onTap: onTap,
|
||||||
onTapDown: onTapDown,
|
onTapDown: onTapDown,
|
||||||
child: Container(padding: padding, child: child))),
|
child: Container(padding: padding, child: child))),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user