I want to remove any bit of space in between multiple widgets in order to create a custom TextField according to my UI.
also if im suggested any packages to do the same, it will be really helpful !
Row
–text
–textField
–text
My goal:
class MyWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
alignment: FractionalOffset.center,
width: 392.72727272727275,
height: 40,
decoration: const BoxDecoration(
border: Border(
top: BorderSide.none,
left: BorderSide.none,
right: BorderSide.none,
bottom: BorderSide.none,
),
),
child: const Row(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
const Text(
'|',
style: TextStyle(color: Colors.white),
),
Padding(
padding: const EdgeInsets.fromLTRB(0, 0, 0, 1.8),
child: SizedBox(
width: 392.72727272727275 - 42.5,
child: TextField(
// controller: controller,
style: const TextStyle(color: Colors.white),
decoration: const InputDecoration(
contentPadding: EdgeInsets.only(left: 20),
enabledBorder: UnderlineInputBorder(
borderSide:
BorderSide(color: Colors.white, width: 1),
),
focusedBorder: UnderlineInputBorder(
borderSide:
BorderSide(color: Colors.white, width: 1),
),
),
),
),
),
const Text(
'|',
style: TextStyle(color: Colors.white),
),
],
),
);
}
}
Output:
This statement indicates the intent to design a customized TextField widget while paying close attention to the spacing between the individual widgets involved in its composition. The primary objective is to precisely match the desired User Interface (UI) layout, ensuring that there are no visible gaps or unnecessary padding between the constituent widgets.
2
Answers
Using Row still contains a tiny space. Row(Text+Expanded(TextFiled)+Text). You can play with Transform or you can use Stack widget.
Use
Sized Box you can avoid unnecessary padding of the widget