image_network 2.6.0 copy "image_network: ^2.6.0" to clipboard
image_network: ^2.6.0 copied to clipboard

PlatformiOSweb

Image Network is a package that allows you to render images on the web using CanvasKit without having problems with CORS

example/lib/main.dart

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

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

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'ImageNetwork',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Demo ImageNetwork'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key, required this.title}) : super(key: key);
  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  final String imageUrl =
      "https://storage.googleapis.com/cms-storage-bucket/a9d6ce81aee44ae017ee.png";

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: ImageNetwork(
          image: imageUrl,
          height: 350.0,
          width: 240.0,
          duration: 1500,
          curve: Curves.easeIn,
          onPointer: true,
          debugPrint: false,
          backgroundColor: Colors.blue,
          fitAndroidIos: BoxFit.cover,
          fitWeb: BoxFitWeb.cover,
          onLoading: const CircularProgressIndicator(
            color: Colors.indigoAccent,
          ),
          onError: const Icon(
            Icons.error,
            color: Colors.red,
          ),
          borderRadius: BorderRadius.circular(10),
          onTap: () {
            showDialog(
              context: context,
              builder: (_) => const AlertDialog(
                content: Text("©gabrielpatricksouza"),
              ),
            );
            debugPrint("©gabriel_patrick_souza");
          },
        ),
      ),
    );
  }
}
160
likes
140
points
17.4k
downloads

Publisher

unverified uploader

Weekly Downloads

Image Network is a package that allows you to render images on the web using CanvasKit without having problems with CORS

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

flutter, http, webviewimage

More

Packages that depend on image_network