{"id":365754,"date":"2024-05-21T02:44:44","date_gmt":"2024-05-21T02:44:44","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=365754"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2024-05-21T02:44:44","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=365754","title":{"rendered":"<span>\u041f\u043e\u043b\u043d\u043e\u0435 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u043f\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044e \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0435\u0439 \u0432\u043e Flutter \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0430\u043a\u0435\u0442\u0430 go_router: \u0447\u0430\u0441\u0442\u044c 1<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! \u041c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u042e\u0440\u0438\u0439 \u041f\u0435\u0442\u0440\u043e\u0432, \u044f \u0430\u0432\u0442\u043e\u0440 <a href=\"https:\/\/www.youtube.com\/@mr.developer\"><u>\u044e\u0442\u0443\u0431-\u043a\u0430\u043d\u0430\u043b\u0430 \u00ab\u041c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u00bb<\/u><\/a> \u0438 Flutter Team Lead <a href=\"https:\/\/friflex.com\/\"><u>\u0432 Friflex<\/u><\/a>. \u041c\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0431\u0438\u0437\u043d\u0435\u0441\u0430 \u0438 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c\u0441\u044f \u043d\u0430 Flutter.\u00a0<\/p>\n<p>\u0412 \u044d\u0442\u043e\u043c \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0435 \u044f \u0445\u043e\u0447\u0443 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0440\u043e \u043f\u0430\u043a\u0435\u0442 <a href=\"https:\/\/pub.dev\/packages\/go_router\">go_router<\/a>. \u041e\u043d \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0435\u0439 \u0432\u043e Flutter. \u041a\u043e\u043c\u0430\u043d\u0434\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 Flutter \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u0430\u043a\u0435\u0442. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u0434\u0435\u044f\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u043f\u0430\u043a\u0435\u0442 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442 \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u0442\u044c\u0441\u044f.<\/p>\n<p>\u0420\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0431\u0443\u0434\u0443 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u2014 Todo (\u0437\u0430\u043c\u0435\u0442\u043a\u0438). \u042f \u043f\u043e\u043d\u0438\u043c\u0430\u044e, \u0447\u0442\u043e \u0442\u0430\u043a\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u043d\u0430 \u0425\u0430\u0431\u0440\u0435 \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e. \u041d\u043e, \u043f\u043e-\u043c\u043e\u0435\u043c\u0443, \u043b\u0443\u0447\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043d\u0435 \u043d\u0430\u0439\u0442\u0438.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/2e3\/ede\/35b\/2e3ede35b9a049af83c37224e9a50536.jpg\" width=\"1958\" height=\"1103\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/2e3\/ede\/35b\/2e3ede35b9a049af83c37224e9a50536.jpg\" data-blurred=\"true\"\/><\/figure>\n<h2>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442 \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443<\/h2>\n<p>\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u0443\u043c\u0430\u0432, \u044f \u0440\u0435\u0448\u0438\u043b, \u0447\u0442\u043e \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0448\u0435\u0441\u0442\u044c \u044d\u043a\u0440\u0430\u043d\u043e\u0432.<\/p>\n<ol>\n<li>\n<p>\u042d\u043a\u0440\u0430\u043d \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f <code>AuthScreen<\/code>. \u0411\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0435\u0439\u043a\u043e\u0432\u0443\u044e \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e.<\/p>\n<\/li>\n<li>\n<p>\u042d\u043a\u0440\u0430\u043d \u0441\u043e \u0441\u043f\u0438\u0441\u043a\u043e\u043c \u0437\u0430\u043c\u0435\u0442\u043e\u043a \u2014 <code>NotesScreen<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u042d\u043a\u0440\u0430\u043d \u0441 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439 \u0437\u0430\u043c\u0435\u0442\u043e\u043a \u2014 <code>DetailNoteScreen<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u042d\u043a\u0440\u0430\u043d \u0441 \u043b\u044e\u0431\u0438\u043c\u044b\u043c\u0438 \u0437\u0430\u043c\u0435\u0442\u043a\u0430\u043c\u0438 \u2014 <code>FavoriteNotesScreen<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u042d\u043a\u0440\u0430\u043d \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0437\u0430\u043c\u0435\u0442\u043e\u043a \u2014 <code>CreateNoteScreen<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u042d\u043a\u0440\u0430\u043d \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0444\u0438\u043b\u0435\u043c \u2014 <code>ProfileScreen<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u042d\u043a\u0440\u0430\u043d \u0434\u043b\u044f \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u0440\u0443\u0442\u043e\u0432\u043e\u0433\u043e \u044d\u043a\u0440\u0430\u043d\u0430 \u0441 \u043d\u0438\u0436\u043d\u0435\u0439 \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u043f\u0430\u043d\u0435\u043b\u044c\u044e \u2014 <code>RootScreen<\/code>.<\/p>\n<\/li>\n<\/ol>\n<p>\u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0447\u0435\u0442\u044b\u0440\u0435 \u043f\u0430\u043f\u043a\u0438 \u0432 \u043f\u0430\u043f\u043a\u0435 features. \u0412 \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0437 \u043d\u0438\u0445 \u2014 \u044d\u043a\u0440\u0430\u043d\u044b. \u0412 \u043a\u0430\u0436\u0434\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043e\u0434\u043d\u043e\u0438\u043c\u0435\u043d\u043d\u044b\u0439 StatelessWidget.<\/p>\n<figure class=\"bordered\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/6a6\/5fd\/64e\/6a65fd64e3b425f7e621199725046574.png\" width=\"471\" height=\"442\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/6a6\/5fd\/64e\/6a65fd64e3b425f7e621199725046574.png\"\/><\/figure>\n<h3>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0438\u0436\u043d\u0435\u0439 \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u043f\u0430\u043d\u0435\u043b\u0438 &#8212; BottomNavigationBar<\/h3>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0430\u043f\u043a\u0443 <strong>routing<\/strong>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0435\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043a\u0430\u0440\u0442\u0443 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432. \u0414\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u0438\u0436\u043d\u0435\u0439 \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u043f\u0430\u043d\u0435\u043b\u0438 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0430\u0440\u0448\u0440\u0443\u0442 <a href=\"https:\/\/pub.dev\/documentation\/go_router\/latest\/go_router\/StatefulShellRoute-class.html\"><u>StatefulShellRoute<\/u><\/a>. \u042d\u0442\u043e\u0442 \u043c\u0430\u0440\u0448\u0440\u0443\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0441 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u043d\u0430\u0432\u0438\u0433\u0430\u0442\u043e\u0440\u0430\u043c\u0438 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0435\u0433\u043e \u043f\u043e\u0434 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432. \u041e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043a\u0430\u043a <a href=\"https:\/\/pub.dev\/documentation\/go_router\/latest\/go_router\/ShellRoute-class.html\"><u>ShellRoute<\/u><\/a>, \u043d\u043e \u0441 \u043e\u0434\u043d\u0438\u043c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c. \u041e\u043d \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u043d\u0430\u0432\u0438\u0433\u0430\u0442\u043e\u0440\u044b \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0437 \u0441\u0432\u043e\u0438\u0445 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0432\u0435\u0442\u0432\u0435\u0439, \u0442\u043e \u0435\u0441\u0442\u044c, \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0445 \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432 \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438. <\/p>\n<p>\u0421 <code>StatefulShellRoute<\/code> \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0439 \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438. \u042d\u0442\u043e \u0443\u0434\u043e\u0431\u043d\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0441 <code>BottomNavigationBar<\/code>, \u0433\u0434\u0435 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0432\u043a\u043b\u0430\u0434\u043a\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u0441\u0432\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438. <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c <code>StatefulShellRoute<\/code>, \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 <code>StatefulShellBranch<\/code>. \u041a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043d\u0438\u0445 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0443\u044e \u0432\u0435\u0442\u043a\u0443 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430 \u0441 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f.\u00a0<\/p>\n<p><code>StatefulShellBranch<\/code> \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043a\u043e\u0440\u043d\u0435\u0432\u044b\u0435 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u044b \u0438 \u043a\u043b\u044e\u0447 \u043d\u0430\u0432\u0438\u0433\u0430\u0442\u043e\u0440\u0430 (<code>GlobalKey<\/code>) \u0434\u043b\u044f \u0432\u0435\u0442\u043a\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435. \u041a\u0430\u043a \u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 <code>ShellRoute<\/code>, \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 <code>StatefulShellRoute<\/code> \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043b\u0438\u0431\u043e <code>builder<\/code>, \u043b\u0438\u0431\u043e <code>pageBuilder<\/code>.\u00a0<\/p>\n<p>\u042d\u0442\u0438 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u044b \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f \u0442\u0435\u043c, \u0447\u0442\u043e \u043e\u043d\u0438 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <code>StatefulNavigationShell<\/code> \u0432\u043c\u0435\u0441\u0442\u043e \u0434\u043e\u0447\u0435\u0440\u043d\u0435\u0433\u043e \u0432\u0438\u0434\u0436\u0435\u0442\u0430. <code>StatefulNavigationShell<\/code> \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430 \u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0430\u043a\u0442\u0438\u0432\u043d\u0443\u044e \u0432\u0435\u0442\u043a\u0443. \u0422\u043e \u0435\u0441\u0442\u044c, \u0434\u043b\u044f \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0442\u0435\u043a\u0430 \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438 \u0434\u0440\u0443\u0433\u043e\u0439 \u0432\u0435\u0442\u043a\u0438. \u042d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430 <code>StatefulNavigationShell.goBranch<\/code>.<\/p>\n<details class=\"spoiler\">\n<summary>routing\/app_routing.dart<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"dart\">final router = GoRouter(   initialLocation: '\/notes',   routes: [     \/\/ BottomNavigationBar     StatefulShellRoute.indexedStack(       builder: (context, state, navigationShell) =>           RootScreen(navigationShell: navigationShell),       branches: [         StatefulShellBranch(           routes: [             GoRoute(               path: '\/notes',               builder: (context, state) => const NotesScreen(),             ),           ],         ),         StatefulShellBranch(           routes: [             GoRoute(               path: '\/favorites',               builder: (context, state) => const FavoritesScreen(),             ),           ],         ),         StatefulShellBranch(           routes: [             GoRoute(               path: '\/profile',               builder: (context, state) => const ProfileScreen(),             ),           ],         ),       ],     ),   ], );<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u041e\u0431\u044a\u044f\u0432\u043b\u044f\u0435\u043c \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0439 <code>router<\/code>. \u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c <code>StatefulShellRoute<\/code> \u0441 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u043e\u043c <code>indexedStack<\/code>. \u0412 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0435 <code>builder<\/code> \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c <code>RootScreen<\/code> \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0432 \u043d\u0435\u0433\u043e <code>navigationShell<\/code>. \u0410 \u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0435 <code>branches<\/code> \u2014 <code>StatefulShellBranch<\/code> \u0441 \u043d\u0443\u0436\u043d\u044b\u043c\u0438 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430\u043c\u0438.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u043e\u043d\u043d\u0443\u044e \u043f\u0430\u043d\u0435\u043b\u044c \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435 <code>RootScreen<\/code>. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 <code>navigationShell<\/code>. \u0418\u0437 \u043d\u0435\u0433\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u0438 \u043c\u0430\u0440\u0448\u0440\u0443\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u043a\u0430\u0437\u0430\u043d \u0432 \u0432\u0435\u0442\u0432\u0438 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430.<\/p>\n<details class=\"spoiler\">\n<summary>root_screen.dart<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"dart\">class RootScreen extends StatelessWidget {   const RootScreen({super.key, required this.navigationShell});    \/\/\/ \u041a\u043e\u043d\u0442\u0435\u0438\u0306\u043d\u0435\u0440 \u0434\u043b\u044f \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0431\u0430\u0440\u0430.   final StatefulNavigationShell navigationShell;    @override   Widget build(BuildContext context) {     return Scaffold(       body: navigationShell,       bottomNavigationBar: BottomNavigationBar(         \/\/\/ \u041b\u0438\u0441\u0442 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u043b\u044f \u043d\u0438\u0436\u043d\u0435\u0433\u043e \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0431\u0430\u0440\u0430.         items: _buildBottomNavBarItems,         \/\/\/ \u0422\u0435\u043a\u0443\u0449\u0438\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u043d\u0438\u0436\u043d\u0435\u0433\u043e \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0431\u0430\u0440\u0430.         currentIndex: navigationShell.currentIndex,         \/\/\/ \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043d\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043d\u0438\u0436\u043d\u0435\u0433\u043e \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0431\u0430\u0440\u0430.         onTap: (index) => navigationShell.goBranch(           index,           initialLocation: index == navigationShell.currentIndex,         ),       ),     );   }    \/\/ \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043b\u0438\u0441\u0442 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u043b\u044f \u043d\u0438\u0436\u043d\u0435\u0433\u043e \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0431\u0430\u0440\u0430.   List&lt;BottomNavigationBarItem> get _buildBottomNavBarItems => [         const BottomNavigationBarItem(           icon: Icon(Icons.note),           label: '\u0417\u0430\u043c\u0435\u0442\u043a\u0438',         ),         const BottomNavigationBarItem(           icon: Icon(Icons.favorite),           label: '\u041b\u044e\u0431\u0438\u043c\u044b\u0435',         ),         const BottomNavigationBarItem(           icon: Icon(Icons.person),           label: '\u041f\u0440\u043e\u0444\u0438\u043b\u044c',         ),        ]; }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0414\u0430\u043b\u044c\u0448\u0435 \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 main.dart \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0440\u043e\u0443\u0442\u0435\u0440\u0430:<\/p>\n<details class=\"spoiler\">\n<summary>main.dart<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"dart\">void main() {   runApp(const AppTodo()); }  class AppTodo extends StatelessWidget {   const AppTodo({super.key});    @override   Widget build(BuildContext context) {     return MaterialApp.router(       routerConfig: router,     );   } }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0440\u043e\u0443\u0442\u0435\u0440 \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0423 \u043d\u0435\u0433\u043e \u0435\u0441\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0443 \u0438 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u043f\u043e\u0438\u0441\u043a\u0430 \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u0430\u043b\u044c\u0448\u0435 \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f\u00a0\u043a \u043c\u0435\u0442\u043e\u0434\u0430\u043c \u0440\u043e\u0443\u0442\u0435\u0440\u0430 \u0431\u0443\u0434\u0435\u043c \u0447\u0435\u0440\u0435\u0437 <code>context<\/code>.<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c <code>MaterialApp<\/code>. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0432 \u043d\u0435\u043c <strong>go_router<\/strong> \u0432\u043c\u0435\u0441\u0442\u043e <code>Navigator<\/code>.<\/p>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u043c\u044b \u043d\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u0432\u0438\u0434\u0436\u0435\u0442. \u0422\u0435\u043f\u0435\u0440\u044c \u0432\u0441\u0435\u0439\u00a0\u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0435\u0439 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 <strong>go_router<\/strong>. \u041f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u043c\u0430\u0440\u0448\u0440\u0443\u0442 \u0441 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0439 \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0435\u0439.<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/65aa3d7e3eb8e176bf177b3d\" data-style=\"\" id=\"65aa3d7e3eb8e176bf177b3d\" width=\"\"><\/div>\n<p>\u041e\u0442\u043b\u0438\u0447\u043d\u043e! \u041d\u0430\u043c \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u044e \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u0437\u0430\u043c\u0435\u0442\u043a\u0435.<\/p>\n<h2>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438<\/h2>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 \u044d\u043a\u0440\u0430\u043d\u0435 <code>NotesScreen<\/code> \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043c\u043e\u043a\u043e\u0432\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0437\u0430\u043c\u0435\u0442\u043e\u043a \u0438 \u043d\u0430\u0440\u0438\u0441\u0443\u0435\u043c \u0438\u0445. \u041f\u043e \u043a\u043b\u0438\u043a\u0443 \u043c\u044b \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043d\u0430 \u044d\u043a\u0440\u0430\u043d \u0441 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439 \u043e \u0437\u0430\u043c\u0435\u0442\u043a\u0435. <\/p>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435! \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u044f \u043d\u0430 \u044d\u0442\u043e\u0442 \u044d\u043a\u0440\u0430\u043d, \u043c\u044b \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u043c\u0430\u0440\u0448\u0440\u0443\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432\u043d\u0443\u0442\u0440\u0438 \u043e\u0434\u043d\u043e\u0439 \u0432\u0435\u0442\u043a\u0438 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432.<\/p>\n<details class=\"spoiler\">\n<summary>notes_screen.dart<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"dart\">\/\/\/ \u041c\u043e\u043a\u043e\u0432\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0437\u0430\u043c\u0435\u0442\u043e\u043a const _notes = [   'Note 1',   'Note 2',   'Note 3',   'Note 4',   'Note 5',   'Note 6', ];  class NotesScreen extends StatelessWidget {   const NotesScreen({super.key});    @override   Widget build(BuildContext context) {     return Center(       child: ListView.separated(           itemBuilder: (context, index) {             return ListTile(               title: Text(_notes[index]),               onTap: () {                 \/\/ \u041f\u0440\u0438 \u043a\u043b\u0438\u043a\u0435 \u043d\u0430 \u0437\u0430\u043c\u0435\u0442\u043a\u0443 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043d\u0430 \u044d\u043a\u0440\u0430\u043d                 \/\/ \u0441 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439                  context.go('\/notes\/detail');               },             );           },           separatorBuilder: (context, index) {             return const Divider();           },           itemCount: _notes.length),     );   } }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u043c\u0430\u0440\u0448\u0440\u0443\u0442 \u0432 \u043a\u0430\u0440\u0442\u0443 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432 \u0432\u0435\u0442\u043a\u0438 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430 <code>\/notes<\/code>.<\/p>\n<pre><code class=\"dart\">  StatefulShellBranch(           routes: [             GoRoute(                 path: '\/notes',                 builder: (context, state) => const NotesScreen(),                 routes: [                   GoRoute(                     path: 'detail',                     builder: (context, state) => const DetailScreen(),                   ),                 ]),           ],         ),<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0444\u0430\u0439\u043b app_routing.dart \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<details class=\"spoiler\">\n<summary>app_routing.dart<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"dart\">final router = GoRouter(   initialLocation: '\/notes',   routes: [     \/\/ BottomNavigationBar     StatefulShellRoute.indexedStack(       builder: (context, state, navigationShell) =>           RootScreen(navigationShell: navigationShell),       branches: [         StatefulShellBranch(           routes: [             GoRoute(                 path: '\/notes',                 builder: (context, state) => const NotesScreen(),                 routes: [                   GoRoute(                     path: 'detail',                     builder: (context, state) => const DetailScreen(),                   ),                 ]),           ],         ),         StatefulShellBranch(           routes: [             GoRoute(               path: '\/favorites',               builder: (context, state) => const FavoritesScreen(),             ),           ],         ),         StatefulShellBranch(           routes: [             GoRoute(               path: '\/profile',               builder: (context, state) => const ProfileScreen(),             ),           ],         ),       ],     ),   ], );<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0442\u0430\u043a\u043e\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/65aa3e943add783089b4bc61\" data-style=\"\" id=\"65aa3e943add783089b4bc61\" width=\"\"><\/div>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u043d\u0430\u0447\u0430\u043b\u0438 \u0438\u0437\u0443\u0447\u0430\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 <strong>go_router<\/strong>. \u0421\u043e\u0437\u0434\u0430\u043b\u0438 \u043d\u0438\u0436\u043d\u044e\u044e \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u043e\u043d\u043d\u0443\u044e \u043f\u0430\u043d\u0435\u043b\u044c \u0438 \u043d\u0430\u0443\u0447\u0438\u043b\u0438\u0441\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0439 \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0435\u0439. \u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c, \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0434\u0438\u0440\u0435\u043a\u0442, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e, \u0430\u043d\u0438\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u044b.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0437 \u0441\u0442\u0430\u0442\u044c\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043f\u043e <a href=\"https:\/\/github.com\/petrovyuri\/go_router_lesson\/tree\/aed90b2ab457620c264e37f47c09fd89585d401d\"><u>\u0441\u0441\u044b\u043b\u043a\u0435<\/u><\/a>. <\/p>\n<p>\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u043d\u0430 <a href=\"https:\/\/pub.dev\/documentation\/go_router\/latest\/topics\/Get%20started-topic.html\"><u>\u0441\u0430\u0439\u0442\u0435<\/u><\/a>.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/787528\/\"> https:\/\/habr.com\/ru\/articles\/787528\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! \u041c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u042e\u0440\u0438\u0439 \u041f\u0435\u0442\u0440\u043e\u0432, \u044f \u0430\u0432\u0442\u043e\u0440 <a href=\"https:\/\/www.youtube.com\/@mr.developer\"><u>\u044e\u0442\u0443\u0431-\u043a\u0430\u043d\u0430\u043b\u0430 \u00ab\u041c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u00bb<\/u><\/a> \u0438 Flutter Team Lead <a href=\"https:\/\/friflex.com\/\"><u>\u0432 Friflex<\/u><\/a>. \u041c\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0431\u0438\u0437\u043d\u0435\u0441\u0430 \u0438 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c\u0441\u044f \u043d\u0430 Flutter.\u00a0<\/p>\n<p>\u0412 \u044d\u0442\u043e\u043c \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0435 \u044f \u0445\u043e\u0447\u0443 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0440\u043e \u043f\u0430\u043a\u0435\u0442 <a href=\"https:\/\/pub.dev\/packages\/go_router\">go_router<\/a>. \u041e\u043d \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0435\u0439 \u0432\u043e Flutter. \u041a\u043e\u043c\u0430\u043d\u0434\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 Flutter \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u0430\u043a\u0435\u0442. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u0434\u0435\u044f\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u0432 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0435\u043c \u043f\u0430\u043a\u0435\u0442 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442 \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u0442\u044c\u0441\u044f.<\/p>\n<p>\u0420\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0431\u0443\u0434\u0443 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u2014 Todo (\u0437\u0430\u043c\u0435\u0442\u043a\u0438). \u042f \u043f\u043e\u043d\u0438\u043c\u0430\u044e, \u0447\u0442\u043e \u0442\u0430\u043a\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u043d\u0430 \u0425\u0430\u0431\u0440\u0435 \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e. \u041d\u043e, \u043f\u043e-\u043c\u043e\u0435\u043c\u0443, \u043b\u0443\u0447\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043d\u0435 \u043d\u0430\u0439\u0442\u0438.<\/p>\n<figure class=\"full-width\"><\/figure>\n<h2>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442 \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443<\/h2>\n<p>\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u0443\u043c\u0430\u0432, \u044f \u0440\u0435\u0448\u0438\u043b, \u0447\u0442\u043e \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0448\u0435\u0441\u0442\u044c \u044d\u043a\u0440\u0430\u043d\u043e\u0432.<\/p>\n<ol>\n<li>\n<p>\u042d\u043a\u0440\u0430\u043d \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f <code>AuthScreen<\/code>. \u0411\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0435\u0439\u043a\u043e\u0432\u0443\u044e \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e.<\/p>\n<\/li>\n<li>\n<p>\u042d\u043a\u0440\u0430\u043d \u0441\u043e \u0441\u043f\u0438\u0441\u043a\u043e\u043c \u0437\u0430\u043c\u0435\u0442\u043e\u043a \u2014 <code>NotesScreen<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u042d\u043a\u0440\u0430\u043d \u0441 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439 \u0437\u0430\u043c\u0435\u0442\u043e\u043a \u2014 <code>DetailNoteScreen<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u042d\u043a\u0440\u0430\u043d \u0441 \u043b\u044e\u0431\u0438\u043c\u044b\u043c\u0438 \u0437\u0430\u043c\u0435\u0442\u043a\u0430\u043c\u0438 \u2014 <code>FavoriteNotesScreen<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u042d\u043a\u0440\u0430\u043d \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0437\u0430\u043c\u0435\u0442\u043e\u043a \u2014 <code>CreateNoteScreen<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u042d\u043a\u0440\u0430\u043d \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0444\u0438\u043b\u0435\u043c \u2014 <code>ProfileScreen<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u042d\u043a\u0440\u0430\u043d \u0434\u043b\u044f \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u0440\u0443\u0442\u043e\u0432\u043e\u0433\u043e \u044d\u043a\u0440\u0430\u043d\u0430 \u0441 \u043d\u0438\u0436\u043d\u0435\u0439 \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u043f\u0430\u043d\u0435\u043b\u044c\u044e \u2014 <code>RootScreen<\/code>.<\/p>\n<\/li>\n<\/ol>\n<p>\u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0447\u0435\u0442\u044b\u0440\u0435 \u043f\u0430\u043f\u043a\u0438 \u0432 \u043f\u0430\u043f\u043a\u0435 features. \u0412 \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0437 \u043d\u0438\u0445 \u2014 \u044d\u043a\u0440\u0430\u043d\u044b. \u0412 \u043a\u0430\u0436\u0434\u043e\u043c \u0444\u0430\u0439\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043e\u0434\u043d\u043e\u0438\u043c\u0435\u043d\u043d\u044b\u0439 StatelessWidget.<\/p>\n<figure class=\"bordered\"><\/figure>\n<h3>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0438\u0436\u043d\u0435\u0439 \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u043f\u0430\u043d\u0435\u043b\u0438 &#8212; BottomNavigationBar<\/h3>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0430\u043f\u043a\u0443 <strong>routing<\/strong>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u0443\u0434\u0435\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043a\u0430\u0440\u0442\u0443 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432. \u0414\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u0438\u0436\u043d\u0435\u0439 \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u043f\u0430\u043d\u0435\u043b\u0438 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0430\u0440\u0448\u0440\u0443\u0442 <a href=\"https:\/\/pub.dev\/documentation\/go_router\/latest\/go_router\/StatefulShellRoute-class.html\"><u>StatefulShellRoute<\/u><\/a>. \u042d\u0442\u043e\u0442 \u043c\u0430\u0440\u0448\u0440\u0443\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0441 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u043d\u0430\u0432\u0438\u0433\u0430\u0442\u043e\u0440\u0430\u043c\u0438 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0435\u0433\u043e \u043f\u043e\u0434 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432. \u041e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043a\u0430\u043a <a href=\"https:\/\/pub.dev\/documentation\/go_router\/latest\/go_router\/ShellRoute-class.html\"><u>ShellRoute<\/u><\/a>, \u043d\u043e \u0441 \u043e\u0434\u043d\u0438\u043c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c. \u041e\u043d \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u043d\u0430\u0432\u0438\u0433\u0430\u0442\u043e\u0440\u044b \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0437 \u0441\u0432\u043e\u0438\u0445 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0432\u0435\u0442\u0432\u0435\u0439, \u0442\u043e \u0435\u0441\u0442\u044c, \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0445 \u0434\u0435\u0440\u0435\u0432\u044c\u0435\u0432 \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438. <\/p>\n<p>\u0421 <code>StatefulShellRoute<\/code> \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0439 \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438. \u042d\u0442\u043e \u0443\u0434\u043e\u0431\u043d\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0441 <code>BottomNavigationBar<\/code>, \u0433\u0434\u0435 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0432\u043a\u043b\u0430\u0434\u043a\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u0441\u0432\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438. <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c <code>StatefulShellRoute<\/code>, \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 <code>StatefulShellBranch<\/code>. \u041a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043d\u0438\u0445 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0443\u044e \u0432\u0435\u0442\u043a\u0443 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430 \u0441 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f.\u00a0<\/p>\n<p><code>StatefulShellBranch<\/code> \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043a\u043e\u0440\u043d\u0435\u0432\u044b\u0435 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u044b \u0438 \u043a\u043b\u044e\u0447 \u043d\u0430\u0432\u0438\u0433\u0430\u0442\u043e\u0440\u0430 (<code>GlobalKey<\/code>) \u0434\u043b\u044f \u0432\u0435\u0442\u043a\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435. \u041a\u0430\u043a \u0438 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 <code>ShellRoute<\/code>, \u043f\u0440\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 <code>StatefulShellRoute<\/code> \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043b\u0438\u0431\u043e <code>builder<\/code>, \u043b\u0438\u0431\u043e <code>pageBuilder<\/code>.\u00a0<\/p>\n<p>\u042d\u0442\u0438 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u044b \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f \u0442\u0435\u043c, \u0447\u0442\u043e \u043e\u043d\u0438 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <code>StatefulNavigationShell<\/code> \u0432\u043c\u0435\u0441\u0442\u043e \u0434\u043e\u0447\u0435\u0440\u043d\u0435\u0433\u043e \u0432\u0438\u0434\u0436\u0435\u0442\u0430. <code>StatefulNavigationShell<\/code> \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430 \u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0430\u043a\u0442\u0438\u0432\u043d\u0443\u044e \u0432\u0435\u0442\u043a\u0443. \u0422\u043e \u0435\u0441\u0442\u044c, \u0434\u043b\u044f \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0442\u0435\u043a\u0430 \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0438 \u0434\u0440\u0443\u0433\u043e\u0439 \u0432\u0435\u0442\u043a\u0438. \u042d\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430 <code>StatefulNavigationShell.goBranch<\/code>.<\/p>\n<details class=\"spoiler\">\n<summary>routing\/app_routing.dart<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"dart\">final router = GoRouter(   initialLocation: '\/notes',   routes: [     \/\/ BottomNavigationBar     StatefulShellRoute.indexedStack(       builder: (context, state, navigationShell) =>           RootScreen(navigationShell: navigationShell),       branches: [         StatefulShellBranch(           routes: [             GoRoute(               path: '\/notes',               builder: (context, state) => const NotesScreen(),             ),           ],         ),         StatefulShellBranch(           routes: [             GoRoute(               path: '\/favorites',               builder: (context, state) => const FavoritesScreen(),             ),           ],         ),         StatefulShellBranch(           routes: [             GoRoute(               path: '\/profile',               builder: (context, state) => const ProfileScreen(),             ),           ],         ),       ],     ),   ], );<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u041e\u0431\u044a\u044f\u0432\u043b\u044f\u0435\u043c \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0439 <code>router<\/code>. \u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c <code>StatefulShellRoute<\/code> \u0441 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u043e\u043c <code>indexedStack<\/code>. \u0412 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0435 <code>builder<\/code> \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c <code>RootScreen<\/code> \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0432 \u043d\u0435\u0433\u043e <code>navigationShell<\/code>. \u0410 \u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0435 <code>branches<\/code> \u2014 <code>StatefulShellBranch<\/code> \u0441 \u043d\u0443\u0436\u043d\u044b\u043c\u0438 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430\u043c\u0438.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u043e\u043d\u043d\u0443\u044e \u043f\u0430\u043d\u0435\u043b\u044c \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435 <code>RootScreen<\/code>. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 <code>navigationShell<\/code>. \u0418\u0437 \u043d\u0435\u0433\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u0438 \u043c\u0430\u0440\u0448\u0440\u0443\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u043a\u0430\u0437\u0430\u043d \u0432 \u0432\u0435\u0442\u0432\u0438 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430.<\/p>\n<details class=\"spoiler\">\n<summary>root_screen.dart<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"dart\">class RootScreen extends StatelessWidget {   const RootScreen({super.key, required this.navigationShell});    \/\/\/ \u041a\u043e\u043d\u0442\u0435\u0438\u0306\u043d\u0435\u0440 \u0434\u043b\u044f \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0431\u0430\u0440\u0430.   final StatefulNavigationShell navigationShell;    @override   Widget build(BuildContext context) {     return Scaffold(       body: navigationShell,       bottomNavigationBar: BottomNavigationBar(         \/\/\/ \u041b\u0438\u0441\u0442 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u043b\u044f \u043d\u0438\u0436\u043d\u0435\u0433\u043e \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0431\u0430\u0440\u0430.         items: _buildBottomNavBarItems,         \/\/\/ \u0422\u0435\u043a\u0443\u0449\u0438\u0439 \u0438\u043d\u0434\u0435\u043a\u0441 \u043d\u0438\u0436\u043d\u0435\u0433\u043e \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0431\u0430\u0440\u0430.         currentIndex: navigationShell.currentIndex,         \/\/\/ \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043d\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043d\u0438\u0436\u043d\u0435\u0433\u043e \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0431\u0430\u0440\u0430.         onTap: (index) => navigationShell.goBranch(           index,           initialLocation: index == navigationShell.currentIndex,         ),       ),     );   }    \/\/ \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043b\u0438\u0441\u0442 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u043b\u044f \u043d\u0438\u0436\u043d\u0435\u0433\u043e \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0433\u043e \u0431\u0430\u0440\u0430.   List&lt;BottomNavigationBarItem> get _buildBottomNavBarItems => [         const BottomNavigationBarItem(           icon: Icon(Icons.note),           label: '\u0417\u0430\u043c\u0435\u0442\u043a\u0438',         ),         const BottomNavigationBarItem(           icon: Icon(Icons.favorite),           label: '\u041b\u044e\u0431\u0438\u043c\u044b\u0435',         ),         const BottomNavigationBarItem(           icon: Icon(Icons.person),           label: '\u041f\u0440\u043e\u0444\u0438\u043b\u044c',         ),        ]; }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0414\u0430\u043b\u044c\u0448\u0435 \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 main.dart \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0440\u043e\u0443\u0442\u0435\u0440\u0430:<\/p>\n<details class=\"spoiler\">\n<summary>main.dart<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"dart\">void main() {   runApp(const AppTodo()); }  class AppTodo extends StatelessWidget {   const AppTodo({super.key});    @override   Widget build(BuildContext context) {     return MaterialApp.router(       routerConfig: router,     );   } }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0440\u043e\u0443\u0442\u0435\u0440 \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0423 \u043d\u0435\u0433\u043e \u0435\u0441\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0443 \u0438 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u043f\u043e\u0438\u0441\u043a\u0430 \u043d\u0443\u0436\u043d\u043e\u0433\u043e \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u0430\u043b\u044c\u0448\u0435 \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f\u00a0\u043a \u043c\u0435\u0442\u043e\u0434\u0430\u043c \u0440\u043e\u0443\u0442\u0435\u0440\u0430 \u0431\u0443\u0434\u0435\u043c \u0447\u0435\u0440\u0435\u0437 <code>context<\/code>.<\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c <code>MaterialApp<\/code>. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0432 \u043d\u0435\u043c <strong>go_router<\/strong> \u0432\u043c\u0435\u0441\u0442\u043e <code>Navigator<\/code>.<\/p>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u043c\u044b \u043d\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u0432\u0438\u0434\u0436\u0435\u0442. \u0422\u0435\u043f\u0435\u0440\u044c \u0432\u0441\u0435\u0439\u00a0\u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0435\u0439 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 <strong>go_router<\/strong>. \u041f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432\u044b \u0443\u0432\u0438\u0434\u0438\u0442\u0435 \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u0439 \u043c\u0430\u0440\u0448\u0440\u0443\u0442 \u0441 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0439 \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0435\u0439.<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/65aa3d7e3eb8e176bf177b3d\" data-style=\"\" id=\"65aa3d7e3eb8e176bf177b3d\" width=\"\"><\/div>\n<p>\u041e\u0442\u043b\u0438\u0447\u043d\u043e! \u041d\u0430\u043c \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u044e \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u0437\u0430\u043c\u0435\u0442\u043a\u0435.<\/p>\n<h2>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438<\/h2>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 \u044d\u043a\u0440\u0430\u043d\u0435 <code>NotesScreen<\/code> \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043c\u043e\u043a\u043e\u0432\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0437\u0430\u043c\u0435\u0442\u043e\u043a \u0438 \u043d\u0430\u0440\u0438\u0441\u0443\u0435\u043c \u0438\u0445. \u041f\u043e \u043a\u043b\u0438\u043a\u0443 \u043c\u044b \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043d\u0430 \u044d\u043a\u0440\u0430\u043d \u0441 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439 \u043e \u0437\u0430\u043c\u0435\u0442\u043a\u0435. <\/p>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435! \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u044f \u043d\u0430 \u044d\u0442\u043e\u0442 \u044d\u043a\u0440\u0430\u043d, \u043c\u044b \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u043c\u0430\u0440\u0448\u0440\u0443\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432\u043d\u0443\u0442\u0440\u0438 \u043e\u0434\u043d\u043e\u0439 \u0432\u0435\u0442\u043a\u0438 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432.<\/p>\n<details class=\"spoiler\">\n<summary>notes_screen.dart<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"dart\">\/\/\/ \u041c\u043e\u043a\u043e\u0432\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0437\u0430\u043c\u0435\u0442\u043e\u043a const _notes = [   'Note 1',   'Note 2',   'Note 3',   'Note 4',   'Note 5',   'Note 6', ];  class NotesScreen extends StatelessWidget {   const NotesScreen({super.key});    @override   Widget build(BuildContext context) {     return Center(       child: ListView.separated(           itemBuilder: (context, index) {             return ListTile(               title: Text(_notes[index]),               onTap: () {                 \/\/ \u041f\u0440\u0438 \u043a\u043b\u0438\u043a\u0435 \u043d\u0430 \u0437\u0430\u043c\u0435\u0442\u043a\u0443 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043d\u0430 \u044d\u043a\u0440\u0430\u043d                 \/\/ \u0441 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439                  context.go('\/notes\/detail');               },             );           },           separatorBuilder: (context, index) {             return const Divider();           },           itemCount: _notes.length),     );   } }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u043c\u0430\u0440\u0448\u0440\u0443\u0442 \u0432 \u043a\u0430\u0440\u0442\u0443 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u043e\u0432 \u0432\u0435\u0442\u043a\u0438 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430 <code>\/notes<\/code>.<\/p>\n<pre><code class=\"dart\">  StatefulShellBranch(           routes: [             GoRoute(                 path: '\/notes',                 builder: (context, state) => const NotesScreen(),                 routes: [                   GoRoute(                     path: 'detail',                     builder: (context, state) => const DetailScreen(),                   ),                 ]),           ],         ),<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0444\u0430\u0439\u043b app_routing.dart \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<details class=\"spoiler\">\n<summary>app_routing.dart<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"dart\">final router = GoRouter(   initialLocation: '\/notes',   routes: [     \/\/ BottomNavigationBar     StatefulShellRoute.indexedStack(       builder: (context, state, navigationShell) =>           RootScreen(navigationShell: navigationShell),       branches: [         StatefulShellBranch(           routes: [             GoRoute(                 path: '\/notes',                 builder: (context, state) => const NotesScreen(),                 routes: [                   GoRoute(                     path: 'detail',                     builder: (context, state) => const DetailScreen(),                   ),                 ]),           ],         ),         StatefulShellBranch(           routes: [             GoRoute(               path: '\/favorites',               builder: (context, state) => const FavoritesScreen(),             ),           ],         ),         StatefulShellBranch(           routes: [             GoRoute(               path: '\/profile',               builder: (context, state) => const ProfileScreen(),             ),           ],         ),       ],     ),   ], );<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0442\u0430\u043a\u043e\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/65aa3e943add783089b4bc61\" data-style=\"\" id=\"65aa3e943add783089b4bc61\" width=\"\"><\/div>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u043d\u0430\u0447\u0430\u043b\u0438 \u0438\u0437\u0443\u0447\u0430\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 <strong>go_router<\/strong>. \u0421\u043e\u0437\u0434\u0430\u043b\u0438 \u043d\u0438\u0436\u043d\u044e\u044e \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u043e\u043d\u043d\u0443\u044e \u043f\u0430\u043d\u0435\u043b\u044c \u0438 \u043d\u0430\u0443\u0447\u0438\u043b\u0438\u0441\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0439 \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u0435\u0439. \u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0447\u0430\u0441\u0442\u0438 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c, \u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0434\u0438\u0440\u0435\u043a\u0442, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e, \u0430\u043d\u0438\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u044b.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0437 \u0441\u0442\u0430\u0442\u044c\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043f\u043e <a href=\"https:\/\/github.com\/petrovyuri\/go_router_lesson\/tree\/aed90b2ab457620c264e37f47c09fd89585d401d\"><u>\u0441\u0441\u044b\u043b\u043a\u0435<\/u><\/a>. <\/p>\n<p>\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u043d\u0430 <a href=\"https:\/\/pub.dev\/documentation\/go_router\/latest\/topics\/Get%20started-topic.html\"><u>\u0441\u0430\u0439\u0442\u0435<\/u><\/a>.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/787528\/\"> https:\/\/habr.com\/ru\/articles\/787528\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-365754","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/365754","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=365754"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/365754\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=365754"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=365754"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=365754"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}