feat: Add color and icon properties to categories, enhance category management in UI
This commit is contained in:
@@ -14,15 +14,25 @@ import 'package:notas/platform/app_platform.dart';
|
||||
// the user confirmed deletion. `null` indicates the user closed without saving.
|
||||
|
||||
class NoteEditorScreen extends StatefulWidget {
|
||||
const NoteEditorScreen({super.key, required this.note, this.onComplete});
|
||||
const NoteEditorScreen({
|
||||
super.key,
|
||||
required this.note,
|
||||
this.categoryId,
|
||||
this.onComplete,
|
||||
});
|
||||
|
||||
final Note? note;
|
||||
final String? categoryId;
|
||||
final ValueChanged<dynamic>? onComplete;
|
||||
|
||||
@override
|
||||
State<NoteEditorScreen> createState() => _NoteEditorScreenState();
|
||||
|
||||
static Future<dynamic> showDialog(BuildContext context, {Note? note}) {
|
||||
static Future<dynamic> showDialog(
|
||||
BuildContext context, {
|
||||
Note? note,
|
||||
String? categoryId,
|
||||
}) {
|
||||
if (isAndroid || isIOS) {
|
||||
return showGeneralDialog<dynamic>(
|
||||
context: context,
|
||||
@@ -30,7 +40,7 @@ class NoteEditorScreen extends StatefulWidget {
|
||||
barrierColor: Colors.transparent,
|
||||
transitionDuration: const Duration(milliseconds: 200),
|
||||
pageBuilder: (context, animation, secondaryAnimation) {
|
||||
return NoteEditorScreen(note: note);
|
||||
return NoteEditorScreen(note: note, categoryId: categoryId);
|
||||
},
|
||||
transitionBuilder: (context, animation, secondaryAnimation, child) {
|
||||
return ScaleTransition(scale: animation, child: child);
|
||||
@@ -46,7 +56,7 @@ class NoteEditorScreen extends StatefulWidget {
|
||||
barrierColor: Colors.transparent,
|
||||
transitionDuration: const Duration(milliseconds: 200),
|
||||
pageBuilder: (context, animation, secondaryAnimation) {
|
||||
return NoteEditorScreen(note: note);
|
||||
return NoteEditorScreen(note: note, categoryId: categoryId);
|
||||
},
|
||||
transitionBuilder: (context, animation, secondaryAnimation, child) {
|
||||
return ScaleTransition(scale: animation, child: child);
|
||||
@@ -61,6 +71,7 @@ class NoteEditorScreen extends StatefulWidget {
|
||||
builder: (BuildContext overlayContext) {
|
||||
return NoteEditorScreen(
|
||||
note: note,
|
||||
categoryId: categoryId,
|
||||
onComplete: (dynamic result) {
|
||||
if (!completer.isCompleted) {
|
||||
completer.complete(result);
|
||||
@@ -99,6 +110,7 @@ class _NoteEditorScreenState extends State<NoteEditorScreen> {
|
||||
createdAt: now,
|
||||
updatedAt: now,
|
||||
position: 0,
|
||||
categoryId: widget.categoryId,
|
||||
);
|
||||
} else {
|
||||
_currentNote = widget.note!;
|
||||
|
||||
Reference in New Issue
Block a user