avs_svg_provider 1.0.1 copy "avs_svg_provider: ^1.0.1" to clipboard
avs_svg_provider: ^1.0.1 copied to clipboard

Flutter package to use your SVG files as an ImageProvider. Use Asset and Network SVG files.

example/lib/main.dart

import 'package:avs_svg_provider/avs_svg_provider.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: 'AVSSVGProvider Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue),
        useMaterial3: false,
      ),
      home: const MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key});

  @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: const Text('AVSSVGProvider Demo'),
      ),
      body: Center(
        child: Padding(
          padding: const EdgeInsets.all(20),
          child: SingleChildScrollView(
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: <Widget>[
                Container(
                  width: MediaQuery.sizeOf(context).width,
                  height: MediaQuery.sizeOf(context).width,
                  alignment: Alignment.center,
                  decoration: BoxDecoration(
                    image: DecorationImage(
                      fit: BoxFit.contain,
                      image: AVSSVGProvider(
                        'https://www.svgrepo.com/show/530440/machine-vision.svg',
                        scale: 9,
                        gradient: const LinearGradient(
                          colors: <Color>[Colors.red, Colors.blue],
                          begin: Alignment.topLeft,
                          end: Alignment.bottomRight,
                        ),
                      ),
                    ),
                  ),
                  child: const Text(
                    "AVSSVGProvider Gradient Example",
                    style: TextStyle(color: Colors.white),
                  ),
                ),
                const SizedBox(height: 20),
                Container(
                  width: MediaQuery.sizeOf(context).width,
                  height: MediaQuery.sizeOf(context).width,
                  decoration: BoxDecoration(
                    image: DecorationImage(
                      image: AVSSVGProvider(
                        'assets/layer2.svg',
                        width: MediaQuery.sizeOf(context).width,
                        height: MediaQuery.sizeOf(context).width,
                      ),
                    ),
                  ),
                ),
                const SizedBox(height: 20),
                Image(
                  image: AVSSVGProvider(
                    'assets/layer3.svg',
                    scale: 8,
                    color: Colors.blue,
                  ),
                ),
                // Container(
                //   width: MediaQuery.sizeOf(context).width,
                //   height: MediaQuery.sizeOf(context).width,
                //   decoration: BoxDecoration(
                //     image: DecorationImage(
                //       image: AVSSVGProvider(
                //         'assets/layer3.svg',
                //         width: MediaQuery.sizeOf(context).width,
                //         height: MediaQuery.sizeOf(context).width,
                //         // scale: 8,
                //         color: Colors.blue,
                //       ),
                //     ),
                //   ),
                // ),
              ],
            ),
          ),
        ),
      ),
    );
  }
}
4
likes
160
points
427
downloads

Publisher

verified publisherahmetveysel.com

Weekly Downloads

Flutter package to use your SVG files as an ImageProvider. Use Asset and Network SVG files.

Homepage
Repository (GitHub)
View/report issues

Topics

#svg-provider #flutter-svg-provider #flutter-svg #avs-svg-provider

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter, flutter_svg, http

More

Packages that depend on avs_svg_provider