95 lines
3.0 KiB
Dart
95 lines
3.0 KiB
Dart
import 'package:flutter/material.dart';
|
||
|
||
class BasketItemCard extends StatelessWidget {
|
||
final String name;
|
||
final String price;
|
||
final String id;
|
||
final Image image;
|
||
final String quantity;
|
||
final VoidCallback onTapPlus;
|
||
final VoidCallback onTapMinus;
|
||
|
||
const BasketItemCard({
|
||
super.key,
|
||
required this.name,
|
||
required this.price,
|
||
required this.id,
|
||
required this.image,
|
||
required this.onTapPlus,
|
||
required this.quantity,
|
||
required this.onTapMinus,
|
||
});
|
||
|
||
@override
|
||
Widget build(BuildContext context) {
|
||
return Padding(
|
||
padding:
|
||
const EdgeInsetsDirectional.symmetric(horizontal: 10, vertical: 10),
|
||
child: ConstrainedBox(
|
||
constraints: const BoxConstraints(
|
||
minHeight: 100,
|
||
maxHeight: 200,
|
||
minWidth: 400,
|
||
maxWidth: 600,
|
||
),
|
||
child: GestureDetector(
|
||
onTap: () {
|
||
debugPrint('name: $name');
|
||
//TODO: сделать переход по клику
|
||
// Navigator.of(context).pushReplacement(CustomPageRoute(builder: (context)=>const DetailPage(name: this.name, description: description, price: price, id: id, image: image)))
|
||
},
|
||
child: Card(
|
||
elevation: 4,
|
||
color: Theme.of(context).scaffoldBackgroundColor,
|
||
shape: RoundedRectangleBorder(
|
||
borderRadius: BorderRadius.circular(30),
|
||
),
|
||
child: Padding(
|
||
padding: const EdgeInsetsDirectional.symmetric(horizontal: 20),
|
||
child: Row(
|
||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||
crossAxisAlignment: CrossAxisAlignment.center,
|
||
children: [
|
||
Row(
|
||
crossAxisAlignment: CrossAxisAlignment.center,
|
||
children: [
|
||
image,
|
||
const SizedBox(width: 20),
|
||
Column(
|
||
mainAxisSize: MainAxisSize.min,
|
||
children: [
|
||
Text(
|
||
name,
|
||
style: Theme.of(context).textTheme.bodyLarge,
|
||
),
|
||
Text('$price руб.'),
|
||
],
|
||
)
|
||
],
|
||
),
|
||
Row(
|
||
mainAxisSize: MainAxisSize.min,
|
||
children: [
|
||
IconButton(
|
||
icon: const Icon(Icons.remove),
|
||
onPressed: onTapMinus,
|
||
),
|
||
const SizedBox(width: 10),
|
||
Text(quantity),
|
||
const SizedBox(width: 10),
|
||
IconButton(
|
||
icon: const Icon(Icons.add),
|
||
onPressed: onTapPlus,
|
||
),
|
||
],
|
||
)
|
||
],
|
||
),
|
||
),
|
||
),
|
||
),
|
||
),
|
||
);
|
||
}
|
||
}
|