You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何移除TextField中放大字体后选中文本的行分隔线?

问题描述

当选中TextField中的全部文本时,每行文本之间会出现一条分隔线,该线条会在增大TextField fontSize时显现。

实际效果

实际效果

预期效果

预期效果

补充说明

以下是我编写的可复用TextField代码片段:

TextField(
      onTap: onTap,
      controller: controller,
      focusNode: focusNode,
      obscureText: obscureText ?? false,
      autofocus: autofocus ?? false,
      onChanged: onChanged,
      onEditingComplete: onEditingComplete,
      onSubmitted: onSubmitted,
      scrollPhysics: const BouncingScrollPhysics(),
      maxLines: maxLines,
      minLines: minLines,
      textCapitalization: TextCapitalization.sentences,
      textInputAction: textInputAction,
      keyboardType: TextInputType.multiline,
      selectionWidthStyle: BoxWidthStyle.max,
      readOnly: readOnly!,
      selectionHeightStyle: BoxHeightStyle.strut,
      maxLengthEnforcement: MaxLengthEnforcement.enforced,
      style: TextStyle(
        fontSize: fontSize,
        fontWeight: fontWeight ?? FontWeight.normal,
        
        
        color: color ?? Theme.of(context).primaryColor,
      ),
      enableInteractiveSelection: true,
      decoration: decoration ??
          InputDecoration(
            isDense: isDense,
            border: InputBorder.none,
            icon: iconData ?? widgetIcon,
            suffix: suffix,
            
            hintText: hintText,
            hintStyle: TextStyle(
              fontSize: fontSize ?? hintFontSize,
              fontWeight: fontWeight ?? FontWeight.normal,
            
            ),
          ),
    );

内容的提问来源于stack exchange,提问作者MElochukwu

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.11 22:25:17