Skip to content

Instantly share code, notes, and snippets.

@viztushar
Created October 21, 2018 18:49
Show Gist options
  • Save viztushar/868e27b6dfb44351a29dd690929697d7 to your computer and use it in GitHub Desktop.
Save viztushar/868e27b6dfb44351a29dd690929697d7 to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
import 'package:UrbanWalls/dataModel/DopeWallsModel.dart';
class ListItem extends StatelessWidget {
final List<DopeWallsModel> walls;
DopeWallsItem({Key key, this.walls}) : super(key: key);
@override
Widget build(BuildContext context) {
return ListView.builder(
itemBuilder: (context, index) {
return Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.0)),
elevation: 1.5,
margin: EdgeInsets.all(8.0),
child: InkWell(
radius: 8.0,
child: /*new ClipRRect(
borderRadius: new BorderRadius.circular(8.0),
child: Image.network(walls[index].url,height: 230.0,fit: BoxFit.cover,)
),*/
getCardView(context, index),
),
);
},
itemCount: walls.length,
addAutomaticKeepAlives: true,
shrinkWrap: true,);
}
getCardView(BuildContext context, int index) {
return new Padding(padding: EdgeInsets.all(0.0),
child:
Stack(
fit: StackFit.expand,
children: <Widget>[
Image.network(walls[index].url, fit: BoxFit.scaleDown,height: 200.0,),
DecoratedBox(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4.0),
gradient: LinearGradient(
colors: [Color(0x00000000).withOpacity(0.5),
Color(0xff000000).withOpacity(0.01),
],
begin: FractionalOffset.bottomCenter,
end: FractionalOffset.topCenter),
),
),
new Positioned(
bottom: 0.0,
child: Padding(
padding: const EdgeInsets.all(12.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text(
walls[index].name,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: new TextStyle(color: Colors.white, fontSize: 16.0),
),
Text(
walls[index].size,
softWrap: true,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: new TextStyle(color: Colors.white, fontSize: 14.0),
),
],
),
),
),
],
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment