mirror of
https://github.com/johrpan/musicus_mobile.git
synced 2025-10-26 18:57:25 +01:00
common: Expose sync property in editors
This commit is contained in:
parent
6c7891de14
commit
322ed3f81e
6 changed files with 78 additions and 0 deletions
|
|
@ -181,6 +181,9 @@ class MusicusBackendState extends State<MusicusBackend> {
|
||||||
basePath: serverSettings.apiPath,
|
basePath: serverSettings.apiPath,
|
||||||
credentials: settings.account.value,
|
credentials: settings.account.value,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// TODO: Maybe don't change the client in the middle of synchronization.
|
||||||
|
db.client = client;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ class _EnsembleEditorState extends State<EnsembleEditor> {
|
||||||
final nameController = TextEditingController();
|
final nameController = TextEditingController();
|
||||||
|
|
||||||
bool uploading = false;
|
bool uploading = false;
|
||||||
|
bool _sync = true;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
|
|
@ -59,6 +60,8 @@ class _EnsembleEditorState extends State<EnsembleEditor> {
|
||||||
final ensemble = Ensemble(
|
final ensemble = Ensemble(
|
||||||
id: widget.ensemble?.id ?? generateId(),
|
id: widget.ensemble?.id ?? generateId(),
|
||||||
name: nameController.text,
|
name: nameController.text,
|
||||||
|
sync: _sync,
|
||||||
|
synced: false,
|
||||||
);
|
);
|
||||||
|
|
||||||
final success = await backend.client.putEnsemble(ensemble);
|
final success = await backend.client.putEnsemble(ensemble);
|
||||||
|
|
@ -80,6 +83,18 @@ class _EnsembleEditorState extends State<EnsembleEditor> {
|
||||||
),
|
),
|
||||||
body: ListView(
|
body: ListView(
|
||||||
children: <Widget>[
|
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(
|
||||||
padding: const EdgeInsets.all(16.0),
|
padding: const EdgeInsets.all(16.0),
|
||||||
child: TextField(
|
child: TextField(
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ class _InstrumentEditorState extends State<InstrumentEditor> {
|
||||||
final nameController = TextEditingController();
|
final nameController = TextEditingController();
|
||||||
|
|
||||||
bool uploading = false;
|
bool uploading = false;
|
||||||
|
bool _sync = true;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
|
|
@ -59,6 +60,8 @@ class _InstrumentEditorState extends State<InstrumentEditor> {
|
||||||
final instrument = Instrument(
|
final instrument = Instrument(
|
||||||
id: widget.instrument?.id ?? generateId(),
|
id: widget.instrument?.id ?? generateId(),
|
||||||
name: nameController.text,
|
name: nameController.text,
|
||||||
|
sync: _sync,
|
||||||
|
synced: false,
|
||||||
);
|
);
|
||||||
|
|
||||||
final success =
|
final success =
|
||||||
|
|
@ -81,6 +84,18 @@ class _InstrumentEditorState extends State<InstrumentEditor> {
|
||||||
),
|
),
|
||||||
body: ListView(
|
body: ListView(
|
||||||
children: <Widget>[
|
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(
|
||||||
padding: const EdgeInsets.all(16.0),
|
padding: const EdgeInsets.all(16.0),
|
||||||
child: TextField(
|
child: TextField(
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ class _PersonEditorState extends State<PersonEditor> {
|
||||||
final lastNameController = TextEditingController();
|
final lastNameController = TextEditingController();
|
||||||
|
|
||||||
bool uploading = false;
|
bool uploading = false;
|
||||||
|
bool _sync = true;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
|
|
@ -62,6 +63,8 @@ class _PersonEditorState extends State<PersonEditor> {
|
||||||
id: widget.person?.id ?? generateId(),
|
id: widget.person?.id ?? generateId(),
|
||||||
firstName: firstNameController.text,
|
firstName: firstNameController.text,
|
||||||
lastName: lastNameController.text,
|
lastName: lastNameController.text,
|
||||||
|
sync: _sync,
|
||||||
|
synced: false,
|
||||||
);
|
);
|
||||||
|
|
||||||
final success = await backend.client.putPerson(person);
|
final success = await backend.client.putPerson(person);
|
||||||
|
|
@ -83,6 +86,18 @@ class _PersonEditorState extends State<PersonEditor> {
|
||||||
),
|
),
|
||||||
body: ListView(
|
body: ListView(
|
||||||
children: <Widget>[
|
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(
|
||||||
padding: const EdgeInsets.all(16.0),
|
padding: const EdgeInsets.all(16.0),
|
||||||
child: TextField(
|
child: TextField(
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ class _RecordingEditorState extends State<RecordingEditor> {
|
||||||
|
|
||||||
MusicusBackendState _backend;
|
MusicusBackendState _backend;
|
||||||
bool _uploading = false;
|
bool _uploading = false;
|
||||||
|
bool _sync = true;
|
||||||
WorkInfo _workInfo;
|
WorkInfo _workInfo;
|
||||||
List<PerformanceInfo> _performanceInfos = [];
|
List<PerformanceInfo> _performanceInfos = [];
|
||||||
|
|
||||||
|
|
@ -137,6 +138,8 @@ class _RecordingEditorState extends State<RecordingEditor> {
|
||||||
generateId(),
|
generateId(),
|
||||||
work: _workInfo.work.id,
|
work: _workInfo.work.id,
|
||||||
comment: _commentController.text,
|
comment: _commentController.text,
|
||||||
|
sync: _sync,
|
||||||
|
synced: false,
|
||||||
),
|
),
|
||||||
performances: _performanceInfos,
|
performances: _performanceInfos,
|
||||||
);
|
);
|
||||||
|
|
@ -167,6 +170,18 @@ class _RecordingEditorState extends State<RecordingEditor> {
|
||||||
),
|
),
|
||||||
body: ListView(
|
body: ListView(
|
||||||
children: <Widget>[
|
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;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
_workInfo != null
|
_workInfo != null
|
||||||
? ListTile(
|
? ListTile(
|
||||||
title: Text(_workInfo.work.title),
|
title: Text(_workInfo.work.title),
|
||||||
|
|
|
||||||
|
|
@ -179,6 +179,7 @@ class _WorkEditorState extends State<WorkEditor> {
|
||||||
final titleController = TextEditingController();
|
final titleController = TextEditingController();
|
||||||
|
|
||||||
bool uploading = false;
|
bool uploading = false;
|
||||||
|
bool _sync = true;
|
||||||
Person composer;
|
Person composer;
|
||||||
List<Instrument> instruments = [];
|
List<Instrument> instruments = [];
|
||||||
List<PartData> parts = [];
|
List<PartData> parts = [];
|
||||||
|
|
@ -310,6 +311,8 @@ class _WorkEditorState extends State<WorkEditor> {
|
||||||
id: workId,
|
id: workId,
|
||||||
title: titleController.text,
|
title: titleController.text,
|
||||||
composer: composer?.id,
|
composer: composer?.id,
|
||||||
|
sync: _sync,
|
||||||
|
synced: false,
|
||||||
),
|
),
|
||||||
instruments: instruments,
|
instruments: instruments,
|
||||||
// TODO: Theoretically, this should include all composers
|
// TODO: Theoretically, this should include all composers
|
||||||
|
|
@ -340,6 +343,18 @@ class _WorkEditorState extends State<WorkEditor> {
|
||||||
header: Column(
|
header: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: <Widget>[
|
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;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
WorkProperties(
|
WorkProperties(
|
||||||
titleController: titleController,
|
titleController: titleController,
|
||||||
composer: composer,
|
composer: composer,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue