diff --git a/CHANGELOG.md b/CHANGELOG.md index 1bfd26c..e7bcbf3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## [4.7.3] + * improve code style + * improve dropdown animate + ## [4.7.2] * add actionAlignment for dropdown diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml index 3a823b3..a9595e1 100644 --- a/example/android/app/src/main/AndroidManifest.xml +++ b/example/android/app/src/main/AndroidManifest.xml @@ -1,24 +1,13 @@ - - + + + + - + @@ -26,8 +15,6 @@ - + diff --git a/example/pubspec.lock b/example/pubspec.lock index dc33cbc..59cce0b 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -1,14 +1,6 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: - archive: - dependency: transitive - description: - name: archive - sha256: "793964beb8e297995714326628881437d4211f10fc8843534bab54129cd896ee" - url: "https://pub.flutter-io.cn" - source: hosted - version: "3.3.1" async: dependency: transitive description: @@ -57,14 +49,6 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "0.3.1" - crypto: - dependency: transitive - description: - name: crypto - sha256: aa274aa7774f8964e4f4f38cc994db7b6158dd36e9187aaceaddc994b35c6c67 - url: "https://pub.flutter-io.cn" - source: hosted - version: "3.0.2" fake_async: dependency: transitive description: @@ -96,14 +80,6 @@ packages: description: flutter source: sdk version: "0.0.0" - image: - dependency: "direct main" - description: - name: image - sha256: "9d2c5f73435a70a936d317769ee8e7ef480e37674b9f2bce95ea98969a307855" - url: "https://pub.flutter-io.cn" - source: hosted - version: "3.2.0" intl: dependency: transitive description: @@ -152,21 +128,13 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.8.3" - petitparser: - dependency: transitive - description: - name: petitparser - sha256: "2ebb289dc4764ec397f5cd3ca9881c6d17196130a7d646ed022a0dd9c2e25a71" - url: "https://pub.flutter-io.cn" - source: hosted - version: "5.0.0" shirne_dialog: dependency: "direct main" description: path: ".." relative: true source: path - version: "4.7.2" + version: "4.7.3" sky_engine: dependency: transitive description: flutter @@ -220,14 +188,6 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "0.6.1" - typed_data: - dependency: transitive - description: - name: typed_data - sha256: "26f87ade979c47a150c9eaab93ccd2bebe70a27dc0b4b29517f2904f04eb11a5" - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.3.1" vector_math: dependency: transitive description: @@ -244,13 +204,5 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "0.3.0" - xml: - dependency: transitive - description: - name: xml - sha256: ac0e3f4bf00ba2708c33fbabbbe766300e509f8c82dbd4ab6525039813f7e2fb - url: "https://pub.flutter-io.cn" - source: hosted - version: "6.1.0" sdks: dart: ">=3.2.0-194.0.dev <4.0.0" diff --git a/example/pubspec.yaml b/example/pubspec.yaml index c35a28f..7cac318 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -26,14 +26,13 @@ dependencies: flutter_localizations: sdk: flutter - image: shirne_dialog: path: ../ dev_dependencies: flutter_test: sdk: flutter - flutter_lints: ^2.0.1 + flutter_lints: # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec diff --git a/lib/src/widgets/dropdown.dart b/lib/src/widgets/dropdown.dart index ade7483..be4ef44 100644 --- a/lib/src/widgets/dropdown.dart +++ b/lib/src/widgets/dropdown.dart @@ -48,10 +48,17 @@ class _DropdownWidgetState extends State { ), child: GestureDetector( onTap: () {}, - child: CombinedAnimation( - config: widget.animate ?? AnimationConfig.fadeIn, - leaveConfig: widget.leaveAnimate, - //controller: controller, + child: ValueListenableBuilder( + valueListenable: layoutPositionNotifier, + builder: (context, value, child) { + return CombinedAnimation( + config: widget.animate ?? + AnimationConfig.enter(align: value.startAlign), + leaveConfig: widget.leaveAnimate, + //controller: controller, + child: child!, + ); + }, child: Material( color: Colors.transparent, borderOnForeground: false, @@ -245,6 +252,19 @@ enum DropDownLayoutPosition { } } + Alignment get startAlign { + switch (this) { + case top: + return const Alignment(0, 0.3); + case left: + return const Alignment(0.3, 0); + case right: + return const Alignment(-0.3, 0); + case bottom: + return const Alignment(0, -0.3); + } + } + static const auto = {bottom, top, right, left}; static const vertical = {bottom, top}; static const horizontal = {bottom, top}; @@ -322,7 +342,9 @@ class _DropDownLayout extends SingleChildLayoutDelegate { constraintsSets.entries.first, bigger, ); - layoutPositionNotifier.value = _resolved!.key; + WidgetsBinding.instance.addPostFrameCallback((_) { + layoutPositionNotifier.value = _resolved!.key; + }); return _resolved!; } diff --git a/pubspec.yaml b/pubspec.yaml index 8cd7528..d565551 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: shirne_dialog description: A flutter package to use alert, toast, popup, snack, imagePreview, loading etc. with customizable style in anywhere. -version: 4.7.2 +version: 4.7.3 homepage: https://shirne.github.io/dialog/ repository: https://github.com/shirne/shirne_dialog screenshots: @@ -22,7 +22,6 @@ dependencies: sdk: flutter combined_animation: ">=0.3.1 <1.0.0" - dev_dependencies: flutter_test: sdk: flutter