第二章●第十一节:Placeholder
2019-05-08 本文已影响21人
白晓明
将在某一天添加其他组件的预留框体组件。此组件经常用于开发期间表示接口尚未完成。默认情况下,placeholder的尺寸适合其容器。若placeholder位于无界空间中,它将根据给定的fallbackWidth和fallbackHeight自行调整大小。
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text("PlaceHolder"),
),
body: Column(
children: <Widget>[
Placeholder(
color: Colors.red,
fallbackHeight: 150,
),
Text("第二列"),
Text("第三列")
],
),
),
);
}
}
![](https://img.haomeiwen.com/i113610/c449e03b48413a3c.jpg)
![](https://img.haomeiwen.com/i113610/936d77bb13f485f3.jpg)