Skip to content

Commit

Permalink
Merge branch 'android_app'
Browse files Browse the repository at this point in the history
  • Loading branch information
rovati committed Aug 31, 2023
2 parents 8f98fc9 + 743012b commit d0658f0
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
5 changes: 5 additions & 0 deletions notes/lib/model/note/notifier/checklist_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ class ChecklistManager extends ChangeNotifier {
NotesList().modifyNote(note);
}

void addGroupAt(ChecklistGroup group, int idx) {
note.groups.insert(idx, group);
NotesList().modifyNote(note);
}

ChecklistGroup groupAt(int idx) => note.groups[idx];

void removeGroup(int idx) {
Expand Down
13 changes: 12 additions & 1 deletion notes/lib/widget/dismissible_checklist.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:notes/model/note/checklist_group.dart';
import 'package:notes/theme/app_theme.dart';
import 'package:provider/provider.dart';

Expand All @@ -14,7 +15,6 @@ class DismissibleChecklist extends StatefulWidget {

class _DismissibleCLState extends State<DismissibleChecklist> {
@override
// TODO separate list and new group button
Widget build(BuildContext context) {
return Consumer<ChecklistManager>(
builder: (context, checklist, child) => SingleChildScrollView(
Expand Down Expand Up @@ -74,7 +74,18 @@ class _DismissibleCLState extends State<DismissibleChecklist> {
}

void _onTapRemoveGroup(idx) {
ChecklistGroup gr = ChecklistManager().groupAt(idx);
ChecklistManager().removeGroup(idx);
setState(() {});
SnackBar snack = SnackBar(
content: const Text('Group deleted'),
action: SnackBarAction(
label: 'UNDO',
onPressed: () {
ChecklistManager().addGroupAt(gr, idx);
setState(() {});
}),
);
ScaffoldMessenger.of(context).showSnackBar(snack);
}
}
2 changes: 1 addition & 1 deletion notes/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
version: 3.1.1+33
version: 3.1.2+34

environment:
sdk: '>=2.18.6 <3.0.0'
Expand Down

0 comments on commit d0658f0

Please sign in to comment.