popupScreen method
Widget
popupScreen(
- BuildContext context, {
- required String title,
- required String text,
- required String name,
- Widget? image,
- bool interactive = true,
- EdgeInsetsGeometry? margin,
- Decoration? decoration,
- EdgeInsetsGeometry? padding,
- CrossAxisAlignment? crossAxisAlignment,
- TextStyle? titleStyle,
- TextStyle? textStyle,
- bool? hasBottomBar,
Provide a 'popup' screen.
Implementation
Widget popupScreen(
BuildContext context, {
required String title,
required String text,
required String name,
Widget? image,
bool interactive = true,
EdgeInsetsGeometry? margin,
Decoration? decoration,
EdgeInsetsGeometry? padding,
CrossAxisAlignment? crossAxisAlignment,
TextStyle? titleStyle,
TextStyle? textStyle,
bool? hasBottomBar,
}) {
final _screenSize = App.screenSize;
final _smallScreen = App.inSmallScreen;
Widget popImage;
popImage = Image.asset(
name,
fit: BoxFit.cover,
);
if (interactive) {
popImage = InteractiveViewer(
maxScale: 3,
minScale: 1,
child: popImage,
);
}
return Container(
margin: margin ??
EdgeInsets.fromLTRB(
_screenSize.width * (_smallScreen ? 0 : 0.2),
_screenSize.height * (_smallScreen ? 0.1 : 0.2),
_screenSize.width * (_smallScreen ? 0.0 : 0.2),
_screenSize.height * (_smallScreen ? 0.1 : 0.2),
),
decoration: decoration ??
BoxDecoration(
borderRadius: BorderRadius.circular(30),
),
padding: padding ?? EdgeInsets.all(_smallScreen ? 10 : 30),
child: Column(
crossAxisAlignment: crossAxisAlignment ?? CrossAxisAlignment.start,
children: [
Text(
title,
style: titleStyle ?? const TextStyle(fontSize: 24),
),
const SizedBox(height: 18),
AutoSizeText(
text,
style: textStyle ?? const TextStyle(fontSize: 16),
),
SizedBox(height: _screenSize.height * 0.05),
InkWell(
splashColor: Colors.transparent,
hoverColor: Colors.transparent,
onTap: () => PopupPage.window<void>(
context,
(_) => Center(
child: popImage,
),
hasBottomBar: hasBottomBar,
),
child: image ??
Padding(
padding: EdgeInsets.all(_smallScreen ? 0 : 40),
child: Image.asset(name),
),
),
],
),
);
}