A framework for building convergent cross-platform Nextcloud clients using Flutter.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

122 lines
4.2 KiB

part of 'neon_notes.dart';
2 years ago
class NotesAppSpecificOptions extends NextcloudAppSpecificOptions {
NotesAppSpecificOptions(super.storage) {
super.categories = [
generalCategory,
notesCategory,
categoriesCategory,
];
super.options = [
defaultCategoryOption,
defaultNoteViewTypeOption,
notesSortPropertyOption,
notesSortBoxOrderOption,
categoriesSortPropertyOption,
categoriesSortBoxOrderOption,
];
}
final generalCategory = OptionsCategory(
name: (final context) => AppLocalizations.of(context).general,
2 years ago
);
final notesCategory = OptionsCategory(
name: (final context) => AppLocalizations.of(context).notes,
2 years ago
);
final categoriesCategory = OptionsCategory(
name: (final context) => AppLocalizations.of(context).categories,
2 years ago
);
late final defaultCategoryOption = SelectOption<DefaultCategory>(
storage: super.storage,
category: generalCategory,
key: 'default-category',
label: (final context) => AppLocalizations.of(context).optionsDefaultCategory,
2 years ago
defaultValue: BehaviorSubject.seeded(DefaultCategory.notes),
values: BehaviorSubject.seeded({
DefaultCategory.notes: (final context) => AppLocalizations.of(context).notes,
DefaultCategory.categories: (final context) => AppLocalizations.of(context).categories,
2 years ago
}),
);
late final defaultNoteViewTypeOption = SelectOption<DefaultNoteViewType>(
storage: super.storage,
category: generalCategory,
key: 'default-note-view-type',
label: (final context) => AppLocalizations.of(context).optionsDefaultNoteViewType,
2 years ago
defaultValue: BehaviorSubject.seeded(DefaultNoteViewType.preview),
values: BehaviorSubject.seeded({
DefaultNoteViewType.preview: (final context) => AppLocalizations.of(context).optionsDefaultNoteViewTypePreview,
DefaultNoteViewType.edit: (final context) => AppLocalizations.of(context).optionsDefaultNoteViewTypeEdit,
2 years ago
}),
);
late final notesSortPropertyOption = SelectOption<NotesSortProperty>(
storage: super.storage,
category: notesCategory,
key: 'notes-sort-property',
label: (final context) => AppLocalizations.of(context).optionsNotesSortProperty,
2 years ago
defaultValue: BehaviorSubject.seeded(NotesSortProperty.lastModified),
values: BehaviorSubject.seeded({
NotesSortProperty.lastModified: (final context) =>
AppLocalizations.of(context).optionsNotesSortPropertyLastModified,
2 years ago
NotesSortProperty.alphabetical: (final context) =>
AppLocalizations.of(context).optionsNotesSortPropertyAlphabetical,
2 years ago
}),
);
late final notesSortBoxOrderOption = SelectOption<SortBoxOrder>(
storage: super.storage,
category: notesCategory,
key: 'notes-sort-box-order',
label: (final context) => AppLocalizations.of(context).optionsNotesSortOrder,
2 years ago
defaultValue: BehaviorSubject.seeded(SortBoxOrder.descending),
values: BehaviorSubject.seeded(sortBoxOrderOptionValues),
);
late final categoriesSortPropertyOption = SelectOption<CategoriesSortProperty>(
storage: super.storage,
category: categoriesCategory,
key: 'categories-sort-property',
label: (final context) => AppLocalizations.of(context).optionsCategoriesSortProperty,
2 years ago
defaultValue: BehaviorSubject.seeded(CategoriesSortProperty.alphabetical),
values: BehaviorSubject.seeded({
CategoriesSortProperty.alphabetical: (final context) =>
AppLocalizations.of(context).optionsCategoriesSortPropertyAlphabetical,
2 years ago
CategoriesSortProperty.notesCount: (final context) =>
AppLocalizations.of(context).optionsCategoriesSortPropertyNotesCount,
2 years ago
}),
);
late final categoriesSortBoxOrderOption = SelectOption<SortBoxOrder>(
storage: super.storage,
category: categoriesCategory,
key: 'categories-sort-box-order',
label: (final context) => AppLocalizations.of(context).optionsCategoriesSortOrder,
2 years ago
defaultValue: BehaviorSubject.seeded(SortBoxOrder.ascending),
values: BehaviorSubject.seeded(sortBoxOrderOptionValues),
);
}
enum DefaultNoteViewType {
preview,
edit,
}
enum NotesSortProperty {
lastModified,
alphabetical,
}
enum CategoriesSortProperty {
alphabetical,
notesCount,
}
enum DefaultCategory {
notes,
categories,
}