Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add useSafeArea to showCustomDialog method in DialogService #21

Merged
merged 2 commits into from
Jul 4, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions lib/src/dialog/dialog_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,9 @@ class DialogService {
Color barrierColor = Colors.black54,
bool barrierDismissible = false,
String barrierLabel = '',
@Deprecated(
'Prefer to use `data` and pass in a generic type. customData doesn\'t work anymore')
dynamic customData,
bool useSafeArea = true,
@Deprecated('Prefer to use `data` and pass in a generic type. customData doesn\'t work anymore')
dynamic customData,
R? data,
}) {
assert(
Expand All @@ -206,9 +206,9 @@ class DialogService {
transitionDuration: const Duration(milliseconds: 200),
barrierDismissible: barrierDismissible,
barrierLabel: barrierLabel,
pageBuilder: (BuildContext buildContext, _, __) => SafeArea(
key: Key('dialog_view'),
child: Builder(
pageBuilder: (BuildContext buildContext, _, __) {
final child = Builder(
key: useSafeArea ? null : Key('dialog_view'),
builder: (BuildContext context) => customDialogUI!(
context,
DialogRequest<R>(
Expand All @@ -228,8 +228,10 @@ class DialogService {
),
completeDialog,
),
),
),
);
if (!useSafeArea) return child;
return SafeArea(key: Key('dialog_view'), child: child);
},
);
}

Expand Down