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,
),
),
),
],
));
}
}
网友评论