flutter ConstrainedBox限定宽高示例

2020-08-27  本文已影响0人  喜剧收尾_XWX
import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return MaterialApp(
        title: "ConstrainedBox限定宽高示例",
        home: Scaffold(
            appBar: AppBar(
              title: Text('ConstrainedBox限定宽高示例'),
            ),
            body: ConstrainedBox(
              constraints: BoxConstraints(
                maxWidth: 200,
                minWidth: 100,
                maxHeight: 200,
                minHeight: 100,
              ),
              child: Container(
                width: 400,
                height: 400,
                color: Colors.red,
              ),
            )));
  }
}
上一篇 下一篇

猜你喜欢

热点阅读