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 fb3c078

Browse files
整理
1 parent cf6a4b6 commit fb3c078

File tree

2 files changed

+21
-30
lines changed

2 files changed

+21
-30
lines changed

‎lib/components/dialog.dart‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ import 'package:flutter/material.dart';
33
import '../flutter_custom_dialog.dart';
44

55
YYDialog YYAlertDialog(BuildContext context) {
6-
return YYDialog(context: context).build()
6+
return YYDialog().build(context)
77
..decoration = BoxDecoration(
88
color: Colors.red,
99
)
10-
..constraints = null
11-
..mainAxisAlignment = MainAxisAlignment.end
10+
..mainAxisAlignment = MainAxisAlignment.center
11+
..width = 200
12+
..height = 100
1213
..widget(
1314
Row(
1415
children: <Widget>[Text('haha'), Text('bbb')],

‎lib/flutter_custom_dialog.dart‎

Lines changed: 17 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,17 @@ class YYDialog {
99
BoxDecoration decoration;
1010
BoxConstraints constraints;
1111

12-
YYDialog({this.context}) {
13-
// this.width = MediaQuery.of(context).size.width * .8;
14-
// this.height = MediaQuery.of(context).size.height * .3;
12+
YYDialogbuild(context) {
13+
this.context = context;
14+
returnthis;
1515
}
1616

17-
YYDialog build() {
18-
print('build');
17+
YYDialog widget(Widget child) {
18+
this.widgetList.add(child);
1919
return this;
2020
}
2121

22-
next() {
23-
print('next');
22+
void show() {
2423
Size size = MediaQuery.of(context).size;
2524
CustomDialog(
2625
context: context,
@@ -30,16 +29,17 @@ class YYDialog {
3029
Material(
3130
type: MaterialType.transparency,
3231
child: Container(
33-
decoration: decoration ?? BoxDecoration(
34-
color: Colors.white,
35-
),
36-
// 限制container大小
37-
constraints: constraints ?? BoxConstraints(
38-
// minHeight: size.height * .3,
39-
// minWidth: size.width * .8,
40-
// maxHeight: size.height * .5,
41-
maxWidth: size.width * .8,
42-
),
32+
width: width,
33+
height: height,
34+
decoration: decoration ??
35+
BoxDecoration(
36+
color: Colors.white,
37+
),
38+
constraints: constraints ??
39+
BoxConstraints(
40+
minHeight: size.height * .01,
41+
minWidth: size.width * .01,
42+
),
4343
child: Column(
4444
children: widgetList,
4545
),
@@ -49,16 +49,6 @@ class YYDialog {
4949
),
5050
);
5151
}
52-
53-
show() {
54-
print('show');
55-
this.next();
56-
}
57-
58-
YYDialog widget(Widget child) {
59-
this.widgetList.add(child);
60-
return this;
61-
}
6252
}
6353

6454
class CustomDialog {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /