执行 flutter clean
并重新启动应用程序,您可以查看这些示例。
测试代码
Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
TextFormField(
decoration: InputDecoration(
hintText: "normal",
prefixIcon: Icon(Icons.ac_unit),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: TextFormField(
textAlign: TextAlign.left,
decoration: InputDecoration(
hintText: "textFormField wrapped with padding",
alignLabelWithHint: true,
prefixIcon: Icon(Icons.usb_rounded),
),
),
),
TextFormField(
decoration: InputDecoration(
hintText: "contentPadding, horizontal: 10, vertical: 10 ",
/// Use same pading
contentPadding:
EdgeInsets.symmetric(horizontal: 10, vertical: 10),
prefixIcon: Icon(Icons.safety_divider),
),
),
TextFormField(
decoration: InputDecoration(
hintText: "contentPadding, horizontal: 21, vertical: 40 ",
/// Use same pading
contentPadding:
EdgeInsets.symmetric(horizontal: 21, vertical: 40),
prefixIcon: Icon(
Icons.safety_divider,
),
),
),
TextFormField(
decoration: InputDecoration(
hintText: "contentPadding,only(left: 10) ",
/// Use same pading
contentPadding: EdgeInsets.only(left: 10),
prefixIcon: Icon(
Icons.safety_divider,
),
),
),
TextFormField(
textAlignVertical: TextAlignVertical.center,
decoration: InputDecoration(
hintText:
"contentPadding,.only(left: 10, top: 10, bottom: 10),",
/// Use same pading
contentPadding:
EdgeInsets.only(left: 10, top: 10, bottom: 10),
prefixIcon: Icon(
Icons.safety_divider,
),
),
),
],
),
),