技术经验谈 技术经验谈
首页
  • 最佳实践

    • 抓包
    • 数据库操作
  • ui

    • 《JavaScript教程》
    • 《JavaScript高级程序设计》
    • 《ES6 教程》
    • 《Vue》
    • 《React》
    • 《TypeScript 从零实现 axios》
    • 《Git》
    • TypeScript
    • JS设计模式总结
  • 总纲
  • 整体开发框架
  • 技术文档
  • GitHub技巧
  • Nodejs
  • 博客搭建
  • 学习
  • 面试
  • 心情杂货
  • 实用技巧
  • 友情链接
关于
收藏
  • 分类
  • 标签
  • 归档
GitHub (opens new window)

hss01248

一号线程序员
首页
  • 最佳实践

    • 抓包
    • 数据库操作
  • ui

    • 《JavaScript教程》
    • 《JavaScript高级程序设计》
    • 《ES6 教程》
    • 《Vue》
    • 《React》
    • 《TypeScript 从零实现 axios》
    • 《Git》
    • TypeScript
    • JS设计模式总结
  • 总纲
  • 整体开发框架
  • 技术文档
  • GitHub技巧
  • Nodejs
  • 博客搭建
  • 学习
  • 面试
  • 心情杂货
  • 实用技巧
  • 友情链接
关于
收藏
  • 分类
  • 标签
  • 归档
GitHub (opens new window)
  • 学习资料

  • 技术选型

  • 要点

    • dart语言核心要点
    • 工程化

    • flutter异步
    • flutter工程化
    • flutter存储相关
    • flutter状态管理
    • flutter网络框架以及相关要点
    • flutter图片相关
      • flutter可观测性和调试
      • flutter插件开发
      • flutter路由管理
      • 遇到的问题
    • 经验

    • flutter
    • 要点
    hss01248
    2022-08-26
    目录

    flutter图片相关

    # flutter图片相关

    # 1 加载

    • 常规加载
    • 大图查看和手势缩放
    • 缓存处理

    推荐: https://github.com/fluttercandies/extended_image

    强大的官方 Image 扩展组件, 支持加载以及失败显示,缓存网络图片,缩放拖拽图片,图片浏览(微信掘金效果),滑动退出页面(微信掘金效果),编辑图片(裁剪旋转翻转),保存,绘制自定义效果等功能

    https://pub.dev/packages/cached_network_image

    Android ScaleType and BoxFit should match like this:

    1. CENTER = none
    2. CENTER_CROP = cover
    3. CENTER_INSIDE = scaleDown
    4. FIT_CENTER = contain (alignment.center)
    5. FIT_END = contain (alignment.bottomright)
    6. FIT_START = contain (alignment.topleft)
    7. FIT_XY = fill

    Ex :- Image.asset('assets/images/your_image.png',fit: BoxFit.fill)

    So you should use Cover to achieve the CENTER_CROP result.

    EDIT:

    The problem should be crossAxisAlignment of the Column widget. Setting this property to crossAxisAlignment: CrossAxisAlignment.stretch should fix your issue.

    # flutter imageview 设置match_parent

    ExtendedImage.file(File(element.localPath),
                       fit: BoxFit.cover,
                       alignment: Alignment.topLeft,
                       width: double.infinity,
                       height: double.infinity,);
    
    1
    2
    3
    4
    5

    # 2 压缩

    https://github.com/fluttercandies/flutter_image_compress

    # 3 exif操作

    # 4 拍照

    https://github.com/fluttercandies/flutter_wechat_camera_picker

    https://pub.dev/packages/camera Display live camera preview in a widget. Snapshots can be captured and saved to a file. Record video.Add access to the image stream from Dart.

    # 5 选图/选文件

    https://github.com/fluttercandies/flutter_wechat_assets_picker

    https://pub.dev/packages/image_picker A Flutter plugin for iOS and Android for picking images from the image library, and taking new pictures with the camera.

    # 6 保存图片到相册

    https://juejin.cn/post/7086762420626014222 预览大图并保存到相册的库和使用demo代码

    # 7 纯dart

    https://github.com/brendan-duncan/image 图片相关操作, load, save and manipulate images in a variety of different file formats

    编辑 (opens new window)
    上次更新: 2022/09/20, 10:24:16
    flutter网络框架以及相关要点
    flutter可观测性和调试

    ← flutter网络框架以及相关要点 flutter可观测性和调试→

    最近更新
    01
    截图后的自动压缩工具
    12-27
    02
    图片视频文件根据exif批量重命名
    12-27
    03
    chatgpt图片识别描述功能
    02-20
    更多文章>
    Theme by Vdoing | Copyright © 2020-2025 | 粤ICP备20041795号
    • 跟随系统
    • 浅色模式
    • 深色模式
    • 阅读模式