Taxi booking in flutter - Location_Cart.dart
Create a file named as 'location_card.dart' in lib -> cards folder and paste following code:
Please, support my blog by clicking on our sponsors ad!
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:myfirstproject/common/constants.dart';
import 'package:myfirstproject/models/locationmodel.dart';
class LocationCard extends StatelessWidget
{
late final LocationModel locationModel;
LocationCard({required this.locationModel});
@override
Widget build(BuildContext context) {
return Card(elevation: 0,
child: Container( width: 150,height: 180,
decoration: BoxDecoration(borderRadius: BorderRadius.circular(20.0), color: Colors.white),
child: Padding(
padding: const EdgeInsets.all(10),
child: Column(
children: [
ClipRRect(borderRadius: BorderRadius.circular(20.0), child: Image.network(locationModel.Img, width:double.infinity, height: 100 ,fit: BoxFit.cover,)),
Align(alignment: Alignment.centerLeft, child: Text(locationModel.Name, style: TextStyle(color: Colors.black),)),
Align(alignment: Alignment.centerLeft,
child: Row(
children: [
IconButton(onPressed: () {}, icon: Icon(FontAwesomeIcons.locationDot), color: PrimaryColor,),
Text(locationModel.Distance),
Expanded(child: Align(alignment: Alignment.centerRight, child: Text('...'))),
],
),
)
],
),
)
)
);
}
}
Comments
Post a Comment