Notice: 函数 WP_Scripts::localize 的调用方法不正确$l10n 参数必须是一个数组。若要将任意数据传递给脚本,请改用 wp_add_inline_script() 函数。 请查阅调试 WordPress来获取更多信息。 (这个消息是在 5.7.0 版本添加的。) in /data/www/appblog/wp-includes/functions.php on line 6131

Flutter Widget之Container

Widget:https://flutter.io/docs/development/ui/widgets
Container:https://docs.flutter.io/flutter/widgets/Container-class.html

import 'package:flutter/material.dart';

class ContainerDemoPage extends StatefulWidget {
  @override
  State<StatefulWidget> createState() => new _ContainerDemoPageState();
}

class _ContainerDemoPageState extends State<ContainerDemoPage> {
  @override
  Widget build(BuildContext context) {
    Expanded imageExpanded(String img) {
      return new Expanded(child: new Container(
        decoration: new BoxDecoration(
            border: new Border.all(width: 10.0, color: Colors.black38),
            borderRadius: const BorderRadius.all(
                const Radius.circular(8.0))),
        margin: const EdgeInsets.all(4.0),
        child: new Image.asset(img),
      ));
    }

    var container = new Container(
      decoration: new BoxDecoration(color: Colors.black26),
      child: new Column(
        children: <Widget>[
          new Row(children: <Widget>[
            imageExpanded('images/lion.jpg'),
            imageExpanded('images/parrot.jpg'),
          ],),
          new Row(children: <Widget>[
            imageExpanded('images/dog.jpg'),
            imageExpanded('images/cat.jpg'),
          ],),
          new Row(children: <Widget>[
            imageExpanded('images/husky.jpg'),
          ],)
        ],
      ),
    );

    return new Scaffold(
      appBar: new AppBar(title: new Text('Container Page Demo'),),
//      body: new SingleChildScrollView(
//        child: new Center(
//          child: container,
//        ),
//      )

      body: Center(
//      child: Container(
//        margin: const EdgeInsets.all(10.0),
//        color: const Color(0xFF00FF00),
//        width: 48.0,
//        height: 48.0,
//      ),
        child: Container(
          constraints: BoxConstraints.expand(
            height: Theme.of(context).textTheme.display1.fontSize * 1.1 + 200.0,
          ),
          padding: const EdgeInsets.all(8.0),
          color: Colors.teal.shade700,
          alignment: Alignment.center,
          child: Text('Hello World', style: Theme.of(context).textTheme.display1.copyWith(color: Colors.white)),
          foregroundDecoration: BoxDecoration(
            image: DecorationImage(
              image: NetworkImage('http://www.appblog.com/css/images/logo128.jpg'),
              centerSlice: Rect.fromLTRB(270.0, 180.0, 1360.0, 730.0),
            ),
          ),
          transform: Matrix4.rotationZ(0.1),
        )
      ),
    );
  }
}

Flutter Widget Container

上一篇 Dart中的函数式编程
下一篇 Flutter Widget之Row