Reputation: 5107
I have created a custom widget to show a ModalBottomSheet when the user clicks on a text:
class DialogUtils {
static DialogUtils _instance = new DialogUtils.internal();
DialogUtils.internal();
factory DialogUtils() => _instance;
static void showModalDialog2(BuildContext context,
{@required String title}) {
showModalBottomSheet(
context: context,
builder: (_) {
return Container(
color: Colors.white,
height: MediaQuery.of(context).size.height * .85,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
Text(title),
Row(
children: [
Spacer(),
IconButton(
icon: Icon(Icons.cancel,
color: Colors.blueGrey, size: 35.0),
onPressed: () {
Navigator.of(context).pop();
},
),
],
),
SizedBox(
height: 10.0,
),
Expanded(
child: Container(
child: SfPdfViewer.network(
'https://.../consentimiento.pdf'),
),
),
],
),
),
);
});
}
}
Here you have the text widget:
GestureDetector(
onTap: () {
DialogUtils.showModalDialog2(context,
title: "hola");
},
child: Textos.textoQplan13Negro(
"Política de privacidad",
TextAlign.start),
),
It is working fine, but I would like to set the height from the ModalDialog to 0.85 of the screen height, but now it is only opening about the half of the screen height, as shown in the screenshot:
Upvotes: 0
Views: 87
Reputation: 1744
add isScrollControlled to the showModalBottomSheet
to make height take effect
showModalBottomSheet(
isScrollControlled:true,
Upvotes: 1