सार्वजनिक जानकारी से बना चयन मार्गदर्शन। केवल संदर्भ हेतु।
एक फ्लटर पैकेज जो गिटहब के प्राइमर डिज़ाइन सिस्टम से प्रगति बार घटक का अनआधिकारिक कार्यान्वयन प्रदान करता है। यह प्रीमर के दृश्य भाषा के साथ संगत, साफ और आधुनिक UI प्रदान करता है, जो विभिन्न प्लेटफॉर्मों पर कार्य पूर्णता या लोडिंग स्थितियों को दिखाने के लिए उपयुक्त है। प्रगति बार के लिए कस्टमाइज़ करने योग्य रंग, एनीमेशन और चिकनी ट्रांज़िशन समर्थित हैं, जो गिटहब के डिज़ाइन भावना के साथ मेल खाने की कोशिश करने वाले एप्लिकेशन के लिए आदर्श है। फ्लटर के विजेट सिस्टम के साथ बनाया गया, यह मौजूदा प्रोजेक्ट में आसानी से एकीकृत होता है।
उपयोग
एप्स में कार्य पूर्णता को प्रदर्शित करना
लोडिंग प्रगति का दृश्यीकरण
GitHub-शैली डिज़ाइन के साथ UI सुसंगतता में सुधार
फ़ाइल अपलोड/डाउनलोड प्रगति दिखाएं
लंबे समय तक चलने वाले संचालन के लिए स्पष्ट उपयोगकर्ता प्रतिक्रिया बनाना
मुख्य विशेषताएँ
GitHub Primer डिज़ाइन सिस्टम संगतता
कस्टमाइज़ किए गए रंग स्कीम
स्मूथ एनीमेशन संक्रमण
क्रॉस-प्लेटफ़ॉर्म समर्थन (Android, iOS, Web, macOS, Windows, Linux)
हल्का और एकीकरण में आसान
इनके लिए उपयुक्त
GitHub-संग एकीकृत उपकरण बनाने वाले विकासकर्मी
उपयोगकर्ता इंटरफेस-केंद्रित Flutter एप्लिकेशन
स्थिर डिज़ाइन भाषा की आवश्यकता वाले प्रोजेक्ट्स
प्राइमर डिज़ाइन सिस्टम कंपोनेंट्स का उपयोग करने वाली टीमें
शानदार प्रगति दृश्यीकरण की आवश्यकता वाले ऐप
विचार योग्य बातें
अनौपचारिक कार्यान्वयन (अंतिम प्राइमर अपडेट को दर्शाने में विफल हो सकता है)
बुनियादी स्टाइलिंग के अलावा सीमित कस्टमाइजेशन
प्राइमर में महत्वपूर्ण बदलावों के लिए हस्तकल्पित अपडेट की आवश्यकता होती है
GitHub द्वारा सीधे बनाए नहीं गए
बग फिक्स और सुधार के लिए बाहरी भंडारण पर निर्भर है
मूल README
संबंधित सोर्स रिपॉज़िटरी के मूल README का स्नैपशॉट। नवीनतम सामग्री के लिए रिपॉज़िटरी देखें।
Version 0.4.0 has been released. It requires the Flutter SDK version 3.16.0 or higher. If you are using an older sdk, please use version 0.3.0 or lower.
Installation
Add this package to your pubspec.yaml.
dependencies:primer_progress_bar:^0.4.0
Alternatively, you can use flutter command like:
flutter pub add primer_progress_bar
Getting Started
Define segments to be displayed in the progress bar using Segment:
Finally you will get a nice progress bar :sunglasses:
Usage
Components
The Primer's progress bar consists of 3 components: the segmented bar, the legend, and the legend items. The progress bar can display multiple colored segments in a horizontal bar, and the legend is placed below the bar with the aligned descriptions of each segment.
The value describes the amount of space the segment occupies in the entier bar (see Proportion of segments section), and the label and valueLabel are the texts used in the legend to explain what the segment means.
The PrimerProgressBar integrates these 3 components and provides a simple interface to create a chart like the one above, so it should fit to general usecases. However, since each component is modulated, it is easy to use them individually for your own purposes. See SegmentedBar, SegmentedBarLegend, LegendItem for more details usage of each component.
Proportions of segment sizes
The proportion of each segment size to the bar length is determined by dividing the maxTotalValue according to the values of the segments. For example, if you want to display the percentage of each programming language used in a project, the value could be the percentage for a language and the maxTotalValue is 100.
Then, the size of a segment with a value of 24, for example, should be the 24% of the bar length.
If maxTotalValue is not specified, it is implicitly set to the sum of the values of the segments, resulting in the segments always filling the entire bar.
Limit legend lines
By default, the legend tries to align all the items while growing in vertical direction. This is fine if the legend has a relatively small number of items to display, but if you have a large number of segments, you will end up with a verbose legend.
For these cases, the legend provides a way to limit the number of lines in which the items are aligned. The following example limits the number of lines in the legend to 2.
PrimerProgressBar(
segments: segments,
// Limits the number of the lines in the legend to 2.
legendStyle: constSegmentedBarLegendStyle(maxLines: 2),
// A builder of a legend item that represent the overflowed items.// `truncatedItemCount` is the number of items that is overflowed.
ellipsisBuilder: (truncatedItemCount) {
final value = segments
.skip(segments.length - truncatedItemCount)
.fold(0, (accValue, segment) => accValue + segment.value);
returnLegendItem(
segment: Segment(
value: value,
color: Colors.grey,
label: constText("Other"),
valueLabel: Text("$value%"),
),
);
},
);
If the legend failed to align some items within the given line limit, the overflowing items are not shown and instead an item that is created by ellipsisBuilder (called an ellipsis) is displayed as the last item in the legend.
PrimerProgressBar(
segments: segments,
legendEllipsisBuilder: DefaultLegendEllipsisBuilder(
segments: segments,
color: Colors.grey,
label: constText("Other"),
// [value] is the sum of [Segment.value]s for each legend item that is overflowed
valueLabelBuilder: (value) => Text("$value%"),
),
);
Styling
The appearace of the 3 components are configurable with SegmentedBarStyle, SegmentedBarLegendStyle, LegendItemStyle, respectively. The documentation will provide detailed descriptions of each class and its properties, while our focus here is on briefly explaining the terminology used in the documentation.
Segmented bar
Gap : A space between adjacent segments.
Background : The color of the bar itself.
Legend item
Handle : A small shape filled with the segment's color and placed at the start of the item.
Label : A text explaining what the segment means.
Value label : A formatted value of the segment.
TODO
[ ] Add tests
[ ] Support mouse hovering
[ ] Refactor with Dart3
Contributing
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".
Don't forget to give the project a star! Thanks again!
Fork the Project
Create your Feature Branch (git checkout -b feature/AmazingFeature)
Commit your Changes (git commit -m 'Add some AmazingFeature')
Push to the Branch (git push origin feature/AmazingFeature)