-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathsetState in alert dialog.dart
114 lines (112 loc) · 4.75 KB
/
setState in alert dialog.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
void showDailyJapaDialog(
{BuildContext context,
String dialogTitle,
Function onADD,
Function onSUB,
String dialogTitleImageIcon,
String bodyFirstHeader,
String dialyJapaCount}) {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
contentPadding: EdgeInsets.all(10),
titlePadding: EdgeInsets.all(0),
title: getDialogTitle(
dialogTitleImageIcon: dialogTitleImageIcon,
dialogTitle: dialogTitle,
context: context),
content: StatefulBuilder(
builder: (context, StateSetter setState) {
return Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
bodyFirstHeader,
style: AppStyle.smallTextStyle(
color: AppColor.fontColorDarkBlue,
),
),
SizedBox(
height: 10,
),
Row(
children: <Widget>[
Expanded(
flex: 8,
child: TextField(
controller:
TextEditingController(text: dialyJapaCount),
style: AppStyle.mediumTextStyle(
color: AppColor.fontColorDarkBlue,
weight: FontWeight.w400,
),
keyboardType: TextInputType.number,
decoration: InputDecoration(
border:
OutlineInputBorder(borderSide: BorderSide.none),
fillColor: AppColor.alertDialogTextFieldColor,
filled: true),
),
),
Expanded(
flex: 5,
child: Padding(
padding: const EdgeInsets.only(left: 2),
child: Container(
height: 60,
decoration: BoxDecoration(
color: AppColor.alertDialogTextFieldColor,
borderRadius: BorderRadius.circular(5)),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
InkWell(
onTap: (){
dialyJapaCount =
(int.parse(dialyJapaCount) + 1)
.toString();
setState(() {});
},
child: Image.asset(
AppImage.getImage(
imagename: "Promises/ic_add.png"),
height: 25,
width: 25,
)),
GestureDetector(
onTap: (){
dialyJapaCount =
(int.parse(dialyJapaCount) - 1)
.toString();
setState(() {});
},
child: Image.asset(
AppImage.getImage(
imagename: "Promises/ic_sub.png"),
height: 25,
width: 25,
)),
],
),
),
),
)
],
),
SizedBox(
height: 20,
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: getButtonWidget(
title: "Save", buttonOnclick: () {Navigator.pop(context);}, context: context),
)
],
);
}
),
);
});
}