Flutter佈局之標題
原文連結
效果圖
程式碼
Widget titleSection = Container(
padding: const EdgeInsets.all(32.0),
color: Colors.grey[100],
child: Row(
children: [
Expanded( //分析1
child: Column(
crossAxisAlignment: CrossAxisAlignment.start, //分析 2
children: [
Container(
padding: const EdgeInsets.only(bottom: 8.0),
child: Text(
'標題行',
style: TextStyle(
fontWeight: FontWeight.bold,
),
),
),
Text(
'描述行',
style: TextStyle(
color: Colors.grey[500],
),
),
],
),
),
Icon(
Icons.star,
color: Colors.red[500],
),
Text('描述'),
],
),
);
分析
- 分析1:
Expanded 中包含的內容是(標題行和描述行)。使用Expanded會讓其內容佔據螢幕中除了其他內容外剩餘的空間,也就是下圖中虛線框的位置:
- 分析2
crossAxisAlignment: CrossAxisAlignment.start 代表內容 左對齊。
相關文章
- Flutter 佈局之企鵝電競Flutter
- Flutter 佈局Flutter
- flutter系列之:在flutter中使用流式佈局Flutter
- Flutter學習之”相對佈局“Flutter
- Flutter實戰之基本佈局篇Flutter
- Flutter系列之Flex佈局詳解FlutterFlex
- Flutter 常用佈局Flutter
- Flutter | 佈局元件Flutter元件
- Flutter學習之佈局、互動、動畫Flutter動畫
- Flutter 佈局真經Flutter
- Flutter 佈局詳解Flutter
- flutter瀑布流佈局Flutter
- Web 開發者如何理解 Flutter 佈局之 —— 1. TextWebFlutter
- Web 開發者如何理解 Flutter 佈局之 —— 3. ImageWebFlutter
- Flutter 基礎佈局Widgets之Expanded詳解Flutter
- Flutter 基礎佈局Widgets之Stack詳解Flutter
- Flutter 基礎佈局Widgets之Row詳解Flutter
- Flutter佈局篇(1)–水平和垂直佈局詳解Flutter
- Flutter佈局篇(1)--水平和垂直佈局詳解Flutter
- Flutter框架分析(六)-- 佈局Flutter框架
- Flutter 簡單佈局技巧Flutter
- flutter佈局-1-columnFlutter
- flutter佈局-2-rowFlutter
- flutter佈局-3-centerFlutter
- Web 開發者如何理解 Flutter 佈局之 —— 2. ContainerWebFlutterAI
- Flutter 基礎佈局Widgets之Align詳解Flutter
- Flutter 基礎佈局Widgets之FittedBox詳解Flutter
- [譯] Flutter 佈局備忘錄Flutter
- Flutter自定義佈局-CustomMultiChildLayoutFlutter
- flutter佈局-4-containerFlutterAI
- flutter佈局-6-MaterialAppFlutterAPP
- Flutter文字標籤TextTagWidget,搜尋記錄流式佈局顯示文字標籤Flutter
- HTML 標籤與佈局HTML
- Web 開發者如何理解 Flutter 佈局之 —— 5. ListView 和 ScrollBarWebFlutterView
- 三欄佈局之自適應佈局
- 移動佈局基礎之 流式佈局
- CSS經典佈局之Sticky footer佈局CSS
- Flutter佈局——Flex、FittedBox、Stack、Container佈局教程【超詳細】FlutterFlexAI