Skip to content

Instantly share code, notes, and snippets.

@ryanlid
Created February 15, 2020 17:04
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/2f9dc786e114683872b78d31a14eccf7 to your computer and use it in GitHub Desktop.
Save ryanlid/2f9dc786e114683872b78d31a14eccf7 to your computer and use it in GitHub Desktop.
LimitedBox 限定宽高布局
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