mirror of
https://github.com/johrpan/musicus_mobile.git
synced 2025-10-26 10:47:25 +01:00
Add persons list to home screen
This commit is contained in:
parent
7bccfeaec7
commit
07e7e38a9b
1 changed files with 19 additions and 1 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../backend.dart';
|
import '../backend.dart';
|
||||||
|
import '../database.dart';
|
||||||
import '../editors/work.dart';
|
import '../editors/work.dart';
|
||||||
|
|
||||||
class HomeScreen extends StatelessWidget {
|
class HomeScreen extends StatelessWidget {
|
||||||
|
|
@ -41,7 +42,24 @@ class HomeScreen extends StatelessWidget {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
// For debugging purposes
|
// For debugging purposes
|
||||||
body: Container(),
|
body: StreamBuilder<List<Person>>(
|
||||||
|
stream: backend.db.allPersons().watch(),
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
if (snapshot.hasData) {
|
||||||
|
return ListView.builder(
|
||||||
|
itemCount: snapshot.data.length,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
final person = snapshot.data[index];
|
||||||
|
return ListTile(
|
||||||
|
title: Text('${person.lastName}, ${person.firstName}'),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return Container();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue