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.
44 lines
1.1 KiB
Dart
44 lines
1.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../models/category.dart';
|
|
|
|
class CategoryGridItem extends StatelessWidget {
|
|
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: onSelectCategory,
|
|
splashColor: Theme.of(context).primaryColor,
|
|
borderRadius: BorderRadius.circular(16),
|
|
child: Container(
|
|
padding: const EdgeInsets.all(16),
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(16),
|
|
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,
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|