flutter_simple_sticker_view 1.0.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 78

flutter_simple_sticker_view #

Flutter plugin for attach stickers on image, as you want. scalable, movable. attached image can also be export.

Getting Started #

Add flutter_simple_sticker_view as a dependency in your pubspec.yaml file.

Check out the example directory for a sample app.

Usage #

Import the library via

import 'package:flutter_simple_sticker_view/flutter_simple_sticker_view.dart';

Example :

FlutterSimpleStickerView(
    Container(
      child: Center(child: Text("Hello, World!")),
    ),
    [
      Image.asset("assets/icons8-super-mario-50.png"),
      Image.asset("assets/icons8-superman-50.png"),
      Image.asset("assets/icons8-captain-america-50.png"),
      Image.asset("assets/icons8-avengers-50.png"),
      Image.asset("assets/icons8-iron-man-50.png"),
      Image.asset("assets/icons8-batman-50.png"),
      Image.asset("assets/icons8-thor-50.png"),
      Image.asset("assets/icons8-venom-head-50.png"),
      Image.asset("assets/icons8-homer-simpson-50.png"),
      Image.asset("assets/icons8-spider-man-head-50.png"),
      Image.asset("assets/icons8-harry-potter-50.png"),
      Image.asset("assets/icons8-genie-lamp-50.png"),
      Image.asset("assets/icons8-cyborg-50.png"),
      Image.asset("assets/icons8-one-ring-50.png"),
      Image.network("https://img.icons8.com/emoji/2x/wolf-emoji.png"),
      Image.network("https://img.icons8.com/emoji/2x/tiger-emoji.png"),
    ],
  )

Required paramsters #

  • source: The screen to attach the sticker.
  • stickerList : List of sticker.

Optional parameters #

  • stickerSize: default sticker size. width/height. (default is 100.0)

  • stickerMaxScale: maximum scale of sticker. (default is 2.0)

  • stickerMinScale: minimum scalof of sticker (default is 0.5)

  • panelHeight: sticker panel height. (default is 200)

  • panelBackgroundColor: background color of sticker panel.

  • panelStickerBackgroundColor: background color of sticker in panel.

  • panelStickercrossAxisCount: axis count of sticker (default is 4)

  • panelStickerAspectRatio: ratio of sticker in sticker panel. (default is 1.0)

  • devicePixelRatio: device pixel ratio for exporting image. (eg. MediaQuery.of(context).devicePixelRatio)

enjoy! 💃

1.0.0 - 2019-11-21 #

  • initial release.

example/lib/main.dart

import 'dart:typed_data';

import 'package:flutter/material.dart';

import 'package:flutter_simple_sticker_view/flutter_simple_sticker_view.dart';

import 'package:image_gallery_saver/image_gallery_saver.dart';
import 'package:permission_handler/permission_handler.dart';

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(title: "Flutter Simple Sticker View", home: HomeView());
  }
}

class HomeView extends StatefulWidget {
  @override
  _HomeViewState createState() => _HomeViewState();
}

class _HomeViewState extends State<HomeView> {
  FlutterSimpleStickerView _stickerView = FlutterSimpleStickerView(
    Container(
      decoration: BoxDecoration(
          color: Colors.red,
          image: DecorationImage(
              fit: BoxFit.cover,
              image: NetworkImage(
                  "https://images.unsplash.com/photo-1544032527-042957c6f7ce?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=800&q=60"))),
    ),
    [
      Image.asset("assets/icons8-superman-50.png"),
      Image.asset("assets/icons8-captain-america-50.png"),
      Image.asset("assets/icons8-avengers-50.png"),
      Image.asset("assets/icons8-iron-man-50.png"),
      Image.asset("assets/icons8-batman-50.png"),
      Image.asset("assets/icons8-thor-50.png"),
      Image.asset("assets/icons8-venom-head-50.png"),
      Image.asset("assets/icons8-homer-simpson-50.png"),
      Image.asset("assets/icons8-spider-man-head-50.png"),
      Image.asset("assets/icons8-harry-potter-50.png"),
      Image.asset("assets/icons8-genie-lamp-50.png"),
      Image.asset("assets/icons8-cyborg-50.png"),
      Image.asset("assets/icons8-one-ring-50.png"),
    ],
    // panelHeight: 150,
    // panelBackgroundColor: Colors.blue,
    // panelStickerBackgroundColor: Colors.pink,
    // panelStickercrossAxisCount: 4,
    // panelStickerAspectRatio: 1.0,
  );

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text("Flutter Simple Sticker View"),
          actions: <Widget>[
            IconButton(
              icon: Icon(Icons.save_alt),
              onPressed: () async {
                Uint8List image = await _stickerView.exportImage();

                Map<PermissionGroup, PermissionStatus> permissions =
                    await PermissionHandler()
                        .requestPermissions([PermissionGroup.storage]);
                await ImageGallerySaver.saveImage(image);
              },
            )
          ],
        ),
        body: _stickerView);
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  flutter_simple_sticker_view: ^1.0.0

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

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

  • Dart: 2.8.4
  • pana: 0.13.14
  • Flutter: 1.17.5

Analysis suggestions

Package does not support Flutter platform linux

Because:

  • package:flutter_simple_sticker_view/flutter_simple_sticker_view.dart that declares support for platforms: android, ios

Package does not support Flutter platform macos

Because:

  • package:flutter_simple_sticker_view/flutter_simple_sticker_view.dart that declares support for platforms: android, ios

Package does not support Flutter platform web

Because:

  • package:flutter_simple_sticker_view/flutter_simple_sticker_view.dart that declares support for platforms: android, ios

Package does not support Flutter platform windows

Because:

  • package:flutter_simple_sticker_view/flutter_simple_sticker_view.dart that declares support for platforms: android, ios

Package not compatible with SDK dart

Because:

  • flutter_simple_sticker_view that is a package requiring null.

Health issues and suggestions

Fix lib/flutter_simple_sticker_image.dart. (-5.48 points)

Analysis of lib/flutter_simple_sticker_image.dart reported 1 warning, 1 hint:

line 40 col 20: Parameters can't override default values, this method overrides 'Diagnosticable.toString' where 'minLevel' has a different value.

line 60 col 10: The value of the field '_previousRotation' isn't used.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
vector_math ^2.0.8 2.0.8 2.1.0-nullsafety
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8 1.2.2
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
Dev dependencies
flutter_test