Created
February 15, 2020 16:52
-
-
Save ryanlid/f427875dbf26d47cbf1b2ed2820f5dea to your computer and use it in GitHub Desktop.
Stack 层叠定位布局
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: "Stack 层叠定位布局示例", | |
home: MyApp(), | |
), | |
); | |
} | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar( | |
title: Text("Stack 层叠定位布局"), | |
), | |
body: Center( | |
child: Stack( | |
children: <Widget>[ | |
Image.network('https://static.lidong.me/upload/XjGwvaVAI.png'), | |
Positioned( | |
bottom: 50.0, | |
right: 50.0, | |
child: Text( | |
"Hi Flutter", | |
style: TextStyle( | |
fontSize: 36.0, | |
fontWeight: FontWeight.bold, | |
fontFamily: "serilf", | |
color: Colors.blueGrey, | |
), | |
), | |
) | |
], | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment