mobile: Add Musicus client

The settings screen now contains a tile to change the URL of the Musicus
server.
This commit is contained in:
Elias Projahn 2020-04-25 15:02:11 +02:00
parent 8ca510e041
commit d2a8363f6f
3 changed files with 76 additions and 0 deletions

View file

@ -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'),
),
],
);
});
},
);
}
),
],
),
);