file picker use static methods
This commit is contained in:
+2
-2
@@ -998,7 +998,7 @@ class BookmarkListScreen extends HookConsumerWidget {
|
|||||||
String format,
|
String format,
|
||||||
) async {
|
) async {
|
||||||
try {
|
try {
|
||||||
final result = await FilePicker.platform.pickFiles(
|
final result = await FilePicker.pickFiles(
|
||||||
type: FileType.custom,
|
type: FileType.custom,
|
||||||
allowedExtensions: format == 'json' ? ['json'] : ['html', 'htm'],
|
allowedExtensions: format == 'json' ? ['json'] : ['html', 'htm'],
|
||||||
);
|
);
|
||||||
@@ -1066,7 +1066,7 @@ class BookmarkListScreen extends HookConsumerWidget {
|
|||||||
final defaultFileName =
|
final defaultFileName =
|
||||||
'bookmarks_$timestamp.${format == 'json' ? 'json' : 'html'}';
|
'bookmarks_$timestamp.${format == 'json' ? 'json' : 'html'}';
|
||||||
|
|
||||||
final outputPath = await FilePicker.platform.saveFile(
|
final outputPath = await FilePicker.saveFile(
|
||||||
dialogTitle: 'Export Bookmarks',
|
dialogTitle: 'Export Bookmarks',
|
||||||
fileName: defaultFileName,
|
fileName: defaultFileName,
|
||||||
type: FileType.custom,
|
type: FileType.custom,
|
||||||
|
|||||||
+1
-1
@@ -45,7 +45,7 @@ class _InstallLocalAddonSheet extends HookConsumerWidget {
|
|||||||
|
|
||||||
Future<void> pickFile() async {
|
Future<void> pickFile() async {
|
||||||
try {
|
try {
|
||||||
final result = await FilePicker.platform.pickFiles();
|
final result = await FilePicker.pickFiles();
|
||||||
|
|
||||||
if (result != null && result.files.isNotEmpty) {
|
if (result != null && result.files.isNotEmpty) {
|
||||||
final path = result.files.single.path;
|
final path = result.files.single.path;
|
||||||
|
|||||||
+1
-1
@@ -1605,7 +1605,7 @@ class _ExportExpansion extends ConsumerWidget {
|
|||||||
content,
|
content,
|
||||||
fileName,
|
fileName,
|
||||||
) async {
|
) async {
|
||||||
await FilePicker.platform.saveFile(
|
await FilePicker.saveFile(
|
||||||
fileName: fileName,
|
fileName: fileName,
|
||||||
type: FileType.custom,
|
type: FileType.custom,
|
||||||
allowedExtensions: ['md'],
|
allowedExtensions: ['md'],
|
||||||
|
|||||||
+4
-2
@@ -211,7 +211,9 @@ class TabMenu extends HookConsumerWidget {
|
|||||||
Consumer(
|
Consumer(
|
||||||
builder: (context, ref, child) {
|
builder: (context, ref, child) {
|
||||||
final isInstallable = ref.watch(isCurrentTabInstallableProvider);
|
final isInstallable = ref.watch(isCurrentTabInstallableProvider);
|
||||||
final isShortcutable = ref.watch(isCurrentTabShortcutableProvider);
|
final isShortcutable = ref.watch(
|
||||||
|
isCurrentTabShortcutableProvider,
|
||||||
|
);
|
||||||
|
|
||||||
return Visibility(
|
return Visibility(
|
||||||
visible: isInstallable || isShortcutable,
|
visible: isInstallable || isShortcutable,
|
||||||
@@ -575,7 +577,7 @@ class TabMenu extends HookConsumerWidget {
|
|||||||
// ignore: deprecated_member_use
|
// ignore: deprecated_member_use
|
||||||
icon: const Icon(MdiIcons.languageMarkdown),
|
icon: const Icon(MdiIcons.languageMarkdown),
|
||||||
shareMarkdownAction: (content, fileName) async {
|
shareMarkdownAction: (content, fileName) async {
|
||||||
await FilePicker.platform.saveFile(
|
await FilePicker.saveFile(
|
||||||
fileName: fileName,
|
fileName: fileName,
|
||||||
type: FileType.custom,
|
type: FileType.custom,
|
||||||
allowedExtensions: ['md'],
|
allowedExtensions: ['md'],
|
||||||
|
|||||||
Reference in New Issue
Block a user