Мой макет экрана чата:
Код: Выделить всё
Scaffold(
backgroundColor: AppConstants.offWhite,
extendBodyBehindAppBar: true,
appBar: IndividualChatAppBar(...),
body: SafeArea(
bottom: false,
child: Column(
children: [
Expanded(
child: BlocBuilder(
builder: (context, state) {
// messages list
},
),
),
BlocBuilder(
builder: (context, state) {
return MessageInputField(...);
},
),
SizedBox(height: MediaQuery.of(context).padding.bottom + 8),
],
),
),
)
Код: Выделить всё
TextField(
controller: _controller,
maxLines: null,
textCapitalization: TextCapitalization.sentences,
keyboardType: TextInputType.multiline,
scrollPadding: EdgeInsets.zero,
autocorrect: false,
enableSuggestions: false,
style: const TextStyle(fontSize: 15, color: Colors.black87),
decoration: InputDecoration(...),
)
- + руководство
Код: Выделить всё
resizeToAvoidBottomInset: falseзаполнение черезКод: Выделить всё
MediaQuery.viewInsets.bottomКод: Выделить всё
SizedBox - с устранением дребезга в течение 80 мс для отслеживания высоты клавиатуры.
Код: Выделить всё
WidgetsBindingObserver + didChangeMetrics() - Перенос ввода в
Код: Выделить всё
SingleChildScrollView(physics: NeverScrollableScrollPhysics()) - Выделение входа в отдельный чтобы ограничить пересборку медиа-запросов
Код: Выделить всё
StatefulWidget - с
Код: Выделить всё
SingleChildScrollView(reverse: true)обертка вводаКод: Выделить всё
Padding(bottom: viewInsets.bottom) - — это фактически нарушило многострочный ввод Android, поэтому пришлось вернуться.
Код: Выделить всё
keyboardType: TextInputType.text
Это известная ошибка движка Flutter в iOS? Есть ли какой-нибудь обходной путь, который действительно работает для макета чата с закрепленным вводом внизу?
Подробнее здесь: https://stackoverflow.com/questions/799 ... ld-flutter