Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .ndk-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
r26d
r27
8 changes: 4 additions & 4 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ android.applicationVariants.all { variant ->
android {
namespace = "com.maelchiotti.localmaterialnotes"
compileSdk = flutter.compileSdkVersion
ndkVersion = flutter.ndkVersion
ndkVersion = "27.0.12077973"

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
jvmTarget = JavaVersion.VERSION_11
}

dependenciesInfo {
Expand Down
2 changes: 1 addition & 1 deletion android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError
org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError
android.useAndroidX=true
android.enableJetifier=true
4 changes: 2 additions & 2 deletions android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip
distributionSha256Sum=bb09982fdf52718e4c7b25023d10df6d35a5fff969860bdf5a5bd27a3ab27a9e
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
distributionSha256Sum=2ab88d6de2c23e6adae7363ae6e29cbdd2a709e992929b48b6530fd0c7133bd6
2 changes: 1 addition & 1 deletion android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pluginManagement {

plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "8.1.0" apply false
id "com.android.application" version "8.7.0" apply false
id "org.jetbrains.kotlin.android" version "1.8.22" apply false
}

Expand Down
16 changes: 6 additions & 10 deletions lib/common/actions/notes/delete.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,9 @@ Future<bool> deleteNote(
SnackBarUtils().show(
context,
text: context.l.snack_bar_deleted(1),
onCancel:
(globalRef) async =>
wasArchived
? await archiveNote(context, globalRef, note: note, cancel: false)
: await restoreNote(context, globalRef, note: note, cancel: false),
onCancel: (globalRef) async => wasArchived
? await archiveNote(context, globalRef, note: note, cancel: false)
: await restoreNote(context, globalRef, note: note, cancel: false),
);
}

Expand Down Expand Up @@ -87,11 +85,9 @@ Future<bool> deleteNotes(BuildContext context, WidgetRef ref, {required List<Not
SnackBarUtils().show(
context,
text: context.l.snack_bar_deleted(notes.length),
onCancel:
(globalRef) async =>
wereArchived
? await archiveNotes(context, ref, notes: notes)
: await restoreNotes(context, globalRef, notes: notes, cancel: false),
onCancel: (globalRef) async => wereArchived
? await archiveNotes(context, ref, notes: notes)
: await restoreNotes(context, globalRef, notes: notes, cancel: false),
);
}

Expand Down
17 changes: 8 additions & 9 deletions lib/common/dialogs/confirmation_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@ Future<bool> _showConfirmationDialog(BuildContext context, String title, String
await showAdaptiveDialog<bool>(
context: context,
useRootNavigator: false,
builder:
(context) => AlertDialog.adaptive(
title: Text(title),
content: SingleChildScrollView(child: Column(children: [Text(body)])),
actions: [
TextButton(onPressed: () => Navigator.pop(context, false), child: Text(context.fl.cancelButtonLabel)),
TextButton(onPressed: () => Navigator.pop(context, true), child: Text(confirmText)),
],
),
builder: (context) => AlertDialog.adaptive(
title: Text(title),
content: SingleChildScrollView(child: Column(children: [Text(body)])),
actions: [
TextButton(onPressed: () => Navigator.pop(context, false), child: Text(context.fl.cancelButtonLabel)),
TextButton(onPressed: () => Navigator.pop(context, true), child: Text(confirmText)),
],
),
) ??
false;

Expand Down
185 changes: 85 additions & 100 deletions lib/common/navigation/app_bars/notes/editor_app_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -152,107 +152,92 @@ class _BackAppBarState extends ConsumerState<EditorAppBar> {
final lockNote = PreferenceKey.lockNote.preferenceOrDefault;

return ValueListenableBuilder(
valueListenable: editorHasFocusNotifier,
builder: (context, editorHasFocus, child) {
return ValueListenableBuilder(
valueListenable: isEditModeNotifier,
builder: (context, isEditMode, child) {
return AppBar(
leading: BackButton(),
actions: [
if (note.status == NoteStatus.available) ...[
if (note.type == NoteType.richText) ...[
ValueListenableBuilder(
valueListenable: fleatherControllerCanUndoNotifier,
builder: (context, canUndo, child) {
final enableUndo =
editorHasFocus &&
canUndo &&
editorController != null &&
editorController.canUndo &&
isEditMode;

return IconButton(
icon: const Icon(Icons.undo),
tooltip: context.l.tooltip_undo,
onPressed: enableUndo ? undo : null,
);
},
),
ValueListenableBuilder(
valueListenable: fleatherControllerCanRedoNotifier,
builder: (context, canRedo, child) {
final enableRedo = editorHasFocus && canRedo && isEditMode;

return IconButton(
icon: const Icon(Icons.redo),
tooltip: context.l.tooltip_redo,
onPressed: enableRedo ? redo : null,
);
},
),
],
if (showEditorModeButton)
ValueListenableBuilder(
valueListenable: isEditModeNotifier,
builder:
(context, isEditMode, child) => IconButton(
icon: Icon(isEditMode ? Icons.visibility : Icons.edit),
tooltip:
isEditMode
? context.l.tooltip_fab_toggle_editor_mode_read
: context.l.tooltip_fab_toggle_editor_mode_edit,
onPressed: switchMode,
),
),
PopupMenuButton<EditorAvailableMenuOption>(
itemBuilder:
(context) => ([
EditorAvailableMenuOption.copy.popupMenuItem(context),
EditorAvailableMenuOption.share.popupMenuItem(context),
const PopupMenuDivider(),
if (note.pinned) EditorAvailableMenuOption.unpin.popupMenuItem(context),
if (!note.pinned) EditorAvailableMenuOption.pin.popupMenuItem(context),
if (lockNote && note.locked) EditorAvailableMenuOption.unlock.popupMenuItem(context),
if (lockNote && !note.locked) EditorAvailableMenuOption.lock.popupMenuItem(context),
if (enableLabels) EditorAvailableMenuOption.selectLabels.popupMenuItem(context),
const PopupMenuDivider(),
EditorAvailableMenuOption.archive.popupMenuItem(context),
EditorAvailableMenuOption.delete.popupMenuItem(context),
const PopupMenuDivider(),
EditorAvailableMenuOption.about.popupMenuItem(context),
]),
onSelected: onAvailableMenuOptionSelected,
),
],
if (note.status == NoteStatus.archived)
PopupMenuButton<EditorArchivedMenuOption>(
itemBuilder:
(context) => ([
EditorArchivedMenuOption.copy.popupMenuItem(context),
EditorArchivedMenuOption.share.popupMenuItem(context),
const PopupMenuDivider(),
EditorArchivedMenuOption.unarchive.popupMenuItem(context),
const PopupMenuDivider(),
EditorArchivedMenuOption.about.popupMenuItem(context),
]),
onSelected: onArchivedMenuOptionSelected,
),
if (note.status == NoteStatus.deleted)
PopupMenuButton<EditorDeletedMenuOption>(
itemBuilder:
(context) => ([
EditorDeletedMenuOption.restore.popupMenuItem(context),
EditorDeletedMenuOption.deletePermanently.popupMenuItem(context),
const PopupMenuDivider(),
EditorDeletedMenuOption.about.popupMenuItem(context),
]),
onSelected: onDeletedMenuOptionSelected,
),
Gap(Sizes.appBarEnd.size),
valueListenable: isEditModeNotifier,
builder: (context, isEditMode, child) {
return AppBar(
leading: BackButton(),
actions: [
if (note.status == NoteStatus.available) ...[
if (note.type == NoteType.richText) ...[
ValueListenableBuilder(
valueListenable: fleatherControllerCanUndoNotifier,
builder: (context, canUndo, child) {
final enableUndo = canUndo && editorController != null && isEditMode;

return IconButton(
icon: const Icon(Icons.undo),
tooltip: context.l.tooltip_undo,
onPressed: enableUndo ? undo : null,
);
},
),
ValueListenableBuilder(
valueListenable: fleatherControllerCanRedoNotifier,
builder: (context, canRedo, child) {
final enableRedo = canRedo && editorController != null && isEditMode;

return IconButton(
icon: const Icon(Icons.redo),
tooltip: context.l.tooltip_redo,
onPressed: enableRedo ? redo : null,
);
},
),
],
);
},
if (showEditorModeButton)
ValueListenableBuilder(
valueListenable: isEditModeNotifier,
builder: (context, isEditMode, child) => IconButton(
icon: Icon(isEditMode ? Icons.visibility : Icons.edit),
tooltip: isEditMode
? context.l.tooltip_fab_toggle_editor_mode_read
: context.l.tooltip_fab_toggle_editor_mode_edit,
onPressed: switchMode,
),
),
PopupMenuButton<EditorAvailableMenuOption>(
itemBuilder: (context) => ([
EditorAvailableMenuOption.copy.popupMenuItem(context),
EditorAvailableMenuOption.share.popupMenuItem(context),
const PopupMenuDivider(),
if (note.pinned) EditorAvailableMenuOption.unpin.popupMenuItem(context),
if (!note.pinned) EditorAvailableMenuOption.pin.popupMenuItem(context),
if (lockNote && note.locked) EditorAvailableMenuOption.unlock.popupMenuItem(context),
if (lockNote && !note.locked) EditorAvailableMenuOption.lock.popupMenuItem(context),
if (enableLabels) EditorAvailableMenuOption.selectLabels.popupMenuItem(context),
const PopupMenuDivider(),
EditorAvailableMenuOption.archive.popupMenuItem(context),
EditorAvailableMenuOption.delete.popupMenuItem(context),
const PopupMenuDivider(),
EditorAvailableMenuOption.about.popupMenuItem(context),
]),
onSelected: onAvailableMenuOptionSelected,
),
],
if (note.status == NoteStatus.archived)
PopupMenuButton<EditorArchivedMenuOption>(
itemBuilder: (context) => ([
EditorArchivedMenuOption.copy.popupMenuItem(context),
EditorArchivedMenuOption.share.popupMenuItem(context),
const PopupMenuDivider(),
EditorArchivedMenuOption.unarchive.popupMenuItem(context),
const PopupMenuDivider(),
EditorArchivedMenuOption.about.popupMenuItem(context),
]),
onSelected: onArchivedMenuOptionSelected,
),
if (note.status == NoteStatus.deleted)
PopupMenuButton<EditorDeletedMenuOption>(
itemBuilder: (context) => ([
EditorDeletedMenuOption.restore.popupMenuItem(context),
EditorDeletedMenuOption.deletePermanently.popupMenuItem(context),
const PopupMenuDivider(),
EditorDeletedMenuOption.about.popupMenuItem(context),
]),
onSelected: onDeletedMenuOptionSelected,
),
Gap(Sizes.appBarEnd.size),
],
);
},
);
Expand Down
84 changes: 41 additions & 43 deletions lib/common/navigation/app_bars/notes/notes_app_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,11 @@ class NotesAppBar extends ConsumerWidget {
viewHintText: context.l.tooltip_search,
searchController: SearchController(),
viewBackgroundColor: Theme.of(context).colorScheme.surface,
builder:
(context, controller) => IconButton(
onPressed: () => controller.openView(),
icon: const Icon(Icons.search),
tooltip: context.l.tooltip_search,
),
builder: (context, controller) => IconButton(
onPressed: () => controller.openView(),
icon: const Icon(Icons.search),
tooltip: context.l.tooltip_search,
),
suggestionsBuilder: (context, controller) => searchNotes(controller.text),
);
}
Expand All @@ -146,44 +145,43 @@ class NotesAppBar extends ConsumerWidget {
PopupMenuButton<SortMethod>(
icon: const Icon(Icons.sort),
tooltip: context.l.tooltip_sort,
itemBuilder:
(context) => [
PopupMenuItem(
value: SortMethod.createdDate,
child: ListTile(
selected: sortMethod == SortMethod.createdDate,
leading: const Icon(Symbols.calendar_add_on),
title: Text(context.l.button_sort_creation_date),
),
),
PopupMenuItem(
value: SortMethod.editedDate,
child: ListTile(
selected: sortMethod == SortMethod.editedDate,
leading: const Icon(Icons.edit_calendar),
title: Text(context.l.button_sort_edition_date),
),
),
PopupMenuItem(
value: SortMethod.title,
child: ListTile(
selected: sortMethod == SortMethod.title,
leading: const Icon(Icons.sort_by_alpha),
title: Text(context.l.button_sort_title),
),
),
const PopupMenuDivider(),
PopupMenuItem(
value: SortMethod.ascending,
child: ListTile(
title: Text(context.l.button_sort_ascending),
trailing: Checkbox(
value: sortAscending,
onChanged: (ascending) => sort(context, ref, ascending: ascending),
),
),
itemBuilder: (context) => [
PopupMenuItem(
value: SortMethod.createdDate,
child: ListTile(
selected: sortMethod == SortMethod.createdDate,
leading: const Icon(Symbols.calendar_add_on),
title: Text(context.l.button_sort_creation_date),
),
),
PopupMenuItem(
value: SortMethod.editedDate,
child: ListTile(
selected: sortMethod == SortMethod.editedDate,
leading: const Icon(Icons.edit_calendar),
title: Text(context.l.button_sort_edition_date),
),
),
PopupMenuItem(
value: SortMethod.title,
child: ListTile(
selected: sortMethod == SortMethod.title,
leading: const Icon(Icons.sort_by_alpha),
title: Text(context.l.button_sort_title),
),
),
const PopupMenuDivider(),
PopupMenuItem(
value: SortMethod.ascending,
child: ListTile(
title: Text(context.l.button_sort_ascending),
trailing: Checkbox(
value: sortAscending,
onChanged: (ascending) => sort(context, ref, ascending: ascending),
),
],
),
),
],
onSelected: (sortMethod) => sort(context, ref, sortMethod: sortMethod),
),
ref
Expand Down
Loading