Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 7bb958b

Browse files
εΈƒε±€
1 parent 42fb527 commit 7bb958b

File tree

7 files changed

+434
-129
lines changed

7 files changed

+434
-129
lines changed

β€Ž.idea/workspace.xml

Lines changed: 184 additions & 96 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

β€Žexample/lib/main.dart

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,22 @@ showAlertDialog(BuildContext context) {
4949
}),
5050
],
5151
),
52+
Row(
53+
children: <Widget>[
54+
makeTextButton("bottom", () {
55+
YYAlertDialog4(context);
56+
}),
57+
makeTextButton("top", () {
58+
YYAlertDialog5(context);
59+
}),
60+
makeTextButton("left", () {
61+
YYAlertDialog6(context);
62+
}),
63+
makeTextButton("right", () {
64+
YYAlertDialog7(context);
65+
}),
66+
],
67+
),
5268
],
5369
);
5470
}

β€Žlib/components/alert_dialog.dart

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'package:flutter/material.dart';
22

33
import '../flutter_custom_dialog.dart';
4+
import 'bean/dialog_gravity.dart';
45

56
YYDialog YYAlertDialog1(BuildContext context) {
67
return YYDialog().build(context)
@@ -24,9 +25,15 @@ YYDialog YYAlertDialog1(BuildContext context) {
2425
text1: "ACTION 1",
2526
color1: Colors.deepPurpleAccent,
2627
fontSize1: 14.0,
28+
onTap1: () {
29+
print("AAAAAAAAA1");
30+
},
2731
text2: "ACTION 2",
2832
color2: Colors.deepPurpleAccent,
2933
fontSize2: 14.0,
34+
onTap2: () {
35+
print("BBBBBBBB1");
36+
},
3037
)
3138
..show();
3239
}
@@ -85,3 +92,129 @@ YYDialog YYAlertDialog3(BuildContext context) {
8592
)
8693
..show();
8794
}
95+
96+
YYDialog YYAlertDialog4(BuildContext context) {
97+
return YYDialog().build(context)
98+
..gravity = Gravity.bottom
99+
..borderRadius = 4.0
100+
..text(
101+
padding: EdgeInsets.all(18.0),
102+
text: "Use location service?",
103+
color: Colors.black,
104+
fontSize: 18.0,
105+
fontWeight: FontWeight.w500,
106+
)
107+
..text(
108+
padding: EdgeInsets.only(left: 18.0, right: 18.0),
109+
text:
110+
"Let us help apps determine location. This means sending anonymous location data to us, even when no apps are running.",
111+
color: Colors.grey[500],
112+
fontSize: 15.0,
113+
)
114+
..doubleButton(
115+
padding: EdgeInsets.only(top: 24.0),
116+
mainAxisAlignment: MainAxisAlignment.end,
117+
text1: "DISAGREE",
118+
color1: Colors.deepPurpleAccent,
119+
fontSize1: 14.0,
120+
text2: "AGREE",
121+
color2: Colors.deepPurpleAccent,
122+
fontSize2: 14.0,
123+
)
124+
..show();
125+
}
126+
127+
YYDialog YYAlertDialog5(BuildContext context) {
128+
return YYDialog().build(context)
129+
..gravity = Gravity.top
130+
..borderRadius = 4.0
131+
..text(
132+
padding: EdgeInsets.all(18.0),
133+
text: "Use location service?",
134+
color: Colors.black,
135+
fontSize: 18.0,
136+
fontWeight: FontWeight.w500,
137+
)
138+
..text(
139+
padding: EdgeInsets.only(left: 18.0, right: 18.0),
140+
text:
141+
"Let us help apps determine location. This means sending anonymous location data to us, even when no apps are running.",
142+
color: Colors.grey[500],
143+
fontSize: 15.0,
144+
)
145+
..doubleButton(
146+
padding: EdgeInsets.only(top: 24.0),
147+
mainAxisAlignment: MainAxisAlignment.end,
148+
text1: "DISAGREE",
149+
color1: Colors.deepPurpleAccent,
150+
fontSize1: 14.0,
151+
text2: "AGREE",
152+
color2: Colors.deepPurpleAccent,
153+
fontSize2: 14.0,
154+
)
155+
..show();
156+
}
157+
158+
YYDialog YYAlertDialog6(BuildContext context) {
159+
return YYDialog().build(context)
160+
..gravity = Gravity.left
161+
..width = 200
162+
..borderRadius = 4.0
163+
..text(
164+
padding: EdgeInsets.all(18.0),
165+
text: "Use location service?",
166+
color: Colors.black,
167+
fontSize: 18.0,
168+
fontWeight: FontWeight.w500,
169+
)
170+
..text(
171+
padding: EdgeInsets.only(left: 18.0, right: 18.0),
172+
text:
173+
"Let us help apps determine location. This means sending anonymous location data to us, even when no apps are running.",
174+
color: Colors.grey[500],
175+
fontSize: 15.0,
176+
)
177+
..doubleButton(
178+
padding: EdgeInsets.only(top: 24.0),
179+
mainAxisAlignment: MainAxisAlignment.end,
180+
text1: "DISAGREE",
181+
color1: Colors.deepPurpleAccent,
182+
fontSize1: 14.0,
183+
text2: "AGREE",
184+
color2: Colors.deepPurpleAccent,
185+
fontSize2: 14.0,
186+
)
187+
..show();
188+
}
189+
190+
YYDialog YYAlertDialog7(BuildContext context) {
191+
return YYDialog().build(context)
192+
..gravity = Gravity.right
193+
..width = 200
194+
..borderRadius = 4.0
195+
..text(
196+
padding: EdgeInsets.all(18.0),
197+
text: "Use location service?",
198+
color: Colors.black,
199+
fontSize: 18.0,
200+
fontWeight: FontWeight.w500,
201+
)
202+
..text(
203+
padding: EdgeInsets.only(left: 18.0, right: 18.0),
204+
text:
205+
"Let us help apps determine location. This means sending anonymous location data to us, even when no apps are running.",
206+
color: Colors.grey[500],
207+
fontSize: 15.0,
208+
)
209+
..doubleButton(
210+
padding: EdgeInsets.only(top: 24.0),
211+
mainAxisAlignment: MainAxisAlignment.end,
212+
text1: "DISAGREE",
213+
color1: Colors.deepPurpleAccent,
214+
fontSize1: 14.0,
215+
text2: "AGREE",
216+
color2: Colors.deepPurpleAccent,
217+
fontSize2: 14.0,
218+
)
219+
..show();
220+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
enum Gravity {
2+
left,
3+
top,
4+
bottom,
5+
right,
6+
center,
7+
}

β€Žlib/components/bean/dialog_item.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ class ListTileItem {
88
this.color,
99
this.fontSize,
1010
this.fontWeight,
11-
this.onTap,
1211
});
1312

1413
EdgeInsets padding;
@@ -17,7 +16,6 @@ class ListTileItem {
1716
Color color;
1817
double fontSize;
1918
FontWeight fontWeight;
20-
GestureTapCallback onTap;
2119
}
2220

2321
class RadioItem {
@@ -35,5 +33,5 @@ class RadioItem {
3533
Color color;
3634
double fontSize;
3735
FontWeight fontWeight;
38-
GestureTapCallback onTap;
36+
Function(int) onTap;
3937
}

β€Žlib/components/listview_dialog.dart

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import '../flutter_custom_dialog.dart';
55

66
var listTileItems = [
77
ListTileItem(
8-
onTap: () {},
98
padding: EdgeInsets.fromLTRB(16.0, 6.0, 16.0, 6.0),
109
leading: ClipOval(
1110
child: Image.network(
@@ -20,7 +19,6 @@ var listTileItems = [
2019
fontSize: 16.0,
2120
),
2221
ListTileItem(
23-
onTap: () {},
2422
padding: EdgeInsets.fromLTRB(16.0, 6.0, 16.0, 6.0),
2523
leading: ClipOval(
2624
child: Image.network(
@@ -35,7 +33,6 @@ var listTileItems = [
3533
fontSize: 16.0,
3634
),
3735
ListTileItem(
38-
onTap: () {},
3936
padding: EdgeInsets.fromLTRB(16.0, 6.0, 16.0, 6.0),
4037
leading: ClipOval(
4138
child: Image.network(
@@ -50,7 +47,6 @@ var listTileItems = [
5047
fontSize: 16.0,
5148
),
5249
ListTileItem(
53-
onTap: () {},
5450
padding: EdgeInsets.fromLTRB(16.0, 6.0, 16.0, 6.0),
5551
leading: ClipOval(
5652
child: Container(
@@ -67,63 +63,54 @@ var listTileItems = [
6763

6864
var radioItems = [
6965
RadioItem(
70-
onTap: () {},
7166
padding: EdgeInsets.only(left: 6.0),
7267
text: "None",
7368
color: Colors.black,
7469
fontSize: 16.0,
7570
),
7671
RadioItem(
77-
onTap: () {},
7872
padding: EdgeInsets.only(left: 6.0),
7973
text: "Callisto",
8074
color: Colors.black,
8175
fontSize: 16.0,
8276
),
8377
RadioItem(
84-
onTap: () {},
8578
padding: EdgeInsets.only(left: 6.0),
8679
text: "Ganymede",
8780
color: Colors.black,
8881
fontSize: 16.0,
8982
),
9083
RadioItem(
91-
onTap: () {},
9284
padding: EdgeInsets.only(left: 6.0),
9385
text: "Luna",
9486
color: Colors.black,
9587
fontSize: 16.0,
9688
),
9789
RadioItem(
98-
onTap: () {},
9990
padding: EdgeInsets.only(left: 6.0),
10091
text: "Oberon",
10192
color: Colors.black,
10293
fontSize: 16.0,
10394
),
10495
RadioItem(
105-
onTap: () {},
10696
padding: EdgeInsets.only(left: 6.0),
10797
text: "Phobos",
10898
color: Colors.black,
10999
fontSize: 16.0,
110100
),
111101
RadioItem(
112-
onTap: () {},
113102
padding: EdgeInsets.only(left: 6.0),
114103
text: "Dione",
115104
color: Colors.black,
116105
fontSize: 16.0,
117106
),
118107
RadioItem(
119-
onTap: () {},
120108
padding: EdgeInsets.only(left: 6.0),
121109
text: "James",
122110
color: Colors.black,
123111
fontSize: 16.0,
124112
),
125113
RadioItem(
126-
onTap: () {},
127114
padding: EdgeInsets.only(left: 6.0),
128115
text: "Lina",
129116
color: Colors.black,
@@ -142,7 +129,12 @@ YYDialog YYListViewDialog1(BuildContext context) {
142129
fontSize: 18.0,
143130
fontWeight: FontWeight.w500,
144131
)
145-
..listViewOfListTile(items: listTileItems)
132+
..listViewOfListTile(
133+
items: listTileItems,
134+
onClickItemListener: (index) {
135+
var listTileItem = listTileItems[index];
136+
print(listTileItem.text + " is on click");
137+
})
146138
..show();
147139
}
148140

@@ -158,7 +150,14 @@ YYDialog YYListViewDialog2(BuildContext context) {
158150
fontWeight: FontWeight.w500,
159151
)
160152
..divider()
161-
..listViewOfRadioButton(items: radioItems, height: 370)
153+
..listViewOfRadioButton(
154+
items: radioItems,
155+
height: 370,
156+
activeColor: Colors.deepPurpleAccent,
157+
onClickItemListener: (index) {
158+
var radioItem = radioItems[index];
159+
print(radioItem.text + " is on click");
160+
})
162161
..divider()
163162
..doubleButton(
164163
padding: EdgeInsets.only(top: 8.0, bottom: 8.0),

0 commit comments

Comments
(0)

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /