Skip to content

Instantly share code, notes, and snippets.

@ryanlid
Created February 15, 2020 16:55
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/c837d3a9011087431451f5007506d629 to your computer and use it in GitHub Desktop.
Save ryanlid/c837d3a9011087431451f5007506d629 to your computer and use it in GitHub Desktop.
IndexedStack 布局示例
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