Skip to content

Instantly share code, notes, and snippets.

@ryanlid
Created February 15, 2020 16:57
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/1cb8c14a626e9219f107d12cb3725d04 to your computer and use it in GitHub Desktop.
Save ryanlid/1cb8c14a626e9219f107d12cb3725d04 to your computer and use it in GitHub Desktop.
OverflowBox 溢出父容器显示
import 'package:flutter/material.dart';
class LayoutDemo extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("OverflowBox 溢出父容器显示示例"),
),
body: Container(
color: Colors.green,
width: 200.0,
height: 200.0,
padding: EdgeInsets.all(50.0),
child: OverflowBox(
alignment: Alignment.topLeft,
maxWidth: 400.0,
maxHeight: 400.0,
child: Container(
color: Colors.blueGrey,
width: 300.0,
height: 300.0,
),
),
),
);
}
}
void main() {
runApp(MaterialApp(
title: "OverflowBox 溢出父容器显示示例",
home: LayoutDemo(),
));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment