-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgradient_button.dart
55 lines (51 loc) · 1.36 KB
/
gradient_button.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
47
48
49
50
51
52
53
54
55
import 'package:auto_size_text/auto_size_text.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:social_4pet/pet_colors.dart';
class GradientButton extends StatelessWidget {
final String text;
final VoidCallback? onTap;
final Gradient gradient;
final EdgeInsets padding;
final TextStyle style;
final bool isUpperCase;
final double rounded;
const GradientButton(
this.text, {
Key? key,
this.onTap,
this.gradient = PetColors.gradient_button,
this.padding = const EdgeInsets.symmetric(vertical: 20),
this.style = GradientButton.blackWhite13,
this.isUpperCase = true,
this.rounded = 6,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return InkWell(
onTap: onTap,
child: Container(
padding: padding,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(rounded),
gradient: gradient,
),
child: Center(
child: AutoSizeText(
isUpperCase ? text.toUpperCase() : text,
style: style,
textAlign: TextAlign.center,
),
),
),
);
}
static const blackWhite13 = TextStyle(
fontSize: 13,
letterSpacing: 0.04,
fontWeight: FontWeight.w900,
height: 1,
color: PetColors.white,
fontFamily: 'Roboto',
);
}