import 'package:flutter/material.dart';
class TextFiledMessageSend extends StatelessWidget {
const TextFiledMessageSend({super.key});
@override
Widget build(BuildContext context) {
return TextField(
textAlignVertical: TextAlignVertical.center,
decoration: InputDecoration(
border: InputBorder.none,
hintText: "Type your message ",
// contentPadding: const EdgeInsets.symmetric(horizontal: 10),
prefixIcon: IconButton(
onPressed: () {}, icon: const Icon(Icons.emoji_emotions, size: 22)),
),
);
}
I want that the hint Text and the cursor is in the center horizontal as wel as the prefixIcon,suffixIcon is in the center :
2
Answers
The
TextField
is expanding.So, set
isDense
totrue
on theInputDecoration
and removetextAlignVertical: TextAlignVertical.center
:You can do it by removing the size of the prefixIcon and applying a contentPadding :