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

पैकेज विवरणv2.0.0

cached_network_svg_image

SVG छवियों को कैश करने के लिए एक Flutter पैकेज।

AndroidiOSWebmacOSWindowsLinux
30-दिन डाउनलोड
25.7 हज़ार
लाइक
58
Pub अंक
120

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

flutter pub add cached_network_svg_image

पैकेज अवलोकन

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

एक फ्लटर पैकेज जो वेब से SVG छवियों को कुशलता से लोड और कैश करने के लिए डिज़ाइन किया गया है। यह नेटवर्क रिक्वेस्ट, कैशिंग और रेंडरिंग को हैंडल करके फ्लटर ऐप में स्केलेबल वेक्टर ग्राफिक्स को दिखाने को सरल बनाता है, न्यूनतम बॉयलरप्लेट के साथ। यह पैकेज Android, iOS, Web, macOS, Windows और Linux जैसे कई प्लेटफॉर्म का समर्थन करता है, जिससे उपकरणों के बीच संगत व्यवहार सुनिश्चित होता है। यह स्थानीय कैशिंग के माध्यम से आवश्यक डाउनलोड को कम करके प्रदर्शन में सुधार करता है और छवि लोड समय को बेहतर बनाता है।

उपयोग

  • URL से स्केलेबल आइकन प्रदर्शित करना
  • ऑफलाइन उपयोग के लिए दूरस्थ SVG संसाधनों को कैश करना
  • कैश्ड वेक्टर ग्राफिक्स के साथ ऐप प्रदर्शन में सुधार
  • क्रॉस-प्लेटफॉर्म फ्लटर एप्लिकेशन में SVG लोड करना
  • दोहरी छवि लोड के लिए बैंडविड्थ उपयोग कम करना

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

  • डाउनलोड किए गए SVGs का स्वचालित कैशिंग
  • सभी प्रमुख फ्लटर प्लेटफॉर्म का समर्थन
  • कुशल मेमोरी और डिस्क उपयोग
  • मौजूदा फ्लटर कोड के साथ सरल एकीकरण
  • एम्बेडेड त्रुटि हैंडलिंग और रीट्राई लॉजिक

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

  • अक्सर SVG छवि लोड करने वाले ऐप्स
  • अनुकूलित छवि प्रदर्शन की खोज कर रहे विकासकर्ता
  • वेक्टर ग्राफिक्स का उपयोग करने वाले प्लेटफॉर्म-स्थिर प्रोजेक्ट्स
  • ऑफलाइन कार्यक्षमता के लिए लक्षित अनुप्रयोग
  • साफ और पुनः उपयोगी छवि घटकों को तत्परता देने वाली टीमें

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

  • प्रारंभिक डाउनलोड के लिए इंटरनेट कनेक्शन की आवश्यकता होती है
  • कैश प्रबंधन को हस्तचालित साफ करने की आवश्यकता हो सकती है
  • बड़े SVG फ़ाइल्स प्रारंभिक लोड समय को प्रभावित कर सकते हैं
  • SVG रेंडरिंग विकल्पों के लिए सीमित कस्टमाइज़ेशन
  • नीचे की SVG विश्लेषण पुस्तकालय स्थिरता पर निर्भर करता है

मूल README

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

Cached Network SVG Image

cached_network_svg_image is a Flutter package that allows you to easily load and cache SVG images from the network. It provides a simple and efficient way to display SVG images with caching, placeholders, and error handling. 🌐🖼️ Now supports Web! 🌍

Features ✨

  • Load SVG images from the network. 🌍
  • Cache images for offline use. 📦
  • Display a placeholder while the image is loading. ⏳
  • Show an error widget if the image fails to load. ❌
  • Customize the fade-in duration for the image. ⏱️

Installation 🛠️

Add the following to your pubspec.yaml file:

dependencies:
  cached_network_svg_image: any

Then, run flutter pub get to install the package. 🚀

Usage 📖

Import the package in your Dart file:

import 'package:cached_network_svg_image/cached_network_svg_image.dart';

Use the CachedNetworkSVGImage widget to display an SVG image from the network:

CachedNetworkSVGImage(
    imageUrl: 'https://upload.wikimedia.org/wikipedia/commons/0/02/SVG_logo.svg',
    placeholder: const CircularProgressIndicator(color: Colors.green),
    errorWidget: const Icon(Icons.error, color: Colors.red),
    width: 250.0,
    height: 250.0,
    fadeDuration: const Duration(milliseconds: 500),
),
Parameters 📋
  • imageUrl: The URL of the SVG image. 🌐
  • cacheKey: A custom cache key to use for the image. 🔑
  • placeholder: A widget to display while the image is loading. ⏳
  • errorWidget: A widget to display if the image fails to load. ❌
  • width: The width of the image. 📏
  • height: The height of the image. 📏
  • fadeDuration: The duration of the fade-in animation when the image loads. ⏱️
  • headers: A map of headers to pass with the network request. 🗂️
  • cacheManager: A custom cache manager to use for caching the image, Default is DefaultCacheManager(). 📦
  • fit: How the image should be inscribed into the space allocated for it. 🔲
  • alignment: How the image should be aligned within its bounds. 📐
  • matchTextDirection: Whether to paint the image in the direction of the TextDirection. ↔️
  • allowDrawingOutsideViewBox: Whether to allow the image to draw outside its view box. 📏
  • color: The color to apply to the image. 🎨
  • colorBlendMode: The blend mode to apply to the image color. 🎨
  • semanticsLabel: A description of the image for accessibility tools. 🏷️
  • excludeFromSemantics: Whether the image should be excluded from semantics. 🚫
  • colorFilter: A color filter to apply to the image. 🎨
  • placeholderBuilder: A builder function to create the placeholder widget. 🛠️
  • theme: The theme to apply to the image. 🎨
Functions 🔧
  • preCache: A function to pre-cache the image. 📦
  • clearCacheForUrl: A function to clear the cache for a specific URL. 🗑️
  • clearCache: A function to clear the entire cache. 🗑️

Example 💡

Here is a complete example of how to use the cached_network_svg_image package:

import 'package:flutter/material.dart';
import 'package:cached_network_svg_image/cached_network_svg_image.dart';

void main() {
    runApp(MyApp());
}

class MyApp extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
        return MaterialApp(
            home: Scaffold(
                appBar: AppBar(
                    title: Text('Cached Network SVG Image Example'),
                ),
                body: Center(
                    child: CachedNetworkSVGImage(
                        imageUrl: 'https://upload.wikimedia.org/wikipedia/commons/0/02/SVG_logo.svg',
                        placeholder: const CircularProgressIndicator(color: Colors.green),
                        errorWidget: const Icon(Icons.error, color: Colors.red),
                        width: 250.0,
                        height: 250.0,
                        fadeDuration: const Duration(milliseconds: 500),
                    ),
                ),
            ),
        );
    }
}

License 📄

This project is licensed under the MIT License. See the LICENSE file for more details.

श्रेणियाँ

निर्भरताएँ

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

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

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