Skip to content

Commit baae531

Browse files
committed
布局
1 parent 0b3ce8c commit baae531

File tree

3 files changed

+42
-4
lines changed

3 files changed

+42
-4
lines changed

example/lib/main.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ showAlertDialog(BuildContext context) {
4444
makeTextButton("2", () {
4545
YYAlertDialog2(context);
4646
}),
47+
makeTextButton("3", () {
48+
YYAlertDialog3(context);
49+
}),
4750
],
4851
),
4952
],

lib/components/dialog.dart

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ YYDialog YYAlertDialog1(BuildContext context) {
88
..borderRadius = 4.0
99
..text(
1010
padding: EdgeInsets.all(18.0),
11-
text: "Dialog Header",
11+
text: "Dialog header",
1212
color: Colors.black,
13-
fontSize: 16.0,
13+
fontSize: 18.0,
14+
fontWeight: FontWeight.w500,
1415
)
1516
..text(
16-
padding: EdgeInsets.only(left: 18.0),
17+
padding: EdgeInsets.only(left: 18.0, right: 18.0),
1718
text: "Dialog body text",
1819
color: Colors.grey[500],
1920
)
@@ -54,6 +55,37 @@ YYDialog YYAlertDialog2(BuildContext context) {
5455
..show();
5556
}
5657

58+
YYDialog YYAlertDialog3(BuildContext context) {
59+
return YYDialog().build(context)
60+
..width = 260
61+
..borderRadius = 4.0
62+
..text(
63+
padding: EdgeInsets.all(18.0),
64+
text: "Use location service?",
65+
color: Colors.black,
66+
fontSize: 18.0,
67+
fontWeight: FontWeight.w500,
68+
)
69+
..text(
70+
padding: EdgeInsets.only(left: 18.0, right: 18.0),
71+
text:
72+
"Let us help apps determine location. This means sending anonymous location data to us, even when no apps are running.",
73+
color: Colors.grey[500],
74+
fontSize: 15.0,
75+
)
76+
..doubleButton(
77+
padding: EdgeInsets.only(top: 24.0),
78+
mainAxisAlignment: MainAxisAlignment.end,
79+
text1: "DISAGREE",
80+
color1: Colors.deepPurpleAccent,
81+
fontSize1: 14.0,
82+
text2: "AGREE",
83+
color2: Colors.deepPurpleAccent,
84+
fontSize2: 14.0,
85+
)
86+
..show();
87+
}
88+
5789
YYDialog YYListTileDialog1(BuildContext context) {
5890
return YYDialog().build(context)
5991
..width = 280
@@ -63,6 +95,7 @@ YYDialog YYListTileDialog1(BuildContext context) {
6395
text: "Set backup account",
6496
color: Colors.black,
6597
fontSize: 18.0,
98+
fontWeight: FontWeight.w500,
6699
)
67100
..listTile(
68101
padding: EdgeInsets.fromLTRB(16.0, 6.0, 16.0, 6.0),
@@ -117,6 +150,7 @@ YYDialog YYListViewDialog1(BuildContext context) {
117150
text: "Phone ringtone",
118151
color: Colors.black,
119152
fontSize: 18.0,
153+
fontWeight: FontWeight.w500,
120154
)
121155
..divider()
122156
..doubleButton(

lib/flutter_custom_dialog.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class YYDialog {
2020
return this;
2121
}
2222

23-
YYDialog text({padding, text, color, fontSize, alignment}) {
23+
YYDialog text({padding, text, color, fontSize, alignment, fontWeight}) {
2424
return this.widget(
2525
Padding(
2626
padding: padding ?? EdgeInsets.all(0.0),
@@ -31,6 +31,7 @@ class YYDialog {
3131
style: TextStyle(
3232
color: color ?? Colors.black,
3333
fontSize: fontSize ?? 14.0,
34+
fontWeight: fontWeight,
3435
),
3536
),
3637
),

0 commit comments

Comments
 (0)