mirror of
https://github.com/johrpan/musicus_mobile.git
synced 2025-10-26 18:57:25 +01:00
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:
parent
febcf29cf1
commit
e9f0bd03e7
9 changed files with 204 additions and 281 deletions
48
lib/app.dart
48
lib/app.dart
|
|
@ -4,7 +4,6 @@ import 'package:flutter/material.dart';
|
|||
|
||||
import 'backend.dart';
|
||||
import 'screens/home.dart';
|
||||
import 'selectors/files.dart';
|
||||
import 'widgets/player_bar.dart';
|
||||
|
||||
class App extends StatelessWidget {
|
||||
|
|
@ -34,37 +33,6 @@ class App extends StatelessWidget {
|
|||
return Material(
|
||||
color: Theme.of(context).scaffoldBackgroundColor,
|
||||
);
|
||||
} else if (backend.status == BackendStatus.needsPermissions) {
|
||||
return Material(
|
||||
color: Theme.of(context).scaffoldBackgroundColor,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
'Musicus needs permissions\nto access your files.',
|
||||
textAlign: TextAlign.center,
|
||||
style: Theme.of(context).textTheme.headline6,
|
||||
),
|
||||
SizedBox(
|
||||
height: 16.0,
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.done),
|
||||
title: Text('Grant permissions'),
|
||||
onTap: () {
|
||||
backend.requestPermissions();
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.settings),
|
||||
title: Text('Open system\'s app settings'),
|
||||
onTap: () {
|
||||
backend.openAppSettings();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
} else if (backend.status == BackendStatus.setup) {
|
||||
return Material(
|
||||
color: Theme.of(context).scaffoldBackgroundColor,
|
||||
|
|
@ -82,20 +50,8 @@ class App extends StatelessWidget {
|
|||
ListTile(
|
||||
leading: const Icon(Icons.folder_open),
|
||||
title: Text('Choose path'),
|
||||
onTap: () async {
|
||||
final path = await Navigator.push<String>(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => FilesSelector(
|
||||
mode: FilesSelectorMode.directory,
|
||||
),
|
||||
fullscreenDialog: true,
|
||||
),
|
||||
);
|
||||
|
||||
if (path != null) {
|
||||
backend.setMusicLibraryPath(path);
|
||||
}
|
||||
onTap: () {
|
||||
backend.chooseMusicLibraryUri();
|
||||
},
|
||||
),
|
||||
],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue