Flutter基础—定位对齐之中心定位

前端之家收集整理的这篇文章主要介绍了Flutter基础—定位对齐之中心定位前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

Center既中心定位控件,能够将子控件放在其内部中心。

import 'package:flutter/material.dart';
class LayoutDemo extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
        title: new Text('中心定位'),),body: new Center(
        child: new Text('我在屏幕的中心!'),);
  }
}
void main() {
  runApp(
    new MaterialApp(
      title: 'Flutter教程',home: new LayoutDemo(),);
}

这里写图片描述

猜你在找的Flutter相关文章