flutter_iiif 0.1.1+1

  • Readme
  • Changelog
  • Example
  • Installing
  • 56

flutter_iiif #

A flutter implementation for IIIF images.

Find more information on IIIF here: IIIF specs

Basic usage: #

In your pubspec.yaml:

dependencies:
  flutter:
    sdk: flutter
  flutter_iiif:^0.0.1

import:

import 'package:flutter_iiif/flutter_iiif.dart';

Add the following code to your widget-tree:

IIIFImage(
    settings:IIIFImageSettings(
        server: 'http://your_iiif_server/', 
        assetID: 'filname_or_assetID', 
        quality: '[default|gray|color].[jpg|png|etc]'
     )
);

Demo #

Flutter IIIF Demo

Check out the example folder.

Repository #

https://code.naturkundemuseum.berlin/naturkunde_365_24/flutter_iiif

Pub #

https://pub.dev/packages/flutter_iiif

[0.1.1+1] #

  • updated faulty preview image url

[0.1.1] - Public Repository #

[0.1.0] - Initial Public Release #

example/lib/main.dart

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

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Flutter IIIFImage Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: IIIFDemo(),
    );
  }
}

class IIIFDemo extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    return _IIIFDemoState();
  }
}

class _IIIFDemoState extends State {
  /// Some info for testing

  /*final String server = 'http://mfn0006.naturkundemuseum-berlin.de:3200/api/v1/iiif/';
  final List<String> assets = ['3745679'];*/

  /*final String server = 'https://iiif.bodleian.ox.ac.uk/iiif/image/';
  final List<String> assets = ['c0c15feb-0406-4cb5-9e0e-b4118eda2c90'];*/

  final String server = 'https://download.mediasphere.museumfuernaturkunde.berlin/iiif/';
  final List<String> assets = ['MFNB_Col_Buprestidae_Julodinae_D015_pyr.tif', 'ZMB_Mol_40_10_2_2_pyr.tif', 'MB_ED_2151_pyr.tif'];
  final List<String> qualities = ['default.jpg', 'gray.jpg'];
  final List<double> tileSizes = [128.0, 256.0, 512.0];

  /// POPUP Menus
  List<PopupMenuItem<String>> imagePopupItems = [];
  List<PopupMenuItem<String>> qualityPopupItems = [];
  List<PopupMenuItem<double>> tileSizePopupItems = [];

  IIIFImage iiif;
  IIIFImageSettings settings;

  /// Demo State Constructor
  _IIIFDemoState() {
    settings = IIIFImageSettings(server: server, assetID: assets[0], quality: qualities[0]);
    iiif = IIIFImage(settings: settings);

    /// create image picker
    assets.forEach((String str) {
      imagePopupItems.add(PopupMenuItem<String>(
        value: str,
        child: Text(
          'image: ${imagePopupItems.length + 1}',
          overflow: TextOverflow.ellipsis,
        ),
      ));
    });

    /// create qualities picker
    qualities.forEach((String str) {
      qualityPopupItems.add(PopupMenuItem<String>(
        value: str,
        child: Text(
          str,
          overflow: TextOverflow.ellipsis,
        ),
      ));
    });

    /// create tileSize picker
    tileSizes.forEach((double i) {
      tileSizePopupItems.add(PopupMenuItem<double>(
        value: i,
        child: Text(
          '$i x $i',
          overflow: TextOverflow.ellipsis,
        ),
      ));
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Stack(children: [
        /// The Image
        iiif,

        /// Interaction menu
        Column(
          mainAxisAlignment: MainAxisAlignment.end,
          children: <Widget>[
            /// choose image
            Row(children: [
              PopupMenuButton(
                  icon: Icon(Icons.image),
                  onSelected: (String str) {
                    setState(() {
                      settings.assetID = str;
                      settings.notifier.notifyListeners();
                    });
                  },
                  itemBuilder: (BuildContext context) => imagePopupItems),
              Expanded(
                  child: Text(
                settings.assetID,
                overflow: TextOverflow.ellipsis,
              ))
            ]),

            /// choose quality
            Row(children: [
              PopupMenuButton(
                  icon: Icon(Icons.filter),
                  onSelected: (String str) {
                    setState(() {
                      settings.quality = str;
                      settings.notifier.notifyListeners();
                    });
                  },
                  itemBuilder: (BuildContext context) => qualityPopupItems),
              Expanded(
                  child: Text(
                settings.quality,
                overflow: TextOverflow.ellipsis,
              ))
            ]),

            // choose quality
            Row(children: [
              PopupMenuButton(
                  icon: Icon(Icons.grid_on),
                  onSelected: (double n) {
                    setState(() {
                      settings.tileSize = n;
                      settings.notifier.notifyListeners();
                    });
                  },
                  itemBuilder: (BuildContext context) => tileSizePopupItems),
              Expanded(
                  child: Text(
                '${settings.tileSize} x ${settings.tileSize}',
                overflow: TextOverflow.ellipsis,
              ))
            ])
          ],
        ),
      ]),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  flutter_iiif: ^0.1.1+1

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:flutter_iiif/flutter_iiif.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
12
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
56
Learn more about scoring.

We analyzed this package on Apr 4, 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

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
http ^0.12.0 0.12.0+4
vector_math ^2.0.0 2.0.8
Transitive dependencies
async 2.4.1
charcode 1.1.3
collection 1.14.11 1.14.12
http_parser 3.1.4
meta 1.1.8
path 1.6.4
pedantic 1.9.0
sky_engine 0.0.99
source_span 1.7.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
Dev dependencies
flutter_test
test ^1.3.0