Skip to main content

8. Ecommerce Card

Card

import 'package:flutter_rating_bar/flutter_rating_bar.dart';
import 'package:extended_image/extended_image.dart';
import 'package:flutter/material.dart';
import 'package:gap/gap.dart';
Card(
margin: const EdgeInsets.all(0),
child: SizedBox(
width: 200,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
AspectRatio(
aspectRatio: 16 / 9,
child: ClipRRect(
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(12),
topRight: Radius.circular(12),
),
child: ExtendedImage.network(
'https://images.pexels.com/photos/277390/pexels-photo-277390.jpeg?auto=compress&cs=tinysrgb&w=600',
fit: BoxFit.cover,
),
),
),
const Gap(12),
const Padding(
padding: EdgeInsets.symmetric(horizontal: 16),
child: Text(
'Beauty Express Watch - Deluxe Version',
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14,
color: Colors.black87,
),
),
),
const Gap(4),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 14),
child: Row(
children: [
RatingBar.builder(
initialRating: 4.5,
itemBuilder: (context, index) => const Icon(
Icons.star_rounded,
color: Colors.amber,
),
unratedColor: Colors.grey.shade400,
allowHalfRating: true,
itemSize: 15,
itemPadding: const EdgeInsets.all(0),
onRatingUpdate: (value) {},
ignoreGestures: true,
),
const Gap(8),
Container(
padding:
const EdgeInsets.symmetric(horizontal: 6, vertical: 2),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
color: Theme.of(context).primaryColor.withOpacity(0.1),
// color: Colors.blue.shade50,
),
child: Text(
'4.9',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 10,
color: Theme.of(context).primaryColor,
),
),
),
],
),
),
Padding(
padding: const EdgeInsets.only(left: 16, right: 8),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Text(
'\$399',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20,
),
),
IconButton(
onPressed: () {},
icon: const Icon(Icons.add_shopping_cart),
),
],
),
),
const Gap(4),
],
),
),
),