التنقل بين الشاشات المشتركة
ربط رسم بياني للتنقل في Compose Multiplatform
التنقل بين الشاشات المشتركة درس مجاني في Kotlin Multiplatform Academy على CoddyKit. هذا هو الدرس 1 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في Kotlin Multiplatform Academy، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة Kotlin Multiplatform Academy 4 دروس في المجموع.
بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.
More Than One Screen
Real apps have many screens: a list, a detail, a settings page. Navigation is how you move between them in shared Compose code. 🧭
One Graph for Every Platform
You define a single navigation graph in commonMain, and Android, iOS and desktop all follow the same route map.
Add the Navigation Library
Compose Multiplatform ships its own navigation-compose artifact. Add it to commonMain and the routing toolkit comes with it.
commonMain.dependencies {
implementation(libs.navigation.compose)
}Screens Are Just Routes
Each destination is identified by a route string. Think of it like a tiny address for one screen in your app.
Create the NavController
A NavController remembers where you are and lets you move around. You create one and hand it to your graph.
val navController = rememberNavController()Declare the NavHost
The NavHost hosts your screens and shows whichever route is current. You give it a controller and a start destination.
NavHost(navController, startDestination = "home") {
composable("home") { HomeScreen() }
composable("details") { DetailsScreen() }
}Pick a Start Destination
The startDestination is the first screen users see. It is just one of your route strings, chosen as the entry point.
Navigate Forward
To open another screen you call navigate with its route. The NavHost swaps in that destination for you.
Button(onClick = { navController.navigate("details") }) {
Text("Open details")
}Go Back Cleanly
Calling popBackStack returns to the previous screen. Compose tracks the history so back behaves the way users expect.
navController.popBackStack()The Back Stack
Every screen you open is pushed onto a back stack. Going back pops the top entry, just like a stack of cards.
Shared Routing, Native Hosting
The graph is shared, but each platform still hosts it in its own entry point. One route map, two native containers. 🙂
Quick Check
Which component actually performs the move from one screen to another?
Recap: A Shared Map of Screens
You added navigation, built a NavHost with routes, and used the NavController to move forward and back. One graph, every platform. 🚀
الأسئلة الشائعة
هل درس «التنقل بين الشاشات المشتركة» مجاني؟
نعم — نص درس «التنقل بين الشاشات المشتركة» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة Kotlin Multiplatform Academy، انتقل إلى CoddyKit PRO. تتضمن دورة Kotlin Multiplatform Academy 4 دروس في المجموع.
ماذا ستتعلم في «التنقل بين الشاشات المشتركة»؟
ربط رسم بياني للتنقل في Compose Multiplatform تتمرن على Kotlin Multiplatform Academy مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.
هل أحتاج إلى خبرة سابقة لأبدأ Kotlin Multiplatform Academy؟
لا تُشترط خبرة سابقة. Kotlin Multiplatform Academy على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 1 من أصل 4.
كم من الوقت يستغرق درس «التنقل بين الشاشات المشتركة»؟
معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.
هل يمكنني كتابة وتشغيل أكواد في درس Kotlin Multiplatform Academy هذا؟
نعم. كل درس في Kotlin Multiplatform Academy يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.
جميع الدروس في هذه الدورة
- التنقل بين الشاشات المشتركة
- تمرير المعاملات والروابط العميقة
- الصور والخطوط والسلاسل المشتركة
- توطين نصوص الواجهة المشتركة