myModal function

Future<void> myModal({
  1. required BuildContext context,
  2. required double? factor,
  3. required Color modalBackgroundColor,
  4. required Widget child,
})

Implementation

Future<void> myModal({required BuildContext context, required double? factor, required Color modalBackgroundColor, required Widget child}) {
  return showModalBottomSheet(
    backgroundColor: modalBackgroundColor,
    context: context,
    builder: (context) {
      return SizedBox(
        height: (factor == null) ? null : MediaQuery.of(context).size.height * factor,
        child: Material(
          type: MaterialType.transparency,
          child: SafeArea(
            child: child,
          ),
        ),
      );
    }
  );
}