Skip to content

Commit

Permalink
add actionAlignment for dropdown
Browse files Browse the repository at this point in the history
  • Loading branch information
shirne committed Dec 23, 2023
1 parent fe6aca7 commit 6408ce8
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 35 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## [4.7.2]
* add actionAlignment for dropdown

## [4.7.1]
* Improve dropdown
* fix EntryController.close
Expand Down
10 changes: 5 additions & 5 deletions example/lib/custom_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ class _CustomPageState extends State<CustomPage> {
shape: const RoundedRectangleBorder(),
foregroundColor: Colors.black87,
),
alertStyle: const ModalStyle(
actionsPadding: EdgeInsets.all(8),
expandedAction: true,
buttonPadding: EdgeInsets.symmetric(vertical: 4),
),
// alertStyle: const ModalStyle(
// actionsPadding: EdgeInsets.all(8),
// expandedAction: true,
// buttonPadding: EdgeInsets.symmetric(vertical: 4),
// ),
modalStyle: ModalStyle.separated(
buttonPadding: const EdgeInsets.symmetric(vertical: 4),
),
Expand Down
28 changes: 14 additions & 14 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ packages:
dependency: transitive
description:
name: collection
sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687
sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.17.2"
version: "1.18.0"
combined_animation:
dependency: transitive
description:
Expand Down Expand Up @@ -140,10 +140,10 @@ packages:
dependency: transitive
description:
name: meta
sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3"
sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.9.1"
version: "1.10.0"
path:
dependency: transitive
description:
Expand All @@ -166,7 +166,7 @@ packages:
path: ".."
relative: true
source: path
version: "4.7.0"
version: "4.7.2"
sky_engine:
dependency: transitive
description: flutter
Expand All @@ -184,18 +184,18 @@ packages:
dependency: transitive
description:
name: stack_trace
sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5
sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.11.0"
version: "1.11.1"
stream_channel:
dependency: transitive
description:
name: stream_channel
sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8"
sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.1"
version: "2.1.2"
string_scanner:
dependency: transitive
description:
Expand All @@ -216,10 +216,10 @@ packages:
dependency: transitive
description:
name: test_api
sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8"
sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b"
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.6.0"
version: "0.6.1"
typed_data:
dependency: transitive
description:
Expand All @@ -240,10 +240,10 @@ packages:
dependency: transitive
description:
name: web
sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10
sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.1.4-beta"
version: "0.3.0"
xml:
dependency: transitive
description:
Expand All @@ -253,4 +253,4 @@ packages:
source: hosted
version: "6.1.0"
sdks:
dart: ">=3.1.0-185.0.dev <4.0.0"
dart: ">=3.2.0-194.0.dev <4.0.0"
5 changes: 5 additions & 0 deletions example/windows/runner/flutter_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ bool FlutterWindow::OnCreate() {
this->Show();
});

// Flutter can complete the first frame before the "show window" callback is
// registered. The following call ensures a frame is pending to ensure the
// window is shown. It is a no-op if the first frame hasn't completed yet.
flutter_controller_->ForceRedraw();

return true;
}

Expand Down
4 changes: 4 additions & 0 deletions lib/src/dropdown.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class DropdownWidget extends StatefulWidget {
super.key,
required this.origRect,
required this.actions,
this.actionAlignment,
this.padding = EdgeInsets.zero,
this.position,
this.elevation = 3.0,
Expand All @@ -14,6 +15,7 @@ class DropdownWidget extends StatefulWidget {
final double elevation;
final Rect origRect;
final List<Widget> actions;
final CrossAxisAlignment? actionAlignment;
final EdgeInsets padding;
final Set<DropDownLayoutPosition>? position;

Expand Down Expand Up @@ -54,6 +56,8 @@ class _DropdownWidgetState extends State<DropdownWidget> {
constraints: BoxConstraints(minWidth: widget.origRect.width),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment:
widget.actionAlignment ?? CrossAxisAlignment.center,
children: widget.actions,
),
),
Expand Down
2 changes: 2 additions & 0 deletions lib/src/my_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -838,6 +838,7 @@ class ShirneDialog {
EntryController dropdown(
List<Widget> actions, {
required Rect origRect,
CrossAxisAlignment? actionAlignment,
double? elevation,
HitTestBehavior? backdropBehavior,
Color? backdropColor,
Expand All @@ -853,6 +854,7 @@ class ShirneDialog {
origRect: origRect,
padding: padding ?? const EdgeInsets.all(8),
position: position,
actionAlignment: actionAlignment,
elevation: elevation ?? 4.0,
),
wrapperBuilder: (context, child) => GestureDetector(
Expand Down
26 changes: 13 additions & 13 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ packages:
dependency: transitive
description:
name: collection
sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687
sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.17.2"
version: "1.18.0"
combined_animation:
dependency: "direct main"
description:
Expand Down Expand Up @@ -103,10 +103,10 @@ packages:
dependency: transitive
description:
name: meta
sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3"
sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.9.1"
version: "1.10.0"
path:
dependency: transitive
description:
Expand All @@ -132,18 +132,18 @@ packages:
dependency: transitive
description:
name: stack_trace
sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5
sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.11.0"
version: "1.11.1"
stream_channel:
dependency: transitive
description:
name: stream_channel
sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8"
sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.1"
version: "2.1.2"
string_scanner:
dependency: transitive
description:
Expand All @@ -164,10 +164,10 @@ packages:
dependency: transitive
description:
name: test_api
sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8"
sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b"
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.6.0"
version: "0.6.1"
vector_math:
dependency: transitive
description:
Expand All @@ -180,9 +180,9 @@ packages:
dependency: transitive
description:
name: web
sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10
sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.1.4-beta"
version: "0.3.0"
sdks:
dart: ">=3.1.0-185.0.dev <4.0.0"
dart: ">=3.2.0-194.0.dev <4.0.0"
7 changes: 4 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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.1
version: 4.7.2
homepage: https://shirne.github.io/dialog/
repository: https://github.com/shirne/shirne_dialog
screenshots:
Expand All @@ -11,20 +11,21 @@ topics:
- toast
- alert
- comfirm
- dropdown

environment:
sdk: ">=2.17.0 <4.0.0"

dependencies:
flutter:
sdk: flutter
combined_animation: ^0.3.1
combined_animation: ">=0.3.1"


dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^2.0.1
flutter_lints:

flutter:
fonts:
Expand Down

0 comments on commit 6408ce8

Please sign in to comment.