You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
meals/lib/widgets/CategoryGridItem.dart

40 lines
1.1 KiB
Dart

import 'package:flutter/material.dart';
import 'package:meals/models/Category.dart';
class CategoryGridItem extends StatelessWidget {
final Category category;
final void Function() onClickCallback;
const CategoryGridItem(
{super.key, required this.category, required this.onClickCallback});
@override
Widget build(BuildContext context) {
return InkWell(
onTap: onClickCallback,
borderRadius: BorderRadius.circular(8),
child: Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
gradient: LinearGradient(
colors: [
category.color.withOpacity(0.55),
category.color.withOpacity(0.9),
],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
),
child: Text(
category.title,
style: Theme.of(context)
.textTheme
.titleLarge!
.copyWith(color: Theme.of(context).colorScheme.onBackground),
),
),
);
}
}