162 Start
This commit is contained in:
@@ -3,14 +3,19 @@ import 'package:flutter/material.dart';
|
||||
import '../models/category.dart';
|
||||
|
||||
class CategoryGridItem extends StatelessWidget {
|
||||
const CategoryGridItem({super.key, required this.category});
|
||||
const CategoryGridItem({
|
||||
super.key,
|
||||
required this.category,
|
||||
required this.onSelectCategory,
|
||||
});
|
||||
|
||||
final Category category;
|
||||
final void Function() onSelectCategory;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () {},
|
||||
onTap: onSelectCategory,
|
||||
splashColor: Theme.of(context).primaryColor,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
child: Container(
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_navigation/models/meal.dart';
|
||||
import 'package:transparent_image/transparent_image.dart';
|
||||
|
||||
class MealItem extends StatelessWidget {
|
||||
const MealItem({
|
||||
super.key,
|
||||
required this.meal,
|
||||
});
|
||||
|
||||
final Meal meal;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Card(
|
||||
margin: const EdgeInsets.all(8),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
clipBehavior: Clip.hardEdge,
|
||||
elevation: 2,
|
||||
child: InkWell(
|
||||
onTap: () {},
|
||||
child: Stack(
|
||||
children: [
|
||||
FadeInImage(
|
||||
placeholder: MemoryImage(kTransparentImage),
|
||||
image: NetworkImage(meal.imageUrl),
|
||||
fit: BoxFit.cover,
|
||||
height: 200,
|
||||
width: double.infinity,
|
||||
),
|
||||
Positioned(
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Container(
|
||||
color: Colors.black54,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 6,
|
||||
horizontal: 44,
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
meal.title,
|
||||
maxLines: 2,
|
||||
textAlign: TextAlign.center,
|
||||
softWrap: true,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Row(
|
||||
children: [],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user