mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
refactor: ui improvement in appearance (#3553)
This commit is contained in:
parent
eb20c7c117
commit
40dcd13394
@ -17,36 +17,37 @@ class BrightnessSetting extends StatelessWidget {
|
|||||||
const BrightnessSetting({required this.currentThemeMode, super.key});
|
const BrightnessSetting({required this.currentThemeMode, super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) => FlowyTooltip.delayed(
|
Widget build(BuildContext context) {
|
||||||
richMessage: themeModeTooltipTextSpan(
|
return FlowyTooltip.delayed(
|
||||||
context,
|
margin: const EdgeInsets.only(left: 180),
|
||||||
LocaleKeys.settings_appearance_themeMode_label.tr(),
|
richMessage: themeModeTooltipTextSpan(
|
||||||
),
|
LocaleKeys.settings_appearance_themeMode_label.tr(),
|
||||||
child: ThemeSettingEntryTemplateWidget(
|
),
|
||||||
label: LocaleKeys.settings_appearance_themeMode_label.tr(),
|
child: ThemeSettingEntryTemplateWidget(
|
||||||
onResetRequested:
|
label: LocaleKeys.settings_appearance_themeMode_label.tr(),
|
||||||
context.read<AppearanceSettingsCubit>().resetThemeMode,
|
onResetRequested:
|
||||||
trailing: [
|
context.read<AppearanceSettingsCubit>().resetThemeMode,
|
||||||
ThemeValueDropDown(
|
trailing: [
|
||||||
currentValue: _themeModeLabelText(currentThemeMode),
|
ThemeValueDropDown(
|
||||||
popupBuilder: (context) => Column(
|
currentValue: _themeModeLabelText(currentThemeMode),
|
||||||
mainAxisSize: MainAxisSize.min,
|
popupBuilder: (context) => Column(
|
||||||
children: [
|
mainAxisSize: MainAxisSize.min,
|
||||||
_themeModeItemButton(context, ThemeMode.light),
|
children: [
|
||||||
_themeModeItemButton(context, ThemeMode.dark),
|
_themeModeItemButton(context, ThemeMode.light),
|
||||||
_themeModeItemButton(context, ThemeMode.system),
|
_themeModeItemButton(context, ThemeMode.dark),
|
||||||
],
|
_themeModeItemButton(context, ThemeMode.system),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
],
|
||||||
);
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
TextSpan themeModeTooltipTextSpan(BuildContext context, String hintText) =>
|
TextSpan themeModeTooltipTextSpan(String hintText) => TextSpan(
|
||||||
TextSpan(
|
|
||||||
children: [
|
children: [
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text: "$hintText\n",
|
text: "${LocaleKeys.settings_files_change.tr()} $hintText\n",
|
||||||
),
|
),
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text: Platform.isMacOS ? "⌘+Shift+L" : "Ctrl+Shift+L",
|
text: Platform.isMacOS ? "⌘+Shift+L" : "Ctrl+Shift+L",
|
||||||
|
@ -25,17 +25,27 @@ class SettingsAppearanceView extends StatelessWidget {
|
|||||||
currentTheme: state.appTheme.themeName,
|
currentTheme: state.appTheme.themeName,
|
||||||
bloc: context.read<DynamicPluginBloc>(),
|
bloc: context.read<DynamicPluginBloc>(),
|
||||||
),
|
),
|
||||||
BrightnessSetting(currentThemeMode: state.themeMode),
|
BrightnessSetting(
|
||||||
|
currentThemeMode: state.themeMode,
|
||||||
|
),
|
||||||
const Divider(),
|
const Divider(),
|
||||||
ThemeFontFamilySetting(currentFontFamily: state.font),
|
ThemeFontFamilySetting(
|
||||||
|
currentFontFamily: state.font,
|
||||||
|
),
|
||||||
const Divider(),
|
const Divider(),
|
||||||
LayoutDirectionSetting(
|
LayoutDirectionSetting(
|
||||||
currentLayoutDirection: state.layoutDirection,
|
currentLayoutDirection: state.layoutDirection,
|
||||||
),
|
),
|
||||||
TextDirectionSetting(currentTextDirection: state.textDirection),
|
TextDirectionSetting(
|
||||||
|
currentTextDirection: state.textDirection,
|
||||||
|
),
|
||||||
const Divider(),
|
const Divider(),
|
||||||
DateFormatSetting(currentFormat: state.dateFormat),
|
DateFormatSetting(
|
||||||
TimeFormatSetting(currentFormat: state.timeFormat),
|
currentFormat: state.dateFormat,
|
||||||
|
),
|
||||||
|
TimeFormatSetting(
|
||||||
|
currentFormat: state.timeFormat,
|
||||||
|
),
|
||||||
const Divider(),
|
const Divider(),
|
||||||
CreateFileSettings(),
|
CreateFileSettings(),
|
||||||
],
|
],
|
||||||
|
@ -19,6 +19,9 @@ class SettingsMenu extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final bool showSyncSetting = isCloudEnabled &&
|
||||||
|
context.read<SettingsDialogBloc>().state.userProfile.authType !=
|
||||||
|
AuthTypePB.Local;
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
SettingsMenuElement(
|
SettingsMenuElement(
|
||||||
@ -58,11 +61,12 @@ class SettingsMenu extends StatelessWidget {
|
|||||||
icon: Icons.account_box_outlined,
|
icon: Icons.account_box_outlined,
|
||||||
changeSelectedPage: changeSelectedPage,
|
changeSelectedPage: changeSelectedPage,
|
||||||
),
|
),
|
||||||
|
if (showSyncSetting)
|
||||||
|
const SizedBox(
|
||||||
|
height: 10,
|
||||||
|
),
|
||||||
// Only show supabase setting if supabase is enabled and the current auth type is not local
|
// Only show supabase setting if supabase is enabled and the current auth type is not local
|
||||||
if (isCloudEnabled &&
|
if (showSyncSetting)
|
||||||
context.read<SettingsDialogBloc>().state.userProfile.authType !=
|
|
||||||
AuthTypePB.Local)
|
|
||||||
SettingsMenuElement(
|
SettingsMenuElement(
|
||||||
page: SettingsPage.syncSetting,
|
page: SettingsPage.syncSetting,
|
||||||
selectedPage: currentPage,
|
selectedPage: currentPage,
|
||||||
|
@ -9,8 +9,10 @@ class FlowyTooltip {
|
|||||||
bool? preferBelow,
|
bool? preferBelow,
|
||||||
Duration? showDuration,
|
Duration? showDuration,
|
||||||
Widget? child,
|
Widget? child,
|
||||||
|
EdgeInsetsGeometry? margin,
|
||||||
}) {
|
}) {
|
||||||
return Tooltip(
|
return Tooltip(
|
||||||
|
margin: margin,
|
||||||
waitDuration: _tooltipWaitDuration,
|
waitDuration: _tooltipWaitDuration,
|
||||||
message: message,
|
message: message,
|
||||||
richMessage: richMessage,
|
richMessage: richMessage,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user