@@ -4,6 +4,7 @@ import 'dart:ui' as ui;
4
4
import 'package:fluent_ui/fluent_ui.dart' ;
5
5
import 'package:file_selector/file_selector.dart' ;
6
6
import 'package:material_symbols_icons/material_symbols_icons.dart' ;
7
+ import 'package:path_provider/path_provider.dart' ;
7
8
8
9
import '../../../utils/l10n.dart' ;
9
10
import '../../../utils/dialogs/unavailable_dialog_on_band.dart' ;
@@ -90,12 +91,14 @@ List<SelectItem> frameItem(BuildContext context) => <SelectItem>[
90
91
class ExportCoverWallDialog extends StatefulWidget {
91
92
final CollectionType type;
92
93
final int id;
94
+ final String title;
93
95
final void Function (void ) $close;
94
96
95
97
const ExportCoverWallDialog ({
96
98
super .key,
97
99
required this .type,
98
100
required this .id,
101
+ required this .title,
99
102
required this .$close,
100
103
});
101
104
@@ -178,8 +181,12 @@ class ExportCoverWallDialogState extends State<ExportCoverWallDialog> {
178
181
: Colors .white,
179
182
);
180
183
181
- final FileSaveLocation ? result = await getSaveLocation (
182
- suggestedName: 'cover_wall.png' ,
184
+ final Directory appDocumentsDir =
185
+ await getApplicationDocumentsDirectory ();
186
+
187
+ final FileSaveLocation ? path = await getSaveLocation (
188
+ suggestedName: '${widget .title }.png' ,
189
+ initialDirectory: appDocumentsDir.path,
183
190
acceptedTypeGroups: const [
184
191
XTypeGroup (
185
192
label: 'images' ,
@@ -188,13 +195,13 @@ class ExportCoverWallDialogState extends State<ExportCoverWallDialog> {
188
195
],
189
196
);
190
197
191
- if (result == null ) return ;
198
+ if (path == null ) return ;
192
199
193
200
final pngBytes = await image.toByteData (
194
201
format: ui.ImageByteFormat .png,
195
202
);
196
203
197
- File (result .path).writeAsBytesSync (
204
+ File (path .path).writeAsBytesSync (
198
205
pngBytes! .buffer.asInt8List (),
199
206
);
200
207
0 commit comments