mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
feat: text and layout direction settings (#3247)
* feat: text and layout direction settings Added ltr|rtl|auto direction button to appflowy toolbar. Introduced layout and default direction settings. * chore: formate code * feat: added hint for direction settings * fix: flutter analyze --------- Co-authored-by: Lucas.Xu <lucas.xu@appflowy.io>
This commit is contained in:
committed by
GitHub
parent
5f4e3ecc76
commit
9565173baf
@ -50,6 +50,16 @@ pub struct AppearanceSettingsPB {
|
||||
#[pb(index = 9)]
|
||||
#[serde(default)]
|
||||
pub menu_offset: f64,
|
||||
|
||||
#[pb(index = 10)]
|
||||
#[serde(default)]
|
||||
pub layout_direction: LayoutDirectionPB,
|
||||
|
||||
// If the value is FALLBACK which is the default value then it will fall back
|
||||
// to layout direction and it will use that as default text direction.
|
||||
#[pb(index = 11)]
|
||||
#[serde(default)]
|
||||
pub text_direction: TextDirectionPB,
|
||||
}
|
||||
|
||||
const DEFAULT_RESET_VALUE: fn() -> bool = || APPEARANCE_RESET_AS_DEFAULT;
|
||||
@ -62,6 +72,22 @@ pub enum ThemeModePB {
|
||||
System = 2,
|
||||
}
|
||||
|
||||
#[derive(ProtoBuf_Enum, Serialize, Deserialize, Clone, Debug, Default)]
|
||||
pub enum LayoutDirectionPB {
|
||||
#[default]
|
||||
LTRLayout = 0,
|
||||
RTLLayout = 1,
|
||||
}
|
||||
|
||||
#[derive(ProtoBuf_Enum, Serialize, Deserialize, Clone, Debug, Default)]
|
||||
pub enum TextDirectionPB {
|
||||
LTR = 0,
|
||||
RTL = 1,
|
||||
AUTO = 2,
|
||||
#[default]
|
||||
FALLBACK = 3,
|
||||
}
|
||||
|
||||
#[derive(ProtoBuf, Serialize, Deserialize, Debug, Clone)]
|
||||
pub struct LocaleSettingsPB {
|
||||
#[pb(index = 1)]
|
||||
@ -99,6 +125,8 @@ impl std::default::Default for AppearanceSettingsPB {
|
||||
setting_key_value: HashMap::default(),
|
||||
is_menu_collapsed: APPEARANCE_DEFAULT_IS_MENU_COLLAPSED,
|
||||
menu_offset: APPEARANCE_DEFAULT_MENU_OFFSET,
|
||||
layout_direction: LayoutDirectionPB::default(),
|
||||
text_direction: TextDirectionPB::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user