I am trying to add a vertical line inside the textfield, here is the image I am trying to achieve
Stack(
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
CustomText(
title: label,
isCenter: true,
textSize: fontSize16,
),
const SizedBox(height: 10),
TextFormField(
decoration: InputDecoration(
contentPadding: const EdgeInsets.symmetric(horizontal: 10),
hintText: hint,
// suffixText: 'USD',
// suffix: Container(
// height: 40,
// width: 10,
// decoration: BoxDecoration(
// border: Border.all(
// color: appGrayColor,
// )),
// ),
suffixStyle: const TextStyle(color: Colors.blue),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(10.0),
borderSide: const BorderSide(
color: appGrayColor,
width: 0.5,
),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(10.0),
borderSide: const BorderSide(
color: appGrayColor,
width: 0.5, // This is the width of the border.
),
),
),
keyboardType: TextInputType.number,
),
],
),
const VerticalDivider(
color: Colors.black,
thickness: 1.0,
)
],
)
2
Answers
Here is my approach which looks like this
Add a
Row
as asuffixIcon
that contains the vertical line (as a Container) and the "USD" (as a Text):The output is:
and then you could update the colors (
appGrayColor
for instance) and the symmetric horizontal padding values.