-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrounded_btn.dart
54 lines (51 loc) · 1.38 KB
/
rounded_btn.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
import 'package:flutter/material.dart';
import 'package:insta_digin/constants/app_colors.dart';
import 'package:insta_digin/constants/dimens.dart';
import 'package:insta_digin/utils/app_styles.dart';
class RoundedBtn extends StatelessWidget {
RoundedBtn({
Key? key,
required this.text,
this.onPress,
this.textStyle,
this.onSubmitColor,
this.width,
this.height,
}) : super(key: key);
void Function()? onPress;
String text;
final TextStyle? textStyle;
final Color? onSubmitColor;
double? width;
double? height;
@override
Widget build(BuildContext context) {
return Material(
color: onSubmitColor ?? AppColors.blueVariant,
borderRadius: BorderRadius.circular(50),
child: InkWell(
onTap: () {
if (onPress != null) {
onPress!();
}
},
borderRadius: BorderRadius.circular(50),
child: Container(
width: scaleW(width ?? 280, context),
height: scaleH(height ?? 38, context),
alignment: Alignment.center,
child: Text(
text,
style: textStyle ??
getTextStyleNormal(
fontSize: scaleW(14, context),
fontWeight: FontWeight.w800,
color: AppColors.white,
),
textAlign: TextAlign.center,
),
),
),
);
}
}