fix permission error on desktop

This commit is contained in:
lukas-heiligenbrunner 2022-11-02 23:40:42 +01:00
parent 65c851a416
commit ac1f388dd8
3 changed files with 9 additions and 10 deletions

View File

@ -59,9 +59,8 @@ class MyPainter extends CustomPainter {
Offset pt2 = stroke.points[i + 1].point; Offset pt2 = stroke.points[i + 1].point;
pt2 = _translatept(pt2, size); pt2 = _translatept(pt2, size);
// final strokewidth = _calcAngleDependentWidth(pt1, pt2, stroke.points[i].thickness);
canvas.drawLine( canvas.drawLine(
pt1, pt2, paint..strokeWidth = stroke.points[i].thickness); pt1, pt2, paint..strokeWidth = stroke.points[i].thickness * zoom);
} }
} }
} }

View File

@ -11,15 +11,15 @@ void main() async {
defaultTargetPlatform != TargetPlatform.iOS) { defaultTargetPlatform != TargetPlatform.iOS) {
sqfliteFfiInit(); sqfliteFfiInit();
databaseFactory = databaseFactoryFfi; databaseFactory = databaseFactoryFfi;
} } else {
WidgetsFlutterBinding.ensureInitialized();
WidgetsFlutterBinding.ensureInitialized(); Map<Permission, PermissionStatus> statuses =
await [Permission.manageExternalStorage, Permission.storage].request();
Map<Permission, PermissionStatus> statuses = if (statuses.containsValue(PermissionStatus.denied)) {
await [Permission.manageExternalStorage, Permission.storage].request(); // todo some error handling
}
if (statuses.containsValue(PermissionStatus.denied)) {
// todo some error handling
} }
runApp(const MaterialApp(home: App())); runApp(const MaterialApp(home: App()));

View File

@ -44,6 +44,6 @@ class NoteFile {
Future<void> close() async { Future<void> close() async {
// shrink the db file size // shrink the db file size
await _db.execute('VACUUM'); await _db.execute('VACUUM');
_db.close(); await _db.close();
} }
} }