Nascleanúint i Flutter a bhogann tú idir scáileáin (leathanaigh/bealaí) — ag úsáid an Navigator (stoca de bhrealaí) don nascleanúint bhunúsach, nó pacáistí beartaithe do thairbhí níos casta. Tá tuiscint ar nascleanúint riachtanach chun feidhmchláir ilscáileáin a thógáil.
Nascleanúint bhunúsach le Navigator (stoca)
// the Navigator manages a STACK of routes (screens)
// PUSH a new screen onto the stack (navigate to it)
Navigator.push(
context,
MaterialPageRoute(builder: (context) => SecondScreen()),
);
// POP — go back (remove the top screen, return to the previous)
Navigator.pop(context);
Think of navigation as a STACK of screens:
→ PUSH adds a screen on top (navigate forward)
→ POP removes the top screen (go back)
→ the back button / gesture also pops
