{"id":32463,"date":"2024-11-01T09:09:10","date_gmt":"2024-11-01T09:09:10","guid":{"rendered":"http:\/\/atmokpo.com\/w\/?p=32463"},"modified":"2024-11-01T11:55:11","modified_gmt":"2024-11-01T11:55:11","slug":"flutter-course-10-2-route-and-screen-navigation","status":"publish","type":"post","link":"https:\/\/atmokpo.com\/w\/32463\/","title":{"rendered":"Flutter Course, 10.2 Route and Screen Navigation"},"content":{"rendered":"<p><body><\/p>\n<p>In this course, we will delve deeply into how to handle navigation between screens in Flutter and the concept of routes. Screen transitions are one of the essential features of mobile applications, providing users with a smooth experience. Therefore, it is crucial to understand how to use routes and navigation well.<\/p>\n<h2>1. What is a Route?<\/h2>\n<p>A route refers to the concept that signifies each screen of a mobile app. Flutter provides two types of routes: basic routes and named routes. Basic routes point to specific widgets, while named routes identify specific routes using strings.<\/p>\n<h2>2. Flutter&#8217;s Navigation Structure<\/h2>\n<p>Flutter&#8217;s navigation structure primarily uses a stack structure. Each time a user navigates to a new screen, the previous screen is added to the stack, and the new screen occupies the top position. When the user presses the back button, the top screen is removed, and the user returns to the previous screen.<\/p>\n<h3>2.1 Navigator Widget<\/h3>\n<p>The Navigator is a widget that manages routes, allowing multiple routes to be stacked and managed. This enables the implementation of various screen transition animations and effects.<\/p>\n<h2>3. Transitioning Screens Using Routes<\/h2>\n<p>There are two main ways to transition between screens using routes. The first is by using <code>Navigator.push()<\/code>, and the second is by using <code>Navigator.pushNamed()<\/code>.<\/p>\n<h3>3.1 Navigator.push()<\/h3>\n<p>The <code>Navigator.push()<\/code> method adds a new screen to the current screen. Here\u2019s how to use this method to transition to a new screen.<\/p>\n<pre><code>Navigator.push(context, MaterialPageRoute(builder: (context) =&gt; NewScreen()));<\/code><\/pre>\n<h3>3.2 Navigator.pushNamed()<\/h3>\n<p>Using named routes has the advantage of making the code more concise. To use named routes, you must first define the routes in the <code>routes<\/code> property of <code>MaterialApp<\/code>.<\/p>\n<pre><code>\nMaterialApp(\n    routes: {\n        '\/': (context) =&gt; HomeScreen(),\n        '\/new': (context) =&gt; NewScreen(),\n    },\n);\n<\/code><\/pre>\n<p>After this, transitioning between screens can be done as follows.<\/p>\n<pre><code>Navigator.pushNamed(context, '\/new');<\/code><\/pre>\n<h2>4. Screen Transition Animations<\/h2>\n<p>Flutter allows you to apply various animations during screen transitions. You can customize it using <code>PageRouteBuilder<\/code>. By using this method, you can finely tune the start and end of the transition animation and the widget during the transition.<\/p>\n<pre><code>\nNavigator.push(context, PageRouteBuilder(\n    pageBuilder: (context, animation, secondaryAnimation) =&gt; NewScreen(),\n    transitionsBuilder: (context, animation, secondaryAnimation, child) {\n        const begin = Offset(1.0, 0.0);\n        const end = Offset.zero;\n        const curve = Curves.easeInOut;\n\n        var tween = Tween(begin: begin, end: end).chain(CurveTween(curve: curve));\n        var offsetAnimation = animation.drive(tween);\n\n        return SlideTransition(\n            position: offsetAnimation,\n            child: child,\n        );\n    },\n));\n<\/code><\/pre>\n<h2>5. Passing Data Between Screens Using Routes<\/h2>\n<p>It is possible to pass data between screens through routes. To pass data to a new screen, you should provide the data as a parameter to the widget&#8217;s constructor when creating it.<\/p>\n<pre><code>\nclass NewScreen extends StatelessWidget {\n    final String data;\n\n    NewScreen(this.data);\n\n    @override\n    Widget build(BuildContext context) {\n        return Scaffold(\n            appBar: AppBar(title: Text(\"New Screen\")),\n            body: Center(child: Text(data)),\n        );\n    }\n}\n<\/code><\/pre>\n<p>Data can be passed as follows:<\/p>\n<pre><code>Navigator.push(context, MaterialPageRoute(builder: (context) =&gt; NewScreen(\"Hello, Flutter!\")));<\/code><\/pre>\n<h2>6. Returning Results Through Routes<\/h2>\n<p>After transitioning screens, you can return results to the previous screen. This allows you to take user input and act according to the result. The <code>Navigator.pop()<\/code> method can be used for this purpose.<\/p>\n<pre><code>Navigator.pop(context, \"Returned Data\");<\/code><\/pre>\n<h2>7. Conclusion<\/h2>\n<p>In this course, we covered routes and screen navigation in Flutter. Using routes is essential for effectively managing transitions between screens and improving user experience. You can navigate screens in various ways and exchange data, so actively implement this in your actual app development.<\/p>\n<p>I hope this article helps you in your Flutter learning, and in the next course, we will discuss state management in Flutter. Thank you!<\/p>\n<p><\/body><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this course, we will delve deeply into how to handle navigation between screens in Flutter and the concept of routes. Screen transitions are one of the essential features of mobile applications, providing users with a smooth experience. Therefore, it is crucial to understand how to use routes and navigation well. 1. What is a &hellip; <a href=\"https:\/\/atmokpo.com\/w\/32463\/\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;Flutter Course, 10.2 Route and Screen Navigation&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[151],"tags":[],"class_list":["post-32463","post","type-post","status-publish","format-standard","hentry","category-flutter-course"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Flutter Course, 10.2 Route and Screen Navigation - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/atmokpo.com\/w\/32463\/\" \/>\n<meta property=\"og:locale\" content=\"ko_KR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Flutter Course, 10.2 Route and Screen Navigation - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"og:description\" content=\"In this course, we will delve deeply into how to handle navigation between screens in Flutter and the concept of routes. Screen transitions are one of the essential features of mobile applications, providing users with a smooth experience. Therefore, it is crucial to understand how to use routes and navigation well. 1. What is a &hellip; \ub354 \ubcf4\uae30 &quot;Flutter Course, 10.2 Route and Screen Navigation&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/atmokpo.com\/w\/32463\/\" \/>\n<meta property=\"og:site_name\" content=\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"article:published_time\" content=\"2024-11-01T09:09:10+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-11-01T11:55:11+00:00\" \/>\n<meta name=\"author\" content=\"root\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@bebubo4\" \/>\n<meta name=\"twitter:site\" content=\"@bebubo4\" \/>\n<meta name=\"twitter:label1\" content=\"\uae00\uc4f4\uc774\" \/>\n\t<meta name=\"twitter:data1\" content=\"root\" \/>\n\t<meta name=\"twitter:label2\" content=\"\uc608\uc0c1 \ub418\ub294 \ud310\ub3c5 \uc2dc\uac04\" \/>\n\t<meta name=\"twitter:data2\" content=\"3\ubd84\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/atmokpo.com\/w\/32463\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/32463\/\"},\"author\":{\"name\":\"root\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7\"},\"headline\":\"Flutter Course, 10.2 Route and Screen Navigation\",\"datePublished\":\"2024-11-01T09:09:10+00:00\",\"dateModified\":\"2024-11-01T11:55:11+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/atmokpo.com\/w\/32463\/\"},\"wordCount\":466,\"publisher\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\"},\"articleSection\":[\"Flutter course\"],\"inLanguage\":\"ko-KR\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/atmokpo.com\/w\/32463\/\",\"url\":\"https:\/\/atmokpo.com\/w\/32463\/\",\"name\":\"Flutter Course, 10.2 Route and Screen Navigation - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#website\"},\"datePublished\":\"2024-11-01T09:09:10+00:00\",\"dateModified\":\"2024-11-01T11:55:11+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/atmokpo.com\/w\/32463\/#breadcrumb\"},\"inLanguage\":\"ko-KR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/atmokpo.com\/w\/32463\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/atmokpo.com\/w\/32463\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\ud648\",\"item\":\"https:\/\/atmokpo.com\/w\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Flutter Course, 10.2 Route and Screen Navigation\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/atmokpo.com\/w\/#website\",\"url\":\"https:\/\/atmokpo.com\/w\/\",\"name\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/atmokpo.com\/w\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"ko-KR\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\",\"name\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"url\":\"https:\/\/atmokpo.com\/w\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png\",\"contentUrl\":\"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png\",\"width\":400,\"height\":400,\"caption\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\"},\"image\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/bebubo4\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7\",\"name\":\"root\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g\",\"caption\":\"root\"},\"sameAs\":[\"http:\/\/atmokpo.com\/w\"],\"url\":\"https:\/\/atmokpo.com\/w\/author\/root\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Flutter Course, 10.2 Route and Screen Navigation - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/atmokpo.com\/w\/32463\/","og_locale":"ko_KR","og_type":"article","og_title":"Flutter Course, 10.2 Route and Screen Navigation - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","og_description":"In this course, we will delve deeply into how to handle navigation between screens in Flutter and the concept of routes. Screen transitions are one of the essential features of mobile applications, providing users with a smooth experience. Therefore, it is crucial to understand how to use routes and navigation well. 1. What is a &hellip; \ub354 \ubcf4\uae30 \"Flutter Course, 10.2 Route and Screen Navigation\"","og_url":"https:\/\/atmokpo.com\/w\/32463\/","og_site_name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","article_published_time":"2024-11-01T09:09:10+00:00","article_modified_time":"2024-11-01T11:55:11+00:00","author":"root","twitter_card":"summary_large_image","twitter_creator":"@bebubo4","twitter_site":"@bebubo4","twitter_misc":{"\uae00\uc4f4\uc774":"root","\uc608\uc0c1 \ub418\ub294 \ud310\ub3c5 \uc2dc\uac04":"3\ubd84"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/atmokpo.com\/w\/32463\/#article","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/32463\/"},"author":{"name":"root","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7"},"headline":"Flutter Course, 10.2 Route and Screen Navigation","datePublished":"2024-11-01T09:09:10+00:00","dateModified":"2024-11-01T11:55:11+00:00","mainEntityOfPage":{"@id":"https:\/\/atmokpo.com\/w\/32463\/"},"wordCount":466,"publisher":{"@id":"https:\/\/atmokpo.com\/w\/#organization"},"articleSection":["Flutter course"],"inLanguage":"ko-KR"},{"@type":"WebPage","@id":"https:\/\/atmokpo.com\/w\/32463\/","url":"https:\/\/atmokpo.com\/w\/32463\/","name":"Flutter Course, 10.2 Route and Screen Navigation - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/#website"},"datePublished":"2024-11-01T09:09:10+00:00","dateModified":"2024-11-01T11:55:11+00:00","breadcrumb":{"@id":"https:\/\/atmokpo.com\/w\/32463\/#breadcrumb"},"inLanguage":"ko-KR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/atmokpo.com\/w\/32463\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/atmokpo.com\/w\/32463\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\ud648","item":"https:\/\/atmokpo.com\/w\/en\/"},{"@type":"ListItem","position":2,"name":"Flutter Course, 10.2 Route and Screen Navigation"}]},{"@type":"WebSite","@id":"https:\/\/atmokpo.com\/w\/#website","url":"https:\/\/atmokpo.com\/w\/","name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","description":"","publisher":{"@id":"https:\/\/atmokpo.com\/w\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/atmokpo.com\/w\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"ko-KR"},{"@type":"Organization","@id":"https:\/\/atmokpo.com\/w\/#organization","name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","url":"https:\/\/atmokpo.com\/w\/","logo":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/","url":"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png","contentUrl":"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png","width":400,"height":400,"caption":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8"},"image":{"@id":"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/bebubo4"]},{"@type":"Person","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7","name":"root","image":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g","caption":"root"},"sameAs":["http:\/\/atmokpo.com\/w"],"url":"https:\/\/atmokpo.com\/w\/author\/root\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/32463","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/comments?post=32463"}],"version-history":[{"count":1,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/32463\/revisions"}],"predecessor-version":[{"id":32464,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/32463\/revisions\/32464"}],"wp:attachment":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/media?parent=32463"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/categories?post=32463"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/tags?post=32463"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}