【问题标题】:fill the spaces of a paragraph in flutter在颤动中填充段落的空格
【发布时间】:2022-07-21 21:53:17
【问题描述】:

我一直在尝试设计一个具有空文本字段的文本小部件,如下所示:

如果您知道如何做到这一点,我将不胜感激

【问题讨论】:

  • 上图中的空白文本字段是什么意思?如果你需要像上面那样的精确用户界面?

标签: flutter text textfield


【解决方案1】:

您可以使用富文本来实现这一点

RichText(
        text: TextSpan(
         children: [
           TextSpan(text: "some really big text which will have a textfield like this"),
           WidgetSpan(child: Container(
             width: 100,
             decoration: BoxDecoration(
              borderRadius: BorderRadius.circular(30),
               color: Colors.orange
             ),
             child:TextField(
               style:TextStyle(fontSize:12))
           )),
           TextSpan(text:" to enter some text in between a text"),
         ]
        )
      )

您可能需要对齐项目。但这应该可行

【讨论】:

  • 谢谢它的工作
【解决方案2】:
Center(
        child: RichText(
          text: TextSpan(
              text:
                  'Grout crack happens mainly due to movement between two surfaces. It can be as a ',
              style: TextStyle(
                  color: Colors.black,
                  fontSize: 40,
                  fontWeight: FontWeight.bold),
              children: [
                TextSpan(
                    text: 'thin',
                    style: TextStyle(
                        color: Colors.red,
                        fontSize: 35,
                        fontStyle: FontStyle.italic)),
                TextSpan(
                    text: ' of humidity',
                    style: TextStyle(color: Colors.black, fontSize: 40)),
              ]),
        ),
      ),

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-09-01
    • 2011-01-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-12-22
    相关资源
    最近更新 更多