ice_tea_studio_plugins 0.0.8

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

Native plugins

A Flutter plugin for show toast in the mobile platform. Supports iOS and Android.

Usage

To use this plugin, add ice_tea_studio_plugins as a dependency in your pubspec.yaml file.

#Example

showToastMessage()  {
    try {
       NativeUtilsPlugin.showToast(msg: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", backgroundColor: "#84db00", gravity: ToastGravity.TOP, isFullWidth: true);
    } on PlatformException {
      print('Failed to call show toast message');
    }
  }
 
  • Required
    • msg: String message
  • Optional
    • backgroundColor: background color of toast. Ex: #84bd00
    • textColor: text color of toast. Ex: #ffffff
    • isFullWidth: set toast full width of screen. In case fullwidth=false toast using default offset of system
    • toastLength: time display toast. Only use for android. Toast.LENGTH_SHORT, Toast.LENGTH_LONG
    • time: time display toast. Only use for iOS.
    • gravity: place of toast ToastGravity.TOP, ToastGravity.CENTER,ToastGravity.BOTTOM

0.0.8

  • Fixed bugs: textSize not found.

0.0.7

  • Supported Toast with text size (Android + iOS).

0.0.6

  • Supported Toast with text size.

0.0.5

  • Fixed bugs: just on Android's Toast.

0.0.4

  • Changed: increased text size, new padding.
  • Supported OS: Android + iOS

0.0.3

  • Features: show Toast with custom: background color, text color, gravity, full width or wrap content.
  • Supported OS: Android + iOS

0.0.2

  • Fix bugs

0.0.1

  • Added Toast

example/lib/main.dart

import 'dart:async';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:ice_tea_studio_plugins/ice_tea_studio_plugins.dart';

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

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

class _MyAppState extends State<MyApp> {
  String _platformVersion = 'Unknown';
  String _platformMessage = '';

  int radioValue = 0;
  bool switchValue = false;
  ToastGravity toastGravity = ToastGravity.TOP;
  String toastMessage = "Looks like you cancelled the login request. Please try again.";

  void handleRadioValueChanged(int value) {
    setState(() {
      radioValue = value;
      print('value $radioValue');
      switch (radioValue) {
        case 0:
          toastGravity = ToastGravity.TOP;
          break;
        case 1:
          toastGravity = ToastGravity.CENTER;
          break;
        default :
          toastGravity = ToastGravity.BOTTOM;
          break;
      }
    });
  }

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

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

    if (!mounted) return;

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

  showToastMessage() async {
    try {
      await NativeUtilsPlugin.showToast(
          msg: toastMessage,
          backgroundColor: "#84db00",
          textSize: 18,
          gravity: toastGravity,
          isFullWidth: switchValue);

      if (!mounted) return;

      setState(() {
        _platformMessage = 'ok';
      });
    } on PlatformException {
      _platformMessage = 'Failed to call show toast message.';
    }
  }

  showToastMessage2() async {
    try {
      await NativeUtilsPlugin.showToast(
          msg: toastMessage,
          backgroundColor: "#d77d00",
          textSize: 25,
          gravity: toastGravity,
          isFullWidth: switchValue);

      if (!mounted) return;

      setState(() {
        _platformMessage = 'ok';
      });
    } on PlatformException {
      _platformMessage = 'Failed to call show toast message.';
    }
  }

  showToastMessage3() async {
    try {
      await NativeUtilsPlugin.showToast(
          msg: toastMessage,
          backgroundColor: "#B71C1C",
          textSize: 25,
          gravity: toastGravity,
          isFullWidth: switchValue);

      if (!mounted) return;

      setState(() {
        _platformMessage = 'ok';
      });
    } on PlatformException {
      _platformMessage = 'Failed to call show toast message.';
    }
  }

  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new Scaffold(
        appBar: new AppBar(
          title: const Text('Plugin example app x'),
        ),
        body: new Center(
            child: new Column(
              mainAxisAlignment: MainAxisAlignment.center,
              crossAxisAlignment: CrossAxisAlignment.center,
              children: <Widget>[
                new Text('Running status: $_platformMessage'),
                new Container(
                  child: new Text('Running on: $_platformVersion'),
                ),
                new Container(
                  width: 250.0,
                  padding: new EdgeInsets.all(20.0),
                  child: buildRadio(),),
                new Container(
                    width: 250.0,
                    child: new Row(
                      mainAxisAlignment: MainAxisAlignment.center,
//                    crossAxisAlignment: CrossAxisAlignment.stretch,
                      children: <Widget>[
                        new Text('isFullWidth'),
                        _buildSwitch(),
                      ],
                    )),
                new Padding(padding: const EdgeInsets.only(top: 10.0)),
                _buildButton('Show Toast', showToastMessage),
                new Padding(padding: const EdgeInsets.only(top: 10.0)),
                _buildWarningButton('Show Warning Toast', showToastMessage2),
                new Padding(padding: const EdgeInsets.only(top: 10.0)),
                _buildErrorButton('Show Error Toast', showToastMessage3),
              ],
            )
        ),
      ),
    );
  }

  Widget _buildButton(String text, VoidCallback callBack) {
    return new Material(
      shape: new RoundedRectangleBorder(borderRadius: BorderRadius.all(new Radius.circular(100.0))),
      color: Colors.green[400],
      child: new InkWell(
        splashColor: Colors.green[900],
        borderRadius: new BorderRadius.circular(100.0),
        onTap: callBack,
        child: new Container(
            width: 250.0,
            alignment: Alignment.center,
            padding: const EdgeInsets.all(10.0),
            child: new Text(text.toUpperCase(), style: new TextStyle(color: Colors.white),)),
      ),
    );
  }

  Widget _buildWarningButton(String text, VoidCallback callBack) {
    return new Material(
      shape: new RoundedRectangleBorder(borderRadius: BorderRadius.all(new Radius.circular(100.0))),
      color: Colors.orange[400],
      child: new InkWell(
        splashColor: Colors.orange[900],
        borderRadius: new BorderRadius.circular(100.0),
        onTap: callBack,
        child: new Container(
            width: 250.0,
            alignment: Alignment.center,
            padding: const EdgeInsets.all(10.0),
            child: new Text(text.toUpperCase(), style: new TextStyle(color: Colors.white),)),
      ),
    );
  }

  Widget _buildErrorButton(String text, VoidCallback callBack) {
    return new Material(
      shape: new RoundedRectangleBorder(borderRadius: BorderRadius.all(new Radius.circular(100.0))),
      color: Colors.red[400],
      child: new InkWell(
        splashColor: Colors.red[900],
        borderRadius: new BorderRadius.circular(100.0),
        onTap: callBack,
        child: new Container(
            width: 250.0,
            alignment: Alignment.center,
            padding: const EdgeInsets.all(10.0),
            child: new Text(text.toUpperCase(), style: new TextStyle(color: Colors.white),)),
      ),
    );
  }

  Widget buildRadio() {
    return new Align(
        alignment: const Alignment(0.0, -0.2),
        child: new Column(
            children: <Widget>[
              new Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  crossAxisAlignment: CrossAxisAlignment.end,
                  children: <Widget>[
                    new Text('TOP'),
                    new Text('CENTER'),
                    new Text('BOTTOM'),
                  ]
              ),
              new Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  crossAxisAlignment: CrossAxisAlignment.end,
                  children: <Widget>[
                    new Radio<int>(
                        value: 0,
                        groupValue: radioValue,
                        onChanged: handleRadioValueChanged
                    ),
                    new Radio<int>(
                        value: 1,
                        groupValue: radioValue,
                        onChanged: handleRadioValueChanged
                    ),
                    new Radio<int>(
                        value: 2,
                        groupValue: radioValue,
                        onChanged: handleRadioValueChanged
                    )
                  ]
              ),
            ]
        )
    );
  }

  Widget _buildSwitch() {
    return new Align(
      alignment: const Alignment(0.0, -0.2),
      child: new Row(
        mainAxisSize: MainAxisSize.min,
        children: <Widget>[
          new Switch(
              value: switchValue,
              onChanged: (bool value) {
                setState(() {
                  switchValue = value;
                });
              }
          ),
        ],
      ),
    );
  }

}

Use this package as a library

1. Depend on it

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


dependencies:
  ice_tea_studio_plugins: ^0.0.8

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:ice_tea_studio_plugins/ice_tea_studio_plugins.dart';
  
Version Uploaded Documentation Archive
0.0.8 Sep 1, 2018 Go to the documentation of ice_tea_studio_plugins 0.0.8 Download ice_tea_studio_plugins 0.0.8 archive
0.0.7 Aug 18, 2018 Go to the documentation of ice_tea_studio_plugins 0.0.7 Download ice_tea_studio_plugins 0.0.7 archive
0.0.6 Aug 18, 2018 Go to the documentation of ice_tea_studio_plugins 0.0.6 Download ice_tea_studio_plugins 0.0.6 archive
0.0.5 Aug 18, 2018 Go to the documentation of ice_tea_studio_plugins 0.0.5 Download ice_tea_studio_plugins 0.0.5 archive
0.0.4 Aug 18, 2018 Go to the documentation of ice_tea_studio_plugins 0.0.4 Download ice_tea_studio_plugins 0.0.4 archive
0.0.3 Aug 18, 2018 Go to the documentation of ice_tea_studio_plugins 0.0.3 Download ice_tea_studio_plugins 0.0.3 archive
0.0.2 Aug 12, 2018 Go to the documentation of ice_tea_studio_plugins 0.0.2 Download ice_tea_studio_plugins 0.0.2 archive
0.0.1 Aug 12, 2018 Go to the documentation of ice_tea_studio_plugins 0.0.1 Download ice_tea_studio_plugins 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
69
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
70
Overall:
Weighted score of the above. [more]
78
Learn more about scoring.

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

  • Dart: 2.0.0
  • pana: 0.12.4
  • Flutter: 0.9.5

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Format lib/ice_tea_studio_plugins.dart.

Run flutter format to format lib/ice_tea_studio_plugins.dart.

Maintenance suggestions

The description is too short. (-20 points)

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. (-10 points)

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.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.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