107 lines
3.0 KiB
Dart
107 lines
3.0 KiB
Dart
// lib/widgets/promo_banners_widget.dart
|
|
import 'package:flutter/material.dart';
|
|
|
|
class PromoBannersWidget extends StatelessWidget {
|
|
const PromoBannersWidget({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
margin: const EdgeInsets.symmetric(horizontal: 16),
|
|
child: Column(
|
|
children: [
|
|
_PromoBanner(
|
|
title: 'Everyday Fresh & Clean with Our Products',
|
|
image: 'assets/onions.png',
|
|
buttonLabel: 'Shop Now →',
|
|
),
|
|
const SizedBox(height: 16),
|
|
_PromoBanner(
|
|
title: 'Make your Breakfast Healthy and Easy',
|
|
image: 'assets/juice.png',
|
|
buttonLabel: 'Shop Now →',
|
|
),
|
|
const SizedBox(height: 16),
|
|
const SizedBox(width: 16),
|
|
_PromoBanner(
|
|
title: 'The best Organic Products Online',
|
|
image: 'assets/vegtables.png',
|
|
buttonLabel: 'Shop Now →',
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class _PromoBanner extends StatelessWidget {
|
|
final String title;
|
|
final String image;
|
|
final String buttonLabel;
|
|
|
|
const _PromoBanner({
|
|
Key? key,
|
|
required this.title,
|
|
required this.image,
|
|
required this.buttonLabel,
|
|
}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
margin: EdgeInsets.zero,
|
|
padding: const EdgeInsets.all(2),
|
|
decoration: BoxDecoration(
|
|
color: Colors.grey[100],
|
|
borderRadius: BorderRadius.circular(12),
|
|
),
|
|
child: Row(
|
|
children: [
|
|
// Left side (text + button)
|
|
Expanded(
|
|
flex: 2,
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
title,
|
|
style: const TextStyle(
|
|
fontSize: 18,
|
|
fontWeight: FontWeight.bold,
|
|
color: Color(0xFF2E3B4E),
|
|
),
|
|
),
|
|
const SizedBox(height: 16),
|
|
ElevatedButton(
|
|
onPressed: () {},
|
|
style: ElevatedButton.styleFrom(
|
|
backgroundColor: const Color(0xFF4CAF50),
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(8),
|
|
),
|
|
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
|
|
),
|
|
child: Text(buttonLabel),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
|
|
const SizedBox(width: 2),
|
|
|
|
// Right side (image expanded with BoxFit.cover)
|
|
Expanded(
|
|
flex: 1,
|
|
child: ClipRRect(
|
|
borderRadius: BorderRadius.circular(12),
|
|
child: Image.asset(
|
|
image,
|
|
fit: BoxFit.cover, // This makes the image expand and fill
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
} |