ရိုးရိုးလေး ရှင်းပြမယ်
Layouts (Row & Column) ကို ရိုးရိုးလေးနားလည်မယ်
Row နှင့် Column က Flutter layout ရဲ့ အခြေခံအကျဆုံး tools ဖြစ်ပါတယ်။ Row က child widgets တွေကို ဘေးတိုက်စီပြီး Column က အပေါ်အောက်စီပါတယ်။ UI ရေးတဲ့အခါ ဘာကို horizontal စီမလဲ၊ ဘာကို vertical စီမလဲဆိုတာဆုံးဖြတ်တာက layout thinking ရဲ့အစပါ။
Problem → Why → Solution
ပြဿနာ — ဘာကြောင့် ဒီ concept လိုတာလဲ
Row ထဲမှာ text အရှည်ကြီးထည့်ပြီး Expanded မသုံးရင် yellow/black overflow warning ပေါ်တတ်ပါတယ်။လိုအပ်ရင် Expanded သို့မဟုတ် Flexible သုံးပါ။
ဖြစ်လေ့ရှိတဲ့အမှား
Screen တစ်မျိုးတွင် sample output မှန်ရုံဖြင့် rebuild, overflow, accessibility, async နဲ့ lifecycle paths အားလုံးမှန်ပြီဟုယူဆခြင်း။
Core Concept — အလုပ်လုပ်ပုံကိုနားလည်မယ်
Layouts (Row & Column) ကို widget syntax အဖြစ်သာမမြင်ဘဲ constraints, size, position, rebuild scope, semantics နဲ့ platform adaptation contract အဖြစ်နားလည်ပါ။ Widget tree ကိုသေးသေးခွဲပြီး const widgets, lazy builders နဲ့ responsive constraints ကိုဦးစားပေးပါ။
- Input + state
- Widget build + layout
- Rendered Flutter UI
Layouts (Row & Column) ရဲ့ widget, state နဲ့ lifecycle behavior ကိုရှင်းပြနိုင်ရန်
အဓိက Syntax / Pattern
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text('Rate this lesson'),
const SizedBox(height: 12),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: const [
Icon(Icons.star, color: Colors.amber, size: 36),
Icon(Icons.star, color: Colors.amber, size: 36),
Icon(Icons.star, color: Colors.amber, size: 36),
],
),
],
)Layouts (Row & Column) ကို widget syntax အဖြစ်သာမမြင်ဘဲ constraints, size, position, rebuild scope, semantics နဲ့ platform adaptation contract အဖြစ်နားလည်ပါ။ Widget tree ကိုသေးသေးခွဲပြီး const widgets, lazy builders နဲ့ responsive constraints ကိုဦးစားပေးပါ။
Code ကို အဆင့်လိုက်ဖတ်မယ်
- Input + state
Column(Row နှင့် Column က Flutter layout ရဲ့ အခြေခံအကျဆုံး tools ဖြစ်ပါတယ်။ Row က child widgets တွေကို ဘေးတိုက်စီပြီး Column က အပေါ်အောက်စီပါတယ်။ UI ရေးတဲ့အခါ ဘာကို horizontal စီမလဲ၊ ဘာကို vertical စီမလဲဆိုတာဆုံးဖြတ်တာက layout thinking ရဲ့အစပါ။
- Widget build + layout
children: const [Layouts (Row & Column) ကို widget syntax အဖြစ်သာမမြင်ဘဲ constraints, size, position, rebuild scope, semantics နဲ့ platform adaptation contract အဖြစ်နားလည်ပါ။ Widget tree ကိုသေးသေးခွဲပြီး const widgets, lazy builders နဲ့ responsive constraints ကိုဦးစားပေးပါ။
- Rendered Flutter UI
)Layouts (Row & Column) example ကို small/large screen, text scaling, empty/loading/error, rapid interaction, navigation restore နဲ့ disposal cases ဖြင့် run/test လုပ်ပါ။ flutter analyze, widget tests နဲ့ profile mode ကိုလိုအပ်သလိုသုံးပါ။
- Input + state
- Widget build + layout
- Rendered Flutter UI
Success
Layouts (Row & Column) ရဲ့ widget, state နဲ့ lifecycle behavior ကိုရှင်းပြနိုင်ရန်
Failure
Row ထဲမှာ text အရှည်ကြီးထည့်ပြီး Expanded မသုံးရင် yellow/black overflow warning ပေါ်တတ်ပါတယ်။လိုအပ်ရင် Expanded သို့မဟုတ် Flexible သုံးပါ။
Row နှင့် Column က Flutter layout ရဲ့ အခြေခံအကျဆုံး tools ဖြစ်ပါတယ်။ Row က child widgets တွေကို ဘေးတိုက်စီပြီး Column က အပေါ်အောက်စီပါတယ်။ UI ရေးတဲ့အခါ ဘာကို horizontal စီမလဲ၊ ဘာကို vertical စီမလဲဆိုတာဆုံးဖြတ်တာက layout thinking ရဲ့အစပါ။
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text('Rate this lesson'),
const SizedBox(height: 12),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: const [
Icon(Icons.star, color: Colors.amber, size: 36),
Icon(Icons.star, color: Colors.amber, size: 36),
Icon(Icons.star, color: Colors.amber, size: 36),
],
),
],
)Screen အလယ်မှာ Rate this lesson စာသားပေါ်ပြီး အောက်မှာ ကြယ် icon ၃ ခု ဘေးတိုက်စီနေပါမယ်။နောက်တစ်ဆင့်
Layout ပြီးရင် user နှိပ်နိုင်တဲ့ buttons တွေကိုစတင်သုံးကြည့်ပါ။
Real-world usage
လက်တွေ့ Project မှာ ဘယ်လိုသုံးမလဲ
Layouts (Row & Column) example ကို small/large screen, text scaling, empty/loading/error, rapid interaction, navigation restore နဲ့ disposal cases ဖြင့် run/test လုပ်ပါ။ flutter analyze, widget tests နဲ့ profile mode ကိုလိုအပ်သလိုသုံးပါ။
Mini challenge
ကိုယ်တိုင်တည်ဆောက်ကြည့်ပါ
Layouts (Row & Column) example ကို small/large screen, text scaling, empty/loading/error, rapid interaction, navigation restore နဲ့ disposal cases ဖြင့် run/test လုပ်ပါ။ flutter analyze, widget tests နဲ့ profile mode ကိုလိုအပ်သလိုသုံးပါ။
- Example ကို copy မလုပ်ဘဲ ပြန်ရေးပါ
- Normal input နဲ့ edge case စမ်းပါ
- Run မလုပ်မီ compiler/output result ကိုခန့်မှန်းပါ
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text('Rate this lesson'),
const SizedBox(height: 12),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: const [
Icon(Icons.star, color: Colors.amber, size: 36),
Icon(Icons.star, color: Colors.amber, size: 36),
Icon(Icons.star, color: Colors.amber, size: 36),
],
),
],
)ရလဒ်: Layouts (Row & Column) ရဲ့ widget, state နဲ့ lifecycle behavior ကိုရှင်းပြနိုင်ရန်
အရိပ်အမြွက် ကြည့်ရန်
Layouts (Row & Column) example ကို small/large screen, text scaling, empty/loading/error, rapid interaction, navigation restore နဲ့ disposal cases ဖြင့် run/test လုပ်ပါ။ flutter analyze, widget tests နဲ့ profile mode ကိုလိုအပ်သလိုသုံးပါ။
Quick Quiz 1 / 3
Quick Quiz 2 / 3
Quick Quiz 3 / 3
ဒီသင်ခန်းစာမှာ မှတ်ထားရမယ့်အချက်များ
- Input + state → Widget build + layout → Rendered Flutter UI
- Layouts (Row & Column) ကို widget syntax အဖြစ်သာမမြင်ဘဲ constraints, size, position, rebuild scope, semantics နဲ့ platform adaptation contract အဖြစ်နားလည်ပါ။ Widget tree ကိုသေးသေးခွဲပြီး const widgets, lazy builders နဲ့ responsive constraints ကိုဦးစားပေးပါ။
- Row ထဲမှာ text အရှည်ကြီးထည့်ပြီး Expanded မသုံးရင် yellow/black overflow warning ပေါ်တတ်ပါတယ်။လိုအပ်ရင် Expanded သို့မဟုတ် Flexible သုံးပါ။
- Layouts (Row & Column) example ကို small/large screen, text scaling, empty/loading/error, rapid interaction, navigation restore နဲ့ disposal cases ဖြင့် run/test လုပ်ပါ။ flutter analyze, widget tests နဲ့ profile mode ကိုလိုအပ်သလိုသုံးပါ။
Flutter documentation — Flutter