पैकेज, रिपॉज़िटरी और ऐप श्रेणियाँ खोजें

पैकेज विवरणv1.0.9

nested_navigators

अपने अलग-अलग मार्ग स्टैक के साथ एकाधिक नेस्टेड नेविगेटर के लिए फ्लटर विजेट।

30-दिन डाउनलोड
22
लाइक
17
Pub अंक
40

पैकेज इंस्टॉल करें

flutter pub add nested_navigators

पैकेज अवलोकन

सार्वजनिक जानकारी से बना चयन मार्गदर्शन। केवल संदर्भ हेतु।

NestedNavigators एक Flutter पैकेज है जो कई नेस्टेड नेविगेटर्स के लागू करने की अनुमति देता है, जिनमें से प्रत्येक अपने स्वयं के स्वतंत्र रूट स्टैक को प्रबंधित करता है। इससे टैब आधारित इंटरफ़ेस या स्क्रीन के भीतर मॉडल जैसे परतदार UI वाले ऐप्स में जटिल नेविगेशन स्थितियों को सरल बनाया जाता है। प्रत्येक नेविगेटर के लिए अलग-अलग नेविगेशन व्यवहार की अनुमति देकर, यह अनचाहे रूट अंतर्देश को रोकता है और रखरखाव में सुधार करता है। यह पैकेज मौजूदा Flutter प्रोजेक्ट में बिना किसी दिक्कत के एकीकृत हो जाता है और नेस्टेड संरचनाओं के भीतर डायनामिक रूटिंग का समर्थन करता है।

उपयोग

  • जटिल टैब इंटरफेस
  • स्क्रीन के भीतर मॉडल डायलॉग
  • बहु-स्तरीय नेविगेशन प्रवाह
  • कंपोनेंट्स में स्वतंत्र रूट स्टैक
  • नेस्टेड स्क्रीन ट्रांजिशन

मुख्य विशेषताएँ

  • प्रति-नेविगेटर रूट स्टैक आइसोलेशन
  • डीप लिंकिंग का समर्थन
  • नेविगेशन तर्क का स्पष्ट अलगाव
  • MaterialApp के साथ आसान एकीकरण
  • डायनामिक रूट प्रबंधन

इनके लिए उपयुक्त

  • बहुत नेविगेशन परतों वाले ऐप्स
  • जटिल रूटिंग का प्रबंधन करने वाले विकासकर्ता
  • स्वतंत्र नेविगेशन परिस्थितियों की आवश्यकता वाले UI
  • मॉड्यूलर स्क्रीन आर्किटेक्चर का उपयोग करने वाले प्रोजेक्ट
  • रखरखाव नेविगेशन कोड प्राथमिकता देने वाली टीमें

विचार योग्य बातें

  • सावधानीपूर्वक राज्य प्रबंधन की आवश्यकता होती है
  • अगर अत्यधिक उपयोग किया जाए, तो ऐप की जटिलता बढ़ सकती है
  • सरल नेविगेशन के लिए आवश्यक नहीं
  • कोर फ्लटर की तुलना में सीमित दस्तावेज़न
  • अत्यधिक नेस्टिंग के साथ संभावित प्रदर्शन अतिरिक्त लागत

मूल README

संबंधित सोर्स रिपॉज़िटरी के मूल README का स्नैपशॉट। नवीनतम सामग्री के लिए रिपॉज़िटरी देखें।

NestedNavigators

Flutter widget for implementing multiple nested navigators with their own route stacks.

Usage

To use, you must at least specify two arguments items and generateRoute:

class RootPage extends StatefulWidget {
  @override
  State<StatefulWidget> createState() => _RootPageState();
}

class _RootPageState extends State<RootPage> {
  @override
  Widget build(BuildContext context) {
    return NestedNavigators(
      items: {
        NestedNavItemKey.blue: NestedNavigatorItem(
          initialRoute: Routes.blue,
          icon: Icons.access_time,
          text: "Blue",
        ),
        NestedNavItemKey.red: NestedNavigatorItem(
          initialRoute: Routes.red,
          icon: Icons.send,
          text: "Red",
        ),
        NestedNavItemKey.green: NestedNavigatorItem(
          initialRoute: Routes.green,
          icon: Icons.perm_identity,
          text: "Green",
        ),
      },
      generateRoute: Routes.generateRoute,
    );
  }
}

See Routes.generateRoute()

By default NestedNavigators displays BottomNavigationBar, but you can hide it if you want:

clearStackAfterTapOnCurrentTab: false

You can customize BottomNavigatosBar items in two ways:

  • configure BottomNavigationBarItem:
buildBottomNavigationItem: (key, item, selected) => BottomNavigationBarItem(
           icon: Icon(
             item.icon,
             color: Colors.blue,
           ),
           title: Text(
             item.text,
             style: TextStyle(fontSize: 20),
           ),
         )
  • Define your own widget:
buildCustomBottomNavigationItem: (key, item, selected) => Container(
            height: 60,
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              mainAxisSize: MainAxisSize.min,
              children: <Widget>[
                Icon(
                  item.icon,
                  size: 24,
                  color: selected ? Colors.blue : null,
                ),
                Text(
                  item.text,
                  style: TextStyle(fontSize: 20, color: selected ? Colors.blue : null),
                ),
              ],
            ),
          )

Initial selected navigator:

  • If number of navigators is even number, than it will be the first elemnt of items;
  • If number of navigators is odd number, than it will be the middle element of items;
  • You can specify your navigator key:
 initialNavigatorKey: NestedNavItemKey.green

You can specify the color of ripple effect in your app theme or in bottomNavigationBarTheme:

bottomNavigationBarTheme: Theme.of(context).copyWith(
       splashColor: Colors.blue[100],
   )

By default, if a user clicks on an already selected tab item, the route stack will be cleared and the initial route will be displayed. You can disable this option:

clearStackAfterTapOnCurrentTab: false

When you navigate to another route within nested navigator, you can hide BottomNavigatorsBar for specific route, just add hideNavTabBar: true to route arguments:

Navigator.of(context).pushNamed(
                    Routes.red,
                    arguments: {
                      hideNavTabBar: true,
                    },
                  );

You can select another navigator from your routes:

NestedNavigatorsBlocProvider.of(context).select(NestedNavItemKey.green)

You can also switch displayed navigator and at the same time make navigation in the new navigator:

NestedNavigatorsBlocProvider.of(context).selectAndNavigate(
                      NestedNavItemKey.green,
                      (navigator) => navigator.pushNamed(
                            Routes.green,
                            arguments: {
                              ArgumentKeys.value: 100,
                            },
                          ));

Add NestedNavigatorsBlocProvider to app widget if you want to use the root navigator and need access to nested navigators from there:

class App extends StatefulWidget {
  @override
  State<StatefulWidget> createState() => _AppState();
}

class _AppState extends State<App> {
  final NestedNavigatorsBloc _bloc = NestedNavigatorsBloc<NestedNavItemKey>();

  @override
  Widget build(BuildContext context) {
    return NestedNavigatorsBlocProvider(
      bloc: _bloc,
      child: MaterialApp(
        title: 'Flutter Demo',
        home: RootPage(),
        onGenerateRoute: (routeSettings) => Routes.generateRoute(routeSettings),
      ),
    );
  }
}

You can use Drawer instead of BottomNavigationBar, use drawer or endDrawer for this:

drawer: (items, selectedItemKey, selectNavigator) => Drawer(
            child: ListView(
              children: items.entries
                  .map((entry) => ListTile(
                        title: Text(
                          entry.value.text,
                          style: TextStyle(
                            color: entry.key == selectedItemKey
                                ? Colors.blue
                                : null,
                          ),
                        ),
                        trailing: Icon(
                          entry.value.icon,
                          color:
                              entry.key == selectedItemKey ? Colors.blue : null,
                        ),
                        onTap: () => selectNavigator(entry.key),
                      ))
                  .toList(),
            ),
          ),

Also you can open drawers from your pages:

NestedNavigatorsBlocProvider.of(context).actionWithScaffold(
                  (scaffoldState) => scaffoldState.openDrawer(),
                );

श्रेणियाँ

सोर्स रिपॉज़िटरी

इस पैकेज का उपयोग करने वाले प्रोजेक्ट

अभी कोई डेटा उपलब्ध नहीं है।