Skip to content

Commit fed614b

Browse files
author
xuyingjun
committed
v1.0.20
1 parent a3e2b78 commit fed614b

File tree

6 files changed

+18
-13
lines changed

6 files changed

+18
-13
lines changed

CHANGELOG.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,8 @@
7777

7878
## 1.0.19
7979

80-
* fix a padding bug
80+
* fix a padding bug
81+
82+
## 1.0.20
83+
84+
* add a useRootNavigator property

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Global dialog function encapsulation, with a semantic way to fill the content in
1717

1818
```yaml
1919
dependencies:
20-
flutter_custom_dialog: ^1.0.19
20+
flutter_custom_dialog: ^1.0.20
2121
```
2222
2323
**2、import**
@@ -278,6 +278,7 @@ animatedFunc|Animation of dialog|Emerge from the middle
278278
showCallBack|dialog show callbacks|not
279279
dismissCallBack|dialog dismiss callbacks|not
280280
barrierDismissible|Whether to click to pop up the external disappear|true
281+
useRootNavigator|Whether to use root navigation|true
281282

282283
* After setting gravity, set gravityAnimationEnable = true if animation is needed
283284
* If the decoration property is set, the backgroundColor and borderRadius are not in effect; they are mutually exclusive

README_CN.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
```yaml
1717
dependencies:
18-
flutter_custom_dialog: ^1.0.19
18+
flutter_custom_dialog: ^1.0.20
1919
```
2020
2121
**2、import**
@@ -276,6 +276,7 @@ animatedFunc|弹窗出现的动画|从中间出现
276276
showCallBack|弹窗展示的回调|无
277277
dismissCallBack|弹窗消失的回调|无
278278
barrierDismissible|是否点击弹出外部消失|true
279+
useRootNavigator|是否使用根导航|true
279280

280281
* 设置完gravity后,若需要动画则设置gravityAnimationEnable = true
281282
* 若设置decoration属性,则backgroundColor和borderRadius不生效,他们是互斥关系

example/pubspec.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ packages:
4747
path: ".."
4848
relative: true
4949
source: path
50-
version: "1.0.20"
50+
version: "1.0.19"
5151
flutter_test:
5252
dependency: "direct dev"
5353
description: flutter

lib/flutter_custom_dialog.dart

+7-8
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,13 @@ class YYDialog {
1919
BoxConstraints constraints; //弹窗约束
2020
Function(Widget child, Animation<double> animation) animatedFunc; //弹窗出现的动画
2121
bool barrierDismissible = true; //是否点击弹出外部消失
22-
bool useRootNavigator = true; // see also Navigator.of()
2322
EdgeInsets margin = EdgeInsets.all(0.0); //弹窗布局的外边距
2423

24+
/// 用于有多个navigator嵌套的情况,默认为true
25+
/// @params useRootNavigator=false,push是用的是当前布局的context
26+
/// @params useRootNavigator=true,push是用的嵌套根布局的context
27+
bool useRootNavigator = true;
28+
2529
Decoration decoration; //弹窗内的装饰,与backgroundColor和borderRadius互斥
2630
Color backgroundColor = Colors.white; //弹窗内的背景色
2731
double borderRadius = 0.0; //弹窗圆角
@@ -268,7 +272,6 @@ class YYDialog {
268272
barrierColor: barrierColor,
269273
animatedFunc: animatedFunc,
270274
barrierDismissible: barrierDismissible,
271-
useRootNavigator: useRootNavigator,
272275
duration: duration,
273276
child: Padding(
274277
padding: margin,
@@ -427,7 +430,6 @@ class CustomDialog {
427430
Color _barrierColor;
428431
RouteTransitionsBuilder _transitionsBuilder;
429432
bool _barrierDismissible;
430-
bool _useRootNavigator;
431433
Gravity _gravity;
432434
bool _gravityAnimationEnable;
433435
Function _animatedFunc;
@@ -442,7 +444,6 @@ class CustomDialog {
442444
bool gravityAnimationEnable,
443445
Function animatedFunc,
444446
bool barrierDismissible,
445-
bool useRootNavigator,
446447
}) : _child = child,
447448
_context = context,
448449
_gravity = gravity,
@@ -451,9 +452,8 @@ class CustomDialog {
451452
_barrierColor = barrierColor,
452453
_animatedFunc = animatedFunc,
453454
_transitionsBuilder = transitionsBuilder,
454-
_barrierDismissible = barrierDismissible,
455-
_useRootNavigator = useRootNavigator {
456-
this.show();
455+
_barrierDismissible = barrierDismissible {
456+
this.show();
457457
}
458458

459459
show() {
@@ -466,7 +466,6 @@ class CustomDialog {
466466
context: _context,
467467
barrierColor: _barrierColor ?? Colors.black.withOpacity(.3),
468468
barrierDismissible: _barrierDismissible ?? true,
469-
useRootNavigator: _useRootNavigator ?? true,
470469
barrierLabel: "",
471470
transitionDuration: _duration ?? Duration(milliseconds: 250),
472471
transitionBuilder: _transitionsBuilder ?? _buildMaterialDialogTransitions,

pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: flutter_custom_dialog
22
description: Semantic dialog | Made In YY.inc | Welcome to contribute
3-
version: 1.0.19
3+
version: 1.0.20
44
author: AndroidHensen <xyj510402535@qq.com>
55
homepage: https://github.com/YYFlutter/flutter-custom-dialog.git
66

0 commit comments

Comments
 (0)