Created
January 7, 2019 21:51
-
-
Save xsahil03x/2b1115dba06a3d201cb7b42a0e2ba291 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Widget makeCollectionList(JweleryKartBloc bloc) => Container( | |
height: 300.0, | |
child: Card( | |
margin: EdgeInsets.all(0.0), | |
shape: RoundedRectangleBorder(borderRadius: BorderRadius.zero), | |
child: Column( | |
children: <Widget>[ | |
Text("Collections"), | |
StreamBuilder( | |
stream: bloc.menCollections, | |
builder: (BuildContext context, | |
AsyncSnapshot<List<Collection>> snapshot) { | |
if (!snapshot.hasData) | |
return Center( | |
child: CircularProgressIndicator(), | |
); | |
else | |
return ListView.builder( | |
itemCount: snapshot.data?.length, | |
shrinkWrap: true, | |
scrollDirection: Axis.horizontal, | |
itemBuilder: (BuildContext context, int position) => | |
makeCollectionItem(context, snapshot.data[position]), | |
); | |
}, | |
) | |
], | |
)), | |
); | |
Widget makeCollectionItem(BuildContext context, Collection collection) => | |
InkWell( | |
onTap: () {}, | |
child: Card( | |
child: Column( | |
children: <Widget>[ | |
Container( | |
height: 200.0, | |
width: 200.0, | |
decoration: BoxDecoration( | |
image: DecorationImage( | |
image: NetworkImage(collection.collectionImageURL))), | |
), | |
Text( | |
collection.collectionName, | |
style: TextStyle( | |
fontSize: 20.0, | |
fontWeight: FontWeight.bold, | |
), | |
) | |
], | |
), | |
), | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment