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.

137 lines
4.4 KiB

part of 'neon_notes.dart';
3 years ago
class NotesAppSpecificOptions extends NextcloudAppOptions {
3 years ago
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,
3 years ago
);
final notesCategory = OptionsCategory(
name: (final context) => AppLocalizations.of(context).notes,
3 years ago
);
final categoriesCategory = OptionsCategory(
name: (final context) => AppLocalizations.of(context).categories,
3 years ago
);
late final defaultCategoryOption = SelectOption<DefaultCategory>(
storage: super.storage,
category: generalCategory,
key: NotesOptionKeys.defaultCategory,
label: (final context) => AppLocalizations.of(context).optionsDefaultCategory,
defaultValue: DefaultCategory.notes,
values: {
DefaultCategory.notes: (final context) => AppLocalizations.of(context).notes,
DefaultCategory.categories: (final context) => AppLocalizations.of(context).categories,
},
3 years ago
);
late final defaultNoteViewTypeOption = SelectOption<DefaultNoteViewType>(
storage: super.storage,
category: generalCategory,
key: NotesOptionKeys.defaultNoteViewType,
label: (final context) => AppLocalizations.of(context).optionsDefaultNoteViewType,
defaultValue: DefaultNoteViewType.preview,
values: {
DefaultNoteViewType.preview: (final context) => AppLocalizations.of(context).optionsDefaultNoteViewTypePreview,
DefaultNoteViewType.edit: (final context) => AppLocalizations.of(context).optionsDefaultNoteViewTypeEdit,
},
3 years ago
);
late final notesSortPropertyOption = SelectOption<NotesSortProperty>(
storage: super.storage,
category: notesCategory,
key: NotesOptionKeys.notesSortProperty,
label: (final context) => AppLocalizations.of(context).optionsNotesSortProperty,
defaultValue: NotesSortProperty.lastModified,
values: {
3 years ago
NotesSortProperty.lastModified: (final context) =>
AppLocalizations.of(context).optionsNotesSortPropertyLastModified,
3 years ago
NotesSortProperty.alphabetical: (final context) =>
AppLocalizations.of(context).optionsNotesSortPropertyAlphabetical,
},
3 years ago
);
late final notesSortBoxOrderOption = SelectOption<SortBoxOrder>(
storage: super.storage,
category: notesCategory,
key: NotesOptionKeys.notesSortBoxOrder,
label: (final context) => AppLocalizations.of(context).optionsNotesSortOrder,
defaultValue: SortBoxOrder.descending,
values: sortBoxOrderOptionValues,
3 years ago
);
late final categoriesSortPropertyOption = SelectOption<CategoriesSortProperty>(
storage: super.storage,
category: categoriesCategory,
key: NotesOptionKeys.categoriesSortProperty,
label: (final context) => AppLocalizations.of(context).optionsCategoriesSortProperty,
defaultValue: CategoriesSortProperty.alphabetical,
values: {
3 years ago
CategoriesSortProperty.alphabetical: (final context) =>
AppLocalizations.of(context).optionsCategoriesSortPropertyAlphabetical,
3 years ago
CategoriesSortProperty.notesCount: (final context) =>
AppLocalizations.of(context).optionsCategoriesSortPropertyNotesCount,
},
3 years ago
);
late final categoriesSortBoxOrderOption = SelectOption<SortBoxOrder>(
storage: super.storage,
category: categoriesCategory,
key: NotesOptionKeys.categoriesSortBoxOrder,
label: (final context) => AppLocalizations.of(context).optionsCategoriesSortOrder,
defaultValue: SortBoxOrder.ascending,
values: sortBoxOrderOptionValues,
3 years ago
);
}
enum NotesOptionKeys implements Storable {
defaultCategory._('default-category'),
defaultNoteViewType._('default-note-view-type'),
notesSortProperty._('notes-sort-property'),
notesSortBoxOrder._('notes-sort-box-order'),
categoriesSortProperty._('categories-sort-property'),
categoriesSortBoxOrder._('categories-sort-box-order');
const NotesOptionKeys._(this.value);
@override
final String value;
}
3 years ago
enum DefaultNoteViewType {
preview,
edit,
}
enum NotesSortProperty {
lastModified,
alphabetical,
favorite,
3 years ago
}
enum CategoriesSortProperty {
alphabetical,
notesCount,
}
enum DefaultCategory {
notes,
categories,
}