-
+
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 5c94cb2..ceac72e 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,6 +1,7 @@
-
-
+
+
+
\ No newline at end of file
diff --git a/.idea/runConfigurations/example_lib_main_dart.xml b/.idea/runConfigurations/example_lib_main_dart.xml
index bac2c8a..5fd9159 100644
--- a/.idea/runConfigurations/example_lib_main_dart.xml
+++ b/.idea/runConfigurations/example_lib_main_dart.xml
@@ -1,6 +1,6 @@
-
+
-
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 46d1db1..5100a54 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -1,695 +1,166 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- fontWeight
- letterSpacing
- widgetList
- borderRadius
- alertdialog
- height
- YYListTileDialog1
- constraints
- onPressed
- mainAxisAlignment
- width
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 1566301746478
+
+ 1571836649360
- 1566301746478
+ 1571836649360
-
- 1566376728934
+
+ 1571837341342
- 1566376728934
+ 1571837341342
-
- 1566442713013
+
+ 1571837363555
- 1566442713013
+ 1571837363555
-
- 1566525553872
+
+ 1629115967010
- 1566525553872
+ 1629115967010
-
- 1566527893970
+
+ 1634888281195
- 1566527893970
+ 1634888281195
-
- 1566528774136
+
+ 1634889158582
- 1566528774136
-
-
- 1566743422412
-
-
-
- 1566743422412
-
-
- 1566784983083
-
-
-
- 1566784983083
-
-
- 1566785811756
-
-
-
- 1566785811756
-
-
- 1566961999296
-
-
-
- 1566961999296
-
-
- 1567055609089
-
-
-
- 1567055609089
-
-
- 1567056034228
-
-
-
- 1567056034228
-
-
- 1567134520885
-
-
-
- 1567134520885
-
-
- 1567156997375
-
-
-
- 1567156997375
+ 1634889158582
-
- 1567995531143
-
-
-
- 1567995531143
-
-
- 1567995637031
-
-
-
- 1567995637031
-
-
- 1568003089015
-
-
-
- 1568003089015
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.metadata b/.metadata
index dadd408..5e6bbc5 100644
--- a/.metadata
+++ b/.metadata
@@ -4,7 +4,7 @@
# This file should be version controlled and should not be manually edited.
version:
- revision: b712a172f9694745f50505c93340883493b505e5
- channel: stable
+ revision: 760635e6dbf9180222171ac189199982a65cf608
+ channel: unknown
project_type: plugin
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 54af6d6..de32932 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,100 @@
## 1.0.0
* first release
-* welcome to submit bug
\ No newline at end of file
+* welcome to submit bug
+
+## 1.0.1
+
+* fix dismiss Bug
+
+## 1.0.2
+
+* add gravity of leftTop,leftBottom,rightTop,rightBottom
+
+## 1.0.3
+
+* add gravityAnimationEnable property
+
+## 1.0.4
+
+* Without the Context to invoke
+
+## 1.0.5
+
+* Modify constraints property
+
+## 1.0.6
+
+* Fix Gradle version in `gradle-wrapper.properties`
+
+## 1.0.7
+
+* Fix Gradle build Aar
+
+## 1.0.8
+
+* Fix Gradle build Aar for iOS
+
+## 1.0.9
+
+* Update Android kotlin version to 1.3.0
+
+## 1.0.10
+
+* add Log
+
+## 1.0.11
+
+* remove kotlin
+
+## 1.0.12
+
+* modify text Semantic
+
+## 1.0.13
+
+* remove kotlin again
+
+## 1.0.14
+
+* remove log
+
+## 1.0.15
+
+* add callback
+
+## 1.0.16
+
+* add decoration property
+
+## 1.0.17
+
+* add decoration property
+
+## 1.0.18
+
+* add color property for listRadio
+
+## 1.0.19
+
+* fix a padding bug
+
+## 1.0.20
+
+* add a useRootNavigator property
+
+## 1.0.21
+
+* Add SpaceEvenly Gravity
+
+## 1.1.0
+
+* Migrate to null safety
+
+## 1.1.1
+
+* try to fix Android V2 embedding
+
+## 1.2.0
+
+* fix Android V2 embedding
\ No newline at end of file
diff --git a/README.md b/README.md
index 494e287..ea40c23 100644
--- a/README.md
+++ b/README.md
@@ -2,13 +2,14 @@
[](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
1. Support for a few semantic component methods to populate the component content inside dialog
2. Support for customizing semantic components for developers to freely populate component content inside dialog
3. Support setting dialog background color, foreground color, position, animation, click the external disappear and other functions, see the details below
+4. Support no Context call dialog, see below
## 🎖 Installing
@@ -16,7 +17,7 @@ Global dialog function encapsulation, with a semantic way to fill the content in
```yaml
dependencies:
- flutter_custom_dialog: ^1.0.0
+ flutter_custom_dialog: ^1.3.0
```
**2、import**
@@ -67,6 +68,43 @@ import 'package:flutter_custom_dialog/flutter_custom_dialog.dart';
✅
+
+
+
+
+ progress
+
+ ✅
+
+
+
+
+ progress&body
+
+ ✅
+
+
+
+
+ bottom sheet
+
+ ✅
+
+
+
+
+ notice
+
+ ✅
+
+
+
+
+ pop menu
+
+ ✅ Support for custom locations
+
+
> dialog_gravity
@@ -109,6 +147,36 @@ import 'package:flutter_custom_dialog/flutter_custom_dialog.dart';
✅
+
+
+
+
+ left bottom
+
+ ✅
+
+
+
+
+ left top
+
+ ✅
+
+
+
+
+ right bottom
+
+ ✅
+
+
+
+
+ right top
+
+ ✅
+
+
> dialog_animation
@@ -151,18 +219,42 @@ import 'package:flutter_custom_dialog/flutter_custom_dialog.dart';
dialog property Settings can be called through the method of member variables, as detailed in the following table
```dart
-YYDialog YYDialogDemo(BuildContext context) {
- return YYDialog().build(context)
- ..width = 220
- ..height = 500
- ..barrierColor = Colors.black.withOpacity(.3)
+YYDialog YYNoticeDialog() {
+ return YYDialog().build()
+ ..width = 120
+ ..height = 110
+ ..backgroundColor = Colors.black.withOpacity(0.8)
+ ..borderRadius = 10.0
+ ..showCallBack = () {
+ print("showCallBack invoke");
+ }
+ ..dismissCallBack = () {
+ print("dismissCallBack invoke");
+ }
+ ..widget(Padding(
+ padding: EdgeInsets.only(top: 21),
+ child: Image.asset(
+ 'images/success.png',
+ width: 38,
+ height: 38,
+ ),
+ ))
+ ..widget(Padding(
+ padding: EdgeInsets.only(top: 10),
+ child: Text(
+ "Success",
+ style: TextStyle(
+ fontSize: 15,
+ color: Colors.white,
+ ),
+ ),
+ ))
..animatedFunc = (child, animation) {
return ScaleTransition(
child: child,
scale: Tween(begin: 0.0, end: 1.0).animate(animation),
);
}
- ..borderRadius = 4.0
..show();
}
```
@@ -175,12 +267,29 @@ width|Dialog width|0
height|Dialog height|Adaptive component height
duration|Dialog animation time|250 ms
gravity|Where the dialog appears|center
+gravityAnimationEnable|The dialog appears with the default animation available|false
+margin|The margin of a dialog|EdgeInsets.all(0.0)
barrierColor|Dialog barrierColor|30% of black
+decoration|Dialog decoration|null
backgroundColor|Dialog backgroundColor|white
borderRadius|Dialog borderRadius|0.0
-constraints|Dialog constraints|Minimum width and height not less than 10%
+constraints|Dialog constraints|no constraints
animatedFunc|Animation of dialog|Emerge from the middle
+showCallBack|dialog show callbacks|not
+dismissCallBack|dialog dismiss callbacks|not
barrierDismissible|Whether to click to pop up the external disappear|true
+useRootNavigator|Whether to use root navigation|true
+
+* After setting gravity, set gravityAnimationEnable = true if animation is needed
+* If the decoration property is set, the backgroundColor and borderRadius are not in effect; they are mutually exclusive
+
+Supported method
+
+method|description
+--|--|
+show[x,y]|show dialog
+dismiss|dismiss dialog
+isShowing|Is the dialog showing
## ⚡ Semantic Widget
@@ -268,6 +377,53 @@ YYDialog YYDialogDemo(BuildContext context) {
}
```
+## ⚡ Without the Context to invoke
+
+* Application scenario: after the network request comes back, there is no Context to refer to in the callback, at this time, the Context needs to be initialized in advance, and then the dialog can be called without the Context
+
+**1、init**
+
+Call static methods before show dialog `YYDialog.init(context);`
+
+```dart
+class AppHome extends StatelessWidget {
+ Widget build(BuildContext context) {
+ //1、init context
+ YYDialog.init(context);
+ //2、Subsequent use may not be required context
+ ......
+ }
+}
+```
+
+**2、use**
+
+direct use `YYDialog`,Note that it must be called `build()`
+
+```dart
+YYDialog YYAlertDialogBody() {
+ return YYDialog().build()
+ ..width = 240
+ ..text(
+ text: "Hello YYDialog",
+ color: Colors.grey[700],
+ )
+ ..show();
+}
+```
+
+## 🔥🔥 Attention
+
+**1、dismiss**
+
+* Do not use 'Navigator.pop(context)' to make the popover disappear, or you will close your page
+* This problem has been solved internally in YYDialog, and you can simply call 'dismiss()' supplied internally
+
+```dart
+var yyDialog = YYDialog();
+yyDialog?.dismiss();
+```
+
## Bugs/Requests
* If your application has problems, please submit your code and effect to Issue.
diff --git a/README_CN.md b/README_CN.md
index dd2f18c..f502f6c 100644
--- a/README_CN.md
+++ b/README_CN.md
@@ -7,6 +7,7 @@
1. 支持少数语义化组件的方法,填充弹窗内部的组件内容
2. 支持自定义语义化组件的方法,供开发者自由填充弹窗内部的组件内容
3. 支持设置弹窗背景色、前景色、位置、动画、点击外部消失等功能,具体看下文
+4. 支持无Context调用弹窗,具体看下文
## 🎖 Installing
@@ -14,7 +15,7 @@
```yaml
dependencies:
- flutter_custom_dialog: ^1.0.0
+ flutter_custom_dialog: ^1.3.0
```
**2、import**
@@ -65,6 +66,43 @@ import 'package:flutter_custom_dialog/flutter_custom_dialog.dart';
✅
+
+
+
+
+ progress
+
+ ✅
+
+
+
+
+ progress&body
+
+ ✅
+
+
+
+
+ notice
+
+ ✅
+
+
+
+
+ bottom sheet
+
+ ✅
+
+
+
+
+ pop menu
+
+ ✅ 支持自定义位置
+
+
> dialog_gravity
@@ -107,6 +145,36 @@ import 'package:flutter_custom_dialog/flutter_custom_dialog.dart';
✅
+
+
+
+
+ left bottom
+
+ ✅
+
+
+
+
+ left top
+
+ ✅
+
+
+
+
+ right bottom
+
+ ✅
+
+
+
+
+ right top
+
+ ✅
+
+
> dialog_animation
@@ -149,18 +217,42 @@ import 'package:flutter_custom_dialog/flutter_custom_dialog.dart';
弹窗的属性设置可以通过成员变量的方法去调用,具体详见下表
```dart
-YYDialog YYDialogDemo(BuildContext context) {
- return YYDialog().build(context)
- ..width = 220
- ..height = 500
- ..barrierColor = Colors.black.withOpacity(.3)
+YYDialog YYNoticeDialog() {
+ return YYDialog().build()
+ ..width = 120
+ ..height = 110
+ ..backgroundColor = Colors.black.withOpacity(0.8)
+ ..borderRadius = 10.0
+ ..showCallBack = () {
+ print("showCallBack invoke");
+ }
+ ..dismissCallBack = () {
+ print("dismissCallBack invoke");
+ }
+ ..widget(Padding(
+ padding: EdgeInsets.only(top: 21),
+ child: Image.asset(
+ 'images/success.png',
+ width: 38,
+ height: 38,
+ ),
+ ))
+ ..widget(Padding(
+ padding: EdgeInsets.only(top: 10),
+ child: Text(
+ "Success",
+ style: TextStyle(
+ fontSize: 15,
+ color: Colors.white,
+ ),
+ ),
+ ))
..animatedFunc = (child, animation) {
return ScaleTransition(
child: child,
scale: Tween(begin: 0.0, end: 1.0).animate(animation),
);
}
- ..borderRadius = 4.0
..show();
}
```
@@ -173,12 +265,29 @@ width|弹窗宽度|0
height|弹窗高度|自适应组件高度
duration|弹窗动画出现的时间|250毫秒
gravity|弹窗出现的位置|居中
+gravityAnimationEnable|弹窗出现的位置带有的默认动画是否可用|false
+margin|弹窗的外边距|EdgeInsets.all(0.0)
barrierColor|弹窗外的背景色|30%黑色
+decoration|弹窗内的装饰|null
backgroundColor|弹窗内的背景色|白色
borderRadius|弹窗圆角|0.0
-constraints|弹窗约束|最小宽高不低于10%
+constraints|弹窗约束|无
animatedFunc|弹窗出现的动画|从中间出现
+showCallBack|弹窗展示的回调|无
+dismissCallBack|弹窗消失的回调|无
barrierDismissible|是否点击弹出外部消失|true
+useRootNavigator|是否使用根导航|true
+
+* 设置完gravity后,若需要动画则设置gravityAnimationEnable = true
+* 若设置decoration属性,则backgroundColor和borderRadius不生效,他们是互斥关系
+
+支持的方法
+
+method|description
+--|--|
+show[x,y]|显示弹窗
+dismiss|隐藏弹窗
+isShowing|弹窗是否在展示
## ⚡ Semantic Widget
@@ -266,6 +375,53 @@ YYDialog YYDialogDemo(BuildContext context) {
}
```
+## ⚡ 无Context调用
+
+* 应用场景:在网络请求回来后,在回调中是无Context可以引用,这时候就需要预先初始化Context,后续就可以不需要Context调用弹窗
+
+**1、init**
+
+在未弹窗之前先调用静态方法`YYDialog.init(context);`
+
+```dart
+class AppHome extends StatelessWidget {
+ Widget build(BuildContext context) {
+ //1、初始化context
+ YYDialog.init(context);
+ //2、后续使用可以不需要context
+ ......
+ }
+}
+```
+
+**2、use**
+
+直接使用`YYDialog`,注意必须要调用`build()`
+
+```dart
+YYDialog YYAlertDialogBody() {
+ return YYDialog().build()
+ ..width = 240
+ ..text(
+ text: "Hello YYDialog",
+ color: Colors.grey[700],
+ )
+ ..show();
+}
+```
+
+## 🔥🔥 注意
+
+**1、dismiss**
+
+* 请勿擅自使用`Navigator.pop(context)`让弹窗消失,否则会关掉自己的页面
+* YYDialog内部已经解决了此问题,调用内部提供的`dismiss()`即可
+
+```dart
+var yyDialog = YYDialog();
+yyDialog?.dismiss();
+```
+
## Bugs/Requests
* If your application has problems, please submit your code and effect to Issue.
diff --git a/android/.idea/.name b/android/.idea/.name
deleted file mode 100644
index f409da2..0000000
--- a/android/.idea/.name
+++ /dev/null
@@ -1 +0,0 @@
-flutter_custom_dialog
\ No newline at end of file
diff --git a/android/.idea/caches/gradle_models.ser b/android/.idea/caches/gradle_models.ser
deleted file mode 100644
index 6fd0be8..0000000
Binary files a/android/.idea/caches/gradle_models.ser and /dev/null differ
diff --git a/android/.idea/encodings.xml b/android/.idea/encodings.xml
deleted file mode 100644
index 15a15b2..0000000
--- a/android/.idea/encodings.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/android/.idea/gradle.xml b/android/.idea/gradle.xml
deleted file mode 100644
index 2996d53..0000000
--- a/android/.idea/gradle.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/android/.idea/modules.xml b/android/.idea/modules.xml
deleted file mode 100644
index b2f9dd0..0000000
--- a/android/.idea/modules.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/android/build.gradle b/android/build.gradle
index 37b7dcf..4b2409a 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -1,5 +1,5 @@
group 'yy.inc.flutter_custom_dialog'
-version '1.0-SNAPSHOT'
+version '1.0'
buildscript {
repositories {
@@ -25,7 +25,7 @@ android {
compileSdkVersion 28
defaultConfig {
- minSdkVersion 16
+ minSdkVersion 20
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
lintOptions {
diff --git a/android/gradle.properties b/android/gradle.properties
index 2bd6f4f..e60119f 100644
--- a/android/gradle.properties
+++ b/android/gradle.properties
@@ -1,2 +1,4 @@
org.gradle.jvmargs=-Xmx1536M
+android.useAndroidX=true
+android.enableJetifier=true
diff --git a/android/gradle/wrapper/gradle-wrapper.jar b/android/gradle/wrapper/gradle-wrapper.jar
deleted file mode 100644
index f6b961f..0000000
Binary files a/android/gradle/wrapper/gradle-wrapper.jar and /dev/null differ
diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties
index 068b8bb..019065d 100644
--- a/android/gradle/wrapper/gradle-wrapper.properties
+++ b/android/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,5 @@
-#Tue Aug 20 19:49:39 CST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
diff --git a/android/gradlew b/android/gradlew
deleted file mode 100644
index cccdd3d..0000000
--- a/android/gradlew
+++ /dev/null
@@ -1,172 +0,0 @@
-#!/usr/bin/env sh
-
-##############################################################################
-##
-## Gradle start up script for UN*X
-##
-##############################################################################
-
-# Attempt to set APP_HOME
-# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
-done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >/dev/null
-APP_HOME="`pwd -P`"
-cd "$SAVED" >/dev/null
-
-APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
-
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
-
-# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
-
-warn () {
- echo "$*"
-}
-
-die () {
- echo
- echo "$*"
- echo
- exit 1
-}
-
-# OS specific support (must be 'true' or 'false').
-cygwin=false
-msys=false
-darwin=false
-nonstop=false
-case "`uname`" in
- CYGWIN* )
- cygwin=true
- ;;
- Darwin* )
- darwin=true
- ;;
- MINGW* )
- msys=true
- ;;
- NONSTOP* )
- nonstop=true
- ;;
-esac
-
-CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
-
-# Determine the Java command to use to start the JVM.
-if [ -n "$JAVA_HOME" ] ; then
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
- # IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
- else
- JAVACMD="$JAVA_HOME/bin/java"
- fi
- if [ ! -x "$JAVACMD" ] ; then
- die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
- fi
-else
- JAVACMD="java"
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
-fi
-
-# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
- MAX_FD_LIMIT=`ulimit -H -n`
- if [ $? -eq 0 ] ; then
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
- MAX_FD="$MAX_FD_LIMIT"
- fi
- ulimit -n $MAX_FD
- if [ $? -ne 0 ] ; then
- warn "Could not set maximum file descriptor limit: $MAX_FD"
- fi
- else
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
- fi
-fi
-
-# For Darwin, add options to specify how the application appears in the dock
-if $darwin; then
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
-fi
-
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
- JAVACMD=`cygpath --unix "$JAVACMD"`
-
- # We build the pattern for arguments to be converted via cygpath
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
- SEP=""
- for dir in $ROOTDIRSRAW ; do
- ROOTDIRS="$ROOTDIRS$SEP$dir"
- SEP="|"
- done
- OURCYGPATTERN="(^($ROOTDIRS))"
- # Add a user-defined pattern to the cygpath arguments
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
- fi
- # Now convert the arguments - kludge to limit ourselves to /bin/sh
- i=0
- for arg in "$@" ; do
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
-
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
- else
- eval `echo args$i`="\"$arg\""
- fi
- i=$((i+1))
- done
- case $i in
- (0) set -- ;;
- (1) set -- "$args0" ;;
- (2) set -- "$args0" "$args1" ;;
- (3) set -- "$args0" "$args1" "$args2" ;;
- (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
- esac
-fi
-
-# Escape application args
-save () {
- for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
- echo " "
-}
-APP_ARGS=$(save "$@")
-
-# Collect all arguments for the java command, following the shell quoting and substitution rules
-eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
-
-# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
-if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
- cd "$(dirname "$0")"
-fi
-
-exec "$JAVACMD" "$@"
diff --git a/android/gradlew.bat b/android/gradlew.bat
deleted file mode 100644
index f955316..0000000
--- a/android/gradlew.bat
+++ /dev/null
@@ -1,84 +0,0 @@
-@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windows variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/android/src/main/java/yy/inc/flutter_custom_dialog/FlutterCustomDialogPlugin.java b/android/src/main/java/yy/inc/flutter_custom_dialog/FlutterCustomDialogPlugin.java
index b708bf4..c901469 100644
--- a/android/src/main/java/yy/inc/flutter_custom_dialog/FlutterCustomDialogPlugin.java
+++ b/android/src/main/java/yy/inc/flutter_custom_dialog/FlutterCustomDialogPlugin.java
@@ -1,25 +1,35 @@
package yy.inc.flutter_custom_dialog;
+import androidx.annotation.NonNull;
+
+import io.flutter.embedding.engine.plugins.FlutterPlugin;
import io.flutter.plugin.common.MethodCall;
import io.flutter.plugin.common.MethodChannel;
import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
import io.flutter.plugin.common.MethodChannel.Result;
-import io.flutter.plugin.common.PluginRegistry.Registrar;
/** FlutterCustomDialogPlugin */
-public class FlutterCustomDialogPlugin implements MethodCallHandler {
- /** Plugin registration. */
- public static void registerWith(Registrar registrar) {
- final MethodChannel channel = new MethodChannel(registrar.messenger(), "flutter_custom_dialog");
- channel.setMethodCallHandler(new FlutterCustomDialogPlugin());
+public class FlutterCustomDialogPlugin implements FlutterPlugin, MethodCallHandler {
+
+ private MethodChannel channel;
+
+ @Override
+ public void onAttachedToEngine(@NonNull FlutterPluginBinding flutterPluginBinding) {
+ channel = new MethodChannel(flutterPluginBinding.getBinaryMessenger(), "flutter_custom_dialog");
+ channel.setMethodCallHandler(this);
}
@Override
- public void onMethodCall(MethodCall call, Result result) {
+ public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) {
if (call.method.equals("getPlatformVersion")) {
result.success("Android " + android.os.Build.VERSION.RELEASE);
} else {
result.notImplemented();
}
}
+
+ @Override
+ public void onDetachedFromEngine(FlutterPluginBinding binding) {
+ channel.setMethodCallHandler(null);
+ }
}
diff --git a/example/.flutter-plugins-dependencies b/example/.flutter-plugins-dependencies
new file mode 100644
index 0000000..b4f3407
--- /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":"2022-09-08 10:51:06.169356","version":"2.5.3"}
\ No newline at end of file
diff --git a/example/.gitignore b/example/.gitignore
index ac4a906..2ddde2a 100644
--- a/example/.gitignore
+++ b/example/.gitignore
@@ -61,6 +61,7 @@
**/ios/Flutter/app.flx
**/ios/Flutter/app.zip
**/ios/Flutter/flutter_assets/
+**/ios/Flutter/flutter_export_environment.sh
**/ios/ServiceDefinitions.json
**/ios/Runner/GeneratedPluginRegistrant.*
diff --git a/example/.metadata b/example/.metadata
index 3b87eb5..738d7d8 100644
--- a/example/.metadata
+++ b/example/.metadata
@@ -4,7 +4,7 @@
# This file should be version controlled and should not be manually edited.
version:
- revision: b712a172f9694745f50505c93340883493b505e5
- channel: stable
+ revision: 760635e6dbf9180222171ac189199982a65cf608
+ channel: unknown
project_type: app
diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle
index 37e040a..29dbb25 100644
--- a/example/android/app/build.gradle
+++ b/example/android/app/build.gradle
@@ -34,7 +34,7 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "yy.inc.flutter_custom_dialog_example"
- minSdkVersion 16
+ minSdkVersion 20
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml
index a7cbfba..0063516 100644
--- a/example/android/app/src/main/AndroidManifest.xml
+++ b/example/android/app/src/main/AndroidManifest.xml
@@ -7,7 +7,6 @@
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
+ android:name="io.flutter.embedding.android.NormalTheme"
+ android:resource="@style/NormalTheme" />
+
+
diff --git a/example/android/app/src/main/java/yy/inc/flutter_custom_dialog_example/MainActivity.java b/example/android/app/src/main/java/yy/inc/flutter_custom_dialog_example/MainActivity.java
index 5c5a420..eaf5cf2 100644
--- a/example/android/app/src/main/java/yy/inc/flutter_custom_dialog_example/MainActivity.java
+++ b/example/android/app/src/main/java/yy/inc/flutter_custom_dialog_example/MainActivity.java
@@ -1,13 +1,7 @@
package yy.inc.flutter_custom_dialog_example;
-import android.os.Bundle;
-import io.flutter.app.FlutterActivity;
-import io.flutter.plugins.GeneratedPluginRegistrant;
+import io.flutter.embedding.android.FlutterActivity;
public class MainActivity extends FlutterActivity {
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- GeneratedPluginRegistrant.registerWith(this);
- }
+
}
diff --git a/example/android/app/src/main/res/values/styles.xml b/example/android/app/src/main/res/values/styles.xml
index 00fa441..9fa09fc 100644
--- a/example/android/app/src/main/res/values/styles.xml
+++ b/example/android/app/src/main/res/values/styles.xml
@@ -5,4 +5,8 @@
Flutter draws its first frame -->
- @drawable/launch_background
+
+
diff --git a/example/android/gradle.properties b/example/android/gradle.properties
index 2bd6f4f..94adc3a 100644
--- a/example/android/gradle.properties
+++ b/example/android/gradle.properties
@@ -1,2 +1,3 @@
org.gradle.jvmargs=-Xmx1536M
-
+android.useAndroidX=true
+android.enableJetifier=true
diff --git a/example/images/success.png b/example/images/success.png
new file mode 100644
index 0000000..c4444ca
Binary files /dev/null and b/example/images/success.png differ
diff --git a/example/ios/Flutter/flutter_export_environment.sh b/example/ios/Flutter/flutter_export_environment.sh
new file mode 100755
index 0000000..a6ae7d7
--- /dev/null
+++ b/example/ios/Flutter/flutter_export_environment.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+# This is a generated file; do not edit or check into version control.
+export "FLUTTER_ROOT=G:\flutter"
+export "FLUTTER_APPLICATION_PATH=C:\YYLive4-OpenSource\flutter-custom-dialog\example"
+export "COCOAPODS_PARALLEL_CODE_SIGN=true"
+export "FLUTTER_TARGET=lib\main.dart"
+export "FLUTTER_BUILD_DIR=build"
+export "FLUTTER_BUILD_NAME=1.0.0"
+export "FLUTTER_BUILD_NUMBER=1"
+export "DART_OBFUSCATION=false"
+export "TRACK_WIDGET_CREATION=false"
+export "TREE_SHAKE_ICONS=false"
+export "PACKAGE_CONFIG=.packages"
diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj
index 032761f..2fbf4d2 100644
--- a/example/ios/Runner.xcodeproj/project.pbxproj
+++ b/example/ios/Runner.xcodeproj/project.pbxproj
@@ -313,7 +313,6 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
- DEVELOPMENT_TEAM = S8QB4VV633;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
diff --git a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
index 3d43d11..dc9ada4 100644
Binary files a/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png and b/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png differ
diff --git a/lib/components/example/alert_dialog.dart b/example/lib/dialog/alert_dialog.dart
similarity index 77%
rename from lib/components/example/alert_dialog.dart
rename to example/lib/dialog/alert_dialog.dart
index e6cd372..7794e45 100644
--- a/lib/components/example/alert_dialog.dart
+++ b/example/lib/dialog/alert_dialog.dart
@@ -1,9 +1,8 @@
import 'package:flutter/material.dart';
-import 'package:flutter_custom_dialog/components/bean/dialog_gravity.dart';
import 'package:flutter_custom_dialog/flutter_custom_dialog.dart';
-YYDialog YYAlertDialogBody(BuildContext context) {
- return YYDialog().build(context)
+YYDialog YYAlertDialogBody() {
+ return YYDialog().build()
..width = 240
..borderRadius = 4.0
..text(
@@ -26,8 +25,8 @@ YYDialog YYAlertDialogBody(BuildContext context) {
..show();
}
-YYDialog YYAlertDialogHeadAndBody(BuildContext context) {
- return YYDialog().build(context)
+YYDialog YYAlertDialogHeadAndBody() {
+ return YYDialog().build()
..width = 260
..borderRadius = 4.0
..text(
@@ -63,8 +62,8 @@ YYDialog YYAlertDialogHeadAndBody(BuildContext context) {
..show();
}
-YYDialog YYAlertDialogWithDivider(BuildContext context) {
- return YYDialog().build(context)
+YYDialog YYAlertDialogWithDivider() {
+ return YYDialog().build()
..width = 220
..borderRadius = 4.0
..text(
@@ -98,10 +97,11 @@ YYDialog YYAlertDialogWithDivider(BuildContext context) {
..show();
}
-YYDialog YYAlertDialogWithDuration(BuildContext context) {
- return YYDialog().build(context)
+YYDialog YYAlertDialogWithDuration() {
+ return YYDialog().build()
..width = 240
..borderRadius = 4.0
+ ..gravityAnimationEnable = true
..gravity = Gravity.left
..duration = Duration(seconds: 1)
..text(
@@ -129,11 +129,11 @@ YYDialog YYAlertDialogWithDuration(BuildContext context) {
..show();
}
-YYDialog YYAlertDialogWithbarrierColor(BuildContext context) {
- return YYDialog().build(context)
+YYDialog YYAlertDialogWithbarrierColor(Color color) {
+ return YYDialog().build()
..width = 240
..borderRadius = 4.0
- ..barrierColor = Colors.redAccent
+ ..barrierColor = color
..text(
padding: EdgeInsets.all(18.0),
text: "Dialog header",
@@ -159,8 +159,8 @@ YYDialog YYAlertDialogWithbarrierColor(BuildContext context) {
..show();
}
-YYDialog YYAlertDialogWithBackgroundColor(BuildContext context) {
- return YYDialog().build(context)
+YYDialog YYAlertDialogWithBackgroundColor() {
+ return YYDialog().build()
..width = 240
..borderRadius = 4.0
..backgroundColor = Colors.yellow
@@ -189,8 +189,8 @@ YYDialog YYAlertDialogWithBackgroundColor(BuildContext context) {
..show();
}
-YYDialog YYAlertDialogWithBarrierDismiss(BuildContext context) {
- return YYDialog().build(context)
+YYDialog YYAlertDialogWithBarrierDismiss() {
+ return YYDialog().build()
..width = 240
..borderRadius = 4.0
..barrierDismissible = false
@@ -219,11 +219,11 @@ YYDialog YYAlertDialogWithBarrierDismiss(BuildContext context) {
..show();
}
-YYDialog YYAlertDialogWithGravity(
- {context, width, gravity, doubleButtonGravity}) {
- return YYDialog().build(context)
+YYDialog YYAlertDialogWithGravity({width, gravity, doubleButtonGravity}) {
+ return YYDialog().build()
..width = width
..gravity = gravity
+ ..gravityAnimationEnable = true
..borderRadius = 4.0
..text(
padding: EdgeInsets.all(18.0),
@@ -252,8 +252,8 @@ YYDialog YYAlertDialogWithGravity(
..show();
}
-YYDialog YYAlertDialogWithScaleIn(BuildContext context) {
- return YYDialog().build(context)
+YYDialog YYAlertDialogWithScaleIn() {
+ return YYDialog().build()
..width = 240
..borderRadius = 4.0
..duration = Duration(milliseconds: 500)
@@ -288,8 +288,8 @@ YYDialog YYAlertDialogWithScaleIn(BuildContext context) {
..show();
}
-YYDialog YYAlertDialogWithFadeIn(BuildContext context) {
- return YYDialog().build(context)
+YYDialog YYAlertDialogWithFadeIn() {
+ return YYDialog().build()
..width = 240
..borderRadius = 4.0
..duration = Duration(milliseconds: 500)
@@ -324,8 +324,8 @@ YYDialog YYAlertDialogWithFadeIn(BuildContext context) {
..show();
}
-YYDialog YYAlertDialogWithRotateIn(BuildContext context) {
- return YYDialog().build(context)
+YYDialog YYAlertDialogWithRotateIn() {
+ return YYDialog().build()
..width = 240
..borderRadius = 4.0
..duration = Duration(milliseconds: 500)
@@ -360,8 +360,8 @@ YYDialog YYAlertDialogWithRotateIn(BuildContext context) {
..show();
}
-YYDialog YYAlertDialogWithCustomIn(BuildContext context) {
- return YYDialog().build(context)
+YYDialog YYAlertDialogWithCustomIn() {
+ return YYDialog().build()
..width = 240
..borderRadius = 4.0
..duration = Duration(milliseconds: 500)
@@ -412,8 +412,8 @@ YYDialog YYAlertDialogWithCustomIn(BuildContext context) {
..show();
}
-YYDialog YYDialogDemo(BuildContext context) {
- return YYDialog().build(context)
+YYDialog YYDialogDemo() {
+ return YYDialog().build()
..width = 220
..height = 500
..barrierColor = Colors.black.withOpacity(.3)
@@ -442,3 +442,84 @@ YYDialog YYDialogDemo(BuildContext context) {
)
..show();
}
+
+YYDialog YYAlertDialogPopMenu() {
+ return YYDialog().build()
+ ..width = 120
+ ..borderRadius = 8.0
+ ..gravity = Gravity.rightTop
+ ..barrierColor = Colors.transparent
+ ..margin = EdgeInsets.only(top: 80, right: 20)
+ ..text(
+ padding: EdgeInsets.fromLTRB(10.0, 16.0, 10.0, 16.0),
+ text: "Edit Libary",
+ fontSize: 16.0,
+ color: Colors.grey[700],
+ )
+ ..text(
+ padding: EdgeInsets.fromLTRB(10.0, 16.0, 10.0, 16.0),
+ text: "Read History",
+ fontSize: 16.0,
+ color: Color(0xFFFF6B2D),
+ )
+ ..show();
+}
+
+YYDialog YYAlertDialogCustomXY() {
+ return YYDialog().build()
+ ..width = 120
+ ..borderRadius = 8.0
+ ..barrierColor = Colors.transparent
+ ..text(
+ padding: EdgeInsets.fromLTRB(10.0, 16.0, 10.0, 16.0),
+ text: "Edit Libary",
+ fontSize: 16.0,
+ color: Colors.grey[700],
+ )
+ ..text(
+ padding: EdgeInsets.fromLTRB(10.0, 16.0, 10.0, 16.0),
+ text: "Read History",
+ fontSize: 16.0,
+ color: Color(0xFFFF6B2D),
+ )
+ ..show(80.0, 100.0);
+}
+
+YYDialog YYNoticeDialogCallback() {
+ return YYDialog().build()
+ ..width = 120
+ ..height = 110
+ ..backgroundColor = Colors.black.withOpacity(0.8)
+ ..borderRadius = 10.0
+ ..showCallBack = () {
+ print("showCallBack invoke");
+ }
+ ..dismissCallBack = () {
+ print("dismissCallBack invoke");
+ }
+ ..widget(Padding(
+ padding: EdgeInsets.only(top: 21),
+ child: Image.asset(
+ 'images/success.png',
+ width: 38,
+ height: 38,
+ ),
+ ))
+ ..widget(Padding(
+ padding: EdgeInsets.only(top: 10),
+ child: Text(
+ "Success",
+ style: TextStyle(
+ fontSize: 15,
+ color: Colors.white,
+ ),
+ ),
+ ))
+ ..animatedFunc = (child, animation) {
+ return ScaleTransition(
+ child: child,
+ scale: Tween(begin: 0.0, end: 1.0).animate(animation),
+ );
+ }
+ ..show();
+}
diff --git a/example/lib/dialog/bottom_sheet_dialog.dart b/example/lib/dialog/bottom_sheet_dialog.dart
new file mode 100644
index 0000000..b651458
--- /dev/null
+++ b/example/lib/dialog/bottom_sheet_dialog.dart
@@ -0,0 +1,37 @@
+import 'package:flutter/material.dart';
+import 'package:flutter_custom_dialog/flutter_custom_dialog.dart';
+
+YYDialog YYBottomSheetDialog() {
+ return YYDialog().build()
+ ..gravity = Gravity.bottom
+ ..gravityAnimationEnable = true
+ ..backgroundColor = Colors.transparent
+ ..widget(Container(
+ width: 300,
+ height: 45,
+ margin: EdgeInsets.only(bottom: 10),
+ decoration: BoxDecoration(
+ borderRadius: BorderRadius.circular(8.0),
+ color: Colors.white,
+ ),
+ child: Center(
+ child: Text("Block"),
+ ),
+ ))
+ ..widget(Container(
+ width: 300,
+ height: 45,
+ margin: EdgeInsets.only(bottom: 20),
+ decoration: BoxDecoration(
+ borderRadius: BorderRadius.circular(8.0),
+ color: Colors.white,
+ ),
+ child: Center(
+ child: Text(
+ "cancel",
+ style: TextStyle(color: Colors.grey[400]),
+ ),
+ ),
+ ))
+ ..show();
+}
diff --git a/example/lib/dialog/develop_dialog.dart b/example/lib/dialog/develop_dialog.dart
new file mode 100644
index 0000000..16e8898
--- /dev/null
+++ b/example/lib/dialog/develop_dialog.dart
@@ -0,0 +1,18 @@
+import 'package:flutter/material.dart';
+import 'package:flutter_custom_dialog/flutter_custom_dialog.dart';
+
+YYDialog YYFixTextFieldDialog() {
+ return YYDialog().build()
+ ..width = 120
+ ..height = 110
+ ..backgroundColor = Colors.white
+ ..borderRadius = 10.0
+ ..gravity = Gravity.bottom
+ ..widget(
+ Padding(
+ padding: EdgeInsets.all(24),
+ child: TextField(),
+ ),
+ )
+ ..show();
+}
diff --git a/lib/components/example/listview_dialog.dart b/example/lib/dialog/listview_dialog.dart
similarity index 92%
rename from lib/components/example/listview_dialog.dart
rename to example/lib/dialog/listview_dialog.dart
index 3ac397b..1f5037f 100644
--- a/lib/components/example/listview_dialog.dart
+++ b/example/lib/dialog/listview_dialog.dart
@@ -1,6 +1,4 @@
import 'package:flutter/material.dart';
-import 'package:flutter_custom_dialog/components/bean/dialog_gravity.dart';
-import 'package:flutter_custom_dialog/components/bean/dialog_item.dart';
import 'package:flutter_custom_dialog/flutter_custom_dialog.dart';
var listTileItems = [
@@ -118,8 +116,8 @@ var radioItems = [
),
];
-YYDialog YYListViewDialogListTile(BuildContext context) {
- return YYDialog().build(context)
+YYDialog YYListViewDialogListTile() {
+ return YYDialog().build()
..width = 280
..borderRadius = 4.0
..text(
@@ -138,8 +136,8 @@ YYDialog YYListViewDialogListTile(BuildContext context) {
..show();
}
-YYDialog YYListViewDialogListRadio(BuildContext context) {
- return YYDialog().build(context)
+YYDialog YYListViewDialogListRadio() {
+ return YYDialog().build()
..width = 280
..borderRadius = 4.0
..text(
@@ -153,6 +151,8 @@ YYDialog YYListViewDialogListRadio(BuildContext context) {
..listViewOfRadioButton(
items: radioItems,
height: 370,
+ intialValue: 2,
+ color: Colors.white,
activeColor: Colors.deepPurpleAccent,
onClickItemListener: (index) {
var radioItem = radioItems[index];
diff --git a/example/lib/dialog/notice_dialog.dart b/example/lib/dialog/notice_dialog.dart
new file mode 100644
index 0000000..21931da
--- /dev/null
+++ b/example/lib/dialog/notice_dialog.dart
@@ -0,0 +1,35 @@
+import 'package:flutter/material.dart';
+import 'package:flutter_custom_dialog/flutter_custom_dialog.dart';
+
+YYDialog YYNoticeDialog() {
+ return YYDialog().build()
+ ..width = 120
+ ..height = 110
+ ..backgroundColor = Colors.black.withOpacity(0.8)
+ ..borderRadius = 10.0
+ ..widget(Padding(
+ padding: EdgeInsets.only(top: 21),
+ child: Image.asset(
+ 'images/success.png',
+ width: 38,
+ height: 38,
+ ),
+ ))
+ ..widget(Padding(
+ padding: EdgeInsets.only(top: 10),
+ child: Text(
+ "Success",
+ style: TextStyle(
+ fontSize: 15,
+ color: Colors.white,
+ ),
+ ),
+ ))
+ ..animatedFunc = (child, animation) {
+ return ScaleTransition(
+ child: child,
+ scale: Tween(begin: 0.0, end: 1.0).animate(animation),
+ );
+ }
+ ..show();
+}
diff --git a/lib/components/example/progress_dialog.dart b/example/lib/dialog/progress_dialog.dart
similarity index 77%
rename from lib/components/example/progress_dialog.dart
rename to example/lib/dialog/progress_dialog.dart
index 5e30196..66fcd82 100644
--- a/lib/components/example/progress_dialog.dart
+++ b/example/lib/dialog/progress_dialog.dart
@@ -1,8 +1,8 @@
import 'package:flutter/material.dart';
import 'package:flutter_custom_dialog/flutter_custom_dialog.dart';
-YYDialog YYProgressDialogNoBody(BuildContext context) {
- return YYDialog().build(context)
+YYDialog YYProgressDialogNoBody() {
+ return YYDialog().build()
..width = 200
..borderRadius = 4.0
..circularProgress(
@@ -12,8 +12,8 @@ YYDialog YYProgressDialogNoBody(BuildContext context) {
..show();
}
-YYDialog YYProgressDialogBody(BuildContext context) {
- return YYDialog().build(context)
+YYDialog YYProgressDialogBody() {
+ return YYDialog().build()
..width = 200
..borderRadius = 4.0
..circularProgress(
diff --git a/example/lib/main.dart b/example/lib/main.dart
index 171ff0d..2d7693f 100644
--- a/example/lib/main.dart
+++ b/example/lib/main.dart
@@ -1,10 +1,14 @@
library flutter_custom_dialog;
import 'package:flutter/material.dart';
-import 'package:flutter_custom_dialog/components/example/alert_dialog.dart';
-import 'package:flutter_custom_dialog/components/bean/dialog_gravity.dart';
-import 'package:flutter_custom_dialog/components/example/listview_dialog.dart';
-import 'package:flutter_custom_dialog/components/example/progress_dialog.dart';
+import 'package:flutter_custom_dialog_example/dialog/alert_dialog.dart';
+import 'package:flutter_custom_dialog_example/dialog/bottom_sheet_dialog.dart';
+import 'package:flutter_custom_dialog_example/dialog/listview_dialog.dart';
+import 'package:flutter_custom_dialog_example/dialog/progress_dialog.dart';
+import 'package:flutter_custom_dialog_example/dialog/notice_dialog.dart';
+import 'package:flutter_custom_dialog/flutter_custom_dialog.dart';
+
+import 'dialog/develop_dialog.dart';
void main() => runApp(MyApp());
@@ -19,16 +23,21 @@ class MyApp extends StatelessWidget {
}
}
+/*
+ * When you init App, you can Initialize YYDialog so that use YYDialog.build().show() everywhere.
+ */
class AppHome extends StatelessWidget {
Widget build(BuildContext context) {
+ //1、初始化context
+ YYDialog.init(context);
+ //2、后续使用可以不需要context
return Scaffold(
appBar: AppBar(),
body: SingleChildScrollView(
child: Column(
children: [
showAlertDialog(context),
- showListViewDialog(context),
- showProgressDialog(context),
+ showDevelopDialog(context),
],
),
),
@@ -47,13 +56,48 @@ showAlertDialog(BuildContext context) {
Row(
children: [
makeTextButton("body", () {
- YYAlertDialogBody(context);
+ YYAlertDialogBody();
}),
makeTextButton("head&body", () {
- YYAlertDialogHeadAndBody(context);
+ YYAlertDialogHeadAndBody();
}),
makeTextButton("divider", () {
- YYAlertDialogWithDivider(context);
+ YYAlertDialogWithDivider();
+ }),
+ makeTextButton("listTile", () {
+ YYListViewDialogListTile();
+ }),
+ makeTextButton("listRadio", () {
+ YYListViewDialogListRadio();
+ }),
+ ],
+ ),
+ Row(
+ children: [
+ makeTextButton("bottom\nsheet", () {
+ YYBottomSheetDialog();
+ }),
+ makeTextButton("progress", () {
+ YYProgressDialogNoBody();
+ }),
+ makeTextButton("progress\n&body", () {
+ YYProgressDialogBody();
+ }),
+ makeTextButton("pop\nmenu", () {
+ YYAlertDialogPopMenu();
+ }),
+ makeTextButton("custom\nx&y", () {
+ YYAlertDialogCustomXY();
+ }),
+ ],
+ ),
+ Row(
+ children: [
+ makeTextButton("notice", () {
+ YYNoticeDialog();
+ }),
+ makeTextButton("callback", () {
+ YYNoticeDialogCallback();
}),
],
),
@@ -61,16 +105,19 @@ showAlertDialog(BuildContext context) {
Row(
children: [
makeTextButton("duration", () {
- YYAlertDialogWithDuration(context);
+ YYAlertDialogWithDuration();
}),
makeTextButton("barrier\ncolor", () {
- YYAlertDialogWithbarrierColor(context);
+ YYAlertDialogWithbarrierColor(Colors.redAccent);
+ }),
+ makeTextButton("transparent\ncolor", () {
+ YYAlertDialogWithbarrierColor(Colors.transparent);
}),
makeTextButton("background\ncolor", () {
- YYAlertDialogWithBackgroundColor(context);
+ YYAlertDialogWithBackgroundColor();
}),
makeTextButton("barrier\ndismiss", () {
- YYAlertDialogWithBarrierDismiss(context);
+ YYAlertDialogWithBarrierDismiss();
}),
],
),
@@ -79,79 +126,105 @@ showAlertDialog(BuildContext context) {
children: [
makeTextButton("bottom", () {
YYAlertDialogWithGravity(
- context: context,
gravity: Gravity.bottom,
);
}),
makeTextButton("top", () {
YYAlertDialogWithGravity(
- context: context,
gravity: Gravity.top,
);
}),
makeTextButton("left", () {
YYAlertDialogWithGravity(
- context: context,
width: 250.0,
gravity: Gravity.left,
);
}),
makeTextButton("right", () {
YYAlertDialogWithGravity(
- context: context,
width: 250.0,
gravity: Gravity.right,
);
}),
makeTextButton("center", () {
YYAlertDialogWithGravity(
- context: context,
width: 250.0,
gravity: Gravity.center,
);
}),
],
),
+ Row(
+ children: [
+ makeTextButton("left\nbottom", () {
+ YYAlertDialogWithGravity(
+ width: 250.0,
+ gravity: Gravity.leftBottom,
+ );
+ }),
+ makeTextButton("left\ntop", () {
+ YYAlertDialogWithGravity(
+ width: 250.0,
+ gravity: Gravity.leftTop,
+ );
+ }),
+ makeTextButton("right\nbottom", () {
+ YYAlertDialogWithGravity(
+ width: 250.0,
+ gravity: Gravity.rightBottom,
+ );
+ }),
+ makeTextButton("right\ntop", () {
+ YYAlertDialogWithGravity(
+ width: 250.0,
+ gravity: Gravity.rightTop,
+ );
+ }),
+ ],
+ ),
Text("4、double button gravity"),
Row(
children: [
makeTextButton("left", () {
YYAlertDialogWithGravity(
- context: context,
width: 250.0,
doubleButtonGravity: Gravity.left,
);
}),
makeTextButton("right", () {
YYAlertDialogWithGravity(
- context: context,
width: 250.0,
doubleButtonGravity: Gravity.right,
);
}),
makeTextButton("center", () {
YYAlertDialogWithGravity(
- context: context,
width: 250.0,
doubleButtonGravity: Gravity.center,
);
}),
+ makeTextButton("space\nEvenly", () {
+ YYAlertDialogWithGravity(
+ width: 250.0,
+ doubleButtonGravity: Gravity.spaceEvenly,
+ );
+ }),
],
),
Text("5、dialog animation"),
Row(
children: [
makeTextButton("scaleIn", () {
- YYAlertDialogWithScaleIn(context);
+ YYAlertDialogWithScaleIn();
}),
makeTextButton("fadeIn", () {
- YYAlertDialogWithFadeIn(context);
+ YYAlertDialogWithFadeIn();
}),
makeTextButton("rotateIn", () {
- YYAlertDialogWithRotateIn(context);
+ YYAlertDialogWithRotateIn();
}),
makeTextButton("customIn", () {
- YYAlertDialogWithCustomIn(context);
+ YYAlertDialogWithCustomIn();
}),
],
),
@@ -160,44 +233,41 @@ showAlertDialog(BuildContext context) {
);
}
-showListViewDialog(BuildContext context) {
- return Padding(
- padding: EdgeInsets.all(8.0),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text("YYListViewDialog", style: titleTextStyle),
- Text("1、demo"),
- Row(
- children: [
- makeTextButton("listTile", () {
- YYListViewDialogListTile(context);
- }),
- makeTextButton("listRadio", () {
- YYListViewDialogListRadio(context);
- }),
- ],
- ),
- ],
- ),
- );
-}
+showDevelopDialog(BuildContext context) {
+ YYDialog yyDialog;
-showProgressDialog(BuildContext context) {
return Padding(
padding: EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Text("YYProgressDialog", style: titleTextStyle),
- Text("1、demo"),
+ Text("YYDevelopDialog", style: titleTextStyle),
+ Text("1、debug"),
Row(
children: [
- makeTextButton("nobody", () {
- YYProgressDialogNoBody(context);
+ makeTextButton("fix dismiss\nbug", () {
+ Navigator.push(
+ context,
+ MaterialPageRoute(
+ builder: (context) => Scaffold(
+ appBar: AppBar(
+ title: Text("fix dismiss bug"),
+ ),
+ body: Column(
+ children: [
+ makeTextButton("show", () {
+ yyDialog = YYAlertDialogBody();
+ }),
+ makeTextButton("dismiss", () {
+ yyDialog?.dismiss();
+ }),
+ ],
+ ),
+ )),
+ );
}),
- makeTextButton("body", () {
- YYProgressDialogBody(context);
+ makeTextButton("fix textfield", () {
+ YYFixTextFieldDialog();
}),
],
),
@@ -208,7 +278,7 @@ showProgressDialog(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 5ba5dfb..0197b10 100644
--- a/example/pubspec.lock
+++ b/example/pubspec.lock
@@ -1,5 +1,5 @@
# Generated by pub
-# See https://www.dartlang.org/tools/pub/glossary#lockfile
+# See https://dart.dev/tools/pub/glossary#lockfile
packages:
async:
dependency: transitive
@@ -7,35 +7,56 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
- version: "2.1.0"
+ version: "2.8.1"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.dartlang.org"
source: hosted
- version: "1.0.4"
+ 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.3.1"
+ 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:
name: cupertino_icons
url: "https://pub.dartlang.org"
source: hosted
- version: "0.1.2"
+ version: "0.1.3"
+ 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.0"
+ version: "1.1.1"
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.6"
+ version: "1.7.0"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
- version: "1.6.2"
- pedantic:
- dependency: transitive
- description:
- name: pedantic
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.5.0"
- quiver:
- dependency: transitive
- description:
- name: quiver
- url: "https://pub.dartlang.org"
- source: hosted
- version: "2.0.2"
+ 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.4"
+ 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.4"
+ version: "0.4.2"
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.0 <3.0.0"
+ dart: ">=2.12.0 <3.0.0"
+ flutter: ">=1.10.0"
diff --git a/example/pubspec.yaml b/example/pubspec.yaml
index 31efff7..8618e98 100644
--- a/example/pubspec.yaml
+++ b/example/pubspec.yaml
@@ -31,10 +31,9 @@ flutter:
# the material Icons class.
uses-material-design: true
- # To add assets to your application, add an assets section, like this:
- # assets:
- # - images/a_dot_burr.jpeg
- # - images/a_dot_ham.jpeg
+ # To add assets to your application, add an assets section, like this:
+ assets:
+ - images/
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware.
diff --git a/example/test/widget_test.dart b/example/test/widget_test.dart
index 34f46e2..da9b52e 100644
--- a/example/test/widget_test.dart
+++ b/example/test/widget_test.dart
@@ -1,2 +1,27 @@
+// This is a basic Flutter widget test.
+//
+// To perform an interaction with a widget in your test, use the WidgetTester
+// utility that Flutter provides. For example, you can send tap and scroll
+// gestures. You can also use WidgetTester to find child widgets in the widget
+// tree, read text, and verify that the values of widget properties are correct.
+
+import 'package:flutter/material.dart';
+import 'package:flutter_test/flutter_test.dart';
+
+import 'package:flutter_custom_dialog_example/main.dart';
+
void main() {
+ testWidgets('Verify Platform version', (WidgetTester tester) async {
+ // Build our app and trigger a frame.
+ await tester.pumpWidget(MyApp());
+
+ // Verify that platform version is retrieved.
+ expect(
+ find.byWidgetPredicate(
+ (Widget widget) => widget is Text &&
+ widget.data.startsWith('Running on:'),
+ ),
+ findsOneWidget,
+ );
+ });
}
diff --git a/image/gif/111.gif b/image/gif/111.gif
new file mode 100644
index 0000000..f951ee2
Binary files /dev/null and b/image/gif/111.gif differ
diff --git a/image/gif/222.gif b/image/gif/222.gif
new file mode 100644
index 0000000..d7d25d8
Binary files /dev/null and b/image/gif/222.gif differ
diff --git a/image/gif/333.gif b/image/gif/333.gif
new file mode 100644
index 0000000..7636dc9
Binary files /dev/null and b/image/gif/333.gif differ
diff --git a/image/gif/444.gif b/image/gif/444.gif
new file mode 100644
index 0000000..015c4fb
Binary files /dev/null and b/image/gif/444.gif differ
diff --git a/image/png/10.png b/image/png/10.png
new file mode 100644
index 0000000..de57894
Binary files /dev/null and b/image/png/10.png differ
diff --git a/image/png/6.png b/image/png/6.png
new file mode 100644
index 0000000..c6fea6c
Binary files /dev/null and b/image/png/6.png differ
diff --git a/image/png/7.png b/image/png/7.png
new file mode 100644
index 0000000..f054ee5
Binary files /dev/null and b/image/png/7.png differ
diff --git a/image/png/8.png b/image/png/8.png
new file mode 100644
index 0000000..7ee16db
Binary files /dev/null and b/image/png/8.png differ
diff --git a/image/png/9.png b/image/png/9.png
new file mode 100644
index 0000000..2f7c5d1
Binary files /dev/null and b/image/png/9.png differ
diff --git a/ios/.gitignore b/ios/.gitignore
index 710ec6c..aa479fd 100644
--- a/ios/.gitignore
+++ b/ios/.gitignore
@@ -34,3 +34,4 @@ Icon?
.tags*
/Flutter/Generated.xcconfig
+/Flutter/flutter_export_environment.sh
\ No newline at end of file
diff --git a/lib/components/bean/dialog_gravity.dart b/lib/components/bean/dialog_gravity.dart
deleted file mode 100644
index 66b82be..0000000
--- a/lib/components/bean/dialog_gravity.dart
+++ /dev/null
@@ -1,7 +0,0 @@
-enum Gravity {
- left,
- top,
- bottom,
- right,
- center,
-}
diff --git a/lib/components/bean/dialog_item.dart b/lib/components/bean/dialog_item.dart
deleted file mode 100644
index 36b03cd..0000000
--- a/lib/components/bean/dialog_item.dart
+++ /dev/null
@@ -1,37 +0,0 @@
-import 'package:flutter/material.dart';
-
-class ListTileItem {
- ListTileItem({
- this.padding,
- this.leading,
- this.text,
- this.color,
- this.fontSize,
- this.fontWeight,
- });
-
- EdgeInsets padding;
- Widget leading;
- String text;
- Color color;
- double fontSize;
- FontWeight fontWeight;
-}
-
-class RadioItem {
- RadioItem({
- this.padding,
- this.text,
- this.color,
- this.fontSize,
- this.fontWeight,
- this.onTap,
- });
-
- EdgeInsets padding;
- String text;
- Color color;
- double fontSize;
- FontWeight fontWeight;
- Function(int) onTap;
-}
diff --git a/lib/flutter_custom_dialog.dart b/lib/flutter_custom_dialog.dart
index 6812e7c..63686ca 100644
--- a/lib/flutter_custom_dialog.dart
+++ b/lib/flutter_custom_dialog.dart
@@ -1,28 +1,52 @@
import 'package:flutter/material.dart';
-import 'package:flutter_custom_dialog/components/bean/dialog_item.dart';
-import 'components/bean/dialog_gravity.dart';
import 'flutter_custom_dialog_widget.dart';
+export 'package:flutter_custom_dialog/flutter_custom_dialog.dart';
+
class YYDialog {
//================================弹窗属性======================================
List widgetList = []; //弹窗内部所有组件
- 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; //弹窗出现的动画
+ bool barrierDismissible = true; //是否点击弹出外部消失
+ EdgeInsets margin = EdgeInsets.all(0.0); //弹窗布局的外边距
+
+ /// 用于有多个navigator嵌套的情况,默认为true
+ /// @params useRootNavigator=false,push是用的是当前布局的context
+ /// @params useRootNavigator=true,push是用的嵌套根布局的context
+ bool useRootNavigator = true;
+
+ Decoration? decoration; //弹窗内的装饰,与backgroundColor和borderRadius互斥
Color backgroundColor = Colors.white; //弹窗内的背景色
double borderRadius = 0.0; //弹窗圆角
- BoxConstraints constraints; //弹窗约束
- Function(Widget child, Animation animation) animatedFunc; //弹窗出现的动画
- bool barrierDismissible = true; //是否点击弹出外部消失
+
+ Function()? showCallBack; //展示的回调
+ Function()? dismissCallBack; //消失的回调
+
+ get isShowing => _isShowing; //当前 弹窗是否可见
+ bool _isShowing = false;
+
//============================================================================
+ static void init(BuildContext ctx) {
+ _context = ctx;
+ }
- YYDialog build(context) {
- this.context = context;
+ YYDialog build([BuildContext? ctx]) {
+ if (ctx == null && _context != null) {
+ this.context = _context;
+ return this;
+ }
+ this.context = ctx;
return this;
}
@@ -31,7 +55,18 @@ class YYDialog {
return this;
}
- YYDialog text({padding, text, color, fontSize, alignment, fontWeight}) {
+ YYDialog text(
+ {padding,
+ text,
+ color,
+ fontSize,
+ alignment,
+ textAlign,
+ maxLines,
+ textDirection,
+ overflow,
+ fontWeight,
+ fontFamily}) {
return this.widget(
Padding(
padding: padding ?? EdgeInsets.all(0.0),
@@ -39,10 +74,15 @@ class YYDialog {
alignment: alignment ?? Alignment.centerLeft,
child: Text(
text ?? "",
+ textAlign: textAlign,
+ maxLines: maxLines,
+ textDirection: textDirection,
+ overflow: overflow,
style: TextStyle(
color: color ?? Colors.black,
fontSize: fontSize ?? 14.0,
fontWeight: fontWeight,
+ fontFamily: fontFamily,
),
),
),
@@ -60,12 +100,16 @@ class YYDialog {
color1,
fontSize1,
fontWeight1,
- VoidCallback onTap1,
+ 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(
@@ -73,42 +117,48 @@ class YYDialog {
child: Row(
mainAxisAlignment: getRowMainAxisAlignment(gravity),
children: [
- FlatButton(
+ TextButton(
onPressed: () {
if (onTap1 != null) onTap1();
if (isClickAutoDismiss) {
dismiss();
}
},
- padding: EdgeInsets.all(0.0),
+ style: TextButton.styleFrom(
+ primary: color1 ?? Colors.black,
+ padding: buttonPadding1,
+ textStyle: TextStyle(
+ fontSize: fontSize1 ?? 18.0,
+ fontWeight: fontWeight1,
+ fontFamily: fontFamily1,
+ )
+ ),
child: Text(
text1 ?? "",
- style: TextStyle(
- color: color1 ?? null,
- fontSize: fontSize1 ?? null,
- fontWeight: fontWeight1 ?? null,
- ),
),
),
Visibility(
visible: withDivider,
child: VerticalDivider(),
),
- FlatButton(
+ TextButton(
onPressed: () {
if (onTap2 != null) onTap2();
if (isClickAutoDismiss) {
dismiss();
}
},
- padding: EdgeInsets.all(0.0),
+ style: TextButton.styleFrom(
+ primary: color2 ?? Colors.black,
+ padding: buttonPadding2,
+ textStyle: TextStyle(
+ fontSize: fontSize2 ?? 14.0,
+ fontWeight: fontWeight2,
+ fontFamily: fontFamily2,
+ ),
+ ),
child: Text(
text2 ?? "",
- style: TextStyle(
- color: color2 ?? Colors.black,
- fontSize: fontSize2 ?? 14.0,
- fontWeight: fontWeight2 ?? null,
- ),
),
)
],
@@ -118,10 +168,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(
@@ -129,7 +179,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,
@@ -143,14 +193,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 ?? null,
+ color: items?[index].color ?? null,
+ fontSize: items?[index].fontSize ?? null,
+ fontWeight: items?[index].fontWeight,
+ fontFamily: items?[index].fontFamily,
),
),
),
@@ -163,13 +214,14 @@ class YYDialog {
}
YYDialog listViewOfRadioButton({
- List items,
- double height,
- Color activeColor,
- Function(int) onClickItemListener,
+ List? items,
+ double? height,
+ Color? color,
+ Color? activeColor,
+ int? intialValue,
+ Function(int)? onClickItemListener,
}) {
- print("YYDialog ==> listViewOfRadioButton()");
- Size size = MediaQuery.of(context).size;
+ Size size = MediaQuery.of(context!).size;
return this.widget(
Container(
height: height,
@@ -180,6 +232,8 @@ class YYDialog {
),
child: YYRadioListTile(
items: items,
+ intialValue: intialValue,
+ color: color,
activeColor: activeColor,
onChanged: onClickItemListener,
),
@@ -208,58 +262,80 @@ class YYDialog {
);
}
- void show() {
+ /// x坐标
+ /// y坐标
+ void show([x, y]) {
var mainAxisAlignment = getColumnMainAxisAlignment(gravity);
var crossAxisAlignment = getColumnCrossAxisAlignment(gravity);
- Size size = MediaQuery.of(context).size;
+ if (x != null && y != null) {
+ gravity = Gravity.leftTop;
+ margin = EdgeInsets.only(left: x, top: y);
+ }
CustomDialog(
gravity: gravity,
- context: context,
+ gravityAnimationEnable: gravityAnimationEnable,
+ context: this.context!,
barrierColor: barrierColor,
animatedFunc: animatedFunc,
barrierDismissible: barrierDismissible,
duration: duration,
- child: Column(
- textDirection: TextDirection.ltr,
- mainAxisAlignment: mainAxisAlignment,
- crossAxisAlignment: crossAxisAlignment,
- children: [
- Material(
- type: MaterialType.transparency,
- child: Container(
- padding: EdgeInsets.all(borderRadius / 3.14),
- width: width ?? null,
- height: height ?? null,
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(borderRadius),
- color: backgroundColor,
- ),
- constraints: constraints ??
- BoxConstraints(
- minHeight: size.height * .1,
- minWidth: size.width * .1,
- ),
- child: Column(
- children: widgetList,
+ child: Padding(
+ padding: margin,
+ child: Column(
+ textDirection: TextDirection.ltr,
+ mainAxisAlignment: mainAxisAlignment,
+ crossAxisAlignment: crossAxisAlignment,
+ children: [
+ Material(
+ clipBehavior: Clip.antiAlias,
+ type: MaterialType.transparency,
+ borderRadius: BorderRadius.circular(borderRadius),
+ child: Container(
+ width: width ?? null,
+ height: height ?? null,
+ decoration: decoration ??
+ BoxDecoration(
+ borderRadius: BorderRadius.circular(borderRadius),
+ color: backgroundColor,
+ ),
+ constraints: constraints ?? BoxConstraints(),
+ child: CustomDialogChildren(
+ widgetList: widgetList,
+ isShowingChange: (bool isShowingChange) {
+ // showing or dismiss Callback
+ if (isShowingChange) {
+ showCallBack?.call();
+ } else {
+ dismissCallBack?.call();
+ }
+ _isShowing = isShowingChange;
+ },
+ ),
),
- ),
- )
- ],
+ )
+ ],
+ ),
),
);
}
void dismiss() {
- Navigator.of(context).pop();
+ if (_isShowing) {
+ Navigator.of(context!, rootNavigator: useRootNavigator).pop();
+ }
}
getColumnMainAxisAlignment(gravity) {
var mainAxisAlignment = MainAxisAlignment.start;
switch (gravity) {
case Gravity.bottom:
+ case Gravity.leftBottom:
+ case Gravity.rightBottom:
mainAxisAlignment = MainAxisAlignment.end;
break;
case Gravity.top:
+ case Gravity.leftTop:
+ case Gravity.rightTop:
mainAxisAlignment = MainAxisAlignment.start;
break;
case Gravity.left:
@@ -284,9 +360,13 @@ class YYDialog {
case Gravity.top:
break;
case Gravity.left:
+ case Gravity.leftTop:
+ case Gravity.leftBottom:
crossAxisAlignment = CrossAxisAlignment.start;
break;
case Gravity.right:
+ case Gravity.rightTop:
+ case Gravity.rightBottom:
crossAxisAlignment = CrossAxisAlignment.end;
break;
default:
@@ -308,6 +388,9 @@ class YYDialog {
case Gravity.right:
mainAxisAlignment = MainAxisAlignment.end;
break;
+ case Gravity.spaceEvenly:
+ mainAxisAlignment = MainAxisAlignment.spaceEvenly;
+ break;
case Gravity.center:
default:
mainAxisAlignment = MainAxisAlignment.center;
@@ -317,28 +400,63 @@ class YYDialog {
}
}
+///弹窗的内容作为可变组件
+class CustomDialogChildren extends StatefulWidget {
+ final List widgetList; //弹窗内部所有组件
+ final Function(bool)? isShowingChange;
+
+ CustomDialogChildren({this.widgetList = const [], this.isShowingChange});
+
+ @override
+ CustomDialogChildState createState() => CustomDialogChildState();
+}
+
+class CustomDialogChildState extends State {
+ @override
+ Widget build(BuildContext context) {
+ if (widget.isShowingChange != null) {
+ widget.isShowingChange!(true);
+ }
+ return Column(
+ children: widget.widgetList,
+ );
+ }
+
+ @override
+ void dispose() {
+ if (widget.isShowingChange != null) {
+ widget.isShowingChange!(false);
+ }
+ super.dispose();
+ }
+}
+
+///弹窗API的封装
class CustomDialog {
BuildContext _context;
Widget _child;
- Duration _duration;
- Color _barrierColor;
- RouteTransitionsBuilder _transitionsBuilder;
- bool _barrierDismissible;
- Gravity _gravity;
- Function _animatedFunc;
+ Duration? _duration;
+ Color? _barrierColor;
+ RouteTransitionsBuilder? _transitionsBuilder;
+ bool? _barrierDismissible;
+ Gravity? _gravity;
+ bool _gravityAnimationEnable;
+ Function? _animatedFunc;
CustomDialog({
- @required Widget child,
- @required BuildContext context,
- Duration duration,
- Color barrierColor,
- RouteTransitionsBuilder transitionsBuilder,
- Gravity gravity,
- 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,
+ _gravityAnimationEnable = gravityAnimationEnable,
_duration = duration,
_barrierColor = barrierColor,
_animatedFunc = animatedFunc,
@@ -348,6 +466,11 @@ class CustomDialog {
}
show() {
+ //fix transparent error
+ if (_barrierColor == Colors.transparent) {
+ _barrierColor = Colors.white.withOpacity(0.0);
+ }
+
showGeneralDialog(
context: _context,
barrierColor: _barrierColor ?? Colors.black.withOpacity(.3),
@@ -357,10 +480,8 @@ class CustomDialog {
transitionBuilder: _transitionsBuilder ?? _buildMaterialDialogTransitions,
pageBuilder: (BuildContext buildContext, Animation animation,
Animation secondaryAnimation) {
- print('show buildContext => #$buildContext');
return Builder(
builder: (BuildContext context) {
- print('show context => #$context');
return _child;
},
);
@@ -376,6 +497,8 @@ class CustomDialog {
Animation custom;
switch (_gravity) {
case Gravity.top:
+ case Gravity.leftTop:
+ case Gravity.rightTop:
custom = Tween(
begin: Offset(0.0, -1.0),
end: Offset(0.0, 0.0),
@@ -394,6 +517,8 @@ class CustomDialog {
).animate(animation);
break;
case Gravity.bottom:
+ case Gravity.leftBottom:
+ case Gravity.rightBottom:
custom = Tween(
begin: Offset(0.0, 1.0),
end: Offset(0.0, 0.0),
@@ -408,8 +533,17 @@ class CustomDialog {
break;
}
+ //自定义动画
if (_animatedFunc != null) {
- return _animatedFunc(child, animation);
+ return _animatedFunc!(child, animation);
+ }
+
+ //不需要默认动画
+ if (!_gravityAnimationEnable) {
+ custom = Tween(
+ begin: Offset(0.0, 0.0),
+ end: Offset(0.0, 0.0),
+ ).animate(animation);
}
return SlideTransition(
@@ -418,3 +552,58 @@ class CustomDialog {
);
}
}
+
+//================================弹窗重心======================================
+enum Gravity {
+ left,
+ top,
+ bottom,
+ right,
+ center,
+ rightTop,
+ leftTop,
+ rightBottom,
+ leftBottom,
+ spaceEvenly,
+}
+//============================================================================
+
+//================================弹窗实体======================================
+class ListTileItem {
+ ListTileItem({
+ this.padding,
+ this.leading,
+ this.text,
+ this.color,
+ this.fontSize,
+ this.fontWeight,
+ this.fontFamily,
+ });
+
+ EdgeInsets? padding;
+ Widget? leading;
+ String? text;
+ Color? color;
+ double? fontSize;
+ FontWeight? fontWeight;
+ String? fontFamily;
+}
+
+class RadioItem {
+ RadioItem({
+ this.padding,
+ this.text,
+ this.color,
+ this.fontSize,
+ this.fontWeight,
+ this.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 8c86482..9114a9d 100644
--- a/lib/flutter_custom_dialog_widget.dart
+++ b/lib/flutter_custom_dialog_widget.dart
@@ -1,19 +1,26 @@
+import 'dart:ui';
+
import 'package:flutter/material.dart';
-import 'components/bean/dialog_item.dart';
+import 'package:flutter_custom_dialog/flutter_custom_dialog.dart';
+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,
this.activeColor,
this.onChanged,
}) : assert(items != null),
super(key: key);
- List items;
- Color activeColor;
- Function(int) onChanged;
+ final List? items;
+ final Color? color;
+ final Color? activeColor;
+ final intialValue;
+ final Function(int)? onChanged;
@override
State createState() {
@@ -22,26 +29,46 @@ class YYRadioListTile extends StatefulWidget {
}
class YYRadioListTileState extends State {
- var groupId = 0;
+ var groupId = -1;
+
+ void intialSelectedItem() {
+ //intialValue:
+ //The button initializes the position.
+ //If it is not filled, it is not selected.
+ if (groupId == -1) {
+ groupId = widget.intialValue ?? -1;
+ }
+ }
@override
Widget build(BuildContext context) {
+ intialSelectedItem();
+
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: Colors.white,
+ color: widget.color,
child: RadioListTile(
- title: Text(widget.items[index].text),
+ title: Text(
+ widget.items?[index].text ?? "",
+ style: TextStyle(
+ 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/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 a1e8431..4fe6b9f 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -1,5 +1,5 @@
# Generated by pub
-# See https://www.dartlang.org/tools/pub/glossary#lockfile
+# See https://dart.dev/tools/pub/glossary#lockfile
packages:
async:
dependency: transitive
@@ -7,28 +7,49 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
- version: "2.1.0"
+ version: "2.8.1"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.dartlang.org"
source: hosted
- version: "1.0.4"
+ 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.3.1"
+ 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.6"
+ version: "1.7.0"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
- version: "1.6.2"
- pedantic:
- dependency: transitive
- description:
- name: pedantic
- url: "https://pub.dartlang.org"
- source: hosted
- version: "1.5.0"
- quiver:
- dependency: transitive
- description:
- name: quiver
- url: "https://pub.dartlang.org"
- source: hosted
- version: "2.0.2"
+ 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.4"
+ 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.4"
+ version: "0.4.2"
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.0 <3.0.0"
+ dart: ">=2.12.0 <3.0.0"
+ flutter: ">=1.10.0"
diff --git a/pubspec.yaml b/pubspec.yaml
index 5a42175..0f7102b 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,11 +1,11 @@
name: flutter_custom_dialog
-description: Semantic dialog
-version: 1.0.0
-author: AndroidHensen
+description: Semantic dialog | Made In YY.inc | Welcome to contribute
+version: 1.3.0
homepage: https://github.com/YYFlutter/flutter-custom-dialog.git
environment:
- sdk: ">=2.1.0 <3.0.0"
+ sdk: ">=2.12.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:
diff --git a/test/flutter_custom_dialog_test.dart b/test/flutter_custom_dialog_test.dart
index 34f46e2..ab73b3a 100644
--- a/test/flutter_custom_dialog_test.dart
+++ b/test/flutter_custom_dialog_test.dart
@@ -1,2 +1 @@
-void main() {
-}
+void main() {}