सार्वजनिक जानकारी से बना चयन मार्गदर्शन। केवल संदर्भ हेतु।
Sailor एक Flutter पैकेज है जो Flutter एप्लिकेशन में नेविगेशन और रूटिंग को सरल बनाता है। यह रूट्स को परिभाषित करने, पृष्ठ संक्रमण के साथ एनीमेशन को प्रबंधित करने और डिबगिंग और एनालिटिक्स के लिए नेविगेशन इवेंट्स को लॉग करने के लिए एक साफ, घोषणात्मक तरीका प्रदान करता है। Sailor के साथ, डेवलपर्स पृष्ठों के बीच आसानी से नेविगेट कर सकते हैं, रूट्स के बीच डेटा पास कर सकते हैं, और डीप लिंकिंग को संभाल सकते हैं। पैकेज मौजूदा Flutter प्रोजेक्ट में बिना किसी दिक्कत के एकीकृत होता है और सरल और जटिल रूटिंग की आवश्यकताओं को समर्थित करता है। इसका हल्का डिज़ाइन और सुविधाजनक API ऐसे एप्लिकेशन के लिए आदर्श है जिनमें संरचित नेविगेशन पैटर्न की आवश्यकता होती है।
उपयोग
सरल ऐप नेविगेशन
जटिल मार्ग प्रबंधन
पृष्ठ संक्रमण एनीमेशन
नेविगेशन इवेंट लॉगिंग
गहरा लिंकिंग समर्थन
स्थायी रूट हैंडलिंग
मुख्य विशेषताएँ
घोषित मार्ग परिभाषाएँ
एम्बेडेड एनिमेशन समर्थन
नेविगेशन इवेंट लॉगिंग
रूट्स के बीच आसान डेटा पासिंग
डीप लिंकिंग का समर्थन
न्यूनतम बॉयलरप्लेट
इनके लिए उपयुक्त
शुरुआती Flutter विकासकर्मी
मध्यम से बड़े पैमाने के Flutter ऐप्स
विस्तृत नेविगेशन ट्रैकिंग की आवश्यकता वाले ऐप
जटिल रूटिंग तर्क वाले प्रोजेक्ट्स
क्लीन कोड संरचना प्राथमिकता देने वाली टीमें
विचार योग्य बातें
सीमित प्लेटफॉर्म-विशिष्ट कस्टमाइज़ेशन
डायनामिक रूट्स के लिए बिल्ट-इन समर्थन नहीं है
Flutter के widget वृक्ष की समझ की आवश्यकता होती है
उन्नत विशेषताओं के लिए अतिरिक्त पैकेज की आवश्यकता हो सकती है
बहुत हल्के एप्लिकेशन के लिए उपयुक्त नहीं जिनमें न्यूनतम नेविगेशन हो
मूल README
संबंधित सोर्स रिपॉज़िटरी के मूल README का स्नैपशॉट। नवीनतम सामग्री के लिए रिपॉज़िटरी देखें।
sailor
A Flutter package for easy navigation management.
Warning: Package is still under development, there might be breaking changes in future.
TIP: Sailor is a callable class, so you can omit navigate and directly call the method.
Routes.sailor("/secondPage");
Passing Parameters
Sailor allows you to pass parameters to the page that you are navigating to.
Before passing the parameter itself, you need to declare it while declaring your route. Let's declare a parameter named id that has a default value of 1234.
classSecondPageextendsStatelessWidget{
@overrideWidgetbuild(BuildContext context) {
final id = Sailor.param<int>(context, 'id');
...
}
}
Make sure to specify the type of paramter when declaring SailorParam<T>. This type is used to make sure when the route is being opened, it is passed the correct param type. Right now Sailor logs a warning if the type of declared and passed param is not same. In future version this might throw an error.
Passing Arguments
Sailor allows you to pass arguments to the page that you are navigating to.
The result from each route guard is Future<bool>. If the value returned by each route is true the route is accepted and opened, anything else will result in route being rejected and not being opened.
Transitions
Sailor has inbuilt support for page transitions. A transition is specified using SailorTransition.
Transition can be specified at 3 levels (ordered in priority from highest to lowest):
When Navigating (using Sailor.navigate).
While adding routes (SailorRoute).
Global transitions (SailorOptions).
When navigating
Specify which transitions to use when calling the navigate method.
More than one transition can be provided when navigating a single route. These transitions are composed on top of each other, so in some cases changing the order will change the animation.
NOTE: Custom transitions have the highest priority, if you provide a custom transition, they will be used over Sailor's inbuilt transitions.
The same priority rules apply to custom transitions as inbuilt sailor transitions, with the added rule that at any step if both transitions are provided (i.e. Sailor's inbuilt transitions and a CustomSailorTransition), the custom transition will be used over inbuilt one.
For example, in the below code, MyCustomTransition will be used instead of SailorTransition.slide_from_top.
Use SailorLoggingObserver to log the push/pop navigation inside the application.
Add the SailorLoggingObserver to the navigatorObservers list inside your MaterialApp.