Skip to content

Commit 35e2325

Browse files
committed
added both json ad text format for task exporting
1 parent 5705c35 commit 35e2325

File tree

1 file changed

+31
-3
lines changed

1 file changed

+31
-3
lines changed

lib/views/profile/profile.dart

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,37 @@ class _ProfilePageState extends State<ProfilePage> {
7878
.toIso8601String()
7979
.replaceAll(RegExp(r'[-:]'), '')
8080
.replaceAll(RegExp(r'\..*'), '');
81-
exportTasks(
82-
contents: tasks,
83-
suggestedName: 'tasks-$now.txt',
81+
82+
showDialog(
83+
context: context,
84+
builder: (BuildContext context) {
85+
return AlertDialog(
86+
title: const Text("Export Format"),
87+
content: const Text("Choose the export format:"),
88+
actions: <Widget>[
89+
TextButton(
90+
child: const Text("JSON"),
91+
onPressed: () {
92+
Navigator.of(context).pop();
93+
exportTasks(
94+
contents: tasks,
95+
suggestedName: 'tasks-$now.json',
96+
);
97+
},
98+
),
99+
TextButton(
100+
child: const Text("TXT"),
101+
onPressed: () {
102+
Navigator.of(context).pop();
103+
exportTasks(
104+
contents: tasks,
105+
suggestedName: 'tasks-$now.txt',
106+
);
107+
},
108+
),
109+
],
110+
);
111+
},
84112
);
85113
},
86114
() {

0 commit comments

Comments
 (0)