remove tooltip of main window tab, opt some tooltip by raising its hierarchy (#7672)

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages 2024-04-10 14:04:12 +08:00 committed by GitHub
parent 7f58737f1f
commit ac79c45529
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 43 additions and 35 deletions

View File

@ -298,19 +298,20 @@ class _DesktopHomePageState extends State<DesktopHomePage>
RxBool hover = false.obs; RxBool hover = false.obs;
return InkWell( return InkWell(
onTap: DesktopTabPage.onAddSetting, onTap: DesktopTabPage.onAddSetting,
child: Obx( child: Tooltip(
() => CircleAvatar( message: translate('Settings'),
radius: 15, child: Obx(
backgroundColor: hover.value () => CircleAvatar(
? Theme.of(context).scaffoldBackgroundColor radius: 15,
: Theme.of(context).colorScheme.background, backgroundColor: hover.value
child: Tooltip( ? Theme.of(context).scaffoldBackgroundColor
message: translate('Settings'), : Theme.of(context).colorScheme.background,
child: Icon( child: Icon(
Icons.more_vert_outlined, Icons.more_vert_outlined,
size: 20, size: 20,
color: hover.value ? textColor : textColor?.withOpacity(0.5), color: hover.value ? textColor : textColor?.withOpacity(0.5),
)), ),
),
), ),
), ),
onHover: (value) => hover.value = value, onHover: (value) => hover.value = value,
@ -371,31 +372,33 @@ class _DesktopHomePageState extends State<DesktopHomePage>
), ),
AnimatedRotationWidget( AnimatedRotationWidget(
onPressed: () => bind.mainUpdateTemporaryPassword(), onPressed: () => bind.mainUpdateTemporaryPassword(),
child: Obx(() => RotatedBox( child: Tooltip(
quarterTurns: 2, message: translate('Refresh Password'),
child: Tooltip( child: Obx(() => RotatedBox(
message: translate('Refresh Password'), quarterTurns: 2,
child: Icon( child: Icon(
Icons.refresh, Icons.refresh,
color: refreshHover.value color: refreshHover.value
? textColor ? textColor
: Color(0xFFDDDDDD), : Color(0xFFDDDDDD),
size: 22, size: 22,
)))), ))),
),
onHover: (value) => refreshHover.value = value, onHover: (value) => refreshHover.value = value,
).marginOnly(right: 8, top: 4), ).marginOnly(right: 8, top: 4),
if (!bind.isDisableSettings()) if (!bind.isDisableSettings())
InkWell( InkWell(
child: Obx( child: Tooltip(
() => Tooltip( message: translate('Change Password'),
message: translate('Change Password'), child: Obx(
child: Icon( () => Icon(
Icons.edit, Icons.edit,
color: editHover.value color: editHover.value
? textColor ? textColor
: Color(0xFFDDDDDD), : Color(0xFFDDDDDD),
size: 22, size: 22,
)).marginOnly(right: 8, top: 4), ).marginOnly(right: 8, top: 4),
),
), ),
onTap: () => DesktopSettingPage.switch2page(0), onTap: () => DesktopSettingPage.switch2page(0),
onHover: (value) => editHover.value = value, onHover: (value) => editHover.value = value,

View File

@ -865,6 +865,7 @@ class _ListView extends StatelessWidget {
label: labelGetter == null label: labelGetter == null
? Rx<String>(tab.label) ? Rx<String>(tab.label)
: labelGetter!(tab.label), : labelGetter!(tab.label),
tabType: controller.tabType,
selectedIcon: tab.selectedIcon, selectedIcon: tab.selectedIcon,
unselectedIcon: tab.unselectedIcon, unselectedIcon: tab.unselectedIcon,
closable: tab.closable, closable: tab.closable,
@ -896,6 +897,7 @@ class _Tab extends StatefulWidget {
final int index; final int index;
final String tabInfoKey; final String tabInfoKey;
final Rx<String> label; final Rx<String> label;
final DesktopTabType tabType;
final IconData? selectedIcon; final IconData? selectedIcon;
final IconData? unselectedIcon; final IconData? unselectedIcon;
final bool closable; final bool closable;
@ -914,6 +916,7 @@ class _Tab extends StatefulWidget {
required this.index, required this.index,
required this.tabInfoKey, required this.tabInfoKey,
required this.label, required this.label,
required this.tabType,
this.selectedIcon, this.selectedIcon,
this.unselectedIcon, this.unselectedIcon,
this.tabBuilder, this.tabBuilder,
@ -953,7 +956,9 @@ class _TabState extends State<_Tab> with RestorationMixin {
return ConstrainedBox( return ConstrainedBox(
constraints: BoxConstraints(maxWidth: widget.maxLabelWidth ?? 200), constraints: BoxConstraints(maxWidth: widget.maxLabelWidth ?? 200),
child: Tooltip( child: Tooltip(
message: translate(widget.label.value), message: widget.tabType == DesktopTabType.main
? ''
: translate(widget.label.value),
child: Text( child: Text(
translate(widget.label.value), translate(widget.label.value),
textAlign: TextAlign.center, textAlign: TextAlign.center,