refactor: add setting documentation and support save key/value in setting

This commit is contained in:
appflowy
2022-09-28 11:44:44 +08:00
parent 82182d7872
commit 908d005737
12 changed files with 127 additions and 72 deletions

View File

@ -104,8 +104,8 @@ class _BoardContentState extends State<BoardContent> {
Widget _buildBoard(BuildContext context) {
return ChangeNotifierProvider.value(
value: Provider.of<AppearanceSettingModel>(context, listen: true),
child: Selector<AppearanceSettingModel, AppTheme>(
value: Provider.of<AppearanceSetting>(context, listen: true),
child: Selector<AppearanceSetting, AppTheme>(
selector: (ctx, notifier) => notifier.theme,
builder: (ctx, theme, child) => Expanded(
child: AppFlowyBoard(
@ -331,8 +331,8 @@ class _ToolbarBlocAdaptor extends StatelessWidget {
);
return ChangeNotifierProvider.value(
value: Provider.of<AppearanceSettingModel>(context, listen: true),
child: Selector<AppearanceSettingModel, AppTheme>(
value: Provider.of<AppearanceSetting>(context, listen: true),
child: Selector<AppearanceSetting, AppTheme>(
selector: (ctx, notifier) => notifier.theme,
builder: (ctx, theme, child) {
return BoardToolbar(toolbarContext: toolbarContext);

View File

@ -131,8 +131,8 @@ class DocumentShareButton extends StatelessWidget {
child: BlocBuilder<DocShareBloc, DocShareState>(
builder: (context, state) {
return ChangeNotifierProvider.value(
value: Provider.of<AppearanceSettingModel>(context, listen: true),
child: Selector<AppearanceSettingModel, Locale>(
value: Provider.of<AppearanceSetting>(context, listen: true),
child: Selector<AppearanceSetting, Locale>(
selector: (ctx, notifier) => notifier.locale,
builder: (ctx, _, child) => ConstrainedBox(
constraints: const BoxConstraints.expand(

View File

@ -134,7 +134,7 @@ class _DocumentPageState extends State<DocumentPage> {
Widget _renderToolbar(quill.QuillController controller) {
return ChangeNotifierProvider.value(
value: Provider.of<AppearanceSettingModel>(context, listen: true),
value: Provider.of<AppearanceSetting>(context, listen: true),
child: EditorToolbar.basic(
controller: controller,
),

View File

@ -33,8 +33,8 @@ class MenuTrash extends StatelessWidget {
Widget _render(BuildContext context) {
return Row(children: [
ChangeNotifierProvider.value(
value: Provider.of<AppearanceSettingModel>(context, listen: true),
child: Selector<AppearanceSettingModel, AppTheme>(
value: Provider.of<AppearanceSetting>(context, listen: true),
child: Selector<AppearanceSetting, AppTheme>(
selector: (ctx, notifier) => notifier.theme,
builder: (ctx, theme, child) => SizedBox(
width: 16,
@ -44,8 +44,8 @@ class MenuTrash extends StatelessWidget {
),
const HSpace(6),
ChangeNotifierProvider.value(
value: Provider.of<AppearanceSettingModel>(context, listen: true),
child: Selector<AppearanceSettingModel, Locale>(
value: Provider.of<AppearanceSetting>(context, listen: true),
child: Selector<AppearanceSetting, Locale>(
selector: (ctx, notifier) => notifier.locale,
builder: (ctx, _, child) =>
FlowyText.medium(LocaleKeys.trash_text.tr(), fontSize: 12),