Some relative stuff
This commit is contained in:
@@ -14,12 +14,20 @@ class ProductCard extends StatelessWidget {
|
||||
required this.onTap,
|
||||
});
|
||||
|
||||
double getCardHeight({required BuildContext context}) {
|
||||
if (MediaQuery.of(context).size.width > 600) {
|
||||
return 200;
|
||||
}
|
||||
return 100;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints(minHeight: 200),
|
||||
constraints: BoxConstraints(
|
||||
minHeight: 80, maxHeight: getCardHeight(context: context)),
|
||||
child: Card(
|
||||
elevation: 3,
|
||||
color: Theme.of(context).scaffoldBackgroundColor,
|
||||
|
||||
Reference in New Issue
Block a user