Can FlutterLogo be made to stretch-to-fill?

后端 未结 2 1037
小蘑菇
小蘑菇 2021-01-07 10:30

I would like to display a large FlutterLogo in my app: https://docs.flutter.io/flutter/material/FlutterLogo-class.html

In order to account for varying screen sizes I

2条回答
  •  旧巷少年郎
    2021-01-07 10:36

    You can accomplish this with a ConstrainedBox:

    import 'package:flutter/material.dart';
    
    void main() {
      runApp(new MyApp());
    }
    
    class MyApp extends StatelessWidget {
      @override
      Widget build(BuildContext context) {
        return new MaterialApp(
          theme: new ThemeData.dark(),
          home: new MyHomePage(),
        );
      }
    }
    
    class MyHomePage extends StatelessWidget {
      @override
      Widget build(BuildContext context) {
        return new Scaffold(
          appBar: new AppBar(title: new Text('Example App')),
          body: new ConstrainedBox(
            constraints: new BoxConstraints.expand(),
            child: new FlutterLogo(
              style: FlutterLogoStyle.horizontal,
              textColor: Colors.white,
            ),
          ),
        );
      }
    }
    

提交回复
热议问题