paulonia_cache_image 0.1.0 copy "paulonia_cache_image: ^0.1.0" to clipboard
paulonia_cache_image: ^0.1.0 copied to clipboard

outdated

Flutter package for cache images in storage or memory from the network or Google Cloud Storage. It supports Android, iOS and Web.

example/lib/main.dart

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

void main() async{
  WidgetsFlutterBinding.ensureInitialized();
  await PCacheImage.init(enableInMemory: true);
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Paulonia Cache Image',
      theme: ThemeData(
        // This is the theme of your application.
        //
        // Try running your application with "flutter run". You'll see the
        // application has a blue toolbar. Then, without quitting the app, try
        // changing the primarySwatch below to Colors.green and then invoke
        // "hot reload" (press "r" in the console where you ran "flutter run",
        // or simply save your changes to "hot reload" in a Flutter IDE).
        // Notice that the counter didn't reset back to zero; the application
        // is not restarted.
        primarySwatch: Colors.blue,
        // This makes the visual density adapt to the platform that you run
        // the app on. For desktop platforms, the controls will be smaller and
        // closer together (more dense) than on mobile platforms.
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: MyHomePage(title: 'Paulonia Cache Image'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  // This widget is the home page of your application. It is stateful, meaning
  // that it has a State object (defined below) that contains fields that affect
  // how it looks.

  // This class is the configuration for the state. It holds the values (in this
  // case the title) provided by the parent (in this case the App widget) and
  // used by the build method of the State. Fields in a Widget subclass are
  // always marked "final".

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage>{


  void initState(){
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Colors.white,
        title: Text(widget.title, style: TextStyle(color: Colors.black),),
      ),
      floatingActionButton: FloatingActionButton(
        child: Icon(Icons.refresh, color: Colors.black,),
        backgroundColor: Colors.white,
        onPressed: (){
          setState(() {

          });
        }
      ),
      body: ListView(
        children: [
          ListTile(
            title: Text("In memory cached network image"),
          ),
          Container(
            height: 250,
            child: Card(
              elevation: 10,
              child: Image(
                image: PCacheImage('https://i.imgur.com/jhRBVEp.jpg', enableInMemory: true),
              ),
            ),
          ),
          ListTile(
            title: Text("Storage cached network image"),
          ),
          Container(
            height: 250,
            child: Card(
              elevation: 10,
              child: Image(
                image: PCacheImage('https://i.imgur.com/5RhnXjE.jpg',),
              ),
            ),
          ),
          ListTile(
            title: Text("Not cached image"),
          ),
          Container(
            height: 250,
            child: Card(
              elevation: 10,
              child: Image(
                image: PCacheImage('https://i.imgur.com/inAkwKw.jpg', enableCache: false),
              ),
            ),
          ),
        ],
      ),
    );

  }

}
35
likes
0
pub points
22%
popularity

Publisher

verified publisherpaulonia.dev

Flutter package for cache images in storage or memory from the network or Google Cloud Storage. It supports Android, iOS and Web.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

firebase, firebase_storage, flutter, hive, http, path_provider

More

Packages that depend on paulonia_cache_image