ios_platform_images 0.1.0+2

  • Readme
  • Changelog
  • Example
  • Installing
  • 76

IOS Platform Images #

A Flutter plugin to share images between Flutter and iOS.

This allows Flutter to load images from Images.xcassets and iOS code to load Flutter images.

When loading images from Image.xcassets the device specific variant is chosen (iOS documentation).

Usage #

iOS->Flutter Example #

// Import package
import 'package:ios_platform_images/ios_platform_images.dart';

Widget build(BuildContext context) {
  return MaterialApp(
    home: Scaffold(
      body: Center(
        child: Image(image: IosPlatformImages.load("flutter")),
      ),
      //..
    ),
  );
}

IosPlatformImages.load functions like [UIImage imageNamed:].

Flutter->iOS Example #

#import <ios_platform_images/UIImage+ios_platform_images.h>

static UIImageView* MakeImage() {
  UIImage* image = [UIImage flutterImageWithName:@"assets/foo.png"];
  return [[UIImageView alloc] initWithImage:image];
}

0.1.0+2 #

  • Make the pedantic dev_dependency explicit.

0.1.0+1 #

  • Removed Android support from the pubspec.

0.1.0 #

  • Fixed a bug where the scale value of the image wasn't respected.

0.0.1 #

  • Initial release. Includes functionality to share images iOS images with Flutter and Flutter assets with iOS.

example/lib/main.dart

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

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

/// Main widget for the example app.
class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          // "pug" is a resource in Assets.xcassets.
          child: Image(image: IosPlatformImages.load("flutter")),
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  ios_platform_images: ^0.1.0+2

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:ios_platform_images/ios_platform_images.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
61
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
76
Learn more about scoring.

We analyzed this package on Apr 3, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6
  • Flutter: 1.12.13+hotfix.8

Maintenance issues and suggestions

Homepage URL doesn't exist. (-20 points)

At the time of the analysis the homepage field https://github.com/flutter/plugins/tree/master/packages/ios_platform_images/ios_platform_images was unreachable.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test
pedantic ^1.8.0