Flutter Container 組件、Text 組件詳解


Text 組件
textAlign     文本對齊方式(center 居中,left 左對齊,right 右對齊,justfy 兩端對齊)
textDirection   文本方向(ltr 從左至右,rtl 從右至左)
overflow    文字超出屏幕之后的處理方式(clip裁剪,fade 漸隱,ellipsis 省略號)
textScaleFactor    字體顯示倍率
maxLines  文字顯示最大行數
style  字體的樣式設置
 
TextStyle 的參數 :
decoration   文字裝飾線(none 沒有線,lineThrough 刪除線,overline 上划線,underline 下划線)
decorationColor   文字裝飾線顏色
decorationStyle   文字裝飾線風格([dashed,dotted]虛線,
double     兩根線,solid 一根實線,wavy 波浪線)
wordSpacing    單詞間隙(如果是負值,會讓單詞變得更緊湊
letterSpacing    字母間隙(如果是負值,會讓字母變得更緊湊)
fontStyle   文字樣式(italic 斜體,normal 正常體)
fontSize   文字大小
color   文字顏色
fontWeight   字體粗細(bold 粗體,normal 正常體)
 
更多參數:https://docs.flutter.io/flutter/painting/TextStyle-class.html
 
Container 組件
alignment
topCenter:頂部居中對齊
topLeft:頂部左對齊
topRight:頂部右對齊
center:水平垂直居中對齊
centerLeft:垂直居中水平居左對齊
centerRight:垂直居中水平居右對齊
bottomCenter 底部居中對齊
bottomLeft:底部居左對齊
bottomRight:底部居右對齊
decoration
decoration: BoxDecoration(
  color: Colors.blue,
  border: Border.all(
    color: Colors.red,
    width: 2.0
  ),
  borderRadius: BorderRadius.all(
    Radius.circular(8.0)
  )
)
// 設置最大最小寬度 高度
   constraints: BoxConstraints(   
     minWidth: 180,
     minHeight: 50,
   ),
 
 
margin
margin 屬性是表示 Container 與外部其他組件的距離。
EdgeInsets.all(20.0),
 
padding
padding   就 是 Container 的 內 邊 距 , 指
Container 邊緣與 Child 之間的距離
padding: EdgeInsets.all(10.0)
 
transform
讓 Container 容易進行一些旋轉之類的湖北眾猿騰網絡科技有限公司
transform: Matrix4.rotationZ(0.2)
height 容器高度
width 容器寬度
child 容器子元素
更多參數:https://api.flutter.dev/flutter/widgets/Container-class.html 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM