File tree Expand file tree Collapse file tree 4 files changed +42
-25
lines changed Expand file tree Collapse file tree 4 files changed +42
-25
lines changed Original file line number Diff line number Diff line change @@ -20,16 +20,22 @@ class MyApp extends StatelessWidget {
2020 }
2121}
2222
23+ /*
24+ * When you init App, you can Initialize YYDialog so that use YYDialog.build().show() everywhere.
25+ */
26+
2327class AppHome extends StatelessWidget {
2428 Widget build (BuildContext context) {
25- return Scaffold (
26- appBar: AppBar (),
27- body: SingleChildScrollView (
28- child: Column (
29- children: < Widget > [
30- showAlertDialog (context),
31- showDevelopDialog (context),
32- ],
29+ return YYDialog .init (
30+ Scaffold (
31+ appBar: AppBar (),
32+ body: SingleChildScrollView (
33+ child: Column (
34+ children: < Widget > [
35+ showAlertDialog (context),
36+ showDevelopDialog (context),
37+ ],
38+ ),
3339 ),
3440 ),
3541 );
Original file line number Diff line number Diff line change @@ -7,14 +7,14 @@ packages:
77 name: async
88 url: "https://pub.dartlang.org"
99 source: hosted
10- version: "2.2 .0"
10+ version: "2.3 .0"
1111 boolean_selector:
1212 dependency: transitive
1313 description:
1414 name: boolean_selector
1515 url: "https://pub.dartlang.org"
1616 source: hosted
17- version: "1.0.4 "
17+ version: "1.0.5 "
1818 charcode:
1919 dependency: transitive
2020 description:
@@ -47,7 +47,7 @@ packages:
4747 path: ".."
4848 relative: true
4949 source: path
50- version: "1.0.2 "
50+ version: "1.0.3 "
5151 flutter_test:
5252 dependency: "direct dev"
5353 description: flutter
@@ -66,28 +66,28 @@ packages:
6666 name: meta
6767 url: "https://pub.dartlang.org"
6868 source: hosted
69- version: "1.1.6 "
69+ version: "1.1.7 "
7070 path:
7171 dependency: transitive
7272 description:
7373 name: path
7474 url: "https://pub.dartlang.org"
7575 source: hosted
76- version: "1.6.2 "
76+ version: "1.6.4 "
7777 pedantic:
7878 dependency: transitive
7979 description:
8080 name: pedantic
8181 url: "https://pub.dartlang.org"
8282 source: hosted
83- version: "1.7.0 "
83+ version: "1.8.0+1 "
8484 quiver:
8585 dependency: transitive
8686 description:
8787 name: quiver
8888 url: "https://pub.dartlang.org"
8989 source: hosted
90- version: "2.0.3 "
90+ version: "2.0.5 "
9191 sky_engine:
9292 dependency: transitive
9393 description: flutter
@@ -120,7 +120,7 @@ packages:
120120 name: string_scanner
121121 url: "https://pub.dartlang.org"
122122 source: hosted
123- version: "1.0.4 "
123+ version: "1.0.5 "
124124 term_glyph:
125125 dependency: transitive
126126 description:
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import 'flutter_custom_dialog_widget.dart';
77export 'package:flutter_custom_dialog/flutter_custom_dialog.dart' ;
88
99class YYDialog {
10+ static BuildContext _context;
1011 //================================弹窗属性======================================
1112 List <Widget > widgetList = []; //弹窗内部所有组件
1213 BuildContext context; //弹窗上下文
@@ -28,8 +29,18 @@ class YYDialog {
2829 bool _isShowing = false ;
2930
3031 //============================================================================
31-
32- YYDialog build (context) {
32+ static Widget init (Widget child, [BuildContext context]) {
33+ return Builder (builder: (
34+ context,
35+ ) {
36+ _context = context;
37+ return child;
38+ });
39+ }
40+ YYDialog build ([BuildContext context]) {
41+ if (context == null && _context != null ) {
42+ context = _context;
43+ }
3344 this .context = context;
3445 return this ;
3546 }
Original file line number Diff line number Diff line change @@ -7,14 +7,14 @@ packages:
77 name: async
88 url: "https://pub.dartlang.org"
99 source: hosted
10- version: "2.2 .0"
10+ version: "2.3 .0"
1111 boolean_selector:
1212 dependency: transitive
1313 description:
1414 name: boolean_selector
1515 url: "https://pub.dartlang.org"
1616 source: hosted
17- version: "1.0.4 "
17+ version: "1.0.5 "
1818 charcode:
1919 dependency: transitive
2020 description:
@@ -52,28 +52,28 @@ packages:
5252 name: meta
5353 url: "https://pub.dartlang.org"
5454 source: hosted
55- version: "1.1.6 "
55+ version: "1.1.7 "
5656 path:
5757 dependency: transitive
5858 description:
5959 name: path
6060 url: "https://pub.dartlang.org"
6161 source: hosted
62- version: "1.6.2 "
62+ version: "1.6.4 "
6363 pedantic:
6464 dependency: transitive
6565 description:
6666 name: pedantic
6767 url: "https://pub.dartlang.org"
6868 source: hosted
69- version: "1.7.0 "
69+ version: "1.8.0+1 "
7070 quiver:
7171 dependency: transitive
7272 description:
7373 name: quiver
7474 url: "https://pub.dartlang.org"
7575 source: hosted
76- version: "2.0.3 "
76+ version: "2.0.5 "
7777 sky_engine:
7878 dependency: transitive
7979 description: flutter
@@ -106,7 +106,7 @@ packages:
106106 name: string_scanner
107107 url: "https://pub.dartlang.org"
108108 source: hosted
109- version: "1.0.4 "
109+ version: "1.0.5 "
110110 term_glyph:
111111 dependency: transitive
112112 description:
You can’t perform that action at this time.
0 commit comments