सार्वजनिक जानकारी से बना चयन मार्गदर्शन। केवल संदर्भ हेतु।
Routemaster एक हल्का, आसान उपयोग करने वाला रूटिंग समाधान है जो वेब, मोबाइल और डेस्कटॉप प्लेटफॉर्म के लिए Flutter एप्लिकेशन के लिए है। यह URL-आधारित नेविगेशन के साथ नेस्टेड रूट्स और टैब आधारित नेविगेशन का समर्थन करता है, जो जटिल रूट प्रबंधन को सरल बनाता है। सरलता और डेवलपर अनुभव के लिए बनाया गया, Routemaster मौजूदा Flutter प्रोजेक्ट में बिना किसी दिक्कत के एकीकृत हो सकता है। इसका स्पष्ट API रूट संक्रमण, डायनामिक पैरामीटर और डीप लिंकिंग को आसानी से संभालता है। बिना बॉइलरप्लेट कोड के संरचित नेविगेशन की आवश्यकता वाले एप्लिकेशन के लिए आदर्श है।
उपयोग
गतिशील सामग्री वाले एकल-पृष्ठ अनुप्रयोग
मोबाइल और वेब पर बहु-टैब इंटरफ़ेस
जटिल UI में नेस्टेड रूट संरचनाएँ
डीप लिंकिंग और URL सिंक्रनाइजेशन
स्थिर रूटिंग की आवश्यकता वाले क्रॉस-प्लेटफ़ॉर्म एप्लिकेशन
न्यूनतम सेटअप के साथ सरल नेविगेशन
मुख्य विशेषताएँ
URL-आधारित रूटिंग
नेस्टेड और टैब्ड रूट्स का समर्थन
न्यूनतम बॉयलरप्लेट
प्लेटफॉर्म के अनुकूलता
मौजूदा Flutter ऐप्स के साथ आसान एकीकरण
डायनामिक रूट पैरामीटर्स
इनके लिए उपयुक्त
क्रॉस-प्लेटफ़ॉर्म Flutter एप्लिकेशन बनाने वाले डेवलपर्स
स्पष्ट, बनाए रखने योग्य रूटिंग तर्क को प्राथमिकता देने वाली टीमें
गहन लिंकिंग या SPA-जैसे व्यवहार की आवश्यकता वाले प्रोजेक्ट
जटिल नेविगेशन हियरार्की वाले ऐप्स
एक स्पष्ट रूटिंग समाधान खोज रहे शुरुआती लोग
विचार योग्य बातें
फ्लटर के मूल नेविगेशन मॉडल पर सीमित
उन्नत उपयोग के मामलों के लिए अतिरिक्त अवस्था प्रबंधन की आवश्यकता हो सकती है
मानक पैटर्न से आगे अधिक कस्टम रूटिंग व्यवहार के लिए उपयुक्त नहीं
मार्ग गार्ड या प्रमाणीकरण पुनर्निर्देश के लिए निर्मित समर्थन नहीं है
मूल README
संबंधित सोर्स रिपॉज़िटरी के मूल README का स्नैपशॉट। नवीनतम सामग्री के लिए रिपॉज़िटरी देखें।
Routemaster
Hello! Routemaster is an easy-to-use router for Flutter, which wraps over Flutter's Router API.
Features
Simple declarative mapping from URLs to pages
Easy-to-use API: just Routemaster.of(context).push('/page')
Really easy nested navigation support for tabs
Multiple route maps: for example one for a logged in user, another for logged out
Observers to easily listen to route changes
Covered by over 250 unit, widget and integration tests
Here's the entire routing setup needed for an app featuring tabs and pushed routes:
Routemaster generates pages based on the current path. This is the key concept of its path-base routing. Path structure matters.
It uses the path to decide where a page should be pushed. This means the path needs to match your intended page hierarchy.
For example:
'/tabs': (route) => TabPage(child: HomePage(), paths: ['one', 'two']),
// First tab default page'/tabs/one': (route) => MaterialPage(child: TabOnePage()),
// Second tab default page'/tabs/two': (route) => MaterialPage(child: TabTwoPage()),
// Second tab sub-page: will be displayed in the 2nd tab because it// starts with '/tabs/two''/tabs/two/subpage': (route) => MaterialPage(child: TabTwoPage()),
// Not a tab page: will not be displayed in in a tab// because the path doesn't start with '/tabs/one' or '/tabs/two''/tabs/notInATab': (route) => MaterialPage(child: NotTabPage()),
Any child paths that begin with /tabs/one or /tabs/two will be pushed into the correct tab.
When navigating to /tabs/two/subpage, the TabPage will be asked "hey, do you know how to handle this path?" and it'll go "sure! it starts with /tabs/two, so it goes in my second tab".
However, navigating to /tabs/notInATab will not be displayed in a tab, but pushed on top of the tab bar.
TabPage will be all "yeah sorry, no idea what to do with that, doesn't match any of my tab paths" and its parent will be asked to hande it.