mirror of
https://github.com/johrpan/musicus_mobile.git
synced 2025-10-26 10:47:25 +01:00
mobile: Add Musicus client
The settings screen now contains a tile to change the URL of the Musicus server.
This commit is contained in:
parent
8ca510e041
commit
d2a8363f6f
3 changed files with 76 additions and 0 deletions
|
|
@ -21,6 +21,52 @@ class SettingsScreen extends StatelessWidget {
|
|||
backend.chooseMusicLibraryUri();
|
||||
},
|
||||
),
|
||||
StreamBuilder<String>(
|
||||
stream: backend.musicusServerUrl,
|
||||
builder: (context, snapshot) {
|
||||
return ListTile(
|
||||
leading: Icon(Icons.router),
|
||||
title: Text('Musicus server'),
|
||||
subtitle: Text(snapshot.data ?? 'Set server URL'),
|
||||
onTap: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
final controller = TextEditingController();
|
||||
|
||||
if (snapshot.data != null) {
|
||||
controller.text = snapshot.data;
|
||||
}
|
||||
|
||||
return AlertDialog(
|
||||
title: Text('Musicus server'),
|
||||
content: TextField(
|
||||
controller: controller,
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Server URL',
|
||||
),
|
||||
),
|
||||
actions: <Widget>[
|
||||
FlatButton(
|
||||
onPressed: () {
|
||||
backend.setMusicusServer(controller.text);
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: Text('SET'),
|
||||
),
|
||||
FlatButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: Text('CANCEL'),
|
||||
),
|
||||
],
|
||||
);
|
||||
});
|
||||
},
|
||||
);
|
||||
}
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue