Created
February 15, 2020 16:42
-
-
Save ryanlid/41509ee215041f56710472b64fd9f1c4 to your computer and use it in GitHub Desktop.
Align 对齐布局
This file contains hidden or 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: "Align 对齐布局示例", | |
home: LayoutDemo(), | |
)); | |
} | |
class LayoutDemo extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar( | |
title: Text("Align 对齐布局"), | |
), | |
body: Stack( | |
children: <Widget>[ | |
Align( | |
alignment: FractionalOffset(0.0, 0.0), | |
child: Image.network( | |
"https://static.lidong.me/upload/XjGwvaVAI.png", | |
width: 128.0, | |
height: 128.0, | |
), | |
), | |
Align( | |
alignment: FractionalOffset(1.0, 0.0), | |
child: Image.network( | |
"https://static.lidong.me/upload/XjGwvaVAI.png", | |
width: 128.0, | |
height: 128.0, | |
), | |
), | |
Align( | |
alignment: FractionalOffset.center, | |
child: Image.network( | |
"https://static.lidong.me/upload/c7QdErvcb.png", | |
width: 128.0, | |
height: 128.0, | |
), | |
), | |
Align( | |
alignment: FractionalOffset.bottomLeft, | |
child: | |
Image.network("https://static.lidong.me/upload/c7QdErvcb.png"), | |
), | |
Align( | |
alignment: FractionalOffset.bottomRight, | |
child: | |
Image.network("https://static.lidong.me/upload/c7QdErvcb.png"), | |
), | |
], | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment