Use the storage access framework

Everything related to file system access has been rewritten to make use
of the storage access framework. This means that the
WRITE_EXTERNAL_STORAGE is no longer needed. Because of that, the
dependency on permission_handler could be dropped and all code related
to permission handling has been removed. To be able to open a whole
document tree, the minSdkVersion was bumped to 21. Finally the file
selector was rewritten using custom platform dependent code.
This commit is contained in:
Elias Projahn 2020-04-11 21:59:23 +02:00
parent febcf29cf1
commit e9f0bd03e7
9 changed files with 204 additions and 281 deletions

View file

@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:path/path.dart' as p;
import '../backend.dart';
import '../database.dart';
@ -7,6 +6,7 @@ import '../selectors/files.dart';
import '../selectors/recording.dart';
import '../widgets/recording_tile.dart';
// TODO: Update for storage access framework.
class TrackModel {
String path;
@ -58,22 +58,9 @@ class _TracksEditorState extends State<TracksEditor> {
final Set<String> paths = await Navigator.push(
context,
MaterialPageRoute(
builder: (context) => FilesSelector(
baseDirectory: backend.musicLibraryPath,
),
builder: (context) => FilesSelector(),
),
);
if (paths != null) {
setState(() {
for (final path in paths) {
tracks.add(TrackModel(p.relative(
path,
from: backend.musicLibraryPath,
)));
}
});
}
},
),
),