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 .fvmrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"flutter": "3.44.0"
"flutter": "3.47.9"
}
7 changes: 5 additions & 2 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
include: package:flutter_lints/flutter.yaml

plugins:
riverpod_lint: ^3.1.9

formatter:
page_width: 120

analyzer:
exclude:
- '**.g.dart'
plugins:
- custom_lint
- build/**
- android/**
language:
strict-inference: true

Expand Down
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.13-all.zip
distributionSha256Sum=fba8464465835e74f7270bbf43d6d8a8d7709ab0a43ce1aa3323f73e9aa0c612
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-all.zip
distributionSha256Sum=17f277867f6914d61b1aa02efab1ba7bb439ad652ca485cd8ca6842fccec6e43
4 changes: 2 additions & 2 deletions android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ pluginManagement {

plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version '8.13.2' apply false
id "org.jetbrains.kotlin.android" version "2.1.0" apply false
id "com.android.application" version '9.1.0' apply false
id "org.jetbrains.kotlin.android" version "2.4.0" apply false
}

include ":app"
12 changes: 4 additions & 8 deletions lib/common/constants/notes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ final screenshotNotes = [
createdTime: DateTime(2000, 01, 01, 12),
editedTime: DateTime(2000, 01, 01, 12),
title: "Welcome to Material Notes",
content:
'[{"insert":"Simple","attributes":{"b":true}},{"insert":", "},{"insert":"local","attributes":{"i":true}},{"insert":", "},{"insert":"material design","attributes":{"u":true}},{"insert":" notes\\n"}]',
content: '[{"insert":"Simple","attributes":{"b":true}},{"insert":", "},{"insert":"local","attributes":{"i":true}},{"insert":", "},{"insert":"material design","attributes":{"u":true}},{"insert":" notes\\n"}]',
),
RichTextNote(
archived: false,
Expand All @@ -31,8 +30,7 @@ final screenshotNotes = [
createdTime: DateTime(2000, 01, 01, 11, 55),
editedTime: DateTime(2000, 01, 01, 11, 55),
title: "Take notes",
content:
'[{"insert":"Write text notes"},{"insert":"\\n","attributes":{"block":"cl","checked":true}},{"insert":"Use plain text, markdown, rich text or checklist notes"},{"insert":"\\n","attributes":{"block":"cl","checked":true}},{"insert":"Use quick action to add from your home screen"},{"insert":"\\n","attributes":{"block":"cl","checked":true}}]',
content: '[{"insert":"Write text notes"},{"insert":"\\n","attributes":{"block":"cl","checked":true}},{"insert":"Use plain text, markdown, rich text or checklist notes"},{"insert":"\\n","attributes":{"block":"cl","checked":true}},{"insert":"Use quick action to add from your home screen"},{"insert":"\\n","attributes":{"block":"cl","checked":true}}]',
),
RichTextNote(
archived: false,
Expand All @@ -59,8 +57,7 @@ final screenshotNotes = [
createdTime: DateTime(2000, 01, 01, 11, 45),
editedTime: DateTime(2000, 01, 01, 11, 45),
title: "Share & backup",
content:
'[{"insert":"Create a note from shared text\\nShare notes as text and export as Markdown\\nBackup notes as JSON\\n"}]',
content: '[{"insert":"Create a note from shared text\\nShare notes as text and export as Markdown\\nBackup notes as JSON\\n"}]',
),
RichTextNote(
archived: false,
Expand All @@ -79,8 +76,7 @@ final screenshotNotes = [
createdTime: DateTime(2000, 01, 01, 11, 40),
editedTime: DateTime(2000, 01, 01, 11, 40),
title: "Customize",
content:
"[{\"insert\":\"Choose your language\\nChoose your theme (including black and dynamic)\\nHide features you don't need\\n\"}]",
content: "[{\"insert\":\"Choose your language\\nChoose your theme (including black and dynamic)\\nHide features you don't need\\n\"}]",
),
RichTextNote(
archived: false,
Expand Down
1 change: 1 addition & 0 deletions lib/common/extensions/color_extension.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';

import '../constants/constants.dart';

/// Extensions on the [Color] class.
Expand Down
1 change: 1 addition & 0 deletions lib/common/extensions/text_style_extension.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';

import 'color_extension.dart';

/// Extensions on the [TextStyle] class.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,8 @@ enum EditorDeletedMenuOption {
leading: Icon(icon, color: dangerous ? Theme.of(context).colorScheme.error : null),
title: Text(
title(context),
style: Theme.of(
context,
).textTheme.titleSmall?.copyWith(color: dangerous ? Theme.of(context).colorScheme.error : null),
style: Theme.of(context).textTheme.titleSmall
?.copyWith(color: dangerous ? Theme.of(context).colorScheme.error : null),
),
),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,8 @@ enum SelectionLabelsMenuOption {
leading: Icon(icon, color: dangerous ? Theme.of(context).colorScheme.error : null),
title: Text(
title(context),
style: Theme.of(
context,
).textTheme.titleSmall?.copyWith(color: dangerous ? Theme.of(context).colorScheme.error : null),
style: Theme.of(context).textTheme.titleSmall
?.copyWith(color: dangerous ? Theme.of(context).colorScheme.error : null),
),
),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,8 @@ enum SelectionDeletedMenuOption {
leading: Icon(icon, color: dangerous ? Theme.of(context).colorScheme.error : null),
title: Text(
title(context),
style: Theme.of(
context,
).textTheme.titleSmall?.copyWith(color: dangerous ? Theme.of(context).colorScheme.error : null),
style: Theme.of(context).textTheme.titleSmall
?.copyWith(color: dangerous ? Theme.of(context).colorScheme.error : null),
),
),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,8 @@ enum ArchivedSwipeAction {
Widget titleWidget(BuildContext context) {
return Text(
title(context),
style: Theme.of(
context,
).textTheme.titleMedium?.copyWith(color: Theme.of(context).colorScheme.onTertiaryContainer),
style: Theme.of(context).textTheme.titleMedium
?.copyWith(color: Theme.of(context).colorScheme.onTertiaryContainer),
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,8 @@ enum AvailableSwipeAction {
Widget titleWidget(BuildContext context) {
return Text(
title(context),
style: Theme.of(
context,
).textTheme.titleMedium?.copyWith(color: Theme.of(context).colorScheme.onTertiaryContainer),
style: Theme.of(context).textTheme.titleMedium
?.copyWith(color: Theme.of(context).colorScheme.onTertiaryContainer),
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,8 @@ enum LabelSwipeAction {
Widget titleWidget(BuildContext context) {
return Text(
title(context),
style: Theme.of(
context,
).textTheme.titleMedium?.copyWith(color: Theme.of(context).colorScheme.onTertiaryContainer),
style: Theme.of(context).textTheme.titleMedium
?.copyWith(color: Theme.of(context).colorScheme.onTertiaryContainer),
);
}

Expand Down
13 changes: 6 additions & 7 deletions lib/common/preferences/preferences_wrapper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,12 @@ class PreferencesWrapper {
}

return switch (T) {
== bool => _preferences.getBool(preferenceKey.name),
== int => _preferences.getInt(preferenceKey.name),
== double => _preferences.getDouble(preferenceKey.name),
== String => _preferences.getString(preferenceKey.name),
_ => throw ArgumentError('Invalid preference type: $T'),
}
as T?;
== bool => _preferences.getBool(preferenceKey.name),
== int => _preferences.getInt(preferenceKey.name),
== double => _preferences.getDouble(preferenceKey.name),
== String => _preferences.getString(preferenceKey.name),
_ => throw ArgumentError('Invalid preference type: $T'),
} as T?;
}
// On type conversion error, reset the preference to its default value
on TypeError catch (error) {
Expand Down
5 changes: 2 additions & 3 deletions lib/common/widgets/placeholders/empty_placeholder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,8 @@ class EmptyPlaceholder extends StatelessWidget {
Padding(padding: Paddings.vertical(16)),
Text(
text!,
style: Theme.of(
context,
).textTheme.headlineSmall?.copyWith(color: Theme.of(context).colorScheme.onSurfaceVariant),
style: Theme.of(context).textTheme.headlineSmall
?.copyWith(color: Theme.of(context).colorScheme.onSurfaceVariant),
),
],
),
Expand Down
6 changes: 3 additions & 3 deletions lib/pages/editor/editor_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ class _EditorState extends ConsumerState<EditorPage> {

savePendingNote(globalRef);

// ignore: avoid_ref_inside_state_dispose
// ignore: riverpod_lint/avoid_ref_inside_state_dispose
globalRef.read(notesProvider(status: NoteStatus.available).notifier).removeEmpty();
// ignore: avoid_ref_inside_state_dispose
// ignore: riverpod_lint/avoid_ref_inside_state_dispose
globalRef.read(notesProvider(status: NoteStatus.archived).notifier).removeEmpty();
if (currentLabelFilter != null) {
// ignore: avoid_ref_inside_state_dispose
// ignore: riverpod_lint/avoid_ref_inside_state_dispose
globalRef.read(notesProvider(status: NoteStatus.available, label: currentLabelFilter).notifier).removeEmpty();
}

Expand Down
38 changes: 28 additions & 10 deletions lib/pages/notes/widgets/add_note_fab.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:math' as math;

import 'package:flutter/material.dart';
import 'package:flutter_expandable_fab/flutter_expandable_fab.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
Expand Down Expand Up @@ -31,9 +33,31 @@ class _AddNoteFabState extends ConsumerState<AddNoteFab> {
canPopNotifier.update();
}

/// Builds the button that opens or closes the FAB, rotated according to the [progress] of the animation.
///
/// It replaces the `RotateFloatingActionButtonBuilder` of the package, whose buttons are built with
/// `autofocus: true`: when the FAB finishes closing, its button is built again and takes the focus,
/// which removes it from the editor that was opened in the meantime and closes the keyboard.
FloatingActionButtonBuilder buildToggleButton({required String heroTag, required IconData icon}) {
final themeSize = Theme.of(context).floatingActionButtonTheme.sizeConstraints?.maxWidth;

return FloatingActionButtonBuilder(
size: themeSize ?? DefaultFloatingActionButtonBuilder().size,
builder: (context, onPressed, progress) {
return AnimatedBuilder(
animation: progress,
builder: (context, _) {
return Transform.rotate(
angle: progress.value * math.pi / 2,
child: FloatingActionButton(heroTag: heroTag, onPressed: onPressed, child: Icon(icon)),
);
},
);
},
);
}

void onPressed(NoteType noteType) {
// Close the FAB before opening the editor, otherwise closing it during the transition removes the focus
// from the editor and closes the keyboard
closeAddNoteFabIfOpen();

addNote(context, ref, noteType: noteType);
Expand All @@ -54,14 +78,8 @@ class _AddNoteFabState extends ConsumerState<AddNoteFab> {
type: ExpandableFabType.up,
childrenAnimation: ExpandableFabAnimation.none,
distance: 64,
openButtonBuilder: RotateFloatingActionButtonBuilder(
heroTag: '<open add note FAB hero tag>',
child: const Icon(Icons.add),
),
closeButtonBuilder: RotateFloatingActionButtonBuilder(
heroTag: '<close add note FAB hero tag>',
child: const Icon(Icons.close),
),
openButtonBuilder: buildToggleButton(heroTag: '<open add note FAB hero tag>', icon: Icons.add),
closeButtonBuilder: buildToggleButton(heroTag: '<close add note FAB hero tag>', icon: Icons.close),
afterOpen: onOpen,
afterClose: onClose,
children: [
Expand Down
1 change: 1 addition & 0 deletions lib/providers/preferences/preferences_provider.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import '../../common/preferences/watched_preferences.dart';

import 'package:riverpod_annotation/riverpod_annotation.dart';

part 'preferences_provider.g.dart';
Expand Down
4 changes: 3 additions & 1 deletion lib/services/backup/auto_backup_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ class AutoExportUtils {
logger.w('The automatic export directory selected by the user is no longer accessible, using the default one');
isAutoExportDirectoryLost = true;

return setAutoExportDirectoryToDefault();
await setAutoExportDirectoryToDefault();

return;
}
} catch (exception, stackTrace) {
logger.e(exception.toString(), exception, stackTrace);
Expand Down
Loading
Loading