Created
February 15, 2020 17:04
-
-
Save ryanlid/2f9dc786e114683872b78d31a14eccf7 to your computer and use it in GitHub Desktop.
LimitedBox 限定宽高布局
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: "LimitedBox限定宽高布局", | |
home: LayoutDemo(), | |
)); | |
} | |
class LayoutDemo extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar( | |
title: Text("LimitedBox限定宽高布局"), | |
), | |
body: Row( | |
children: <Widget>[ | |
Container( | |
color: Colors.grey, | |
width: 100.0, | |
), | |
LimitedBox( | |
maxWidth: 150.0, | |
child: Container( | |
color: Colors.lightGreen, | |
width: 250.0, | |
), | |
) | |
], | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment