build method
- dynamic context
Implementation
@override
Widget build(BuildContext context) {
final double width = MediaQuery.of(context).size.width * widthRatio!;
final double height = MediaQuery.of(context).size.height *
MediaQuery.of(context).systemGestureInsets.top;
final double rowWidth = width - padding!.horizontal - 100;
return SizedBox(
height: height,
child: Column(
children: [
Expanded(
child: Center(
child: ConstrainedBox(
constraints: BoxConstraints(maxWidth: maxWidth ?? width),
child: Material(
type: MaterialType.transparency,
child: Container(
decoration: BoxDecoration(
color: backgroundColor ?? context.colors.surface,
borderRadius: borderRadius,
),
width: width,
margin: margin,
padding: padding,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Stack(
children: [
Align(
alignment: Alignment.topCenter,
child: Container(
constraints: BoxConstraints(
maxWidth: rowWidth,
),
child: Padding(
padding: const EdgeInsets.only(top: 8.0),
child: NomoText(
title,
style: titleStyle ??
context.theme.typographyTheme.h1,
),
),
),
),
if (showCloseButton!)
Align(
alignment: Alignment.topRight,
child: SizedBox(
width: 40,
height: 40,
child: closeButton ??
NomoButton.icon(
onPressed: Navigator.of(context).pop,
borderRadius: BorderRadius.circular(100),
icon: Icon(
Icons.close,
),
),
),
),
],
),
SizedBox(
height: 16,
),
ConstrainedBox(
constraints: BoxConstraints(
maxHeight: maxHeight ??
MediaQuery.of(context).size.height * 0.5,
minHeight: 0,
),
child: content,
),
SizedBox(
height: 16,
),
if (actions.isNotEmpty)
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: actions,
),
],
),
),
),
),
)),
],
),
);
}