Buscar pacotes, repositórios e categorias de apps

Detalhes do pacotev1.0.12

universal_image

Um pacote Flutter para exibir todos os tipos de imagem em todas as plataformas

AndroidiOSWebmacOSWindowsLinux
Downloads em 30 dias
96,1 mil
Curtidas
38
Pontos Pub
160

Instalar pacote

flutter pub add universal_image

Visão geral do pacote

Orientação gerada a partir de informações públicas. Apenas para referência.

Universal Image é um pacote do Flutter projetado para exibir vários formatos de imagem em todas as principais plataformas, incluindo Android, iOS, Web, macOS, Windows e Linux. Ele simplifica o manuseio de imagens fornecendo uma API consistente que se adapta automaticamente ao suporte nativo de imagens da plataforma. O pacote garante a renderização confiável de tipos comuns de imagens sem exigir configuração adicional ou código específico da plataforma. Ideal para aplicativos que precisam de ampla compatibilidade com imagens com configuração mínima.

Casos de uso

  • Exibição de imagem multiplataforma
  • Suporte a múltiplos formatos de imagem
  • Manipulação unificada de imagens em aplicativos multiplataforma
  • Carregamento de imagem simplificado em aplicativos web e desktop
  • Reduzindo código de imagem específico de plataforma
  • Integração rápida em projetos Flutter existentes

Principais recursos

  • Suporta todos os formatos padrão de imagem
  • Adaptação automática da plataforma
  • Configuração mínima necessária
  • API consistente entre plataformas
  • Mecanismos internos de fallback
  • Desempenho otimizado em todos os alvos

Indicado para

  • Desenvolvedores direcionados a múltiplas plataformas
  • Aplicativos que exigem suporte a diversos formatos de imagem
  • Projetos com foco em simplicidade de código
  • Evitando lógica de imagem específica da plataforma
  • Aplicações com imagens dinâmicas ou carregadas pelo usuário
  • Aplicações para desktop e web com necessidades de imagem

Considerações

  • Pode não suportar formatos de imagem raros ou experimentais
  • Depende das bibliotecas de imagem da plataforma subjacente
  • Personalização limitada em comparação com pacotes especializados
  • Sobrecarga potencial de tamanho causada pelos codecs incluídos
  • Requer acesso à internet para carregar imagens remotas
  • Mais adequado para uso geral do que para processamento avançado de imagens

README original

Snapshot do README original do repositório-fonte vinculado. Consulte o repositório para o conteúdo mais recente.

universal_image

pub package

A comprehensive image package that provides a unified solution for displaying all major image formats across mobile, desktop, and web platforms in Flutter applications.
Skip the hassle of Image.network(), Image.asset(), or Image.memory() - simply pass your image source and let UniversalImage handle the rest

Key Features

  • Supports a wide range of image formats, including JPEG, PNG, GIF, Animated GIF, WebP, Animated WebP, BMP, and WBMP from the built-in Image widget.
  • Seamless integration with flutter_svg for rendering SVG images.
  • Powerful caching capabilities with extended_image for optimal performance.
  • Streamlined usage with imageUri, eliminating the need to specify network, asset, or file paths separately.
  • Ability to work with Icons font and memory-based images.

Example usage:

  • Assets provider
    var image = UniversalImage(
      'assets/image.png', // path must start with 'assets'
      color: Colors.black,
      matchTextDirection: false,
      scale: 1.0,
      width: 100,
      height: 100,
      frameBuilder: null,
      errorBuilder: null,
      semanticLabel: null,
      excludeFromSemantics: false,
      colorBlendMode: BlendMode.clear,
      fit: BoxFit.cover,
      alignment: Alignment.center,
      repeat: ImageRepeat.noRepeat,
      centerSlice: Rect.fromLTWH(0, 0, 100, 100),
      gaplessPlayback: false,
      isAntiAlias: false,
      filterQuality: FilterQuality.low,
      cacheWidth: 100,
      cacheHeight: 100,
      allowDrawingOutsideViewBox: false,
      placeholder: Container(),
      svgSkiaMode: true, // using flutter_svg on web, make sure building with FLUTTER_WEB_USE_SKIA=true
    );
  • File provider:
var image = UniversalImage(
      '/com.package.app/files/image.png', // image storage file path
      color: Colors.black,
      matchTextDirection: false,
      scale: 1.0,
      width: 100,
      height: 100,
      frameBuilder: null,
      errorBuilder: null,
      semanticLabel: null,
      excludeFromSemantics: false,
      colorBlendMode: BlendMode.clear,
      fit: BoxFit.cover,
      alignment: Alignment.center,
      repeat: ImageRepeat.noRepeat,
      centerSlice: Rect.fromLTWH(0, 0, 100, 100),
      gaplessPlayback: false,
      isAntiAlias: false,
      filterQuality: FilterQuality.low,
      cacheWidth: 100,
      cacheHeight: 100,
      allowDrawingOutsideViewBox: false,
      svgSkiaMode: false,
      placeholder: Container(),
    );
  • Network provider:
var image = UniversalImage(
      'https://flutter.github.io/assets-for-api-docs/assets/widgets/owl.jpg',
      color: Colors.black,
      matchTextDirection: false,
      scale: 1.0,
      width: 100,
      height: 100,
      frameBuilder: null,
      errorBuilder: null,
      semanticLabel: null,
      excludeFromSemantics: false,
      colorBlendMode: BlendMode.clear,
      fit: BoxFit.cover,
      alignment: Alignment.center,
      repeat: ImageRepeat.noRepeat,
      centerSlice: Rect.fromLTWH(0, 0, 100, 100),
      gaplessPlayback: false,
      isAntiAlias: false,
      filterQuality: FilterQuality.low,
      cacheWidth: 100,
      cacheHeight: 100,
      allowDrawingOutsideViewBox: false,
      svgSkiaMode: false,
      placeholder: Container(),
    );
  • Icon provider:
var image = UniversalImage(
      Icons.add,
      color: Colors.black,
      size: 30,
      textDirection: TextDirection.ltr
    );
  • Base64 provider:
Uint8List data = await loadImage();
var base64String = data.base64Image; // or replace any base64 image string 
var image = UniversalImage(
      base64String,
      color: Colors.black,
      matchTextDirection: false,
      scale: 1.0,
      width: 100,
      height: 100,
      frameBuilder: null,
      errorBuilder: null,
      semanticLabel: null,
      excludeFromSemantics: false,
      colorBlendMode: BlendMode.clear,
      fit: BoxFit.cover,
      alignment: Alignment.center,
      repeat: ImageRepeat.noRepeat,
      centerSlice: Rect.fromLTWH(0, 0, 100, 100),
      gaplessPlayback: false,
      isAntiAlias: false,
      filterQuality: FilterQuality.low,
      cacheWidth: 100,
      cacheHeight: 100,
      allowDrawingOutsideViewBox: false,
    );
  • Bytes memory provider:
Uint8List data = await loadImage();
var image = UniversalImage(
      data,
      color: Colors.black,
      matchTextDirection: false,
      scale: 1.0,
      width: 100,
      height: 100,
      frameBuilder: null,
      errorBuilder: null,
      semanticLabel: null,
      excludeFromSemantics: false,
      colorBlendMode: BlendMode.clear,
      fit: BoxFit.cover,
      alignment: Alignment.center,
      repeat: ImageRepeat.noRepeat,
      centerSlice: Rect.fromLTWH(0, 0, 100, 100),
      gaplessPlayback: false,
      isAntiAlias: false,
      filterQuality: FilterQuality.low,
      cacheWidth: 100,
      cacheHeight: 100,
      allowDrawingOutsideViewBox: false,
    );

License

License

Copyright (C) 2020 ductranit

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Categorias

Dependências

Lista de dependências 2 itens

Repositório-fonte

Projetos que usam este pacote

Rankings