एक एवटार विजेट जो प्रदान किए गए डेटा स्रोत में से सर्वश्रेष्ठ उपलब्ध डेटा स्रोत का उपयोग करता है (सोशल छवियाँ, ग्रावटार, नाम के प्रारंभिक अक्षर, कस्टम)
सार्वजनिक जानकारी से बना चयन मार्गदर्शन। केवल संदर्भ हेतु।
avatars पैकेज फ्लटर के लिए एक लचीला और स्मार्ट एवटार विजेट प्रदान करता है जो उपलब्ध चित्र स्रोत—जैसे सोशल मीडिया प्रोफाइल, ग्रावटार, नाम के प्रारंभिक अक्षर या कस्टम छवि—को दिए गए डेटा के आधार पर स्वचालित रूप से चुनता है। यह फॉलबैक लॉजिक को बिना किसी झंझट के संभालता है, जिससे ऐप्स में उपयोगकर्ता के प्रतिनिधित्व को स्थिर बनाए रखा जाता है। चैट इंटरफ़ेस, उपयोगकर्ता प्रोफ़ाइल और सोशल फीचर्स के लिए उपयुक्त, यह बॉयलरप्लेट कोड को कम करता है और विश्वसनीय दृश्य पहचान प्रदर्शन के साथ UX को बढ़ाता है।
उपयोग
उपयोगकर्ता प्रोफ़ाइल प्रदर्शित करता है
चैट इंटरफेस
सोशल मीडिया एकीकरण
डैशबोर्ड उपयोगकर्ता कार्ड
प्रमाणीकरण प्रवाह
मुख्य विशेषताएँ
स्वचालित छवि स्रोत चयन
Gravatar समर्थन
नाम प्रारंभिक फॉलबैक
कस्टम इमेज ओवरराइड
प्लेटफॉर्म के अनुकूलता
इनके लिए उपयुक्त
उपयोगकर्ता प्रोफ़ाइल वाले ऐप्स
संदेश या चैट एप्लिकेशन
सोशल नेटवर्किंग फीचर्स
उपयोगकर्ता डेटा के साथ डैशबोर्ड UI
विचार योग्य बातें
बाहरी स्रोतों जैसे ग्रेवटार के लिए इंटरनेट की आवश्यकता होती है
प्रारंभिक अक्षर उत्पादन नाम इनपुट गुणवत्ता पर निर्भर करता है
मूल शैली के अलावा सीमित कस्टमाइज़ेशन
प्रदर्शन के लिए कैशिंग रणनीति की आवश्यकता हो सकती है
कुछ स्रोतों के लिए बाहरी API पर निर्भर करता है
मूल README
संबंधित सोर्स रिपॉज़िटरी के मूल README का स्नैपशॉट। नवीनतम सामग्री के लिए रिपॉज़िटरी देखें।
avatars
A complete avatar widget with a priority & fallback system which allows you to specify multiple image sources like socials (Facebook, Instagram, GitHub, Gravatar) and custom providers (assets and network) or to use text (name initials or custom values).
The widget will automatically find the best available image/text source among those provided.
Installation
In your pubspec.yaml file within your Flutter Project:
Using name property, the widget displays up to two initial letters found in the provided string.
Using value property, the widget displays the exact provided string.
Avatar's background is calculated from a default list of Color(). You can use a custom set of colors using placeholderColors:
An image source is an object used to generate, from local or remote sources, an ImageProvider() that will be used to show a picture inside the widget.
The sources list in Avatar() widget can contain multiple image sources: here, the priority & fallback system shows its power. If the first image source fails, the widget will try with the next one until a valid image source is found. If there are no sources available, the widget will use name or value data as seen in the previous example.
Here's the complete set of available image sources:
Socials
FacebookSource
Since Sep. 2020, to retrieve a user's profile picture by its ID from Facebook, you must make the request with an App Token or an Access Token.
You can find more details here.
GenericSource is generally used as a jolly image source: you can pass an ImageProvider() to show a picture.
GenericSource(ImageProvider image)
Shape, dimension, border and color
You can pass an AvatarShape() object to the widget using the shape property. The AvatarShape class provides two helper methods: circle(double radius) and rectangle(double width, double height, [BorderRadius borderRadius = BorderRadius.zero]).
This package uses flutter_cache_manager as dependency. The useCache set to true enables cache for every remote image request, improving performances. The default cache expiration is set to 7 days.