From 61a7cca8b0d8ca0b4232b810be6059efc3d3ad5b Mon Sep 17 00:00:00 2001 From: Jelle Schaafsma Date: Thu, 26 Sep 2024 11:45:06 +0200 Subject: [PATCH] feat: add option to override the padding for BottomAlertDialog --- CHANGELOG.md | 3 +++ lib/src/bottom_alert_dialog.dart | 2 +- lib/src/bottom_alert_dialog_config.dart | 5 +++++ pubspec.yaml | 2 +- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a376cc0..e86c9fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 1.1.0 +- Add option `bottomAlertDialogPadding` to `BottomAlertDialogConfig` for specifying the empty space above the title of a dialog. By default it is an EdgeInsets with top 10px. + ## 1.0.0 - Flutter_dialogs and flutter_bottom_alert_dialogs combined into one package - Add default padding to the bottom alert dialog that is the size of the safe area of a device. You can disable this by setting `useSafeAreaPadding` to false. diff --git a/lib/src/bottom_alert_dialog.dart b/lib/src/bottom_alert_dialog.dart index 4702f5e..c391057 100644 --- a/lib/src/bottom_alert_dialog.dart +++ b/lib/src/bottom_alert_dialog.dart @@ -282,7 +282,7 @@ class BottomAlertDialog extends StatelessWidget { child: Stack( children: [ Padding( - padding: const EdgeInsets.only(top: 10), + padding: config.bottomAlertDialogPadding, child: Align( alignment: Alignment.center, child: Column( diff --git a/lib/src/bottom_alert_dialog_config.dart b/lib/src/bottom_alert_dialog_config.dart index df42dc6..9573436 100644 --- a/lib/src/bottom_alert_dialog_config.dart +++ b/lib/src/bottom_alert_dialog_config.dart @@ -29,6 +29,7 @@ class BottomAlertDialogConfig extends InheritedWidget { CloseButtonBuilder? closeButtonBuilder, this.yesText = "Yes", this.noText = "No", + this.bottomAlertDialogPadding = const EdgeInsets.only(top: 10), this.backgroundColor, super.key, }) : _buttonBuilder = buttonBuilder, @@ -38,6 +39,10 @@ class BottomAlertDialogConfig extends InheritedWidget { final CloseButtonBuilder? _closeButtonBuilder; final String yesText; final String noText; + + /// The padding that is put between the top of the dialog and the content. + /// This is by default const EdgeInsets.only(top:10). + final EdgeInsets bottomAlertDialogPadding; final Color? backgroundColor; ButtonBuilder get buttonBuilder => diff --git a/pubspec.yaml b/pubspec.yaml index 40dcc7d..43227ad 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_dialogs description: A new Flutter package project. -version: 1.0.0 +version: 1.1.0 homepage: https://github.com/Iconica-Development/flutter_dialogs environment: