iOS-Flutter入门基础(一)-Label

释放双眼,带上耳机,听听看~!

效果图

Flutter基础-label

代码如下

<code class="java"><span class="hljs-keyword">import</span> <span class="hljs-string">'package:flutter/material.dart'</span>;

<span class="hljs-comment">// main</span>
<span class="hljs-function"><span class="hljs-keyword">void</span> <span class="hljs-title">main</span><span class="hljs-params">()</span> async </span>{
  runApp(<span class="hljs-keyword">new</span> MyApp());
}


<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">MyApp</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">StatelessWidget</span> </span>{
  
  <span class="hljs-meta">@override</span>
  <span class="hljs-function">Widget <span class="hljs-title">build</span><span class="hljs-params">(BuildContext context)</span> </span>{
    <span class="hljs-comment">// </span>
    WelcomePage();
    <span class="hljs-keyword">return</span> <span class="hljs-keyword">new</span> MaterialApp(
      title: <span class="hljs-string">'title'</span>,
      home: RouteProSample( ),
    );
  }
}

<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">RouteProSample</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">StatefulWidget</span> </span>{

  <span class="hljs-meta">@override</span>
  createState() =&gt; _RouteProSampleState();
}

<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">_RouteProSampleState</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">State</span>&lt;<span class="hljs-title">RouteProSample</span>&gt; </span>{
  <span class="hljs-meta">@override</span>
  <span class="hljs-function">Widget <span class="hljs-title">build</span><span class="hljs-params">(BuildContext context)</span> </span>{
    <span class="hljs-keyword">return</span> Scaffold(
      appBar: AppBar(
        title: Text(<span class="hljs-string">'-&gt;label'</span>),
      ),
      body: <span class="hljs-keyword">new</span> Center(
        child: <span class="hljs-keyword">new</span> Text (
          <span class="hljs-string">'text'</span>,
          style: <span class="hljs-keyword">new</span> TextStyle(
            fontSize: <span class="hljs-number">20.0</span>,
            color: Colors.red,
            fontStyle: FontStyle.italic,
          ),
        ),
      ),
    );
  }
}
</code>

系列教程

Flutter配置for Mac — VSCode

Flutter入门基础(十)- 图解修改应用名称及图标

人已赞赏
iOS文章

iOS-KVC底层原理--YYModel简述

2019-9-25 23:37:01

iOS文章

iOS-Xcode无线调试

2019-9-26 4:19:30

个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
有新消息 消息中心
搜索