有没有办法修复文本上方的泪珠滑块?
Is there a way to fix the teardrops sliders being above the text?
我在文本字段中选定文本的滑块时遇到了一个奇怪的问题,如下图所示,它只出现在这个屏幕上,而不出现在其他屏幕上
The problem image
这是文本字段的代码:
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'Maiden Name :',
style: TextStyle(
fontSize: 16, color: Colors.grey.shade700),
),
Flexible(
child: SizedBox(
width: MediaQuery.of(context).size.width / 2,
height: 30,
child: TextField(
cursorColor: Colors.grey.shade700,
textAlign: TextAlign.center,
style: TextStyle(fontSize: 16),
decoration: new InputDecoration(
hintText:
'As per your official documents',
hintStyle: TextStyle(
color: Colors.grey.shade900,
fontSize: 10,
fontStyle: FontStyle.italic),
isDense: true,
filled: true,
fillColor: Colors.white,
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(5),
borderSide: BorderSide(),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(5),
borderSide: BorderSide(),
),
),
controller: familyNameController,
),
),
),
],
我找到了问题的解决方案,
通过添加
修复
contentPadding: EdgeInsets.symmetric(vertical: 5),
到文本字段中的 InputDecoration 并通过删除 Flexible 小部件,所以它变成这样:
Container(
width: MediaQuery.of(context).size.width / 2,
height: 30,
child: TextField(
cursorColor: Colors.grey.shade700,
textAlign: TextAlign.center,
style:
TextStyle(fontSize: 16),
textAlignVertical: TextAlignVertical.center,
decoration: new InputDecoration(
hintText:
'As per your official documents',
hintStyle: TextStyle(
color: Colors.grey.shade900,
fontSize: 10,
fontStyle: FontStyle.italic),
isDense: true,
//focusColor: Colors.black,
filled: true,
fillColor: Colors.white,
contentPadding: EdgeInsets.symmetric(vertical: 5),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(5),
borderSide: BorderSide(),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(5),
borderSide: BorderSide(),
),
),
controller: surnameController,
),
),
我在文本字段中选定文本的滑块时遇到了一个奇怪的问题,如下图所示,它只出现在这个屏幕上,而不出现在其他屏幕上
The problem image
这是文本字段的代码:
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'Maiden Name :',
style: TextStyle(
fontSize: 16, color: Colors.grey.shade700),
),
Flexible(
child: SizedBox(
width: MediaQuery.of(context).size.width / 2,
height: 30,
child: TextField(
cursorColor: Colors.grey.shade700,
textAlign: TextAlign.center,
style: TextStyle(fontSize: 16),
decoration: new InputDecoration(
hintText:
'As per your official documents',
hintStyle: TextStyle(
color: Colors.grey.shade900,
fontSize: 10,
fontStyle: FontStyle.italic),
isDense: true,
filled: true,
fillColor: Colors.white,
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(5),
borderSide: BorderSide(),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(5),
borderSide: BorderSide(),
),
),
controller: familyNameController,
),
),
),
],
我找到了问题的解决方案,
通过添加
修复contentPadding: EdgeInsets.symmetric(vertical: 5),
到文本字段中的 InputDecoration 并通过删除 Flexible 小部件,所以它变成这样:
Container(
width: MediaQuery.of(context).size.width / 2,
height: 30,
child: TextField(
cursorColor: Colors.grey.shade700,
textAlign: TextAlign.center,
style:
TextStyle(fontSize: 16),
textAlignVertical: TextAlignVertical.center,
decoration: new InputDecoration(
hintText:
'As per your official documents',
hintStyle: TextStyle(
color: Colors.grey.shade900,
fontSize: 10,
fontStyle: FontStyle.italic),
isDense: true,
//focusColor: Colors.black,
filled: true,
fillColor: Colors.white,
contentPadding: EdgeInsets.symmetric(vertical: 5),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(5),
borderSide: BorderSide(),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(5),
borderSide: BorderSide(),
),
),
controller: surnameController,
),
),