saltedfish_gallery_inserter 0.0.1

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • new63

saltedfish_gallery_inserter

How to use

1. Install

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

dependencies:
  saltedfish_gallery_inserter: "^0.0.1"

2. Import

import 'package:saltedfish_gallery_inserter/saltedfish_gallery_inserter.dart';

3. IOS

plist file

<key>NSPhotoLibraryUsageDescription</key>
	<string></string>

4. Use

  • Insert Image

if success(or resultCode is 'failed') , return a map like this:

{resultCode: success, /Users/haoluo/Library/Developer/CoreSimulator/Devices/D3CEB1DD-DB59-47BE-B87E-11548778AD8C/data/Media/DCIM/100APPLE/IMG_0013.PNG: path}

SaltedfishGalleryInserter.insertImageToGallery(image).then((map){
      print('$map');
    });
  • Insert Image File
 SaltedfishGalleryInserter.insertFileToGallery(file).then((map){
      print('$map');
    });

License

Copyright 2018 LuoHao

Licensed 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.

0.0.1

  • TODO: Describe initial release.

example/lib/main.dart

import 'dart:async';

import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart';
import 'package:saltedfish_gallery_inserter/saltedfish_gallery_inserter.dart';
import 'dart:ui' as ui;

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

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => new _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String _platformVersion = 'Unknown';
  GlobalKey globalKey = GlobalKey();

  @override
  void initState() {
    super.initState();
    initPlatformState();
  }

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlatformState() async {
    String platformVersion;
    // Platform messages may fail, so we use a try/catch PlatformException.
    try {
      platformVersion = await SaltedfishGalleryInserter.platformVersion;
    } on PlatformException {
      platformVersion = 'Failed to get platform version.';
    }

    // If the widget was removed from the tree while the asynchronous platform
    // message was in flight, we want to discard the reply rather than calling
    // setState to update our non-existent appearance.
    if (!mounted) return;

    setState(() {
      _platformVersion = platformVersion;
    });
  }

  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new Scaffold(
        appBar: new AppBar(
          title: const Text('Plugin example app'),
        ),
        body: new Center(
          child: RepaintBoundary(
            child: Container(
              child: Text('Can take a screenshot'),
              height: 300.0,width:300.0,
              color: Colors.orange,
            ),key: globalKey,
          ),
        ),floatingActionButton: FloatingActionButton(onPressed: (){

        _capturePngToSave();
      },child: Icon(Icons.add),),
      ),
    );
  }

  Future<void> _capturePngToSave() async {
    RenderRepaintBoundary boundary = globalKey.currentContext.findRenderObject();
    ui.Image image = await boundary.toImage();
    SaltedfishGalleryInserter.insertImageToGallery(image).then((map){
      print('$map');
    });
   /* ByteData byteData = await image.toByteData(format: ui.ImageByteFormat.png);
    Uint8List pngBytes = byteData.buffer.asUint8List();
    print(pngBytes);*/
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  saltedfish_gallery_inserter: ^0.0.1

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter packages get

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

3. Import it

Now in your Dart code, you can use:


import 'package:saltedfish_gallery_inserter/saltedfish_gallery_inserter.dart';
  
Version Uploaded Documentation Archive
0.0.1 Aug 30, 2018 Go to the documentation of saltedfish_gallery_inserter 0.0.1 Download saltedfish_gallery_inserter 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
46
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
50
Overall:
Weighted score of the above. [more]
63
Learn more about scoring.

We analyzed this package on Sep 18, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0
  • pana: 0.12.3
  • Flutter: 0.8.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Issues and suggestions

Homepage does not exists.

We were unable to access https://github.com/luohaohaha/saltedfish_gallery_inserter at the time of the analysis.

The description is too short.

Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

Package is pre-v0.1 release.

While there is nothing inherently wrong with versions of 0.0.*, it usually means that the author is still experimenting with the general direction of the API.

Format lib/saltedfish_gallery_inserter.dart.

Run flutter format to format lib/saltedfish_gallery_inserter.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.19.0-dev.28.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11
meta 1.1.6
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8