Skip to content

Commit

Permalink
Clearer code
Browse files Browse the repository at this point in the history
  • Loading branch information
g123k committed Jul 15, 2023
1 parent 15d8c76 commit 45c37a9
Showing 1 changed file with 7 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,18 @@ class SmoothAlertDialog extends StatelessWidget {
final SmoothActionButton? negativeAction;
final Axis? actionsAxis;
final SmoothButtonsBarOrder? actionsOrder;
final EdgeInsets? contentPadding;
final EdgeInsetsDirectional? contentPadding;

static const EdgeInsetsGeometry _smallContentPadding =
static const EdgeInsetsDirectional _smallContentPadding =
EdgeInsetsDirectional.only(
start: SMALL_SPACE,
top: MEDIUM_SPACE,
end: SMALL_SPACE,
bottom: SMALL_SPACE,
);

static const EdgeInsetsGeometry _contentPadding = EdgeInsetsDirectional.only(
static const EdgeInsetsDirectional _contentPadding =
EdgeInsetsDirectional.only(
start: 22.0,
top: VERY_LARGE_SPACE,
end: 22.0,
Expand All @@ -58,7 +59,7 @@ class SmoothAlertDialog extends StatelessWidget {
@override
Widget build(BuildContext context) {
final Widget content = _buildContent(context);
final EdgeInsetsGeometry padding = contentPadding ??
final EdgeInsetsDirectional padding = contentPadding ??
(context.isSmallDevice() ? _smallContentPadding : _contentPadding);

return AlertDialog(
Expand All @@ -85,19 +86,10 @@ class SmoothAlertDialog extends StatelessWidget {
);
}

Padding _buildBottomBar(EdgeInsetsGeometry padding) {
final double topPadding;
if (padding is EdgeInsetsDirectional) {
topPadding = padding.bottom;
} else if (padding is EdgeInsets) {
topPadding = padding.bottom;
} else {
topPadding = 0.0;
}

Padding _buildBottomBar(EdgeInsetsDirectional padding) {
return Padding(
padding: EdgeInsetsDirectional.only(
top: topPadding,
top: padding.bottom,
start: SMALL_SPACE,
end: positiveAction != null && negativeAction != null
? 0.0
Expand Down

0 comments on commit 45c37a9

Please sign in to comment.