fix: text overflow issue of font family dropdown (#3348)

* fixed text overflow issue of font family dropdown

* added tooltip delay

* code review fixes: unwanted key removed; tooltip added for all fonts;
delay time reduces;

* Update frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_appearance/font_family_setting.dart

---------

Co-authored-by: Lucas.Xu <lucas.xu@appflowy.io>
This commit is contained in:
Aslam 2023-12-21 07:01:37 +05:30 committed by GitHub
parent 6ecc3c9076
commit 366e28752c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -173,37 +173,43 @@ class _FontFamilyDropDownState extends State<FontFamilyDropDown> {
TextStyle style, TextStyle style,
) { ) {
final buttonFontFamily = parseFontFamilyName(style.fontFamily!); final buttonFontFamily = parseFontFamilyName(style.fontFamily!);
return SizedBox(
key: UniqueKey(), return Tooltip(
height: 32, message: buttonFontFamily,
child: FlowyButton( waitDuration: const Duration(milliseconds: 150),
key: Key(buttonFontFamily), child: SizedBox(
onHover: (_) => FocusScope.of(context).unfocus(), key: ValueKey(buttonFontFamily),
text: FlowyText.medium( height: 32,
parseFontFamilyName(style.fontFamily!), child: FlowyButton(
fontFamily: style.fontFamily!, onHover: (_) => FocusScope.of(context).unfocus(),
), text: FlowyText.medium(
rightIcon: parseFontFamilyName(style.fontFamily!),
buttonFontFamily == parseFontFamilyName(widget.currentFontFamily) fontFamily: style.fontFamily!,
? const FlowySvg( ),
FlowySvgs.check_s, rightIcon:
) buttonFontFamily == parseFontFamilyName(widget.currentFontFamily)
: null, ? const FlowySvg(
onTap: () { FlowySvgs.check_s,
if (widget.onFontFamilyChanged != null) { )
widget.onFontFamilyChanged!(style.fontFamily!); : null,
} else { onTap: () {
final fontFamily = style.fontFamily!.parseFontFamilyName(); if (widget.onFontFamilyChanged != null) {
if (parseFontFamilyName(widget.currentFontFamily) != widget.onFontFamilyChanged!(style.fontFamily!);
buttonFontFamily) { } else {
context.read<AppearanceSettingsCubit>().setFontFamily(fontFamily); final fontFamily = style.fontFamily!.parseFontFamilyName();
context if (parseFontFamilyName(widget.currentFontFamily) !=
.read<DocumentAppearanceCubit>() buttonFontFamily) {
.syncFontFamily(fontFamily); context
.read<AppearanceSettingsCubit>()
.setFontFamily(fontFamily);
context
.read<DocumentAppearanceCubit>()
.syncFontFamily(fontFamily);
}
} }
} PopoverContainer.of(context).close();
PopoverContainer.of(context).close(); },
}, ),
), ),
); );
} }