enhanced the restore button logic
This commit is contained in:
parent
16e2f5a4f3
commit
e8acfe10d9
@ -197,13 +197,7 @@ class NotesView extends StatelessWidget {
|
|||||||
)
|
)
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
return AnimatedOpacity(
|
return AnimatedContainer(
|
||||||
duration: const Duration(milliseconds: 200),
|
|
||||||
opacity: note.isActive ? 1.0 : 0.6,
|
|
||||||
child: IgnorePointer(
|
|
||||||
ignoring: !note.isActive,
|
|
||||||
ignoringSemantics: false,
|
|
||||||
child: AnimatedContainer(
|
|
||||||
duration: const Duration(milliseconds: 250),
|
duration: const Duration(milliseconds: 250),
|
||||||
padding: MySpacing.xy(12, 12),
|
padding: MySpacing.xy(12, 12),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
@ -232,14 +226,27 @@ class NotesView extends StatelessWidget {
|
|||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
/// Header
|
// Header & Note content (fade them if inactive)
|
||||||
Row(
|
AnimatedOpacity(
|
||||||
|
duration: const Duration(milliseconds: 200),
|
||||||
|
opacity: note.isActive ? 1.0 : 0.6,
|
||||||
|
child: IgnorePointer(
|
||||||
|
ignoring: !note.isActive,
|
||||||
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Avatar(
|
Avatar(
|
||||||
firstName: initials,
|
firstName: initials,
|
||||||
lastName: '',
|
lastName: '',
|
||||||
size: 40),
|
size: 40,
|
||||||
|
backgroundColor: note.isActive
|
||||||
|
? null
|
||||||
|
: Colors.grey.shade400,
|
||||||
|
),
|
||||||
MySpacing.width(12),
|
MySpacing.width(12),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Column(
|
child: Column(
|
||||||
@ -250,27 +257,30 @@ class NotesView extends StatelessWidget {
|
|||||||
"${note.contactName} (${note.organizationName})",
|
"${note.contactName} (${note.organizationName})",
|
||||||
fontWeight: 600,
|
fontWeight: 600,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
color: Colors.indigo[800],
|
color: note.isActive
|
||||||
|
? Colors.indigo[800]
|
||||||
|
: Colors.grey,
|
||||||
),
|
),
|
||||||
MyText.bodySmall(
|
MyText.bodySmall(
|
||||||
"by ${note.createdBy.firstName} • $createdDate, $createdTime",
|
"by ${note.createdBy.firstName} • $createdDate, $createdTime",
|
||||||
color: Colors.grey[600],
|
color: note.isActive
|
||||||
|
? Colors.grey[600]
|
||||||
|
: Colors.grey,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
||||||
MySpacing.height(12),
|
MySpacing.height(12),
|
||||||
|
|
||||||
if (isEditing && quillController != null)
|
if (isEditing && quillController != null)
|
||||||
CommentEditorCard(
|
CommentEditorCard(
|
||||||
controller: quillController,
|
controller: quillController,
|
||||||
onCancel: () =>
|
onCancel: () =>
|
||||||
controller.editingNoteId.value = null,
|
controller.editingNoteId.value = null,
|
||||||
onSave: (quillCtrl) async {
|
onSave: (quillCtrl) async {
|
||||||
final delta = quillCtrl.document.toDelta();
|
final delta =
|
||||||
|
quillCtrl.document.toDelta();
|
||||||
final htmlOutput =
|
final htmlOutput =
|
||||||
_convertDeltaToHtml(delta);
|
_convertDeltaToHtml(delta);
|
||||||
final updated =
|
final updated =
|
||||||
@ -287,26 +297,29 @@ class NotesView extends StatelessWidget {
|
|||||||
margin: html.Margins.zero,
|
margin: html.Margins.zero,
|
||||||
padding: html.HtmlPaddings.zero,
|
padding: html.HtmlPaddings.zero,
|
||||||
fontSize: html.FontSize.medium,
|
fontSize: html.FontSize.medium,
|
||||||
color: Colors.black87,
|
color: note.isActive
|
||||||
|
? Colors.black87
|
||||||
|
: Colors.grey,
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
// Action buttons (always fully visible)
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
children: [
|
children: [
|
||||||
if (note.isActive) ...[
|
if (note.isActive) ...[
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
isEditing
|
isEditing ? Icons.close : Icons.edit,
|
||||||
? Icons.close
|
|
||||||
: Icons.edit,
|
|
||||||
color: Colors.indigo,
|
color: Colors.indigo,
|
||||||
size: 20,
|
size: 20,
|
||||||
),
|
),
|
||||||
padding: EdgeInsets.all(
|
padding: EdgeInsets.all(2),
|
||||||
2),
|
|
||||||
constraints: const BoxConstraints(),
|
constraints: const BoxConstraints(),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
controller.editingNoteId.value =
|
controller.editingNoteId.value =
|
||||||
@ -319,7 +332,6 @@ class NotesView extends StatelessWidget {
|
|||||||
color: Colors.redAccent,
|
color: Colors.redAccent,
|
||||||
size: 20,
|
size: 20,
|
||||||
),
|
),
|
||||||
padding: EdgeInsets.all(2),
|
|
||||||
constraints: const BoxConstraints(),
|
constraints: const BoxConstraints(),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
await Get.dialog(
|
await Get.dialog(
|
||||||
@ -331,8 +343,8 @@ class NotesView extends StatelessWidget {
|
|||||||
confirmColor: Colors.redAccent,
|
confirmColor: Colors.redAccent,
|
||||||
icon: Icons.delete_forever,
|
icon: Icons.delete_forever,
|
||||||
onConfirm: () async {
|
onConfirm: () async {
|
||||||
await controller
|
await controller.restoreOrDeleteNote(
|
||||||
.restoreOrDeleteNote(note,
|
note,
|
||||||
restore: false);
|
restore: false);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -341,8 +353,6 @@ class NotesView extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
|
||||||
],
|
|
||||||
if (!note.isActive)
|
if (!note.isActive)
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: const Icon(
|
icon: const Icon(
|
||||||
@ -351,7 +361,6 @@ class NotesView extends StatelessWidget {
|
|||||||
size: 22,
|
size: 22,
|
||||||
),
|
),
|
||||||
tooltip: "Restore",
|
tooltip: "Restore",
|
||||||
padding: EdgeInsets.zero,
|
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
await Get.dialog(
|
await Get.dialog(
|
||||||
ConfirmDialog(
|
ConfirmDialog(
|
||||||
@ -362,8 +371,8 @@ class NotesView extends StatelessWidget {
|
|||||||
confirmColor: Colors.green,
|
confirmColor: Colors.green,
|
||||||
icon: Icons.restore,
|
icon: Icons.restore,
|
||||||
onConfirm: () async {
|
onConfirm: () async {
|
||||||
await controller
|
await controller.restoreOrDeleteNote(
|
||||||
.restoreOrDeleteNote(note,
|
note,
|
||||||
restore: true);
|
restore: true);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -375,8 +384,6 @@ class NotesView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user