Skip to content

Instantly share code, notes, and snippets.

@ryanlid
Created February 15, 2020 16:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanlid/f427875dbf26d47cbf1b2ed2820f5dea to your computer and use it in GitHub Desktop.
Save ryanlid/f427875dbf26d47cbf1b2ed2820f5dea to your computer and use it in GitHub Desktop.
Stack 层叠定位布局
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