ရိုးရိုးလေး ရှင်းပြမယ်
Basic Widgets ကို ရိုးရိုးလေးနားလည်မယ်
Flutter app တစ်ခုမှာ နေ့တိုင်းနီးပါးသုံးရမယ့် widget တွေရှိပါတယ်။ Text ကစာပြရန်၊ Icon က icon ပြရန်၊ Image ကပုံပြရန်၊ Container က box/styling ပြုလုပ်ရန်၊ Scaffold က page structure တည်ဆောက်ရန်သုံးပါတယ်။ ဒီ widget တွေကိုသိရင် simple UI အများစုကို စတင်တည်ဆောက်နိုင်ပါပြီ။
Problem → Why → Solution
ပြဿနာ — ဘာကြောင့် ဒီ concept လိုတာလဲ
Text ကို color နဲ့ background တိုက်မိအောင်ရေးရင် မဖတ်ရလွယ်ပါ။ Contrast ကိုအမြဲစစ်ပါ။
ဖြစ်လေ့ရှိတဲ့အမှား
Screen တစ်မျိုးတွင် sample output မှန်ရုံဖြင့် rebuild, overflow, accessibility, async နဲ့ lifecycle paths အားလုံးမှန်ပြီဟုယူဆခြင်း။
Core Concept — အလုပ်လုပ်ပုံကိုနားလည်မယ်
Basic Widgets ကို 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
Basic Widgets ရဲ့ widget, state နဲ့ lifecycle behavior ကိုရှင်းပြနိုင်ရန်
အဓိက Syntax / Pattern
Scaffold(
appBar: AppBar(title: const Text('Basic Widgets')),
body: Center(
child: Container(
padding: const EdgeInsets.all(20),
decoration: BoxDecoration(
color: Colors.blue,
borderRadius: BorderRadius.circular(16),
),
child: const Text(
'Hello Flutter',
style: TextStyle(color: Colors.white, fontSize: 24),
),
),
),
)Basic Widgets ကို widget syntax အဖြစ်သာမမြင်ဘဲ constraints, size, position, rebuild scope, semantics နဲ့ platform adaptation contract အဖြစ်နားလည်ပါ။ Widget tree ကိုသေးသေးခွဲပြီး const widgets, lazy builders နဲ့ responsive constraints ကိုဦးစားပေးပါ။
Code ကို အဆင့်လိုက်ဖတ်မယ်
- Input + state
Scaffold(Flutter app တစ်ခုမှာ နေ့တိုင်းနီးပါးသုံးရမယ့် widget တွေရှိပါတယ်။ Text ကစာပြရန်၊ Icon က icon ပြရန်၊ Image ကပုံပြရန်၊ Container က box/styling ပြုလုပ်ရန်၊ Scaffold က page structure တည်ဆောက်ရန်သုံးပါတယ်။ ဒီ widget တွေကိုသိရင် simple UI အများစုကို စတင်တည်ဆောက်နိုင်ပါပြီ။
- Widget build + layout
),Basic Widgets ကို widget syntax အဖြစ်သာမမြင်ဘဲ constraints, size, position, rebuild scope, semantics နဲ့ platform adaptation contract အဖြစ်နားလည်ပါ။ Widget tree ကိုသေးသေးခွဲပြီး const widgets, lazy builders နဲ့ responsive constraints ကိုဦးစားပေးပါ။
- Rendered Flutter UI
)Basic Widgets 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
Basic Widgets ရဲ့ widget, state နဲ့ lifecycle behavior ကိုရှင်းပြနိုင်ရန်
Failure
Text ကို color နဲ့ background တိုက်မိအောင်ရေးရင် မဖတ်ရလွယ်ပါ။ Contrast ကိုအမြဲစစ်ပါ။
Flutter app တစ်ခုမှာ နေ့တိုင်းနီးပါးသုံးရမယ့် widget တွေရှိပါတယ်။ Text ကစာပြရန်၊ Icon က icon ပြရန်၊ Image ကပုံပြရန်၊ Container က box/styling ပြုလုပ်ရန်၊ Scaffold က page structure တည်ဆောက်ရန်သုံးပါတယ်။ ဒီ widget တွေကိုသိရင် simple UI အများစုကို စတင်တည်ဆောက်နိုင်ပါပြီ။
Scaffold(
appBar: AppBar(title: const Text('Basic Widgets')),
body: Center(
child: Container(
padding: const EdgeInsets.all(20),
decoration: BoxDecoration(
color: Colors.blue,
borderRadius: BorderRadius.circular(16),
),
child: const Text(
'Hello Flutter',
style: TextStyle(color: Colors.white, fontSize: 24),
),
),
),
)App bar ပါတဲ့ screen အလယ်မှာ အပြာရောင် rounded box တစ်ခုနှင့် Hello Flutter စာသားပေါ်ပါမယ်။နောက်တစ်ဆင့်
UI elements တွေရှိပြီဆိုရင် Row နဲ့ Column သုံးပြီး ဘယ်လိုစီမလဲကိုဆက်သင်ပါ။
Real-world usage
လက်တွေ့ Project မှာ ဘယ်လိုသုံးမလဲ
Basic Widgets 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
ကိုယ်တိုင်တည်ဆောက်ကြည့်ပါ
Basic Widgets 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 ကိုခန့်မှန်းပါ
Scaffold(
appBar: AppBar(title: const Text('Basic Widgets')),
body: Center(
child: Container(
padding: const EdgeInsets.all(20),
decoration: BoxDecoration(
color: Colors.blue,
borderRadius: BorderRadius.circular(16),
),
child: const Text(
'Hello Flutter',
style: TextStyle(color: Colors.white, fontSize: 24),
),
),
),
)ရလဒ်: Basic Widgets ရဲ့ widget, state နဲ့ lifecycle behavior ကိုရှင်းပြနိုင်ရန်
အရိပ်အမြွက် ကြည့်ရန်
Basic Widgets 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
- Basic Widgets ကို widget syntax အဖြစ်သာမမြင်ဘဲ constraints, size, position, rebuild scope, semantics နဲ့ platform adaptation contract အဖြစ်နားလည်ပါ။ Widget tree ကိုသေးသေးခွဲပြီး const widgets, lazy builders နဲ့ responsive constraints ကိုဦးစားပေးပါ။
- Text ကို color နဲ့ background တိုက်မိအောင်ရေးရင် မဖတ်ရလွယ်ပါ။ Contrast ကိုအမြဲစစ်ပါ။
- Basic Widgets 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