成人免费xxxxx在线视频软件_久久精品久久久_亚洲国产精品久久久_天天色天天色_亚洲人成一区_欧美一级欧美三级在线观看

為前端工程師準備的Flutter入門指南

開發 前端 Android
在接下來的章節中,我們仔細來對比下平時用 HTML/CSS 代碼所實現的效果,如果替換為等價的 Flutter/Dart 代碼,會是什么樣子。

如果你恰好是一名前端工程師,且對 Flutter 抱有興趣,那么真的是太好了,這篇文章完全就是為你準備的。寫慣了 HTML、CSS 與 JavaScript,要不要來是試試 Dart?如果你不熟悉 Flutter 但仍對其感興趣,可以先看看「讓我們在2019年重新認識 Flutter」一文了解些 Flutter 基礎。

在接下來的章節中,我們仔細來對比下平時用 HTML/CSS 代碼所實現的效果,如果替換為等價的 Flutter/Dart 代碼,會是什么樣子。

為前端工程師準備的Flutter入門指南

本文結構如下:

  1. 基礎布局
  2. 位置與大小
  3. 圖形/形狀
  4. 文本

注:本文只摘錄 Web 到 Flutter 中一些特性的轉換介紹,詳細及完整的使用方法與語法請查閱 Flutter/Dart 官網 https://flutter.io, https://flutter.cn 與 https://www.dartlang.org.

本文示例中默認已包含如下假設:

HTML 文件均會以 開頭,且為了與 Flutter 模型保持一致,所有 HTML 元素的 CSS 盒模型被設置為 border-box。 

  1.   box-sizing: border-box; 

在 Flutter 中,為了保持語法簡潔,示例中所用的 “Lorem ipsum” 文本的默認樣式由如下 bold24Roboto 變量定義: 

  1. TextStyle bold24Roboto = TextStyle( 
  2.   color: Colors.white, 
  3.   fontSize: 24.0, 
  4.   fontWeight: FontWeight.w900, 
  5. ); 

Flutter UI 采用聲明式編程,欲了解其與傳統命令式風格的不同,請查閱聲明式 UI 介紹。

一、基礎布局

先來看看最常見的一些 UI 布局操作。

1.1 文本樣式與對齊

我們在 CSS 中設置的字體樣式、大小以及其他文本屬性,都是 Flutter 中一個 Text widget 子元素 TextStyle 中單獨的屬性。

In both HTML and Flutter, child elements or widgets are anchored at the top left, by default.

不論是 HTML 還是 Flutter,子元素或者 widget 都默認錨定在左上方。

Web 

  1. <div class="greybox"
  2.     Lorem ipsum 
  3. </div> 
  4.  
  5. .greybox { 
  6.   background-color: #e0e0e0; /* grey 300 */ 
  7.   width: 320px; 
  8.   height: 240px; 
  9.   font: 900 24px Georgia; 

Dart 

  1. var container = Container( // grey box 
  2.   child: Text( 
  3.     "Lorem ipsum"
  4.     style: TextStyle( 
  5.       fontSize: 24.0, 
  6.       fontWeight: FontWeight.w900, 
  7.       fontFamily: "Georgia"
  8.     ), 
  9.   ), 
  10.   width: 320.0, 
  11.   height: 240.0, 
  12.   color: Colors.grey[300], 
  13. ); 

1.2 背景顏色

在 Flutter 中,你可以通過 Container 的 decoration 屬性來設置背景顏色。

CSS 示例中我們使用等價的十六進制顏色表示。

Web 

  1. <div class="greybox"
  2.   Lorem ipsum 
  3. </div> 
  4.  
  5. .greybox { 
  6.   background-color: #e0e0e0;  /* grey 300 */ 
  7.   width: 320px; 
  8.   height: 240px; 
  9.   font: 900 24px Roboto; 

Dart 

  1. var container = Container( // grey box 
  2.     child: Text( 
  3.       "Lorem ipsum"
  4.       style: bold24Roboto, 
  5.     ), 
  6.     width: 320.0, 
  7.     height: 240.0, 
  8.     color: Colors.grey[300], 
  9.   ); 

1.3 居中元素

在 Flutter 中,Center widget 可以將它的子元素水平和垂直居中。

要用 CSS 實現相似的效果,其父元素則需要使用一個 flex 或者 table-cell 顯示布局。本節示例使用的是 flex 布局。

Web 

  1. <div class="greybox"
  2.   Lorem ipsum 
  3. </div> 
  4.  
  5. .greybox { 
  6.   background-color: #e0e0e0; /* grey 300 */ 
  7.   width: 320px; 
  8.   height: 240px; 
  9.   font: 900 24px Roboto; 
  10.   display: flex; 
  11.   align-items: center; 
  12.   justify-content: center;  

Dart 

  1. var container = Container( // grey box 
  2.   child:  Center( 
  3.     child:  Text( 
  4.       "Lorem ipsum"
  5.       style: bold24Roboto, 
  6.     ), 
  7.   ), 
  8.   width: 320.0, 
  9.   height: 240.0, 
  10.   color: Colors.grey[300], 
  11. ); 

1.4 設置容器寬度

Container widget 的寬度可以用它的 width 屬性指定,但需要注意的是,和 CSS 中的 max-width 屬性用于指定容器可調整的***寬度值不同的是,這里指定的是一個固定寬度。要在 Flutter 中模擬 max-width 的效果,可以使用 Container 的 constraints 屬性。新建一個帶有 minWidth 和 maxWidth 屬性的 BoxConstraints widget。 而對嵌套的 Container 來說,如果其父元素寬度小于子元素寬度,則子元素實際尺寸以父元素大小為準。

Web 

  1. <div class="greybox"
  2.   <div class="redbox"
  3.     Lorem ipsum 
  4.   </div> 
  5. </div> 
  6.  
  7. .greybox { 
  8.   background-color: #e0e0e0; /* grey 300 */ 
  9.   width: 320px;  
  10.   height: 240px; 
  11.   font: 900 24px Roboto; 
  12.   display: flex; 
  13.   align-items: center; 
  14.   justify-content: center; 
  15. .redbox { 
  16.   background-color: #ef5350; /* red 400 */ 
  17.   padding: 16px; 
  18.   color: #ffffff; 
  19.   width: 100%; 
  20.   max-width: 240px;  

Dart 

  1. var container = Container( // grey box 
  2.   child: Center( 
  3.     child: Container( // red box 
  4.       child: Text( 
  5.         "Lorem ipsum"
  6.         style: bold24Roboto, 
  7.       ), 
  8.       decoration: BoxDecoration( 
  9.         color: Colors.red[400], 
  10.       ), 
  11.       padding: EdgeInsets.all(16.0), 
  12.       width: 240.0, //max-width is 240.0 
  13.     ), 
  14.   ), 
  15.   width: 320.0,  
  16.   height: 240.0, 
  17.   color: Colors.grey[300], 
  18. ); 

二、位置與大小

以下示例將展示如何對 widget 的位置、大小以及背景進行更復雜的操作。

2.1 絕對定位

默認情況下, widget 是相對于其父元素定位的。要通過 x-y 坐標指定一個 widget 的絕對位置,請把它嵌套在一個 Positioned widget 中,而該 widget 則需被嵌套在一個 Stack widget 中。

Web 

  1. <div class="greybox"
  2.   <div class="redbox"
  3.     Lorem ipsum 
  4.   </div> 
  5. </div> 
  6.  
  7. .greybox { 
  8.   background-color: #e0e0e0; /* grey 300 */ 
  9.   width: 320px; 
  10.   height: 240px; 
  11.   font: 900 24px Roboto; 
  12.   position: relative;  
  13. .redbox { 
  14.   background-color: #ef5350; /* red 400 */ 
  15.   padding: 16px; 
  16.   color: #ffffff; 
  17.   position: absolute
  18.   top: 24px; 
  19.   left: 24px;  

Dart 

  1. var container = Container( // grey box 
  2.   child: Stack( 
  3.     children: [ 
  4.       Positioned( // red box 
  5.         child:  Container( 
  6.           child: Text( 
  7.             "Lorem ipsum"
  8.             style: bold24Roboto, 
  9.           ), 
  10.           decoration: BoxDecoration( 
  11.             color: Colors.red[400], 
  12.           ), 
  13.           padding: EdgeInsets.all(16.0), 
  14.         ), 
  15.         left: 24.0, 
  16.         top: 24.0, 
  17.       ), 
  18.     ], 
  19.   ),  
  20.   width: 320.0, 
  21.   height: 240.0, 
  22.   color: Colors.grey[300], 
  23. ); 

2.2 旋轉

要旋轉一個 widget,請將它嵌套在 Transform widget 中。其中,使用 Transform widget 的 alignment 和 origin 屬性分別來指定轉換原點的具體位置信息。

對于簡單的 2D 旋轉,widget 是依據弧度在 Z 軸上旋轉的。(角度 × π / 180)

Web  

  1. <div class="greybox"
  2.   <div class="redbox"
  3.     Lorem ipsum 
  4.   </div> 
  5. </div> 
  6.  
  7. .greybox { 
  8.   background-color: #e0e0e0; /* grey 300 */ 
  9.   width: 320px; 
  10.   height: 240px; 
  11.   font: 900 24px Roboto; 
  12.   display: flex; 
  13.   align-items: center; 
  14.   justify-content: center; 
  15. .redbox { 
  16.   background-color: #ef5350; /* red 400 */ 
  17.   padding: 16px; 
  18.   color: #ffffff; 
  19.   transform: rotate(15deg);  

Dart 

  1. var container = Container( // gray box 
  2.   child: Center( 
  3.     child:  Transform( 
  4.       child:  Container( // red box 
  5.         child: Text( 
  6.           "Lorem ipsum"
  7.           style: bold24Roboto, 
  8.           textAlign: TextAlign.center, 
  9.         ), 
  10.         decoration: BoxDecoration( 
  11.           color: Colors.red[400], 
  12.         ), 
  13.         padding: EdgeInsets.all(16.0), 
  14.       ), 
  15.       alignment: Alignment.center, 
  16.       transform: Matrix4.identity() 
  17.         ..rotateZ(15 * 3.1415927 / 180), 
  18.     ),  
  19.   ), 
  20.   width: 320.0, 
  21.   height: 240.0, 
  22.   color: Colors.grey[300], 
  23. ); 

2.3 縮放元素

將元素嵌套在一個 Transform widget 中,可以實現縮放。使用 Transform widget 的 alignment 和 origin 屬性分別來指定縮放原點的具體位置信息。

對于沿 x 軸的簡單縮放操作,新建一個 Matrix4 標識對象并用它的 scale() 方法來指定縮放因系數。

當你縮放一個父 widget 時,它的子 widget 也會相應被縮放。

Web 

  1. <div class="greybox"
  2.   <div class="redbox"
  3.     Lorem ipsum 
  4.   </div> 
  5. </div> 
  6.  
  7. .greybox { 
  8.   background-color: #e0e0e0; /* grey 300 */ 
  9.   width: 320px; 
  10.   height: 240px; 
  11.   font: 900 24px Roboto; 
  12.   display: flex; 
  13.   align-items: center; 
  14.   justify-content: center; 
  15. .redbox { 
  16.   background-color: #ef5350; /* red 400 */ 
  17.   padding: 16px; 
  18.   color: #ffffff; 
  19.   transform: scale(1.5);  

Dart 

  1. var container = Container( // gray box 
  2.   child: Center( 
  3.     child:  Transform( 
  4.       child:  Container( // red box 
  5.         child: Text( 
  6.           "Lorem ipsum"
  7.           style: bold24Roboto, 
  8.           textAlign: TextAlign.center, 
  9.         ), 
  10.         decoration: BoxDecoration( 
  11.           color: Colors.red[400], 
  12.         ), 
  13.         padding: EdgeInsets.all(16.0), 
  14.       ), 
  15.       alignment: Alignment.center, 
  16.       transform: Matrix4.identity() 
  17.         ..scale(1.5), 
  18.      ),  
  19.   width: 320.0, 
  20.   height: 240.0, 
  21.   color: Colors.grey[300], 
  22. ); 

2.4 線性變換

將元素嵌套在一個 Container widget 中,可以將線性變換應用在 widget 的背景上。之后,再用 Container widget 的 decoration 屬性生成一個 BoxDecoration 對象,然后使用 BoxDecoration 的 gradient 屬性來變換背景填充內容。

變換“角度”基于 Alignment (x, y) 取值來定:

  • 如果開始和結束的 x 值相同,變換將是垂直的(0°180°)。
  • 如果開始和結束的 y 值相同,變換將是水平的(90°270°)。

這里,只展示垂直變換的代碼差異:

Web  

  1. <div class="greybox"
  2.   <div class="redbox"
  3.     Lorem ipsum 
  4.   </div> 
  5. </div> 
  6.  
  7. .greybox { 
  8.   background-color: #e0e0e0; /* grey 300 */ 
  9.   width: 320px; 
  10.   height: 240px; 
  11.   font: 900 24px Roboto; 
  12.   display: flex; 
  13.   align-items: center; 
  14.   justify-content: center; 
  15. .redbox { 
  16.   padding: 16px; 
  17.   color: #ffffff; 
  18.   background: linear-gradient(180deg, #ef5350, rgba(0, 0, 0, 0) 80%);  

Dart 

  1. var container = Container( // grey box 
  2.   child: Center( 
  3.     child: Container( // red box 
  4.       child: Text( 
  5.         "Lorem ipsum"
  6.         style: bold24Roboto, 
  7.       ), 
  8.       decoration: BoxDecoration( 
  9.         gradient: LinearGradient( 
  10.           begin: const Alignment(0.0, -1.0), 
  11.           end: const Alignment(0.0, 0.6), 
  12.           colors: <Color>[ 
  13.             const Color(0xffef5350), 
  14.             const Color(0x00ef5350) 
  15.           ], 
  16.         ), 
  17.       ),  
  18.       padding: EdgeInsets.all(16.0), 
  19.     ), 
  20.   ), 
  21.   width: 320.0, 
  22.   height: 240.0, 
  23.   color: Colors.grey[300], 
  24. ); 

三、圖形/形狀

以下示例將展示如何新建和自定義圖形。

3.1 圓角

在矩形上實現圓角,可以用 BoxDecoration 對象的 borderRadius 屬性。新建一個 BorderRadius 對象來指定每個圓角的半徑大小。

Web 

  1. <div class="greybox"
  2.   <div class="redbox"
  3.     Lorem ipsum 
  4.   </div> 
  5. </div> 
  6.  
  7. .greybox { 
  8.   background-color: #e0e0e0; /* gray 300 */ 
  9.   width: 320px; 
  10.   height: 240px; 
  11.   font: 900 24px Roboto; 
  12.   display: flex; 
  13.   align-items: center; 
  14.   justify-content: center; 
  15. .redbox { 
  16.   background-color: #ef5350; /* red 400 */ 
  17.   padding: 16px; 
  18.   color: #ffffff; 
  19.   border-radius: 8px;  

Dart 

  1. var container = Container( // grey box 
  2.   child: Center( 
  3.     child: Container( // red circle 
  4.       child: Text( 
  5.         "Lorem ipsum"
  6.         style: bold24Roboto, 
  7.       ), 
  8.       decoration: BoxDecoration( 
  9.         color: Colors.red[400], 
  10.         borderRadius: BorderRadius.all
  11.           const Radius.circular(8.0), 
  12.         ),  
  13.       ), 
  14.       padding: EdgeInsets.all(16.0), 
  15.     ), 
  16.   ), 
  17.   width: 320.0, 
  18.   height: 240.0, 
  19.   color: Colors.grey[300], 
  20. ); 

3.2 陰影

在 CSS 中你可以通過 box-shadow 屬性快速指定陰影偏移與模糊范圍。比如如下兩個盒陰影的屬性設置:

  • xOffset: 0px, yOffset: 2px, blur: 4px, color: black @80% alpha
  • xOffset: 0px, yOffset: 06x, blur: 20px, color: black @50% alpha

在 Flutter 中,每個屬性與其取值都是單獨指定的。請使用 BoxDecoration 的 boxShadow 屬性來生成一系列 BoxShadow widget。你可以定義一個或多個 BoxShadow widget,這些 widget 共同用于設置陰影深度、顏色等等。

Web 

  1. <div class="greybox"
  2.   <div class="redbox"
  3.     Lorem ipsum 
  4.   </div> 
  5. </div> 
  6.  
  7. .greybox { 
  8.   background-color: #e0e0e0; /* grey 300 */ 
  9.   width: 320px; 
  10.   height: 240px; 
  11.   font: 900 24px Roboto; 
  12.   display: flex; 
  13.   align-items: center; 
  14.   justify-content: center; 
  15. .redbox { 
  16.   background-color: #ef5350; /* red 400 */ 
  17.   padding: 16px; 
  18.   color: #ffffff; 
  19.   box-shadow: 0 2px 4px rgba(0, 0, 0, 0.8), 
  20.               0 6px 20px rgba(0, 0, 0, 0.5); 

Dart 

  1. var container = Container( // grey box 
  2.   child: Center( 
  3.     child: Container( // red box 
  4.       child: Text( 
  5.         "Lorem ipsum"
  6.         style: bold24Roboto, 
  7.       ), 
  8.       decoration: BoxDecoration( 
  9.         color: Colors.red[400], 
  10.         boxShadow: <BoxShadow>[ 
  11.           BoxShadow ( 
  12.             color: const Color(0xcc000000), 
  13.             offset: Offset(0.0, 2.0), 
  14.             blurRadius: 4.0, 
  15.           ), 
  16.           BoxShadow ( 
  17.             color: const Color(0x80000000), 
  18.             offset: Offset(0.0, 6.0), 
  19.             blurRadius: 20.0, 
  20.           ), 
  21.         ],  
  22.       ), 
  23.       padding: EdgeInsets.all(16.0), 
  24.     ), 
  25.   ), 
  26.   width: 320.0, 
  27.   height: 240.0, 
  28.   decoration: BoxDecoration( 
  29.     color: Colors.grey[300], 
  30.   ), 
  31.   margin: EdgeInsets.only(bottom: 16.0), 
  32. ); 

3.3 圓與橢圓

盡管 CSS 中有基礎圖形,CSS 中一個生成圓的變通方案是:將矩形的四邊 border-radius 均設成50%。

雖然 BoxDecoration 的 borderRadius 屬性支持這樣設置,Flutter 為 BoxShape enum 提供一個 shape 屬性也用于實現同樣的目的。

Web  

  1. <div class="greybox"
  2.   <div class="redcircle"
  3.     Lorem ipsum 
  4.   </div> 
  5. </div> 
  6.  
  7. .greybox { 
  8.   background-color: #e0e0e0; /* gray 300 */ 
  9.   width: 320px; 
  10.   height: 240px; 
  11.   font: 900 24px Roboto; 
  12.   display: flex; 
  13.   align-items: center; 
  14.   justify-content: center; 
  15. .redcircle { 
  16.   background-color: #ef5350; /* red 400 */ 
  17.   padding: 16px; 
  18.   color: #ffffff; 
  19.   text-align: center; 
  20.   width: 160px; 
  21.   height: 160px; 
  22.   border-radius: 50%;  

Dart 

  1. var container = Container( // grey box 
  2.   child: Center( 
  3.     child: Container( // red circle 
  4.       child: Text( 
  5.         "Lorem ipsum"
  6.         style: bold24Roboto, 
  7.         textAlign: TextAlign.center,  
  8.       ), 
  9.       decoration: BoxDecoration( 
  10.         color: Colors.red[400], 
  11.         shape: BoxShape.circle,  
  12.       ), 
  13.       padding: EdgeInsets.all(16.0), 
  14.       width: 160.0, 
  15.       height: 160.0,  
  16.     ), 
  17.   ), 
  18.   width: 320.0, 
  19.   height: 240.0, 
  20.   color: Colors.grey[300], 
  21. ); 

四、文本

以下示例展示了如何設置字體和其他文本屬性,除此外還包括一些特性比如如何變換文本字符、自定義間距以及生成摘錄。

4.1 文字間距

在 CSS 中你可以通過分別給 letter-spacing 和 word-spacing 屬性的長度賦值來指定每個字母以及每個單詞間的空白距離。距離的單位可以是 px, pt, cm, em 等等。

在 Flutter 中,你可以在 Text widget 子元素 TextStyle 的 letterSpacing 與 wordSpacing 屬性中將間距設置為邏輯像素(允許負值)。

Web  

  1. <div class="greybox"
  2.   <div class="redbox"
  3.     Lorem ipsum 
  4.   </div> 
  5. </div> 
  6.  
  7. .greybox { 
  8.   background-color: #e0e0e0; /* grey 300 */ 
  9.   width: 320px; 
  10.   height: 240px; 
  11.   font: 900 24px Roboto; 
  12.   display: flex; 
  13.   align-items: center; 
  14.   justify-content: center; 
  15. .redbox { 
  16.   background-color: #ef5350; /* red 400 */ 
  17.   padding: 16px; 
  18.   color: #ffffff; 
  19.   letter-spacing: 4px;  

Dart 

  1. var container = Container( // grey box 
  2.   child: Center( 
  3.     child: Container( // red box 
  4.       child: Text( 
  5.         "Lorem ipsum"
  6.         style: TextStyle( 
  7.           color: Colors.white, 
  8.           fontSize: 24.0, 
  9.           fontWeight: FontWeight.w900, 
  10.           letterSpacing: 4.0,  
  11.         ), 
  12.       ), 
  13.       decoration: BoxDecoration( 
  14.         color: Colors.red[400], 
  15.       ), 
  16.       padding: EdgeInsets.all(16.0), 
  17.     ), 
  18.   ), 
  19.   width: 320.0, 
  20.   height: 240.0, 
  21.   color: Colors.grey[300], 
  22. ); 

4.2 內聯樣式

一個 Text widget 可以展示同一類樣式的文本。為了展現具有多種樣式的文本,需要改用 RichText widget。它的 text 屬性可以指定一個或多個可以單獨設置樣式的 TextSpan widget。

在下例中,”Lorem” 位于 TextSpan widget 中,具有默認(繼承自其父元素)文本樣式,”ipsum” 位于具有自定義樣式、單獨的一個 TextSpan 中。

Web  

  1. <div class="greybox"
  2.   <div class="redbox"
  3.     Lorem <em>ipsum</em>  
  4.   </div> 
  5. </div> 
  6.  
  7. .greybox { 
  8.   background-color: #e0e0e0; /* grey 300 */ 
  9.   width: 320px; 
  10.   height: 240px; 
  11.   font: 900 24px Roboto;  
  12.   display: flex; 
  13.   align-items: center; 
  14.   justify-content: center; 
  15. .redbox { 
  16.   background-color: #ef5350; /* red 400 */ 
  17.   padding: 16px; 
  18.   color: #ffffff; 
  19.  .redbox em { 
  20.   font: 300 48px Roboto; 
  21.   font-style: italic; 
  22. }  

Dart 

  1. var container = Container( // grey box 
  2.   child: Center( 
  3.     child: Container( // red box 
  4.       child:  RichText( 
  5.         text: TextSpan( 
  6.           style: bold24Roboto, 
  7.           children: <TextSpan>[ 
  8.             TextSpan(text: "Lorem "), 
  9.             TextSpan( 
  10.               text: "ipsum"
  11.               style: TextStyle( 
  12.                 fontWeight: FontWeight.w300, 
  13.                 fontStyle: FontStyle.italic, 
  14.                 fontSize: 48.0, 
  15.               ), 
  16.             ), 
  17.           ], 
  18.         ), 
  19.       ),  
  20.       decoration: BoxDecoration( 
  21.         backgroundColor: Colors.red[400], 
  22.       ), 
  23.       padding: EdgeInsets.all(16.0), 
  24.     ), 
  25.   ), 
  26.   width: 320.0, 
  27.   height: 240.0, 
  28.   color: Colors.grey[300], 
  29. ); 

4.3 文本摘要

在 Web 中,我們常用省略號處理溢出的文本內容,且在 HTML/CSS 中,摘要不能超過一行。 如果要在多行之后進行截斷,那么就需要 JavaScript 的幫助了。

在 Flutter 中,使用 Text widget 的 maxLines 屬性來指定包含在摘要中的行數,以及 overflow 屬性來處理溢出文本。

Web  

  1. <div class="greybox"
  2.   <div class="redbox"
  3.     Lorem ipsum dolor sit amet, consec etur 
  4.   </div> 
  5. </div> 
  6.  
  7. .greybox { 
  8.   background-color: #e0e0e0; /* grey 300 */ 
  9.   width: 320px; 
  10.   height: 240px; 
  11.   font: 900 24px Roboto; 
  12.   display: flex; 
  13.   align-items: center; 
  14.   justify-content: center; 
  15. .redbox { 
  16.   background-color: #ef5350; /* red 400 */ 
  17.   padding: 16px; 
  18.   color: #ffffff; 
  19.   overflow: hidden; 
  20.   text-overflow: ellipsis; 
  21.   white-space: nowrap;  

Dart 

  1. var container = Container( // grey box 
  2.   child: Center( 
  3.     child: Container( // red box 
  4.       child: Text( 
  5.         "Lorem ipsum dolor sit amet, consec etur"
  6.         style: bold24Roboto, 
  7.         overflow: TextOverflow.ellipsis, 
  8.         maxLines: 1,  
  9.       ), 
  10.       decoration: BoxDecoration( 
  11.         backgroundColor: Colors.red[400], 
  12.       ), 
  13.       padding: EdgeInsets.all(16.0), 
  14.     ), 
  15.   ), 
  16.   width: 320.0, 
  17.   height: 240.0, 
  18.   color: Colors.grey[300], 
  19. ); 

Teaser 截圖自 flutter.io 官網。

責任編輯:未麗燕 來源: Joe's Blog
相關推薦

2019-12-18 10:30:24

前端開發技術

2019-07-29 16:05:48

前端DockerNode.js

2015-08-26 14:18:25

Web前端工程師價值

2015-09-30 10:25:03

前端工程師

2018-11-15 15:55:44

前端工程師Web云計算

2010-01-13 10:53:51

Web前端工程師定位

2014-12-23 14:55:23

前端

2022-03-15 08:00:00

Flutter開發工具

2023-11-02 11:49:22

2022-07-29 09:12:44

軟件硬件開發

2022-09-16 08:00:00

軟件工程師求職薪酬

2016-09-22 16:14:45

前端設計Photoshop

2010-01-13 10:10:07

Web前端工程師

2015-03-16 16:01:40

Web前端前端工程師Web

2009-02-23 09:41:29

面試軟件測試工程師

2019-06-24 09:40:17

前端前端工程師開發工具

2023-10-30 08:27:50

ML后端學習機器

2022-08-18 08:00:00

BGP非網絡工程師漏洞

2021-04-22 09:00:00

軟件工程師代碼

2012-06-28 14:23:32

Web
點贊
收藏

51CTO技術棧公眾號

主站蜘蛛池模板: 亚洲一区二区三区视频 | 国产精品99久久久精品免费观看 | 国产精品区一区二 | 黄色毛片在线观看 | 亚洲午夜一区二区 | 日韩成人免费在线视频 | 天久久| 国产日韩一区 | 999re5这里只有精品 | 性一交一乱一透一a级 | 久草在线在线精品观看 | 国产一区二区在线免费观看 | 97色在线观看免费视频 | 黄网免费 | 国产日韩视频 | 亚洲一二三区在线观看 | 欧美老妇交乱视频 | 日韩一区二区三区精品 | 精品久久国产 | 免费的网站www | 欧美电影网 | 亚洲高清在线 | 国产精品成人一区二区 | 色呦呦在线 | 日韩视频免费看 | 美女视频一区二区三区 | 国产精品久久久久久久久久软件 | 精品一区二区三 | 欧美日韩一区二区在线 | 免费性视频 | av喷水| 国产精品毛片一区二区三区 | 婷婷在线视频 | 男人天堂国产 | 色在线看 | 一级a性色生活片久久毛片 午夜精品在线观看 | 亚洲视频在线看 | 2019中文字幕视频 | 日韩伦理电影免费在线观看 | 一本一道久久a久久精品综合 | 狠狠艹 |