✅ Flutter Widget of the Week: Hero Animation
🎯 Want seamless transitions between screens in Flutter?
Meet Hero 🦸♂️
It magically animates a widget (like an image or profile) from one screen to another — smooth, native-like, and ✨ delightful.
🔥 Use Case:
Profile picture zoom transition
Gallery image preview
Animating shared elements
Example:
dart
Hero(
tag: 'profile-pic',
child: Image.asset('assets/profile.jpg'),
)
On the next screen:
dart
Hero(
tag: 'profile-pic',
child: Image.asset('assets/profile.jpg'),
)
💡 When to use it:
✅ Smooth screen transitions
✅ Shared element animations
❌ Not for unrelated widgets
⚖️ Quick Compare:
Hero → Easy, auto-animated
Custom animations → More control, more setup
#Flutter #HeroWidget #Animations #FlutterTips #MoustaCore
🎯 Want seamless transitions between screens in Flutter?
Meet Hero 🦸♂️
It magically animates a widget (like an image or profile) from one screen to another — smooth, native-like, and ✨ delightful.
🔥 Use Case:
Profile picture zoom transition
Gallery image preview
Animating shared elements
Example:
dart
Hero(
tag: 'profile-pic',
child: Image.asset('assets/profile.jpg'),
)
On the next screen:
dart
Hero(
tag: 'profile-pic',
child: Image.asset('assets/profile.jpg'),
)
💡 When to use it:
✅ Smooth screen transitions
✅ Shared element animations
❌ Not for unrelated widgets
⚖️ Quick Compare:
Hero → Easy, auto-animated
Custom animations → More control, more setup
#Flutter #HeroWidget #Animations #FlutterTips #MoustaCore
✅ Flutter Tips: TextField Mastery
🖊️ Want to make your Flutter forms smarter and cleaner?
Meet TextField – the essential widget for user input.
Let’s boost it with best practices 🚀
🔥 Use Case:
Login forms
Feedback input
Search bars
🧪 Tips:
dart
TextField(
controller: myController,
decoration: InputDecoration(
labelText: 'Email',
hintText: 'Enter your email',
prefixIcon: Icon(Icons.email),
),
keyboardType: TextInputType.emailAddress,
)
💡 Best Practices:
✅ Always use a TextEditingController
✅ Add decoration to improve UX
✅ Use the right keyboardType
❌ Don’t ignore validation logic!
⚖️ Quick Compare:
TextField → Basic input
TextFormField → With validation built-in
#Flutter #TextField #FlutterTips #Forms #MoustaCore
🖊️ Want to make your Flutter forms smarter and cleaner?
Meet TextField – the essential widget for user input.
Let’s boost it with best practices 🚀
🔥 Use Case:
Login forms
Feedback input
Search bars
🧪 Tips:
dart
TextField(
controller: myController,
decoration: InputDecoration(
labelText: 'Email',
hintText: 'Enter your email',
prefixIcon: Icon(Icons.email),
),
keyboardType: TextInputType.emailAddress,
)
💡 Best Practices:
✅ Always use a TextEditingController
✅ Add decoration to improve UX
✅ Use the right keyboardType
❌ Don’t ignore validation logic!
⚖️ Quick Compare:
TextField → Basic input
TextFormField → With validation built-in
#Flutter #TextField #FlutterTips #Forms #MoustaCore
منشور اليوم 🎯
✅ Flutter Fix: "setState called after dispose" Error
🤯 المشكلة:
هل واجهت هذا الخطأ؟
setState() called after dispose()
يحدث عندما تحاول تحديث الواجهة (UI) بعد أن يتم إزالة الـ Widget من الشجرة!
🔥 أكثر سيناريو شائع:
استدعاء setState داخل Future أو Timer بعد مغادرة الشاشة.
🧪 مثال خاطئ:
dart
@override
void initState() {
super.initState();
Future.delayed(Duration(seconds: 3), () {
setState(() {
// تحديث الحالة
💡 الحل:
✅ تحقق من أن الـ widget ما زال مركبًا (mounted) قبل استخدام setState.
🛠️ مثال صحيح:
dart
Future.delayed(Duration(seconds: 3), () {
if (mounted) {
setState(() {
// تحديث آمن
⚠️ تذكير:
mounted = true فقط إذا كانت الواجهة ما زالت جزءًا من التطبيق.
#Flutter #FlutterTips #FlutterDev #MoustaCore #ErrorFix
✅ Flutter Fix: "setState called after dispose" Error
🤯 المشكلة:
هل واجهت هذا الخطأ؟
setState() called after dispose()
يحدث عندما تحاول تحديث الواجهة (UI) بعد أن يتم إزالة الـ Widget من الشجرة!
🔥 أكثر سيناريو شائع:
استدعاء setState داخل Future أو Timer بعد مغادرة الشاشة.
🧪 مثال خاطئ:
dart
@override
void initState() {
super.initState();
Future.delayed(Duration(seconds: 3), () {
setState(() {
// تحديث الحالة
💡 الحل:
✅ تحقق من أن الـ widget ما زال مركبًا (mounted) قبل استخدام setState.
🛠️ مثال صحيح:
dart
Future.delayed(Duration(seconds: 3), () {
if (mounted) {
setState(() {
// تحديث آمن
⚠️ تذكير:
mounted = true فقط إذا كانت الواجهة ما زالت جزءًا من التطبيق.
#Flutter #FlutterTips #FlutterDev #MoustaCore #ErrorFix
✅ Flutter Dev Tip: هل واجهت مشكلة Overflow في Widgets؟
🧨 واحدة من أكثر المشاكل إزعاجًا في Flutter هي:
"Bottom Overflowed by XX pixels"
وتظهر غالبًا عند ظهور الكيبورد!
لكن لا تقلق، الحل بسيط واحترافي 👇
🛠️ الحل السريع:
استخدم هذا السطر داخل Scaffold:
dart
resizeToAvoidBottomInset: true,
وإذا كنت تريد تحكمًا أدق:
dart
SingleChildScrollView(
child: Column(
children: [
// محتواك هنا
💡 نصيحة إضافية:
استخدم MediaQuery.of(context).viewInsets.bottom للحصول على حجم الكيبورد وتعديل واجهتك بناءً عليه.
🧠 سؤال اليوم:
ما أكثر مشكلة UI أزعجتك أثناء استخدام Flutter؟ شاركنا تجربتك بالتعليقات! 👇
#FlutterTips #FlutterUI #MoustaCore #FlutterDev #BugFix #Overflow #UX
🧨 واحدة من أكثر المشاكل إزعاجًا في Flutter هي:
"Bottom Overflowed by XX pixels"
وتظهر غالبًا عند ظهور الكيبورد!
لكن لا تقلق، الحل بسيط واحترافي 👇
🛠️ الحل السريع:
استخدم هذا السطر داخل Scaffold:
dart
resizeToAvoidBottomInset: true,
وإذا كنت تريد تحكمًا أدق:
dart
SingleChildScrollView(
child: Column(
children: [
// محتواك هنا
💡 نصيحة إضافية:
استخدم MediaQuery.of(context).viewInsets.bottom للحصول على حجم الكيبورد وتعديل واجهتك بناءً عليه.
🧠 سؤال اليوم:
ما أكثر مشكلة UI أزعجتك أثناء استخدام Flutter؟ شاركنا تجربتك بالتعليقات! 👇
#FlutterTips #FlutterUI #MoustaCore #FlutterDev #BugFix #Overflow #UX
✅ Flutter Tips: Mastering ListView
📜 Need to display a scrollable list in Flutter?
Meet ListView — the go-to widget for lists of any kind. Let’s level it up 🚀
🔥 Use Case:
Chat messages
Product lists
News feeds
➡️ Example:
ListView.builder(
itemCount: items.length,
itemBuilder: (context, index) {
return ListTile(
title: Text(items[index]),
);
},
)
💡 Best Practices:
✅ Use ListView.builder for large lists to save memory
✅ Keep items lightweight for smooth scrolling
✅ Combine with SeparatorBuilder for cleaner UI
❌ Avoid building all widgets at once for big lists
⚖️ Quick Compare:
ListView → Simple, static lists
ListView.builder → Efficient for dynamic/large lists
#Flutter #ListView #FlutterTips #MoustaCore
📜 Need to display a scrollable list in Flutter?
Meet ListView — the go-to widget for lists of any kind. Let’s level it up 🚀
🔥 Use Case:
Chat messages
Product lists
News feeds
➡️ Example:
ListView.builder(
itemCount: items.length,
itemBuilder: (context, index) {
return ListTile(
title: Text(items[index]),
);
},
)
💡 Best Practices:
✅ Use ListView.builder for large lists to save memory
✅ Keep items lightweight for smooth scrolling
✅ Combine with SeparatorBuilder for cleaner UI
❌ Avoid building all widgets at once for big lists
⚖️ Quick Compare:
ListView → Simple, static lists
ListView.builder → Efficient for dynamic/large lists
#Flutter #ListView #FlutterTips #MoustaCore