Hi here is my code i want to create a prefix like the image i attached
`class NumberFiled extends StatelessWidget {
const NumberFiled({Key? key, required this.lebal}) : super(key: key);
final String lebal;
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"$lebal*",
style: const TextStyle(color: whiltetextcolor),
),
const SizedBox(
height: 15,
),
TextField(
style: const TextStyle(color: secondarycolor),
keyboardType: TextInputType.number,
cursorColor: secondarycolor,
decoration: InputDecoration(
prefix: Container(
padding: const EdgeInsets.symmetric(horizontal: 10),
color: secondarycolor,
child: const Text("+91"),
),
focusedBorder: const OutlineInputBorder(
borderSide: BorderSide(color: whiltetextcolor)),
enabledBorder: const OutlineInputBorder(
borderSide: BorderSide(color: whiltetextcolor, width: .2)),
),
),
],
));
}
}`
Hi here is my code i want to create a prefix like the image i attached
2
Answers
Change you prefix to prefixIcon and give height and width of the Container in prefixIcon. Hope this will help you