Baseline

指定子Widget的基线,包含两个主要属性:

  • baseline

    指定子Widget内容的基线位置,从外框也即是父控件的顶部位置开始定位基线位置。

  • baselineType

    基线的类型,包括TextBaseline.ideographic和TextBaseline.alphabetic。

  • TextBaseline.alphabetic

    对齐字母字符的水平线。

  • TextBaseline.ideographic

    对齐表意字符的水平线。

 Widget getBaseline() {
    return Column(
      children: <Widget>[
        Container(
           200,
          height: 100,
          margin: EdgeInsets.all(100),
          color: Colors.blueAccent,
          child: Baseline(
            baseline: 0,
            baselineType: TextBaseline.alphabetic,
            child: Text(
              'Baseline type alphabetic',
              style: TextStyle(fontSize: 20),
            ),
          ),
        ),
        Container(
           200,
          height: 100,
          margin: EdgeInsets.all(100),
          color: Colors.blueAccent,
          child: Baseline(
            baseline: 0,
            baselineType: TextBaseline.ideographic,
            child: Text(
              'Baseline type ideographic',
              style: TextStyle(fontSize: 20),
            ),
          ),
        )
      ],
    );
  }
原文地址:https://www.cnblogs.com/timba1322/p/12487563.html