settings: scrollable access grant list
This commit is contained in:
parent
15857ccc9f
commit
876b2af432
1 changed files with 64 additions and 51 deletions
|
@ -52,21 +52,6 @@ class _StorageAccessPageState extends State<StorageAccessPage> {
|
|||
title: Text(context.l10n.settingsStorageAccessTitle),
|
||||
),
|
||||
body: SafeArea(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 16),
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(AIcons.info),
|
||||
const SizedBox(width: 16),
|
||||
Expanded(child: Text(context.l10n.settingsStorageAccessBanner)),
|
||||
],
|
||||
),
|
||||
),
|
||||
const Divider(),
|
||||
Expanded(
|
||||
child: FutureBuilder<List<String>>(
|
||||
future: _pathLoader,
|
||||
builder: (context, snapshot) {
|
||||
|
@ -78,14 +63,28 @@ class _StorageAccessPageState extends State<StorageAccessPage> {
|
|||
}
|
||||
_lastPaths = snapshot.data!..sort();
|
||||
if (_lastPaths!.isEmpty) {
|
||||
return EmptyContent(
|
||||
text: context.l10n.settingsStorageAccessEmpty,
|
||||
);
|
||||
}
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: _lastPaths!
|
||||
.map((path) => ListTile(
|
||||
children: [
|
||||
const _Header(),
|
||||
const Divider(),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: EmptyContent(
|
||||
text: context.l10n.settingsStorageAccessEmpty,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
return ListView(
|
||||
children: [
|
||||
const _Header(),
|
||||
const Divider(),
|
||||
..._lastPaths!.map((path) => ListTile(
|
||||
title: Text(path),
|
||||
dense: true,
|
||||
trailing: IconButton(
|
||||
|
@ -97,15 +96,29 @@ class _StorageAccessPageState extends State<StorageAccessPage> {
|
|||
},
|
||||
tooltip: context.l10n.settingsStorageAccessRevokeTooltip,
|
||||
),
|
||||
))
|
||||
.toList(),
|
||||
)),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
}),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _Header extends StatelessWidget {
|
||||
const _Header({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 16),
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(AIcons.info),
|
||||
const SizedBox(width: 16),
|
||||
Expanded(child: Text(context.l10n.settingsStorageAccessBanner)),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue