cached_svg_image 0.0.7 cached_svg_image: ^0.0.7 copied to clipboard
This using package svg network image cached in reusable for image
import 'package:cached_svg_image/cached_svg_image.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Cached SVG Image',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const MyHomePage(title: 'Cached SVG Image Page'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
title: Text(widget.title),
),
body: const Center(
child: CachedNetworkSvgImage(
url: "https://upload.wikimedia.org/wikipedia/commons/4/44/Google-flutter-logo.svg", loadingGif: '{your loading assets}',
),
),
);
}
}