showFullWidthDialog function

void showFullWidthDialog({
  1. required Widget child,
  2. required DialogType type,
  3. bool isCancelable = true,
  4. BuildContext? context,
  5. dynamic heightFactor = 0.5,
  6. double elevation = 0,
})

Implementation

void showFullWidthDialog(
    {
      required Widget child,
      required DialogType type,
      bool isCancelable=true,
      BuildContext ? context,
      heightFactor = 0.5,
      double elevation=0,
    }) {
  if (type == DialogType.dialog) {
    showDialog(
      barrierDismissible: isCancelable,
      context: context??AppCntx.currentContext,
      builder: (context) => Dialog(
        backgroundColor: Colors.transparent,
        elevation: elevation,
        insetPadding: const EdgeInsets.symmetric(horizontal: 20),
        child: child,
      ),
    );
  } else {
    var userMaterial3 = Theme.of(AppCntx.currentContext).useMaterial3;
    showModalBottomSheet(
      backgroundColor: Colors.transparent,
      context: context??AppCntx.currentContext,
      isDismissible: isCancelable,
      isScrollControlled: true,
      useSafeArea: true,
      builder: (context) => FractionallySizedBox(
        heightFactor: heightFactor,
        child: userMaterial3? _material3sheet(child, elevation): child,
      ),
    );
  }
}