common: Expose sync property in editors

This commit is contained in:
Elias Projahn 2020-07-17 20:13:55 +02:00
parent 6c7891de14
commit 322ed3f81e
6 changed files with 78 additions and 0 deletions

View file

@ -18,6 +18,7 @@ class _InstrumentEditorState extends State<InstrumentEditor> {
final nameController = TextEditingController();
bool uploading = false;
bool _sync = true;
@override
void initState() {
@ -59,6 +60,8 @@ class _InstrumentEditorState extends State<InstrumentEditor> {
final instrument = Instrument(
id: widget.instrument?.id ?? generateId(),
name: nameController.text,
sync: _sync,
synced: false,
);
final success =
@ -81,6 +84,18 @@ class _InstrumentEditorState extends State<InstrumentEditor> {
),
body: ListView(
children: <Widget>[
SwitchListTile(
title: Text('Synchronize changes'),
subtitle: Text(_sync
? 'Publish changes on the server'
: 'Keep changes private'),
value: _sync,
onChanged: (value) {
setState(() {
_sync = value;
});
},
),
Padding(
padding: const EdgeInsets.all(16.0),
child: TextField(