popupScreen method

Widget popupScreen(
  1. BuildContext context, {
  2. required String title,
  3. required String text,
  4. required String name,
  5. Widget? image,
  6. bool interactive = true,
  7. EdgeInsetsGeometry? margin,
  8. Decoration? decoration,
  9. EdgeInsetsGeometry? padding,
  10. CrossAxisAlignment? crossAxisAlignment,
  11. TextStyle? titleStyle,
  12. TextStyle? textStyle,
  13. 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),
              ),
        ),
      ],
    ),
  );
}