防采集标记:亢少军老师的课程和资料
import 'package:flutter/material.dart';
void main() {
runApp(new MaterialApp(
title: 'IndexedStack布局示例',
home: new MyApp(),
));
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
var stack = new IndexedStack(
index: 1,//设置索引为1就只显示文本内容了
alignment: const FractionalOffset(0.2, 0.2),
children: [
new CircleAvatar(
backgroundImage: new AssetImage('images/1.jpeg'),
radius: 100.0,
),
new Container(
decoration: new BoxDecoration(
color: Colors.black38,
),
child: new Text(
'我是超级飞侠',
style: new TextStyle(
fontSize: 22.0,
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
),
],
);
return new Scaffold(
appBar: new AppBar(
title: new Text('Stack层叠布局示例'),
),
body: new Center(
child: stack,
),
);
}
}
- Flutter技术入门与实战: http://product.dangdang.com/26485813.html
- Flutter交流学习群:894109159
- Flutter开源项目请关注: https://github.com/kangshaojun
- Flutter视频教程:https://edu.csdn.net/lecturer/2436
@作者: 亢少军