博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

02-10 flutter hintText和光标不对齐

Posted on 2020-11-23 23:54  肖无情  阅读(334)  评论(0编辑  收藏  举报

Expanded(
                      child: Container(
                        margin: EdgeInsets.fromLTRB(10, 5, 10, 5),
                        padding: EdgeInsets.only(left: 5),
                        decoration: BoxDecoration(
                            color: Colors.white,
                            borderRadius: BorderRadius.circular(4)),
                        width: double.infinity,
                        child: TextField(
                          controller: shoCodeTextField,
                          toolbarOptions: ToolbarOptions(),
                          maxLines: 1,

                          decoration: InputDecoration(
                            fillColor: Colors.red,
                            hintText: "请输入门店号",
                            hintStyle: TextStyle(
                              fontSize: 12 ,
                              height: 1.8,
                              textBaseline: TextBaseline.alphabetic, //用于提示文字对齐
                            ),
                            contentPadding: EdgeInsets.all(0),
                            border: OutlineInputBorder(
                              borderSide: BorderSide.none
                            )
                          ),
                          style: TextStyle(
                            fontSize: 12 ,
                            textBaseline: TextBaseline.alphabetic, //用于提示文字对齐
                          ),


                        ),
                      ),
                    ),
child: CupertinoTextField(
    controller: telephoneController,
    keyboardType: TextInputType.number,
    textInputAction: TextInputAction.done,
  style:  TextStyle(
    fontSize: 12,
    height: 1.2,
    textBaseline: TextBaseline.alphabetic,
  ),
),