Just noticed that the top SafeArea is being ignored when showModalBottomSheet is set to isScrollControlled: true.(I want my modal to fit the screen) Anyone found a way to fix it?

showModalBottomSheet(
  context: context,
  isScrollControlled: true,
  builder: (context) => MyModal(),
)

My test modal

class MyModal extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return SafeArea(
      child: Column(
        children: <Widget>[
          Text('Modal'),
          Expanded(
              child: Container(
            color: Colors.red,
          ))
        ],
      ),
    );
  }
}

OUTPUT

enter image description here

I kinda temporary fixed it by setting height of modal content

SafeArea(
      child: Container(
        height: MediaQuery.of(context).size.height - 80,
        child: Column(
          children: ...

OUTPUT

enter image description here


Solution 1: Robert

If you're using GetX Try it

    final padding = MediaQuery.of(Get.context!).viewPadding;

Else you can pass parent context as param

    final padding = MediaQuery.of(parentContext).viewPadding;