From d9b637aeb07a17a02fc65b289816a809edd66768 Mon Sep 17 00:00:00 2001 From: Daniel Carneiro Date: Tue, 10 Nov 2020 12:30:07 +0000 Subject: [PATCH 01/13] fix: type on readme file --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d281d4a..4d07627 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![pub package](https://img.shields.io/pub/v/flutter_custom_dialog.svg)](https://pub.dev/packages/flutter_custom_dialog) -**[Lanuage ~~]** [English](README.md) | [中文文档](README_CN.md) +**[Language ~~]** [English](README.md) | [中文文档](README_CN.md) Global dialog function encapsulation, with a semantic way to fill the content inside the dialog, the current function provided From d085c4aa91ca0c8c4eae785e3953380674e75b97 Mon Sep 17 00:00:00 2001 From: JayYu Date: Mon, 18 Jan 2021 06:46:40 +0900 Subject: [PATCH 02/13] Add SpaceEvenly Gravity --- lib/flutter_custom_dialog.dart | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/flutter_custom_dialog.dart b/lib/flutter_custom_dialog.dart index fd072e9..9ebc520 100644 --- a/lib/flutter_custom_dialog.dart +++ b/lib/flutter_custom_dialog.dart @@ -386,6 +386,9 @@ class YYDialog { case Gravity.right: mainAxisAlignment = MainAxisAlignment.end; break; + case Gravity.spaceEvenly: + mainAxisAlignment = MainAxisAlignment.spaceEvenly; + break; case Gravity.center: default: mainAxisAlignment = MainAxisAlignment.center; @@ -555,6 +558,7 @@ enum Gravity { leftTop, rightBottom, leftBottom, + spaceEvenly, } //============================================================================ From 48d687230fb92a1ace8834ed65f4a62fea03619b Mon Sep 17 00:00:00 2001 From: frozenrainyoo Date: Sat, 30 Jan 2021 23:31:01 +0900 Subject: [PATCH 03/13] Apply custom buttonPadding for doubleButton When button text length is short, doubleButton is hard to tab. so, need custom buttonPadding. --- lib/flutter_custom_dialog.dart | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/flutter_custom_dialog.dart b/lib/flutter_custom_dialog.dart index fd072e9..a1d7708 100644 --- a/lib/flutter_custom_dialog.dart +++ b/lib/flutter_custom_dialog.dart @@ -102,12 +102,14 @@ class YYDialog { fontWeight1, fontFamily1, VoidCallback onTap1, + buttonPadding1 = const EdgeInsets.all(0.0), text2, color2, fontSize2, fontWeight2, fontFamily2, onTap2, + buttonPadding2 = const EdgeInsets.all(0.0), }) { return this.widget( SizedBox( @@ -122,7 +124,7 @@ class YYDialog { dismiss(); } }, - padding: EdgeInsets.all(0.0), + padding: buttonPadding1, child: Text( text1 ?? "", style: TextStyle( @@ -144,7 +146,7 @@ class YYDialog { dismiss(); } }, - padding: EdgeInsets.all(0.0), + padding: buttonPadding2, child: Text( text2 ?? "", style: TextStyle( From 6a9ab572ae45f3ab3360183a13316fd66dc83270 Mon Sep 17 00:00:00 2001 From: xuyingjun Date: Mon, 16 Aug 2021 17:34:06 +0800 Subject: [PATCH 04/13] 1.0.21 --- CHANGELOG.md | 6 ++- README.md | 2 +- README_CN.md | 2 +- example/.flutter-plugins-dependencies | 1 + example/lib/main.dart | 12 +++-- example/pubspec.lock | 70 +++++++++++++++------------ local.properties | 8 +++ pubspec.lock | 68 ++++++++++++++------------ pubspec.yaml | 12 +++-- 9 files changed, 110 insertions(+), 71 deletions(-) create mode 100644 example/.flutter-plugins-dependencies create mode 100644 local.properties diff --git a/CHANGELOG.md b/CHANGELOG.md index eb84f80..faf3749 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -81,4 +81,8 @@ ## 1.0.20 -* add a useRootNavigator property \ No newline at end of file +* add a useRootNavigator property + +## 1.0.21 + +* Add SpaceEvenly Gravity \ No newline at end of file diff --git a/README.md b/README.md index d281d4a..f7642f6 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Global dialog function encapsulation, with a semantic way to fill the content in ```yaml dependencies: - flutter_custom_dialog: ^1.0.20 + flutter_custom_dialog: ^1.0.21 ``` **2、import** diff --git a/README_CN.md b/README_CN.md index 9f2784f..2534ac4 100644 --- a/README_CN.md +++ b/README_CN.md @@ -15,7 +15,7 @@ ```yaml dependencies: - flutter_custom_dialog: ^1.0.20 + flutter_custom_dialog: ^1.0.21 ``` **2、import** diff --git a/example/.flutter-plugins-dependencies b/example/.flutter-plugins-dependencies new file mode 100644 index 0000000..a15985a --- /dev/null +++ b/example/.flutter-plugins-dependencies @@ -0,0 +1 @@ +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_custom_dialog","path":"C:\\\\YYLive4-OpenSource\\\\flutter-custom-dialog\\\\","dependencies":[]}],"android":[{"name":"flutter_custom_dialog","path":"C:\\\\YYLive4-OpenSource\\\\flutter-custom-dialog\\\\","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"flutter_custom_dialog","dependencies":[]}],"date_created":"2021-08-16 17:32:14.319764","version":"2.2.3"} \ No newline at end of file diff --git a/example/lib/main.dart b/example/lib/main.dart index be828a5..2d7693f 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -74,7 +74,7 @@ showAlertDialog(BuildContext context) { ), Row( children: [ - makeTextButton("bottomsheet", () { + makeTextButton("bottom\nsheet", () { YYBottomSheetDialog(); }), makeTextButton("progress", () { @@ -203,6 +203,12 @@ showAlertDialog(BuildContext context) { doubleButtonGravity: Gravity.center, ); }), + makeTextButton("space\nEvenly", () { + YYAlertDialogWithGravity( + width: 250.0, + doubleButtonGravity: Gravity.spaceEvenly, + ); + }), ], ), Text("5、dialog animation"), @@ -239,7 +245,7 @@ showDevelopDialog(BuildContext context) { Text("1、debug"), Row( children: [ - makeTextButton("fix dismiss\nbug in v1.0.1", () { + makeTextButton("fix dismiss\nbug", () { Navigator.push( context, MaterialPageRoute( @@ -272,7 +278,7 @@ showDevelopDialog(BuildContext context) { Widget makeTextButton(title, Function() function) { return SizedBox( - width: 70.0, + width: 65.0, height: 35.0, child: RaisedButton( padding: EdgeInsets.all(0.0), diff --git a/example/pubspec.lock b/example/pubspec.lock index aa5283a..f90a913 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -7,28 +7,42 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.3.0" + version: "2.6.1" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "1.0.5" + version: "2.1.0" + characters: + dependency: transitive + description: + name: characters + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.1.2" + version: "1.2.0" + clock: + dependency: transitive + description: + name: clock + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.14.11" + version: "1.15.0" cupertino_icons: dependency: "direct main" description: @@ -36,6 +50,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.1.2" + fake_async: + dependency: transitive + description: + name: fake_async + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0" flutter: dependency: "direct main" description: flutter @@ -47,7 +68,7 @@ packages: path: ".." relative: true source: path - version: "1.0.19" + version: "1.0.21" flutter_test: dependency: "direct dev" description: flutter @@ -59,35 +80,21 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.5" + version: "0.12.10" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.1.7" + version: "1.3.0" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.6.4" - pedantic: - dependency: transitive - description: - name: pedantic - url: "https://pub.dartlang.org" - source: hosted - version: "1.8.0+1" - quiver: - dependency: transitive - description: - name: quiver - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.5" + version: "1.8.0" sky_engine: dependency: transitive description: flutter @@ -99,55 +106,56 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.5.5" + version: "1.8.1" stack_trace: dependency: transitive description: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.9.3" + version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0" string_scanner: dependency: transitive description: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.0.5" + version: "1.1.0" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.5" + version: "0.3.0" typed_data: dependency: transitive description: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.1.6" + version: "1.3.0" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.0.8" + version: "2.1.0" sdks: - dart: ">=2.2.2 <3.0.0" + dart: ">=2.12.0 <3.0.0" + flutter: ">=1.12.0" diff --git a/local.properties b/local.properties new file mode 100644 index 0000000..c154f3d --- /dev/null +++ b/local.properties @@ -0,0 +1,8 @@ +## This file must *NOT* be checked into Version Control Systems, +# as it contains information specific to your local configuration. +# +# Location of the SDK. This is only used by Gradle. +# For customization when using a Version Control System, please read the +# header note. +#Mon Aug 16 16:54:26 CST 2021 +sdk.dir=C\:\\Users\\Administrator\\AppData\\Local\\Android\\Sdk diff --git a/pubspec.lock b/pubspec.lock index aebdafa..e9ed765 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,28 +7,49 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.3.0" + version: "2.6.1" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "1.0.5" + version: "2.1.0" + characters: + dependency: transitive + description: + name: characters + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.1.2" + version: "1.2.0" + clock: + dependency: transitive + description: + name: clock + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.14.11" + version: "1.15.0" + fake_async: + dependency: transitive + description: + name: fake_async + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0" flutter: dependency: "direct main" description: flutter @@ -45,35 +66,21 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.5" + version: "0.12.10" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.1.7" + version: "1.3.0" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.6.4" - pedantic: - dependency: transitive - description: - name: pedantic - url: "https://pub.dartlang.org" - source: hosted - version: "1.8.0+1" - quiver: - dependency: transitive - description: - name: quiver - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.5" + version: "1.8.0" sky_engine: dependency: transitive description: flutter @@ -85,55 +92,56 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.5.5" + version: "1.8.1" stack_trace: dependency: transitive description: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.9.3" + version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0" string_scanner: dependency: transitive description: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.0.5" + version: "1.1.0" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.5" + version: "0.3.0" typed_data: dependency: transitive description: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.1.6" + version: "1.3.0" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.0.8" + version: "2.1.0" sdks: - dart: ">=2.2.2 <3.0.0" + dart: ">=2.12.0 <3.0.0" + flutter: ">=1.12.0" diff --git a/pubspec.yaml b/pubspec.yaml index 9d4e183..8aacb75 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,11 +1,11 @@ name: flutter_custom_dialog description: Semantic dialog | Made In YY.inc | Welcome to contribute -version: 1.0.20 -author: AndroidHensen +version: 1.0.21 homepage: https://github.com/YYFlutter/flutter-custom-dialog.git environment: sdk: ">=2.1.0 <3.0.0" + flutter: ">=1.10.0" dependencies: flutter: @@ -25,8 +25,12 @@ flutter: # be modified. They are used by the tooling to maintain consistency when # adding or updating assets for this project. plugin: - androidPackage: yy.inc.flutter_custom_dialog - pluginClass: FlutterCustomDialogPlugin + platforms: + android: + package: yy.inc.flutter_custom_dialog + pluginClass: FlutterCustomDialogPlugin + ios: + pluginClass: FlutterCustomDialogPlugin # To add assets to your plugin package, add an assets section, like this: # assets: From 634c6f0265d4f92fd9e64912eac3e37a5a4891a4 Mon Sep 17 00:00:00 2001 From: AndroidHensen Date: Mon, 16 Aug 2021 19:05:31 +0800 Subject: [PATCH 05/13] example --- example/.flutter-plugins-dependencies | 2 +- pubspec.yaml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/example/.flutter-plugins-dependencies b/example/.flutter-plugins-dependencies index a15985a..0f072fd 100644 --- a/example/.flutter-plugins-dependencies +++ b/example/.flutter-plugins-dependencies @@ -1 +1 @@ -{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_custom_dialog","path":"C:\\\\YYLive4-OpenSource\\\\flutter-custom-dialog\\\\","dependencies":[]}],"android":[{"name":"flutter_custom_dialog","path":"C:\\\\YYLive4-OpenSource\\\\flutter-custom-dialog\\\\","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"flutter_custom_dialog","dependencies":[]}],"date_created":"2021-08-16 17:32:14.319764","version":"2.2.3"} \ No newline at end of file +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_custom_dialog","path":"C:\\\\YYLive4-OpenSource\\\\flutter-custom-dialog\\\\","dependencies":[]}],"android":[{"name":"flutter_custom_dialog","path":"C:\\\\YYLive4-OpenSource\\\\flutter-custom-dialog\\\\","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"flutter_custom_dialog","dependencies":[]}],"date_created":"2021-08-16 18:33:17.928565","version":"2.2.3"} \ No newline at end of file diff --git a/pubspec.yaml b/pubspec.yaml index 8aacb75..940d09c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,6 +2,7 @@ name: flutter_custom_dialog description: Semantic dialog | Made In YY.inc | Welcome to contribute version: 1.0.21 homepage: https://github.com/YYFlutter/flutter-custom-dialog.git +publish_to: 'https://pub.dev' environment: sdk: ">=2.1.0 <3.0.0" From dd0f44b8ba644739ab65d12d2dae4d4e34bae919 Mon Sep 17 00:00:00 2001 From: AndroidHensen Date: Mon, 16 Aug 2021 19:20:48 +0800 Subject: [PATCH 06/13] RadioItem --- lib/flutter_custom_dialog_widget.dart | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/flutter_custom_dialog_widget.dart b/lib/flutter_custom_dialog_widget.dart index 4978476..047f723 100644 --- a/lib/flutter_custom_dialog_widget.dart +++ b/lib/flutter_custom_dialog_widget.dart @@ -1,3 +1,5 @@ +import 'dart:ui'; + import 'package:flutter/material.dart'; import 'package:flutter_custom_dialog/flutter_custom_dialog.dart'; @@ -50,7 +52,13 @@ class YYRadioListTileState extends State { return Material( color: widget.color, child: RadioListTile( - title: Text(widget.items[index].text), + title: Text( + widget.items[index].text, + style: TextStyle( + fontSize: widget.items[index].fontSize, + fontWeight: widget.items[index].fontWeight, + color: widget.items[index].color), + ), value: index, groupValue: groupId, activeColor: widget.activeColor, From 11c781813898640d981160f476a3545a583c56c3 Mon Sep 17 00:00:00 2001 From: AndroidHensen Date: Mon, 16 Aug 2021 20:12:46 +0800 Subject: [PATCH 07/13] #Migrate to null safety v1.1.0 --- CHANGELOG.md | 6 +- README.md | 2 +- README_CN.md | 2 +- example/.flutter-plugins-dependencies | 2 +- example/pubspec.lock | 1 - lib/flutter_custom_dialog.dart | 138 +++++++++++++------------- lib/flutter_custom_dialog_widget.dart | 29 +++--- pubspec.lock | 1 - pubspec.yaml | 4 +- 9 files changed, 95 insertions(+), 90 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index faf3749..2a6e983 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -85,4 +85,8 @@ ## 1.0.21 -* Add SpaceEvenly Gravity \ No newline at end of file +* Add SpaceEvenly Gravity + +## 1.1.0 + +* Migrate to null safety \ No newline at end of file diff --git a/README.md b/README.md index 43bb340..5c827aa 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Global dialog function encapsulation, with a semantic way to fill the content in ```yaml dependencies: - flutter_custom_dialog: ^1.0.21 + flutter_custom_dialog: ^1.1.0 ``` **2、import** diff --git a/README_CN.md b/README_CN.md index 2534ac4..4aec0e9 100644 --- a/README_CN.md +++ b/README_CN.md @@ -15,7 +15,7 @@ ```yaml dependencies: - flutter_custom_dialog: ^1.0.21 + flutter_custom_dialog: ^1.1.0 ``` **2、import** diff --git a/example/.flutter-plugins-dependencies b/example/.flutter-plugins-dependencies index 0f072fd..f382161 100644 --- a/example/.flutter-plugins-dependencies +++ b/example/.flutter-plugins-dependencies @@ -1 +1 @@ -{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_custom_dialog","path":"C:\\\\YYLive4-OpenSource\\\\flutter-custom-dialog\\\\","dependencies":[]}],"android":[{"name":"flutter_custom_dialog","path":"C:\\\\YYLive4-OpenSource\\\\flutter-custom-dialog\\\\","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"flutter_custom_dialog","dependencies":[]}],"date_created":"2021-08-16 18:33:17.928565","version":"2.2.3"} \ No newline at end of file +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_custom_dialog","path":"C:\\\\YYLive4-OpenSource\\\\flutter-custom-dialog\\\\","dependencies":[]}],"android":[{"name":"flutter_custom_dialog","path":"C:\\\\YYLive4-OpenSource\\\\flutter-custom-dialog\\\\","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"flutter_custom_dialog","dependencies":[]}],"date_created":"2021-08-16 20:01:06.563734","version":"2.2.3"} \ No newline at end of file diff --git a/example/pubspec.lock b/example/pubspec.lock index f90a913..e9049b7 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -158,4 +158,3 @@ packages: version: "2.1.0" sdks: dart: ">=2.12.0 <3.0.0" - flutter: ">=1.12.0" diff --git a/lib/flutter_custom_dialog.dart b/lib/flutter_custom_dialog.dart index 1bfac6f..598eb6a 100644 --- a/lib/flutter_custom_dialog.dart +++ b/lib/flutter_custom_dialog.dart @@ -7,17 +7,17 @@ export 'package:flutter_custom_dialog/flutter_custom_dialog.dart'; class YYDialog { //================================弹窗属性====================================== List widgetList = []; //弹窗内部所有组件 - static BuildContext _context; //弹窗上下文 - BuildContext context; //弹窗上下文 + static BuildContext? _context; //弹窗上下文 + BuildContext? context; //弹窗上下文 - double width; //弹窗宽度 - double height; //弹窗高度 + double? width; //弹窗宽度 + double? height; //弹窗高度 Duration duration = Duration(milliseconds: 250); //弹窗动画出现的时间 Gravity gravity = Gravity.center; //弹窗出现的位置 bool gravityAnimationEnable = false; //弹窗出现的位置带有的默认动画是否可用 Color barrierColor = Colors.black.withOpacity(.3); //弹窗外的背景色 - BoxConstraints constraints; //弹窗约束 - Function(Widget child, Animation animation) animatedFunc; //弹窗出现的动画 + BoxConstraints? constraints; //弹窗约束 + Function(Widget child, Animation animation)? animatedFunc; //弹窗出现的动画 bool barrierDismissible = true; //是否点击弹出外部消失 EdgeInsets margin = EdgeInsets.all(0.0); //弹窗布局的外边距 @@ -26,12 +26,12 @@ class YYDialog { /// @params useRootNavigator=true,push是用的嵌套根布局的context bool useRootNavigator = true; - Decoration decoration; //弹窗内的装饰,与backgroundColor和borderRadius互斥 + Decoration? decoration; //弹窗内的装饰,与backgroundColor和borderRadius互斥 Color backgroundColor = Colors.white; //弹窗内的背景色 double borderRadius = 0.0; //弹窗圆角 - Function() showCallBack; //展示的回调 - Function() dismissCallBack; //消失的回调 + Function()? showCallBack; //展示的回调 + Function()? dismissCallBack; //消失的回调 get isShowing => _isShowing; //当前 弹窗是否可见 bool _isShowing = false; @@ -41,7 +41,7 @@ class YYDialog { _context = ctx; } - YYDialog build([BuildContext ctx]) { + YYDialog build([BuildContext? ctx]) { if (ctx == null && _context != null) { this.context = _context; return this; @@ -101,7 +101,7 @@ class YYDialog { fontSize1, fontWeight1, fontFamily1, - VoidCallback onTap1, + VoidCallback? onTap1, buttonPadding1 = const EdgeInsets.all(0.0), text2, color2, @@ -164,10 +164,10 @@ class YYDialog { } YYDialog listViewOfListTile({ - List items, - double height, + List? items, + double? height, isClickAutoDismiss = true, - Function(int) onClickItemListener, + Function(int)? onClickItemListener, }) { return this.widget( Container( @@ -175,7 +175,7 @@ class YYDialog { child: ListView.builder( padding: EdgeInsets.all(0.0), shrinkWrap: true, - itemCount: items.length, + itemCount: items?.length ?? 0, itemBuilder: (BuildContext context, int index) { return Material( color: Colors.white, @@ -189,15 +189,15 @@ class YYDialog { dismiss(); } }, - contentPadding: items[index].padding ?? EdgeInsets.all(0.0), - leading: items[index].leading, + contentPadding: items?[index].padding ?? EdgeInsets.all(0.0), + leading: items?[index].leading, title: Text( - items[index].text ?? "", + items?[index].text ?? "", style: TextStyle( - color: items[index].color ?? null, - fontSize: items[index].fontSize ?? null, - fontWeight: items[index].fontWeight, - fontFamily: items[index].fontFamily, + color: items?[index].color ?? null, + fontSize: items?[index].fontSize ?? null, + fontWeight: items?[index].fontWeight, + fontFamily: items?[index].fontFamily, ), ), ), @@ -210,14 +210,14 @@ class YYDialog { } YYDialog listViewOfRadioButton({ - List items, - double height, - Color color, - Color activeColor, - int intialValue, - Function(int) onClickItemListener, + List? items, + double? height, + Color? color, + Color? activeColor, + int? intialValue, + Function(int)? onClickItemListener, }) { - Size size = MediaQuery.of(context).size; + Size size = MediaQuery.of(context!).size; return this.widget( Container( height: height, @@ -270,7 +270,7 @@ class YYDialog { CustomDialog( gravity: gravity, gravityAnimationEnable: gravityAnimationEnable, - context: this.context, + context: this.context!, barrierColor: barrierColor, animatedFunc: animatedFunc, barrierDismissible: barrierDismissible, @@ -300,13 +300,9 @@ class YYDialog { isShowingChange: (bool isShowingChange) { // showing or dismiss Callback if (isShowingChange) { - if (showCallBack != null) { - showCallBack(); - } + showCallBack?.call(); } else { - if (dismissCallBack != null) { - dismissCallBack(); - } + dismissCallBack?.call(); } _isShowing = isShowingChange; }, @@ -321,7 +317,7 @@ class YYDialog { void dismiss() { if (_isShowing) { - Navigator.of(context, rootNavigator: useRootNavigator).pop(); + Navigator.of(context!, rootNavigator: useRootNavigator).pop(); } } @@ -403,7 +399,7 @@ class YYDialog { ///弹窗的内容作为可变组件 class CustomDialogChildren extends StatefulWidget { final List widgetList; //弹窗内部所有组件 - final Function(bool) isShowingChange; + final Function(bool)? isShowingChange; CustomDialogChildren({this.widgetList = const [], this.isShowingChange}); @@ -414,7 +410,9 @@ class CustomDialogChildren extends StatefulWidget { class CustomDialogChildState extends State { @override Widget build(BuildContext context) { - widget.isShowingChange(true); + if (widget.isShowingChange != null) { + widget.isShowingChange!(true); + } return Column( children: widget.widgetList, ); @@ -422,7 +420,9 @@ class CustomDialogChildState extends State { @override void dispose() { - widget.isShowingChange(false); + if (widget.isShowingChange != null) { + widget.isShowingChange!(false); + } super.dispose(); } } @@ -431,24 +431,24 @@ class CustomDialogChildState extends State { class CustomDialog { BuildContext _context; Widget _child; - Duration _duration; - Color _barrierColor; - RouteTransitionsBuilder _transitionsBuilder; - bool _barrierDismissible; - Gravity _gravity; + Duration? _duration; + Color? _barrierColor; + RouteTransitionsBuilder? _transitionsBuilder; + bool? _barrierDismissible; + Gravity? _gravity; bool _gravityAnimationEnable; - Function _animatedFunc; + Function? _animatedFunc; CustomDialog({ - @required Widget child, - @required BuildContext context, - Duration duration, - Color barrierColor, - RouteTransitionsBuilder transitionsBuilder, - Gravity gravity, - bool gravityAnimationEnable, - Function animatedFunc, - bool barrierDismissible, + required Widget child, + required BuildContext context, + Duration? duration, + Color? barrierColor, + RouteTransitionsBuilder? transitionsBuilder, + Gravity? gravity, + bool gravityAnimationEnable = false, + Function? animatedFunc, + bool? barrierDismissible, }) : _child = child, _context = context, _gravity = gravity, @@ -531,7 +531,7 @@ class CustomDialog { //自定义动画 if (_animatedFunc != null) { - return _animatedFunc(child, animation); + return _animatedFunc!(child, animation); } //不需要默认动画 @@ -576,13 +576,13 @@ class ListTileItem { this.fontFamily, }); - EdgeInsets padding; - Widget leading; - String text; - Color color; - double fontSize; - FontWeight fontWeight; - String fontFamily; + EdgeInsets? padding; + Widget? leading; + String? text; + Color? color; + double? fontSize; + FontWeight? fontWeight; + String? fontFamily; } class RadioItem { @@ -595,11 +595,11 @@ class RadioItem { this.onTap, }); - EdgeInsets padding; - String text; - Color color; - double fontSize; - FontWeight fontWeight; - Function(int) onTap; + EdgeInsets? padding; + String? text; + Color? color; + double? fontSize; + FontWeight? fontWeight; + Function(int)? onTap; } //============================================================================ diff --git a/lib/flutter_custom_dialog_widget.dart b/lib/flutter_custom_dialog_widget.dart index 047f723..9114a9d 100644 --- a/lib/flutter_custom_dialog_widget.dart +++ b/lib/flutter_custom_dialog_widget.dart @@ -7,7 +7,7 @@ export 'package:flutter_custom_dialog/flutter_custom_dialog_widget.dart'; class YYRadioListTile extends StatefulWidget { YYRadioListTile({ - Key key, + Key? key, this.items, this.intialValue, this.color, @@ -16,11 +16,11 @@ class YYRadioListTile extends StatefulWidget { }) : assert(items != null), super(key: key); - final List items; - final Color color; - final Color activeColor; + final List? items; + final Color? color; + final Color? activeColor; final intialValue; - final Function(int) onChanged; + final Function(int)? onChanged; @override State createState() { @@ -47,25 +47,28 @@ class YYRadioListTileState extends State { return ListView.builder( padding: EdgeInsets.all(0.0), shrinkWrap: true, - itemCount: widget.items.length, + itemCount: widget.items?.length ?? 0, itemBuilder: (BuildContext context, int index) { return Material( color: widget.color, child: RadioListTile( title: Text( - widget.items[index].text, + widget.items?[index].text ?? "", style: TextStyle( - fontSize: widget.items[index].fontSize, - fontWeight: widget.items[index].fontWeight, - color: widget.items[index].color), + fontSize: widget.items?[index].fontSize ?? 14, + fontWeight: + widget.items?[index].fontWeight ?? FontWeight.normal, + color: widget.items?[index].color ?? Colors.black), ), value: index, groupValue: groupId, activeColor: widget.activeColor, - onChanged: (int value) { + onChanged: (int? value) { setState(() { - widget.onChanged(value); - groupId = value; + if (widget.onChanged != null) { + widget.onChanged!(value ?? 0); + } + groupId = value ?? -1; }); }, ), diff --git a/pubspec.lock b/pubspec.lock index e9ed765..ad6d1df 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -144,4 +144,3 @@ packages: version: "2.1.0" sdks: dart: ">=2.12.0 <3.0.0" - flutter: ">=1.12.0" diff --git a/pubspec.yaml b/pubspec.yaml index 940d09c..290ddc0 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,11 +1,11 @@ name: flutter_custom_dialog description: Semantic dialog | Made In YY.inc | Welcome to contribute -version: 1.0.21 +version: 1.1.0 homepage: https://github.com/YYFlutter/flutter-custom-dialog.git publish_to: 'https://pub.dev' environment: - sdk: ">=2.1.0 <3.0.0" + sdk: ">=2.12.0 <3.0.0" flutter: ">=1.10.0" dependencies: From 0639824718a3a2156c03774f28f58d66f235755d Mon Sep 17 00:00:00 2001 From: AndroidHensen Date: Fri, 22 Oct 2021 15:38:00 +0800 Subject: [PATCH 08/13] try to fix Android V2 embedding --- .idea/libraries/Dart_SDK.xml | 31 +- .idea/misc.xml | 3 + .idea/workspace.xml | 519 ++++-------------- CHANGELOG.md | 6 +- example/.flutter-plugins-dependencies | 2 +- .../android/app/src/main/AndroidManifest.xml | 11 +- .../MainActivity.java | 13 - .../app/src/main/res/values/styles.xml | 4 + .../ios/Flutter/flutter_export_environment.sh | 13 +- example/pubspec.lock | 13 +- pubspec.lock | 1 + pubspec.yaml | 2 +- 12 files changed, 164 insertions(+), 454 deletions(-) delete mode 100644 example/android/app/src/main/java/yy/inc/flutter_custom_dialog_example/MainActivity.java diff --git a/.idea/libraries/Dart_SDK.xml b/.idea/libraries/Dart_SDK.xml index 5b80310..b54adb1 100644 --- a/.idea/libraries/Dart_SDK.xml +++ b/.idea/libraries/Dart_SDK.xml @@ -1,17 +1,26 @@ - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + diff --git a/.idea/misc.xml b/.idea/misc.xml index dfda312..ceac72e 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,7 @@ + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml index b40cb42..d51621e 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -3,297 +3,61 @@ + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - + + - + \ No newline at end of file diff --git a/README.md b/README.md index b7a612b..ea40c23 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Global dialog function encapsulation, with a semantic way to fill the content in ```yaml dependencies: - flutter_custom_dialog: ^1.2.0 + flutter_custom_dialog: ^1.3.0 ``` **2、import** diff --git a/README_CN.md b/README_CN.md index a9aae1e..f502f6c 100644 --- a/README_CN.md +++ b/README_CN.md @@ -15,7 +15,7 @@ ```yaml dependencies: - flutter_custom_dialog: ^1.2.0 + flutter_custom_dialog: ^1.3.0 ``` **2、import** diff --git a/example/.flutter-plugins-dependencies b/example/.flutter-plugins-dependencies index b2b04d4..b4f3407 100644 --- a/example/.flutter-plugins-dependencies +++ b/example/.flutter-plugins-dependencies @@ -1 +1 @@ -{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_custom_dialog","path":"C:\\\\YYLive4-OpenSource\\\\flutter-custom-dialog\\\\","dependencies":[]}],"android":[{"name":"flutter_custom_dialog","path":"C:\\\\YYLive4-OpenSource\\\\flutter-custom-dialog\\\\","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"flutter_custom_dialog","dependencies":[]}],"date_created":"2021-10-22 16:32:26.122793","version":"2.5.3"} \ No newline at end of file +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_custom_dialog","path":"C:\\\\YYLive4-OpenSource\\\\flutter-custom-dialog\\\\","dependencies":[]}],"android":[{"name":"flutter_custom_dialog","path":"C:\\\\YYLive4-OpenSource\\\\flutter-custom-dialog\\\\","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"flutter_custom_dialog","dependencies":[]}],"date_created":"2022-09-08 10:51:06.169356","version":"2.5.3"} \ No newline at end of file diff --git a/lib/flutter_custom_dialog.dart b/lib/flutter_custom_dialog.dart index 863e613..63686ca 100644 --- a/lib/flutter_custom_dialog.dart +++ b/lib/flutter_custom_dialog.dart @@ -125,10 +125,10 @@ class YYDialog { } }, style: TextButton.styleFrom( + primary: color1 ?? Colors.black, padding: buttonPadding1, textStyle: TextStyle( - color: color1 ?? null, - fontSize: fontSize1 ?? null, + fontSize: fontSize1 ?? 18.0, fontWeight: fontWeight1, fontFamily: fontFamily1, ) @@ -149,9 +149,9 @@ class YYDialog { } }, style: TextButton.styleFrom( + primary: color2 ?? Colors.black, padding: buttonPadding2, textStyle: TextStyle( - color: color2 ?? Colors.black, fontSize: fontSize2 ?? 14.0, fontWeight: fontWeight2, fontFamily: fontFamily2, diff --git a/pubspec.yaml b/pubspec.yaml index c4e3267..0f7102b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,8 +1,7 @@ name: flutter_custom_dialog description: Semantic dialog | Made In YY.inc | Welcome to contribute -version: 1.2.0 +version: 1.3.0 homepage: https://github.com/YYFlutter/flutter-custom-dialog.git -publish_to: 'https://pub.dev' environment: sdk: ">=2.12.0 <3.0.0"