Created
February 15, 2020 16:55
-
-
Save ryanlid/c837d3a9011087431451f5007506d629 to your computer and use it in GitHub Desktop.
IndexedStack 布局示例
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() { | |
runApp( | |
MaterialApp( | |
title: "IndexedStack 布局示例", | |
home: MyApp(), | |
), | |
); | |
} | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
var stack = IndexedStack( | |
index: 1, | |
alignment: FractionalOffset(0.2, 0.2), | |
children: <Widget>[ | |
CircleAvatar( | |
backgroundImage: | |
NetworkImage("https://static.lidong.me/upload/c7QdErvcb.png"), | |
radius: 100.0, | |
), | |
Container( | |
decoration: BoxDecoration(color: Colors.black38), | |
child: Text( | |
"哈哈哈哈", | |
style: TextStyle( | |
fontSize: 22.0, | |
fontWeight: FontWeight.bold, | |
color: Colors.white, | |
), | |
), | |
) | |
], | |
); | |
return Scaffold( | |
appBar: AppBar( | |
title: Text("IndexedStack 布局示例"), | |
), | |
body: Center( | |
child: stack, | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment