56 lines
1.8 KiB
Dart
56 lines
1.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import 'dialog_standard_container_design_model.dart';
|
|
|
|
class DialogStandardContainer extends StatelessWidget {
|
|
final Color? backgroundColor;
|
|
final Image? closeImage;
|
|
final bool? showCloseImage;
|
|
final VoidCallback? closeCallback;
|
|
final Widget child;
|
|
|
|
const DialogStandardContainer({
|
|
Key? key,
|
|
this.backgroundColor,
|
|
this.closeImage,
|
|
this.showCloseImage = false,
|
|
this.closeCallback,
|
|
required this.child,
|
|
}) :super(key: key);
|
|
DialogStandardDesignSpec get designSpec => DialogStandardDesignSpec.get();
|
|
DialogStandardContainerDesignSpec get contentSpec => designSpec.contentSpec;
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Center(
|
|
child: Container(
|
|
decoration: BoxDecoration(
|
|
color: backgroundColor ?? Colors.white,
|
|
borderRadius: contentSpec.cardRadius,
|
|
),
|
|
width: contentSpec.measuredSize.width,
|
|
child: showCloseImage == null || showCloseImage == false
|
|
? child
|
|
: Stack(
|
|
fit: StackFit.loose,
|
|
alignment: AlignmentDirectional.topCenter,
|
|
children: [
|
|
child,
|
|
Positioned(
|
|
left: contentSpec.closeIconInsets.left,
|
|
top: contentSpec.closeIconInsets.top,
|
|
child: GestureDetector(
|
|
onTap: () {
|
|
closeCallback?.call();
|
|
},
|
|
child: closeImage ??
|
|
Image(
|
|
image: const AssetImage("assets/icons/ic_close_dark.png", package: "guru_ui"),
|
|
width: contentSpec.closeIconSize.height,
|
|
height: contentSpec.closeIconSize.height,
|
|
)))
|
|
],
|
|
),
|
|
));
|
|
}
|
|
}
|