image_collage_widget 0.0.2

Image Collage Widget #

A flutter package for creating photo collages in your applications.

Preview #

image image image

Key Features #

  • Create 11 different type of collages.
  • Start with or without images from gallery preloaded (Only for Android).
  • Allow user to add or remove photo into collage.
  • User can update images from gallery/camera.
  • Don't worry about permissions, we handled it.

Usage #

  • Step 1:- Prepare AndroidManifest.xml

         <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
         <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
    
  • Step 2:- Prepare Info.plist

         <key>NSPhotoLibraryUsageDescription</key>
         <string>Need to access photo library</string>
         <key>NSCameraUsageDescription</key>
         <string>To upload your picture</string>
    
  • Step 3:- To use this package, add image_collage_widget as a dependency in your pubspec.yaml file.

          dependencies:
            ...
            image_collage_widget: ^0.0.2
    
       /// @param withImage:- If withImage = true, It will load image from given {filePath (default = "Camera")}
       /// @param collageType:- CollageType.CenterBig
    
               child: ImageCollageWidget(
                 collageType: widget.collageType,
                 withImage: true,
                 filePath: _directory?.path?.toString(),
               ),
    
    

Dependencies #

  • flutter_staggered_grid_view: ^0.2.7
  • flutter_bloc: ^0.9.0
  • flutter_file_manager: ^0.0.6
  • permission_handler: ^3.0.0
  • image_picker: ^0.5.0+9
  • equatable: ^0.2.3

LICENSE! #

Image Collage Widget is MIT-licensed.

Let us know! #

We’d be really happy if you send us links to your projects where you use our component. Just send an email to sales@mindinventory.com And do let us know if you have any questions or suggestion regarding our work.

[0.0.2] - 10 April 2019

  • Added 11 different type of collages.
  • Allow user to add or remove photo into collage.
  • User can update images from gallery/camera.

[0.0.1] - 27 March 2019

  • Initial release.

example/lib/main.dart

import 'dart:io';

import 'package:flutter/material.dart';
import 'package:image_collage_widget/utils/collage_type.dart';
import 'package:path_provider/path_provider.dart';
import 'package:test_package/CollageSample.dart';

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

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

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  Directory _directory;
  var color = Colors.white;

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

  getPath() async {
    _directory = await getExternalStorageDirectory();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("Test"),
      ),
      body: Center(
        child: ListView(
          padding: EdgeInsets.all(16.0),
          shrinkWrap: true,
          children: <Widget>[
            RaisedButton(
              onPressed: () => pushImageWidget(CollageType.VSplit),
              shape: buttonShape(),
              color: color,
              child: Padding(
                padding: const EdgeInsets.all(8.0),
                child: Text("Vsplit"),
              ),
            ),
            RaisedButton(
              onPressed: () => pushImageWidget(CollageType.HSplit),
              shape: buttonShape(),
              color: color,
              child: Padding(
                padding: const EdgeInsets.all(8.0),
                child: Text("HSplit"),
              ),
            ),
            RaisedButton(
              onPressed: () => pushImageWidget(CollageType.FourSquare),
              shape: buttonShape(),
              color: color,
              child: Padding(
                padding: const EdgeInsets.all(8.0),
                child: Text("FourSquare"),
              ),
            ),
            RaisedButton(
              onPressed: () => pushImageWidget(CollageType.NineSquare),
              shape: buttonShape(),
              color: color,
              child: Padding(
                padding: const EdgeInsets.all(8.0),
                child: Text("NineSquare"),
              ),
            ),
            RaisedButton(
              onPressed: () => pushImageWidget(CollageType.ThreeVertical),
              shape: buttonShape(),
              color: color,
              child: Padding(
                padding: const EdgeInsets.all(8.0),
                child: Text("ThreeVertical"),
              ),
            ),
            RaisedButton(
              onPressed: () => pushImageWidget(CollageType.ThreeHorizontal),
              color: color,
              shape: buttonShape(),
              child: Padding(
                padding: const EdgeInsets.all(8.0),
                child: Text("ThreeHorizontal"),
              ),
            ),
            RaisedButton(
              onPressed: () => pushImageWidget(CollageType.LeftBig),
              shape: buttonShape(),
              color: color,
              child: Padding(
                padding: const EdgeInsets.all(8.0),
                child: Text("LeftBig"),
              ),
            ),
            RaisedButton(
              onPressed: () => pushImageWidget(CollageType.RightBig),
              shape: buttonShape(),
              color: color,
              child: Padding(
                padding: const EdgeInsets.all(8.0),
                child: Text("RightBig"),
              ),
            ),
            RaisedButton(
              onPressed: () => pushImageWidget(CollageType.FourLeftBig),
              shape:  buttonShape(),
              color: color,
              child: Padding(
                padding: const EdgeInsets.all(8.0),
                child: Text("FourLeftBig"),
              ),
            ),
            RaisedButton(
              onPressed: () => pushImageWidget(CollageType.VMiddleTwo),
              shape:  buttonShape(),
              color: color,
              child: Padding(
                padding: const EdgeInsets.all(8.0),
                child: Text("VMiddleTwo"),
              ),
            ),
            RaisedButton(
              onPressed: () => pushImageWidget(CollageType.CenterBig),
              shape:  buttonShape(),
              color: color,
              child: Padding(
                padding: const EdgeInsets.all(8.0),
                child: Text("CenterBig"),
              ),
            )
          ],
        ),
      ),
    );
  }

  pushImageWidget(CollageType type) {
    Navigator.push(context,
        new MaterialPageRoute(builder: (context) => CollageSample(type)));
  }

  RoundedRectangleBorder buttonShape() {
    return RoundedRectangleBorder(
        borderRadius: new BorderRadius.circular(10.0));
  }
}

Use this package as a library

1. Depend on it

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


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

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

  • Dart: 2.5.0
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.2

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Fix lib/blocs/image_list_bloc.dart. (-1.49 points)

Analysis of lib/blocs/image_list_bloc.dart reported 3 hints:

line 15 col 7: Name types using UpperCamelCase.

line 129 col 34: Avoid using braces in interpolation when not needed.

line 130 col 39: Avoid using braces in interpolation when not needed.

Fix lib/blocs/collage_bloc.dart. (-1 points)

Analysis of lib/blocs/collage_bloc.dart reported 2 hints:

line 153 col 34: Avoid using braces in interpolation when not needed.

line 154 col 39: Avoid using braces in interpolation when not needed.

Fix lib/blocs/image_list_event.dart. (-1 points)

Analysis of lib/blocs/image_list_event.dart reported 2 hints:

line 2 col 8: Unused import: 'package:flutter/material.dart'.

line 4 col 16: Name types using UpperCamelCase.

Fix additional 7 files with analysis or formatting issues. (-2.50 points)

Additional issues in the following files:

  • lib/utils/key_utils.dart (2 hints)
  • lib/widgets/row_widget.dart (2 hints)
  • lib/blocs/image_list_state.dart (1 hint)
  • lib/blocs/collage_event.dart (Run flutter format to format lib/blocs/collage_event.dart.)
  • lib/blocs/collage_state.dart (Run flutter format to format lib/blocs/collage_state.dart.)
  • lib/utils/collage_type.dart (Run flutter format to format lib/utils/collage_type.dart.)
  • lib/utils/permission_type.dart (Run flutter format to format lib/utils/permission_type.dart.)

Maintenance issues and suggestions

Support latest dependencies. (-50 points)

The version constraint in pubspec.yaml does not support the latest published versions for 5 dependencies (equatable, flutter_bloc, flutter_file_manager, flutter_staggered_grid_view, image_picker).

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Package is pre-v0.1 release. (-10 points)

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

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
equatable ^0.2.3 0.2.6 0.5.1
flutter 0.0.0
flutter_bloc ^0.9.0 0.9.1 0.21.0
flutter_file_manager ^0.0.6 0.0.6 0.2.0
flutter_staggered_grid_view ^0.2.7 0.2.7 0.3.0
image_picker ^0.5.0+9 0.5.4+3 0.6.1+4
permission_handler ^3.0.0 3.2.2
Transitive dependencies
bloc 0.11.2 0.15.0
collection 1.14.11 1.14.12
meta 1.1.7
path 1.6.4
path_provider 0.4.1 1.3.0
rxdart 0.21.0 0.22.2
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test