album creation dialog: use radio buttons instead of dropdown
This commit is contained in:
parent
5f3d4e5946
commit
5b338ba025
1 changed files with 45 additions and 44 deletions
|
@ -16,6 +16,8 @@ class _CreateAlbumDialogState extends State<CreateAlbumDialog> {
|
||||||
Set<StorageVolume> _allVolumes;
|
Set<StorageVolume> _allVolumes;
|
||||||
StorageVolume _primaryVolume, _selectedVolume;
|
StorageVolume _primaryVolume, _selectedVolume;
|
||||||
|
|
||||||
|
static const EdgeInsets hPadding = EdgeInsets.symmetric(horizontal: 24);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
@ -35,42 +37,40 @@ class _CreateAlbumDialogState extends State<CreateAlbumDialog> {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
title: Text('New Album'),
|
title: Text('New Album'),
|
||||||
content: Column(
|
content: ListView(
|
||||||
mainAxisSize: MainAxisSize.min,
|
shrinkWrap: true,
|
||||||
children: [
|
children: [
|
||||||
if (_allVolumes.length > 1) ...[
|
if (_allVolumes.length > 1) ...[
|
||||||
Row(
|
Padding(
|
||||||
mainAxisSize: MainAxisSize.min,
|
padding: hPadding,
|
||||||
children: [
|
child: Text('Storage:'),
|
||||||
Text('Storage:'),
|
|
||||||
SizedBox(width: 8),
|
|
||||||
Expanded(
|
|
||||||
child: DropdownButton<StorageVolume>(
|
|
||||||
isExpanded: true,
|
|
||||||
items: _allVolumes
|
|
||||||
.map((volume) => DropdownMenuItem(
|
|
||||||
value: volume,
|
|
||||||
child: Text(
|
|
||||||
volume.description,
|
|
||||||
softWrap: false,
|
|
||||||
overflow: TextOverflow.fade,
|
|
||||||
maxLines: 1,
|
|
||||||
),
|
),
|
||||||
))
|
..._allVolumes.map((volume) => RadioListTile<StorageVolume>(
|
||||||
.toList(),
|
value: volume,
|
||||||
value: _selectedVolume,
|
groupValue: _selectedVolume,
|
||||||
onChanged: (volume) {
|
onChanged: (volume) {
|
||||||
_selectedVolume = volume;
|
_selectedVolume = volume;
|
||||||
_checkAlbumExists();
|
_checkAlbumExists();
|
||||||
setState(() {});
|
setState(() {});
|
||||||
},
|
},
|
||||||
|
title: Text(
|
||||||
|
volume.description,
|
||||||
|
softWrap: false,
|
||||||
|
overflow: TextOverflow.fade,
|
||||||
|
maxLines: 1,
|
||||||
),
|
),
|
||||||
|
subtitle: Text(
|
||||||
|
volume.path,
|
||||||
|
softWrap: false,
|
||||||
|
overflow: TextOverflow.fade,
|
||||||
|
maxLines: 1,
|
||||||
),
|
),
|
||||||
|
)),
|
||||||
|
SizedBox(height: 8),
|
||||||
],
|
],
|
||||||
),
|
Padding(
|
||||||
SizedBox(height: 16),
|
padding: hPadding,
|
||||||
],
|
child: ValueListenableBuilder<bool>(
|
||||||
ValueListenableBuilder<bool>(
|
|
||||||
valueListenable: _existsNotifier,
|
valueListenable: _existsNotifier,
|
||||||
builder: (context, exists, child) {
|
builder: (context, exists, child) {
|
||||||
return TextField(
|
return TextField(
|
||||||
|
@ -82,9 +82,10 @@ class _CreateAlbumDialogState extends State<CreateAlbumDialog> {
|
||||||
onSubmitted: (_) => _submit(context),
|
onSubmitted: (_) => _submit(context),
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
contentPadding: EdgeInsets.fromLTRB(24, 20, 24, 0),
|
contentPadding: EdgeInsets.only(top: 20),
|
||||||
actions: [
|
actions: [
|
||||||
FlatButton(
|
FlatButton(
|
||||||
onPressed: () => Navigator.pop(context),
|
onPressed: () => Navigator.pop(context),
|
||||||
|
|
Loading…
Reference in a new issue