美文网首页
flutter Baseline基准线对齐

flutter Baseline基准线对齐

作者: 喜剧收尾_XWX | 来源:发表于2020-08-19 21:19 被阅读0次
    import 'package:flutter/material.dart';
    
    void main() => runApp(MaterialApp(
          title: "Baseline基准线对齐",
          home: MyApp(),
        ));
    
    class MyApp extends StatelessWidget {
      @override
      Widget build(BuildContext context) {
        // TODO: implement build
        return Scaffold(
            appBar: AppBar(
              title: Text('Baseline基准线对齐'),
            ),
            body: Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: <Widget>[
                Baseline(
                  baseline: 80.0,
                  //对齐字符底部水平线
                  baselineType: TextBaseline.alphabetic,
                  child: Text(
                    'AaBbCc',
                    style: TextStyle(
                      fontSize: 18.0,
                      textBaseline: TextBaseline.alphabetic,
                    ),
                  ),
                ),
                Baseline(
                  baseline: 80.0,
                  //对齐字符底部水平线
                  baselineType: TextBaseline.alphabetic,
                  child: Container(
                    width: 40,
                    height: 40,
                    color: Colors.greenAccent,
                  ),
                ),
                Baseline(
                  baseline: 80.0,
                  //对齐字符底部水平线
                  baselineType: TextBaseline.alphabetic,
                  child: Text(
                    'DdEeFf',
                    style: TextStyle(
                      fontSize: 18.0,
                      textBaseline: TextBaseline.alphabetic,
                    ),
                  ),
                ),
              ],
            ));
      }
    }
    

    相关文章

      网友评论

          本文标题:flutter Baseline基准线对齐

          本文链接:https://www.haomeiwen.com/subject/lsiydktx.html