flutter 缩放布局FittedBox

作者: 喜剧收尾_XWX | 来源:发表于2020-09-02 14:36 被阅读0次
    import 'package:flutter/material.dart';
    
    void main() => runApp(MyApp());
    
    class MyApp extends StatelessWidget {
      @override
      Widget build(BuildContext context) {
        // TODO: implement build
        return MaterialApp(
          title: "FittedBox缩放布局",
          home: Scaffold(
              appBar: AppBar(
                title: Text('FittedBox缩放布局'),
              ),
              body: Container(
                color: Colors.grey,
                width: 250,
                height: 250,
    
                //缩放布局
                child: FittedBox(
                  fit: BoxFit.contain,
                  //对亲属性
                  alignment: Alignment.topLeft,
    
                  child: Container(
                    color: Colors.lightBlue,
                    child: Text('还有谁'),
                  ),
                ),
              )),
        );
      }
    }
    

    相关文章

      网友评论

        本文标题:flutter 缩放布局FittedBox

        本文链接:https://www.haomeiwen.com/subject/dnbydktx.html