[FIX] Dialog Helper options

This commit is contained in:
2026-01-24 11:12:08 +02:00
parent 018f3555c3
commit 2b3d758987
3 changed files with 15 additions and 56 deletions

View File

@@ -16,14 +16,15 @@ class AstromicDialogHelper {
return await showDialog<T>( return await showDialog<T>(
context: context, context: context,
useSafeArea: configuration.safeAreaAware, useSafeArea: configuration.safeAreaAware,
builder: (BuildContext _) { builder: (_) {
return Dialog( return Dialog(
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
insetPadding: style.placement?.resolve(style.textDirection) ?? const EdgeInsets.symmetric(horizontal: 40, vertical: 24), insetPadding: style.margin?.resolve(style.textDirection) ?? const EdgeInsets.symmetric(horizontal: 40, vertical: 24),
child: Stack( child: Stack(
children: <Widget>[ children: <Widget>[
Container( Container(
width: style.width, width: style.width,
height: style.height,
padding: style.contentPadding, padding: style.contentPadding,
decoration: BoxDecoration( decoration: BoxDecoration(
color: style.backgroundColor, color: style.backgroundColor,
@@ -42,43 +43,6 @@ class AstromicDialogHelper {
], ],
), ),
); );
// Container(
// margin: style.placement,
// //
// child: Column(
// mainAxisSize: MainAxisSize.min,
// children: <Widget>[
// Row(
// mainAxisSize: MainAxisSize.min,
// children: <Widget>[
// Stack(
// children: [
// Container(
// width: (style.width ?? 0) - ((style.placement?.start ?? 0) + (style.placement?.start ?? 0)),
// //
// padding: style.contentPadding,
// decoration: BoxDecoration(
// color: style.backgroundColor,
// borderRadius: style.radius,
// ),
// child: contentSection,
// ),
// if (stackedCloseWidget != null)
// Positioned.directional(
// textDirection: style.textDirection,
// start: style.closeWidgetPlacement?.start,
// end: style.closeWidgetPlacement?.end,
// top: style.closeWidgetPlacement?.top,
// //
// child: stackedCloseWidget,
// ),
// ],
// ),
// ],
// ),
// ],
// ),
// );
}); });
// //
} }

View File

@@ -1,19 +1,15 @@
class AstromicDialogConfiguration { class AstromicDialogConfiguration {
//
final bool isCentered;
final bool safeAreaAware;
const AstromicDialogConfiguration({ const AstromicDialogConfiguration({
this.isCentered = true,
this.safeAreaAware = true, this.safeAreaAware = true,
}); });
//
final bool safeAreaAware;
AstromicDialogConfiguration copyWith({ AstromicDialogConfiguration copyWith({
bool? isCentered, bool? isCentered,
bool? safeAreaAware, bool? safeAreaAware,
}) { }) {
return AstromicDialogConfiguration( return AstromicDialogConfiguration(
isCentered: isCentered ?? this.isCentered,
safeAreaAware: safeAreaAware ?? this.safeAreaAware, safeAreaAware: safeAreaAware ?? this.safeAreaAware,
); );
} }

View File

@@ -1,16 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class AstromicDialogStyle { class AstromicDialogStyle {
//
final Color? backgroundColor;
final BorderRadius? radius;
final EdgeInsets? contentPadding;
final double? width;
final double? height;
final TextDirection textDirection;
final EdgeInsetsDirectional? placement;
final EdgeInsetsDirectional? closeWidgetPlacement;
const AstromicDialogStyle({ const AstromicDialogStyle({
this.backgroundColor = Colors.white, this.backgroundColor = Colors.white,
this.radius, this.radius,
@@ -18,8 +8,17 @@ class AstromicDialogStyle {
this.width = 300, this.width = 300,
this.height, this.height,
this.textDirection = TextDirection.ltr, this.textDirection = TextDirection.ltr,
this.placement, this.margin,
this.closeWidgetPlacement, this.closeWidgetPlacement,
}); });
final Color? backgroundColor;
final BorderRadius? radius;
final EdgeInsets? contentPadding;
final double? width;
final double? height;
final TextDirection textDirection;
final EdgeInsetsDirectional? margin;
final EdgeInsetsDirectional? closeWidgetPlacement;
// //
} }