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

पैकेज विवरणv0.5.1

diffutil_sliverlist

एक SliverList जो diffutil.dart का उपयोग करके परिवर्तनों को स्वचालित रूप से एनीमेट करता है।

AndroidiOSWebmacOSWindowsLinux
30-दिन डाउनलोड
3.3 हज़ार
लाइक
61
Pub अंक
140

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

flutter pub add diffutil_sliverlist

पैकेज अवलोकन

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

एक SliverList विजेट जो DiffUtil एल्गोरिदम का उपयोग करके आइटम परिवर्तनों को स्वचालित रूप से एनीमेट करता है, जिससे आधारभूत डेटा सूची में परिवर्तन होने पर चिकनी और कुशल अपडेट सुनिश्चित होते हैं। यह diffutil.dart का उपयोग करके पुरानी और नई सूचियों के बीच न्यूनतम अंतर की गणना करता है, और केवल आवश्यक एनीमेशन और पुनर्निर्माण लागू करता है। बड़े, गतिशील स्क्रॉल करने योग्य सूचियों के लिए उपयुक्त जहां प्रदर्शन और दृश्य निरंतरता महत्वपूर्ण है। यह पैकेज Flutter की Sliver संरचना के साथ बिना किसी दिक्कत के एकीकृत होता है और सभी प्रमुख प्लेटफॉर्मों का समर्थन करता है।

उपयोग

  • लगातार अपडेट के साथ डायनामिक स्क्रॉल करने योग्य सूचियाँ
  • एक स्क्रॉल करने योग्य दृश्य में आइटम की पुनर्व्यवस्था करना
  • सूची आइटम जोड़ने/हटाने पर स्मूथ ट्रांजिशन
  • अनुकूलित रेंडरिंग की आवश्यकता वाले बड़े डेटासेट
  • स्क्रॉल करने योग्य इंटरफेस में रियल-टाइम डेटा फीड

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

  • सूची परिवर्तनों का स्वचालित एनीमेशन
  • न्यूनतम अपडेट के लिए DiffUtil का उपयोग करता है
  • बड़े सूचियों के लिए अनुकूलित प्रदर्शन
  • Sliver विजेट्स के साथ निरंतर एकीकरण
  • सभी फ्लटर लक्ष्यों के लिए क्रॉस-प्लेटफ़ॉर्म समर्थन

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

  • लचीले सूची एनिमेशन की आवश्यकता वाले डेवलपर्स
  • वास्तविक समय या लगातार बदलते डेटा वाले ऐप्स
  • प्रदर्शन-संवेदनशील स्क्रॉलिंग इंटरफेस
  • Sliver-आधारित लेआउट का उपयोग करने वाले Flutter विकासकर्मी
  • सूची अंतरों के लिए न्यूनतम बॉयलरप्लेट की आवश्यकता वाले प्रोजेक्ट्स

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

  • DiffUtil संकल्पना की समझ आवश्यक है
  • बहुत छोटी सूचियों के लिए अतिरिक्त ओवरहेड हो सकता है
  • एनिमेशन व्यवहार के सीमित कस्टमाइज़ेशन
  • बाहरी diffutil.dart पैकेज पर निर्भर करता है
  • गैर-सूची स्लिवर प्रकार के लिए उपयुक्त नहीं

मूल README

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

diffutil_sliverlist

Pub Package Build Status codecov

A SliverList that implicitly animates changes.

It supports two use cases:

Animating changes from a list of widgets with unique keys

When you have a list of Widgets and can give each Widget a unique key, you can use DiffUtilSliverList.fromKeyedWidgetList.

See the example code:

class _ExpandableListsState extends State<ExpandableLists> {
  bool expanded = false;

  @override
  Widget build(BuildContext context) {
    return DiffUtilSliverList.fromKeyedWidgetList(
      children: [
        ListTile(
          key: Key("1"),
          title: Text("first"),
          trailing: Icon(Icons.chevron_right),
        ),
        ListTile(
          key: Key("2"),
          title: Text("second"),
          trailing: Icon(Icons.chevron_right),
        ),
        if (this.expanded)
          for (int i = 3; i < 6; i++)
            ListTile(
              key: Key(i.toString()),
              title: Text("index: $i"),
              trailing: Icon(Icons.chevron_right),
            ),
        ListTile(
          key: Key("expand_collapse"),
          onTap: () => setState(() {
            expaned = !expaned;
          }),
          title: Text(expanded ? "collapse" : "expand", style: TextStyle(fontWeight: FontWeight.bold),),
          trailing: Icon(expanded ? Icons.expand_less : Icons.expand_more),
        )
      ],
      insertAnimationBuilder: (context, animation, child) => FadeTransition(
        opacity: animation,
        child: child,
      ),
      removeAnimationBuilder: (context, animation, child) => FadeTransition(
        opacity: animation,
        child: SizeTransition(
          sizeFactor: animation,
          axisAlignment: 0,
          child: child,
        ),
      ),
    );
  }
}

And the result:

Building Widgets from a list of data objects that implement ==

Example:


Widget build(BuildContext context) {
    return CustomScrollView(
             slivers: [
               DiffUtilSliverList<int>(
                 items: list,
                 builder: (context, item) => 
                   Container(
                     color: colors[item % colors.length],
                     height: 48,
                     width: double.infinity,
                 ),
                 insertAnimationBuilder: (context, animation, child) =>
                     FadeTransition(
                       opacity: animation,
                       child: child,
                 ),
                 removeAnimationBuilder: (context, animation, child) =>
                     SizeTransition(
                       sizeFactor: animation,
                       child: child,
                 ),
                 removeAnimationDuration: const Duration(milliseconds: 3000),
                 insertAnimationDuration: const Duration(milliseconds: 1200),
             ),
           ],
         );
}

If list changes, the list will automatically animate new/removed items:

If the items don't implement == correctly, you can pass your own equalityChecker.

श्रेणियाँ

निर्भरताएँ

निर्भरता सूची 1 आइटम

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

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