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 22fbac8

Browse files
εΈƒε±€
1 parent fb3c078 commit 22fbac8

File tree

2 files changed

+71
-17
lines changed

2 files changed

+71
-17
lines changed

β€Žlib/components/dialog.dart

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,23 @@ import '../flutter_custom_dialog.dart';
44

55
YYDialog YYAlertDialog(BuildContext context) {
66
return YYDialog().build(context)
7-
..decoration = BoxDecoration(
8-
color: Colors.red,
7+
..width = 240
8+
..text(
9+
padding: EdgeInsets.all(16.0),
10+
text: "Dialog Header",
11+
color: Colors.black,
12+
fontSize: 16.0,
913
)
10-
..mainAxisAlignment = MainAxisAlignment.center
11-
..width = 200
12-
..height = 100
13-
..widget(
14-
Row(
15-
children: <Widget>[Text('haha'), Text('bbb')],
16-
),
14+
..text(
15+
padding: EdgeInsets.only(left: 16.0),
16+
text: "Dialog body text",
17+
color: Colors.grey[500],
1718
)
18-
..widget(
19-
Row(
20-
children: <Widget>[Text('haha'), Text('bbb')],
21-
),
19+
..doubleButton(
20+
padding: EdgeInsets.only(top: 12.0),
21+
text: "ACTION 1",
22+
color: Colors.deepPurpleAccent,
23+
fontSize: 14.0,
2224
)
2325
..show();
2426
}

β€Žlib/flutter_custom_dialog.dart

Lines changed: 56 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,78 @@ class YYDialog {
1919
return this;
2020
}
2121

22+
YYDialog text({padding, text, color, fontSize, alignment}) {
23+
return this.widget(
24+
Padding(
25+
padding: padding ?? EdgeInsets.all(0.0),
26+
child: Align(
27+
alignment: alignment ?? Alignment.centerLeft,
28+
child: Text(
29+
text ?? "",
30+
style: TextStyle(
31+
color: color ?? Colors.black,
32+
fontSize: fontSize ?? 14.0,
33+
),
34+
),
35+
),
36+
),
37+
);
38+
}
39+
40+
YYDialog doubleButton({padding, text, color, fontSize}) {
41+
return this.widget(
42+
Padding(
43+
padding: padding ?? EdgeInsets.all(0.0),
44+
child: Row(
45+
mainAxisAlignment: MainAxisAlignment.end,
46+
children: <Widget>[
47+
FlatButton(
48+
onPressed: () {},
49+
child: Text(
50+
text ?? "",
51+
style: TextStyle(
52+
color: color ?? Colors.black,
53+
fontSize: fontSize ?? 14.0,
54+
),
55+
),
56+
),
57+
FlatButton(
58+
onPressed: () {},
59+
child: Text(
60+
text ?? "",
61+
style: TextStyle(
62+
color: color ?? Colors.black,
63+
fontSize: fontSize ?? 14.0,
64+
),
65+
),
66+
)
67+
],
68+
),
69+
),
70+
);
71+
}
72+
2273
void show() {
2374
Size size = MediaQuery.of(context).size;
2475
CustomDialog(
2576
context: context,
2677
child: Column(
78+
textDirection: TextDirection.ltr,
2779
mainAxisAlignment: mainAxisAlignment,
2880
children: <Widget>[
2981
Material(
3082
type: MaterialType.transparency,
3183
child: Container(
32-
width: width,
33-
height: height,
84+
width: width??null,
85+
height: height??null,
3486
decoration: decoration ??
3587
BoxDecoration(
3688
color: Colors.white,
3789
),
3890
constraints: constraints ??
3991
BoxConstraints(
40-
minHeight: size.height * .01,
41-
minWidth: size.width * .01,
92+
minHeight: size.height * .1,
93+
minWidth: size.width * .1,
4294
),
4395
child: Column(
4496
children: widgetList,

0 commit comments

Comments
(0)

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