mirror of
https://github.com/johrpan/musicus_mobile.git
synced 2025-10-27 03:07:26 +01:00
27 lines
606 B
Dart
27 lines
606 B
Dart
|
|
import 'package:flutter/material.dart';
|
||
|
|
|
||
|
|
import '../backend.dart';
|
||
|
|
import '../database.dart';
|
||
|
|
|
||
|
|
class PersonText extends StatelessWidget {
|
||
|
|
final int personId;
|
||
|
|
|
||
|
|
PersonText(this.personId);
|
||
|
|
|
||
|
|
@override
|
||
|
|
Widget build(BuildContext context) {
|
||
|
|
final backend = Backend.of(context);
|
||
|
|
|
||
|
|
return StreamBuilder<Person>(
|
||
|
|
stream: backend.db.personById(personId).watchSingle(),
|
||
|
|
builder: (context, snapshot) {
|
||
|
|
if (snapshot.hasData) {
|
||
|
|
return Text('${snapshot.data.firstName} ${snapshot.data.lastName}');
|
||
|
|
} else {
|
||
|
|
return Container();
|
||
|
|
}
|
||
|
|
},
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|