Remove seperate role repesentation

The role and instrument tables have been merged into one (the instrument
table). There are not that many roles that aren't instruments and it is
much simpler to mange this way. The role editor and role selector have
been removed and the instrument related UI parts have been modified
accordingly.
This commit is contained in:
Elias Projahn 2020-03-31 15:49:15 +02:00
parent 24f2022930
commit 99e4711cfc
8 changed files with 57 additions and 172 deletions

View file

@ -32,7 +32,7 @@ class _InstrumentEditorState extends State<InstrumentEditor> {
return Scaffold(
appBar: AppBar(
title: Text('Instrument'),
title: Text('Instrument/Role'),
actions: <Widget>[
FlatButton(
child: Text('DONE'),

View file

@ -1,66 +0,0 @@
import 'package:flutter/material.dart';
import '../backend.dart';
import '../database.dart';
class RoleEditor extends StatefulWidget {
final Role role;
RoleEditor({
this.role,
});
@override
_RoleEditorState createState() => _RoleEditorState();
}
class _RoleEditorState extends State<RoleEditor> {
final nameController = TextEditingController();
@override
void initState() {
super.initState();
if (widget.role != null) {
nameController.text = widget.role.name;
}
}
@override
Widget build(BuildContext context) {
final backend = Backend.of(context);
return Scaffold(
appBar: AppBar(
title: Text('Role'),
actions: <Widget>[
FlatButton(
child: Text('DONE'),
onPressed: () async {
final role = Role(
id: widget.role?.id ?? generateId(),
name: nameController.text,
);
await backend.db.updateRole(role);
Navigator.pop(context, role);
},
)
],
),
body: ListView(
children: <Widget>[
Padding(
padding: const EdgeInsets.all(16.0),
child: TextField(
controller: nameController,
decoration: InputDecoration(
labelText: 'Name',
),
),
),
],
),
);
}
}

View file

@ -89,6 +89,7 @@ class WorkProperties extends StatelessWidget {
context,
MaterialPageRoute(
builder: (context) => InstrumentsSelector(
multiple: true,
selection: instruments,
),
fullscreenDialog: true,