[FEAT] Added snackbar herlper and dialog helper.
This commit is contained in:
59
lib/src/dialog/dialog_helper.astromic.dart
Normal file
59
lib/src/dialog/dialog_helper.astromic.dart
Normal file
@@ -0,0 +1,59 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import './src/models/models.exports.dart';
|
||||
|
||||
class AstromicDialogHelper {
|
||||
/// Show a dialog.
|
||||
static Future<T?> show<T>(
|
||||
BuildContext context, {
|
||||
required Widget contentSection,
|
||||
Widget? stackedCloseWidget,
|
||||
AstromicDialogConfiguration configuration = const AstromicDialogConfiguration(),
|
||||
AstromicDialogStyle style = const AstromicDialogStyle(),
|
||||
void Function(T?)? onClose,
|
||||
}) async {
|
||||
//
|
||||
return await showDialog<T>(
|
||||
context: context,
|
||||
useSafeArea: configuration.safeAreaAware,
|
||||
builder: (BuildContext _) {
|
||||
return 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,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
});
|
||||
//
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user