Advertisement
Guest User

Untitled

a guest
Jul 12th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 2.02 KB | None | 0 0
  1. class DoctorsList extends StatelessWidget {
  2.   @override
  3.   Widget build(BuildContext context) {
  4.     return new StreamBuilder<QuerySnapshot>(
  5.       stream: Firestore.instance.collection('Doctors').snapshots(),
  6.       builder: (BuildContext context, AsyncSnapshot<QuerySnapshot> snapshot) {
  7.         if (!snapshot.hasData) return CircularProgressIndicator();
  8.         return new ListView(
  9.           children: snapshot.data.documents.map((DocumentSnapshot document) {
  10.             return new CustomScrollView(
  11.               slivers: <Widget>[
  12.                 new SliverAppBar(
  13.                   expandedHeight: 180.0,
  14.                   floating: false,
  15.                   pinned: true,
  16.                   flexibleSpace: new FlexibleSpaceBar(
  17.                     title: new Text("Select a Doctor",
  18.                       style: new TextStyle(color: Colors.white),),
  19.                     background: new Image.asset("lib/images/listofdoctors.jpg",
  20.                         fit: BoxFit.cover),
  21.                   ),
  22.                 ),
  23.                 new SliverList(
  24.                   delegate: new SliverChildBuilderDelegate((context, index) =>
  25.                   new Card(
  26.                     child: new Container(
  27.                       padding: EdgeInsets.all(10.0),
  28.                       child: new Row(
  29.                         mainAxisAlignment: MainAxisAlignment.start,
  30.                         children: <Widget>[
  31.                           CircleAvatar(
  32.                             backgroundColor: Colors.transparent,
  33.                             backgroundImage: new NetworkImage(
  34.                                 "${document['Picture']}"),
  35.                             radius: 30.0,
  36.                           ),
  37.                           SizedBox(width: 10.0),
  38.                           Text(document['Name'])
  39.  
  40.                         ],
  41.                       ),
  42.                     ),
  43.                   )
  44.                   ),
  45.                 ),
  46.               ],
  47.             );
  48.           }).toList(),
  49.         );
  50.       },
  51.     );
  52.   }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement