showTopPopView function

dynamic showTopPopView({
  1. required BuildContext context,
  2. Widget? child,
  3. double topOffset = 0,
})

Implementation

showTopPopView({required BuildContext context, Widget? child, double topOffset = 0}) {
  showGeneralDialog(
    context: context,
    barrierDismissible: true,
    barrierLabel: MaterialLocalizations.of(context).modalBarrierDismissLabel,
    transitionDuration: const Duration(milliseconds: 150),
    pageBuilder: (BuildContext context, Animation animation, Animation secondaryAnimation) {
      return Scaffold(
        backgroundColor: Colors.transparent,
        body: Stack(
          children: <Widget>[
            GestureDetector(
              onTap: () => Navigator.pop(context),
              behavior: HitTestBehavior.opaque,
              child: Container(),
            ),
            Positioned(
              left: 0,
              top: topOffset,
              right: 0,
              bottom: 0,
              child: IgnorePointer(
                child: Container(color: Colors.black54),
              ),
            ),
            Positioned(
              left: 0,
              right: 0,
              top: topOffset,
              child: child!,
            ),
          ],
        ),
      );
    },
  );
}