forked from markandey007/hacktoberfest_2022
-
Notifications
You must be signed in to change notification settings - Fork 0
/
categoryItem.dart
46 lines (43 loc) · 1.28 KB
/
categoryItem.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import 'package:flutter/material.dart';
import 'package:shopmeals/screens/category_meals_screen.dart';
class CategoryItem extends StatelessWidget {
final String id;
final String title;
final Color color;
const CategoryItem(
{Key key, @required this.id, @required this.title, @required this.color})
: super(key: key);
void SelectCategory(BuildContext ctx) {
Navigator.of(ctx)
.pushNamed('/category-meals', arguments: {'id': id, 'title': title});
}
@override
Widget build(BuildContext context) {
return InkWell(
onTap: () => SelectCategory(context),
splashColor: Theme.of(context).primaryColor,
borderRadius: BorderRadius.circular(15),
child: Container(
padding: const EdgeInsets.all(15),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
color.withOpacity(0.6),
color,
],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
borderRadius: BorderRadius.circular(15),
),
child: Text(
title,
style: const TextStyle(
fontSize: 22,
fontWeight: FontWeight.w500,
fontFamily: 'RobotoCondensed'),
),
),
);
}
}