सार्वजनिक जानकारी से बना चयन मार्गदर्शन। केवल संदर्भ हेतु।
एक ऐसा Flutter पैकेज जो स्क्रॉल करने योग्य सूचियों को प्रभावी ढंग से बनाता है और जब सूची के आइटम दृश्य क्षेत्र में प्रवेश या निकलते हैं तो वास्तविक समय में नोटिफिकेशन प्रदान करता है। यह ListView की शक्ति का उपयोग करता है, लेकिन दृश्य स्थिति का पता लगाने के लिए एक प्रतिक्रियाशील तंत्र भी जोड़ता है, जिससे ऑप्टिमाइज्ड रेंडरिंग, लेजी लोडिंग और प्रदर्शन में सुधार होता है। छवि लोडिंग, विश्लेषण ट्रैकिंग या दृश्यता से चालित एनीमेशन जैसे परिदृश्यों के लिए आदर्श है। यह पैकेज सभी प्रमुख प्लेटफॉर्मों को समर्थन देता है, जिसमें मोबाइल, वेब और डेस्कटॉप शामिल हैं।
उपयोग
लेजी लोडिंग छवि या सामग्री
विश्लेषण के लिए ट्रैकिंग दृश्यता
दृश्यता पर एनिमेशन ट्रिगर करना
लंबी सूचियों में संसाधन उपयोग को अनुकूलित करना
दृश्यता जाँच के साथ अनंत स्क्रॉलिंग का कार्यान्वयन
मुख्य विशेषताएँ
रियल-टाइम दृश्य में डिटेक्शन
ListView के साथ कुशल widget पुनर्उपयोग
क्रॉस-प्लेटफॉर्म समर्थन
सरल कॉलबैक-आधारित एपीआई
एकीकरण के लिए न्यूनतम बॉलरप्लेट
इनके लिए उपयुक्त
प्रदर्शन-संवेदनशील सूचियों के निर्माण करने वाले विकासकर्ता
दृश्यता-आधारित क्रियाकलापों की आवश्यकता वाले ऐप्स
गतिशील डेटा के साथ सामग्री-भारी एप्लिकेशन
चिकनी स्क्रॉलिंग और प्रतिक्रियाशीलता को प्राथमिकता देने वाली टीमें
विचार योग्य बातें
अगर बहुत सारे लिस्टनर सक्रिय हैं, तो मेमोरी का उपयोग बढ़ सकता है
लीक होने से बचने के लिए कॉलबैक का सावधानीपूर्वक उपयोग करने की आवश्यकता है
बहुत छोटी सूचियों के लिए आदर्श नहीं है जहां ओवरहेड लाभ से अधिक होता है
अक्सर अपडेट किए जाने वाले सूचियों या बड़े डेटासेट के लिए सबसे उपयुक्त
मूल README
संबंधित सोर्स रिपॉज़िटरी के मूल README का स्नैपशॉट। नवीनतम सामग्री के लिए रिपॉज़िटरी देखें।
inview_notifier_list
A Flutter package that builds a ListView or CustomScrollView and notifies when the widgets are on screen within a provided area.
Add the required property isInViewPortCondition to the InViewNotifierList widget. This is the function that defines the area which the widgets overlap should be notified as currently in-view.
deltaTop: It is the distance from top of the widget to be notified in the list view to top of the viewport(0.0).
deltaBottom: It is the distance from bottom of the widget to be notified in the list view to top of the viewport(0.0).
viewPortDimension: The height or width of the viewport depending on the srollDirection property provided. The image below showcases the values if the srollDirection is Axis.vertical.
Here is an example that returns true only when the widget's top is above the halfway of the viewport and the widget's bottom is below the halfway of the viewport. It is shown in example1.
Use the InViewNotifierWidget to get notified if the required widget is currently in-view or not.
The InViewNotifierWidget consists of the following properties:
id: a required String property. This should be unique for every widget that wants to get notified.
builder : Signature for a function that creates a widget for a given index. The function that defines and returns the widget that should be notified as inView. See InViewNotifierWidgetBuilder.
isInViewPortCondition: [Required] The function that defines the area within which the widgets should be notified as in-view.
initialInViewIds: The String list of unique ids of the child widgets that should be initialized as in-view when the list view is built for the first time.
endNotificationOffset: The distance from the bottom of the list where the onListEndReached should be invoked. Defaults to the end of the list i.e 0.0.
onListEndReached: The function that is invoked when the list scroll reaches the end or the endNotificationOffset if provided.
throttleDuration: The duration to be used for throttling the scroll notification. Defaults to 200 milliseconds.
scrollDirection: The axis along which the scroll view scrolls.
scrollViewWrapper: An optional callback that wraps the internal scroll view with an additional widget, such as a pull-to-refresh or shimmer wrapper, while keeping in-view detection working. It receives the fully built scroll view and must return a widget that contains it.
Note: The wrapper must let ScrollNotification events bubble up from the inner scroll view (most widgets do by default). If the wrapper provides its own ScrollController, make sure it does not conflict with the one passed to InViewNotifierList.