Skip to content

Commit

Permalink
Reverted to old code and also contains new code
Browse files Browse the repository at this point in the history
  • Loading branch information
ponnamkarthik committed Jul 16, 2020
1 parent 4f363e7 commit e77f442
Show file tree
Hide file tree
Showing 43 changed files with 2,186 additions and 200 deletions.
147 changes: 116 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,116 @@

# [fluttertoast](https://pub.dartlang.org/packages/fluttertoast)

Toast Library for Flutter

> Supported Platforms
>
> - ALL
## Notice
Toast Library for Flutter

Now this toast library supports two kinds of toast messages one which requires `BuildContext` other with No `BuildContext`

## Toast with no context

> Supported Platforms
>
> - Android
> - IOS
> - Web (Uses [Toastify-JS](https://github.com/apvarun/toastify-js))
Please check readme before you update your package
This one has limited features and no control over UI

This update has changes complete plugin to new one

Previously this plugin used to interact with native platform which now removed.
## Toast Which requires BuildContext

## Features
> Supported Platforms
>
> - ALL
1. Full Controll of the Toast
2. Toasts will be queued
3. Remove a toast
4. Clear the queue

## How to Use

```yaml
# add this line to your dependencies
fluttertoast: ^6.0.0
```
```dart
import 'package:fluttertoast/fluttertoast.dart';
```


## How to Use

```yaml
# add this line to your dependencies
fluttertoast: ^7.0.0
```
```dart
import 'package:fluttertoast/fluttertoast.dart';
```

## Toast with No Build Context

```dart
FlutterToast.showToast(
msg: "This is Center Short Toast",
toastLength: Toast.LENGTH_SHORT,
gravity: ToastGravity.CENTER,
timeInSecForIosWeb: 1,
backgroundColor: Colors.red,
textColor: Colors.white,
fontSize: 16.0
);
```

| property | description | default |
| --------------- | ------------------------------------------------------------------ |------------|
| msg | String (Not Null)(required) |required |
| toastLength | Toast.LENGTH_SHORT or Toast.LENGTH_LONG (optional) |Toast.LENGTH_SHORT |
| gravity | ToastGravity.TOP (or) ToastGravity.CENTER (or) ToastGravity.BOTTOM (Web Only supports top, bottom) | ToastGravity.BOTTOM |
| timeInSecForIosWeb | int (only for ios) | 1 |
| backgroundColor | Colors.red |Colors.black |
| textcolor | Colors.white |Colors.white |
| fontSize | 16.0 (float) | 16.0 |
| webShowClose | false (bool) | false |
| webBgColor | String (hex Color) | linear-gradient(to right, #00b09b, #96c93d) |
| webPosition | String (`left`, `center` or `right`) | right |

### To cancel all the toasts call

```dart
FlutterToast.cancel()
```

### Custom Toast For Android

Create a file named `toast_custom.xml` in your project `app/res/layout` folder and do custom styling

```xml
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginStart="50dp"
android:background="@drawable/corner"
android:layout_marginEnd="50dp">

<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#CC000000"
android:paddingStart="16dp"
android:paddingTop="10dp"
android:paddingEnd="16dp"
android:paddingBottom="10dp"
android:textStyle="bold"
android:textColor="#FFFFFF"
tools:text="Toast should be short." />
</FrameLayout>
```

## Toast with BuildContext

```dart
FlutterToast flutterToast;
FToast fToast;
@override
void initState() {
super.initState();
flutterToast = FlutterToast(context);
fToast = FToast(context);
}
_showToast() {
Expand All @@ -62,7 +133,7 @@ _showToast() {
);
flutterToast.showToast(
fToast.showToast(
child: toast,
gravity: ToastGravity.BOTTOM,
toastDuration: Duration(seconds: 2),
Expand All @@ -84,15 +155,29 @@ For more details check `example` project

```dart
// To remove present shwoing toast
flutterToast.removeCustomToast()
fToast.removeCustomToast()
// To clear the queue
flutterToast.removeQueuedCustomToasts();
fToast.removeQueuedCustomToasts();
```

## Preview Images (No BuildContext)

<img src="https://raw.githubusercontent.com/ponnamkarthik/FlutterToast/master/screenshot/1.png" width="320px" />
<img src="https://raw.githubusercontent.com/ponnamkarthik/FlutterToast/master/screenshot/2.png" width="320px" />
<img src="https://raw.githubusercontent.com/ponnamkarthik/FlutterToast/master/screenshot/3.png" width="320px" />
<img src="https://raw.githubusercontent.com/ponnamkarthik/FlutterToast/master/screenshot/4.png" width="320px" />

## Preview Images (BuildContext)

## Preview Images

<img src="https://raw.githubusercontent.com/PonnamKarthik/FlutterToast/master/screenshot/1.png" width="320px" />
<img src="https://raw.githubusercontent.com/ponnamkarthik/FlutterToast/master/screenshot/5.jpg" width="320px" />


## If you need any features suggest

...


## Buy Me a Coffee

## If you need any features suggest
<a href="https://www.buymeacoffee.com/karthikponnam" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" height="41" width="174"></a>
8 changes: 8 additions & 0 deletions android/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures
26 changes: 26 additions & 0 deletions android/.idea/$CACHE_FILE$

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions android/.idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added android/.idea/caches/build_file_checksums.ser
Binary file not shown.
116 changes: 116 additions & 0 deletions android/.idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions android/.idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions android/.idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit e77f442

Please sign in to comment.