optimized_cached_image 0.1.3 copy "optimized_cached_image: ^0.1.3" to clipboard
optimized_cached_image: ^0.1.3 copied to clipboard

outdated

A library for loading images from network, resizing as per container size and caching while being memory sensitive.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:optimized_cached_image/widgets.dart';

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Optimized Cached Image Example'),
        ),
        body: Padding(
          padding: const EdgeInsets.all(16.0),
          child: Column(
            children: <Widget>[
              SizedBox(
                height: 50,
              ),
              Text("This is via the widget: OptimizedCacheImage"),
              // the following Image will have width its dimensions on disk = width of device
              // You don't need to specify width/height explicitly the widget automatically
              // detects it based on its parent's constraints.
              OptimizedCacheImage(
                imageUrl:
                    "https://grist.files.wordpress.com/2019/07/ocean1.jpg",
              ),
              SizedBox(
                height: 50,
              ),
              Text("This is via the provider: OptimizedCacheImageProvider"),
              //Unlike OptimizedCacheImage, OptimizedCacheImageProvider needs cacheWidth or/and cacheHeight to resize images
              Image(
                image: OptimizedCacheImageProvider(
                    "https://p.bigstockphoto.com/rwyznvNQ76U2liDFDH6g_bigstock-Yachts-In-City-Bay-At-Hot-Summ-283784740.jpg",
                    cacheHeight: 150,
                    cacheWidth: 200),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
114
likes
0
pub points
91%
popularity

Publisher

verified publisheranvith.dev

A library for loading images from network, resizing as per container size and caching while being memory sensitive.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, flutter_cache_manager, flutter_image_compress, http, path, path_provider, uuid

More

Packages that depend on optimized_cached_image