openwith feature added

This commit is contained in:
dstark5
2023-09-02 04:59:01 -07:00
parent 93013fe6bb
commit f4f86a1353
2 changed files with 5 additions and 26 deletions

View File

@ -1,17 +1,12 @@
import 'dart:io'; import 'dart:io';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:path_provider/path_provider.dart'; import 'package:path_provider/path_provider.dart';
// import 'package:permission_handler/permission_handler.dart';
import 'package:openlib/state/state.dart' show dbProvider, myLibraryProvider; import 'package:openlib/state/state.dart' show dbProvider, myLibraryProvider;
Future<String> get getAppDirectoryPath async { Future<String> get getAppDirectoryPath async {
if (Platform.isAndroid) { if (Platform.isAndroid) {
final directory = await getExternalStorageDirectory(); final directory = await getExternalStorageDirectory();
return directory!.path; return directory!.path;
// // final path = '/storage/emulated/0/Openlib';
// print(directory.path);
// // File(directory.path).copySync(newPath);
// return '/storage/emulated/0/Openlib';
} else { } else {
final directory = await getApplicationDocumentsDirectory(); final directory = await getApplicationDocumentsDirectory();
return directory.path; return directory.path;
@ -32,27 +27,11 @@ Future<void> moveFilesToAndroidInternalStorage() async {
} }
} }
} catch (e) { } catch (e) {
// ignore: avoid_print
print(e); print(e);
} }
} }
// Future<void> getStoragePermissionAndroid() async {
// if (Platform.isAndroid) {
// print("hi");
// if (await Permission.storage.status.isGranted ||
// await Permission.manageExternalStorage.status.isGranted) {
// final storagePermission = await Permission.storage.request().isGranted;
// final manageStoragePermission =
// await Permission.manageExternalStorage.request().isGranted;
// print(storagePermission || manageStoragePermission);
// if (storagePermission || manageStoragePermission) {
// await openAppSettings();
// print(storagePermission || manageStoragePermission);
// }
// }
// }
// }
Future<bool> isFileExists(String filePath) async { Future<bool> isFileExists(String filePath) async {
return await File(filePath).exists(); return await File(filePath).exists();
} }

View File

@ -29,7 +29,7 @@ class SettingsPage extends ConsumerWidget {
Text( Text(
"Dark Mode", "Dark Mode",
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 15,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Theme.of(context).colorScheme.tertiary, color: Theme.of(context).colorScheme.tertiary,
), ),
@ -51,7 +51,7 @@ class SettingsPage extends ConsumerWidget {
Text( Text(
"Open PDF with External Reader", "Open PDF with External Reader",
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 15,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Theme.of(context).colorScheme.tertiary, color: Theme.of(context).colorScheme.tertiary,
), ),
@ -75,7 +75,7 @@ class SettingsPage extends ConsumerWidget {
Text( Text(
"Open Epub with External Reader", "Open Epub with External Reader",
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 15,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Theme.of(context).colorScheme.tertiary, color: Theme.of(context).colorScheme.tertiary,
), ),
@ -107,7 +107,7 @@ class SettingsPage extends ConsumerWidget {
Text( Text(
"About", "About",
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 15,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Theme.of(context).colorScheme.tertiary, color: Theme.of(context).colorScheme.tertiary,
), ),