zoukankan      html  css  js  c++  java
  • 没有使用Material组件和使用了的对比

    import 'package:flutter/material.dart';
    
    void main() => runApp(new MyApp());
    
    class MyApp extends StatelessWidget {
      @override
      Widget build(BuildContext context) {
        return new MaterialApp(
          title: 'Welcome to Flutter',
          home: new Scaffold(
            appBar: new AppBar(
              title: new Text('Welcome to Flutter'),
            ),
            body: new Center(
              child: new Text('Hello World'),
            ),
          ),
        );
      }
    }
    // 这个App没有使用Material组件,  如Scaffold.
    // 一般来说, app没有使用Scaffold的话,会有一个黑色的背景和一个默认为黑色的文本颜色。
    // 这个app,将背景色改为了白色,并且将文本颜色改为了黑色以模仿Material app
    import 'package:flutter/material.dart';
    
    void main() {
      runApp(new MyApp());
    }
    
    class MyApp extends StatelessWidget {
      @override
      Widget build(BuildContext context) {
        return new Container(
          decoration: new BoxDecoration(color: Colors.white),
          child: new Center(
            child: new Text('Hello World',
                textDirection: TextDirection.ltr,
                style: new TextStyle(fontSize: 40.0, color: Colors.black87)),
          ),
        );
      }
    }
  • 相关阅读:
    javascript的组成
    BOM
    相等操作符
    arguments
    数组
    Tomcat日志时间的时区问题
    利用脚本批量操作Solr集群(SolrCloud)
    Solr的schema.xml(managedschema)文件
    Solr报警告The _default configset could not be uploaded
    Ubuntu创建用户
  • 原文地址:https://www.cnblogs.com/xiongwei/p/10620261.html
Copyright © 2011-2022 走看看