Я использую showModalBottomSheet()
, чтобы открыть модальную форму, и я также использовал SingleChildScrollView()
, чтобы обернуть это основное тело Scaffold()
, когда на портрете это выглядело хорошо, но бит скрыт для второго поля формы, но когда я делаю пейзаж, модальное поле формы получило bottom overflowed by 25px
вот картинка:
вот мой код для полей формы:
return Container(
child: Form(
key: _formKey,
child: SingleChildScrollView(
child: Card(
elevation: 5,
child: Container(
// margin: EdgeInsets.only(bottom: MediaQuery.of(context).size.height * 0.3),
padding: EdgeInsets.only(
top: 10,
right: 10,
left: 10,
bottom: MediaQuery.of(context).viewInsets.bottom + 10,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
TextFormField(
controller: stateTitle,
decoration: InputDecoration(
labelText: "Title"
),
keyboardType: TextInputType.text,
validator: (val) {
return val.isEmpty ? "required title" : null;
},
),
TextFormField(
controller: stateAmount,
decoration: InputDecoration(
labelText: "Amount"
),
keyboardType: TextInputType.numberWithOptions(decimal: true),
validator: (val) {
return val.isEmpty ? "required amount" : null;
},
),
Container(
height: 70,
child: Row(
children: <Widget>[
Text(_dateSelected == null ?
"No date choose" :
DateFormat.yMd().format(_dateSelected)
),
FlatButton(
onPressed: _presentDatePicker,
child: Text("Choose Date"),
textColor: Colors.pinkAccent,
),
],
),
),
RaisedButton(
onPressed: _submitData,
child: Text(
"Add transaction",
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.lightGreen
),
)
),
],
),
),
),
),
),
);
и здесь я делаю SingleChildScrollView()
:
return SafeArea(
child: Scaffold(
resizeToAvoidBottomInset: true,
appBar: appBar,
body: SingleChildScrollView(
child: Column(
children: <Widget> [
$isLandscape ?
switchButton
:
_chartBar(0.3),
_showChart && $isLandscape ?
_chartBar(0.7) : transactionListComponent
],
),
)
),
как вы ребята, чтобы избежать этого? я сделал заполнение этого контейнера
Padding(padding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom));
, но не работает,