mirror of
https://github.com/johrpan/musicus_mobile.git
synced 2025-10-26 18:57:25 +01:00
43 lines
1 KiB
Dart
43 lines
1 KiB
Dart
|
|
import 'package:flutter/material.dart';
|
||
|
|
|
||
|
|
import '../backend.dart';
|
||
|
|
import '../database.dart';
|
||
|
|
|
||
|
|
import 'person_text.dart';
|
||
|
|
import 'ensemble_text.dart';
|
||
|
|
|
||
|
|
class PerformanceRow extends StatelessWidget {
|
||
|
|
final Performance performance;
|
||
|
|
|
||
|
|
PerformanceRow(this.performance);
|
||
|
|
|
||
|
|
@override
|
||
|
|
Widget build(BuildContext context) {
|
||
|
|
final backend = Backend.of(context);
|
||
|
|
|
||
|
|
return Row(
|
||
|
|
children: <Widget>[
|
||
|
|
if (performance.person != null)
|
||
|
|
PersonText(performance.person)
|
||
|
|
else if (performance.ensemble != null)
|
||
|
|
EnsembleText(performance.ensemble),
|
||
|
|
if (performance.role != null) ...[
|
||
|
|
SizedBox(
|
||
|
|
width: 4.0,
|
||
|
|
),
|
||
|
|
StreamBuilder<Instrument>(
|
||
|
|
stream: backend.db.instrumentById(performance.role).watchSingle(),
|
||
|
|
builder: (context, snapshot) {
|
||
|
|
if (snapshot.hasData) {
|
||
|
|
return Text('(${snapshot.data.name})');
|
||
|
|
} else {
|
||
|
|
return Container();
|
||
|
|
}
|
||
|
|
},
|
||
|
|
),
|
||
|
|
],
|
||
|
|
],
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|