Giter VIP home page Giter VIP logo

native_image_view's Introduction

native_image_view

在Flutter嵌入已有原生项目的场景中,比较常见的一个问题是Flutter和原生项目中都使用了同一张图片时,两侧会分别进行存储,即该图片会被存储两次。

不同于Weex、Hippy等基于JS的跨平台框架是依赖于原生进行图片的获取和显示,Flutter是自行进行图片的管理并直接通过Skia引擎直接进行绘制的。

针对这一问题作者开发一个Flutter插件(native_image_view)将Flutter图片的下载和缓存工作交给Native实现,通过PlatformChannel进行图片二进制数据的传输,Flutter端则仅负责图片的绘制。

此外,我们还可以定义一个特殊协议,用于处理本地图片的调用,同时解决Flutter无法复用原生项目本地图片的问题。

Getting Started

安装插件 在pubspec.yaml文件中添加:

dependencies:
  native_image_view: ^0.0.1

在flutter项目目录中安装插件

flutter pub get

使用插件

import 'package:native_image_view/native_image_view.dart';
……
//网络图片
String url = "https://iknow-pic.cdn.bcebos.com/79f0f736afc379313a380ef3e7c4b74542a91193";
//本地图片
//String url = "localImage://wdqy.jpeg";
NativeImageView(
          url: url,
          width: 300,
          height: 200,
        ),

native_image_view's People

Contributors

qianshou avatar

Stargazers

 avatar

Watchers

 avatar  avatar

native_image_view's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.