mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
chore: added a tooltip to theme mode for toggling theme
This commit is contained in:
parent
70915df5ad
commit
bcd116797d
@ -17,6 +17,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
|||||||
import 'package:google_fonts/google_fonts.dart';
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
|
|
||||||
import 'levenshtein.dart';
|
import 'levenshtein.dart';
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
class SettingsAppearanceView extends StatelessWidget {
|
class SettingsAppearanceView extends StatelessWidget {
|
||||||
const SettingsAppearanceView({Key? key}) : super(key: key);
|
const SettingsAppearanceView({Key? key}) : super(key: key);
|
||||||
@ -216,20 +217,36 @@ class BrightnessSetting extends StatelessWidget {
|
|||||||
const BrightnessSetting({required this.currentThemeMode, super.key});
|
const BrightnessSetting({required this.currentThemeMode, super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) => Tooltip(
|
||||||
return ThemeSettingDropDown(
|
richMessage: themeModeTooltipTextSpan(
|
||||||
label: LocaleKeys.settings_appearance_themeMode_label.tr(),
|
context,
|
||||||
currentValue: _themeModeLabelText(currentThemeMode),
|
LocaleKeys.settings_appearance_themeMode_label.tr(),
|
||||||
popupBuilder: (_) => Column(
|
),
|
||||||
mainAxisSize: MainAxisSize.min,
|
child: ThemeSettingDropDown(
|
||||||
|
label: LocaleKeys.settings_appearance_themeMode_label.tr(),
|
||||||
|
currentValue: _themeModeLabelText(currentThemeMode),
|
||||||
|
popupBuilder: (_) => Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
_themeModeItemButton(context, ThemeMode.light),
|
||||||
|
_themeModeItemButton(context, ThemeMode.dark),
|
||||||
|
_themeModeItemButton(context, ThemeMode.system),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
TextSpan themeModeTooltipTextSpan(BuildContext context, String hintText) =>
|
||||||
|
TextSpan(
|
||||||
children: [
|
children: [
|
||||||
_themeModeItemButton(context, ThemeMode.light),
|
TextSpan(
|
||||||
_themeModeItemButton(context, ThemeMode.dark),
|
text: "$hintText\n",
|
||||||
_themeModeItemButton(context, ThemeMode.system),
|
),
|
||||||
|
TextSpan(
|
||||||
|
text: Platform.isMacOS ? "⌘+Shift+L" : "Ctrl+Shift+L",
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _themeModeItemButton(BuildContext context, ThemeMode themeMode) {
|
Widget _themeModeItemButton(BuildContext context, ThemeMode themeMode) {
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
|
Loading…
Reference in New Issue
Block a user