Skip to content

Instantly share code, notes, and snippets.

@joramkimata
Created July 13, 2020 14:23
Show Gist options
  • Save joramkimata/e4177551bf508b43a261f26146cc0c18 to your computer and use it in GitHub Desktop.
Save joramkimata/e4177551bf508b43a261f26146cc0c18 to your computer and use it in GitHub Desktop.
Toast Flutter Plugin
import 'package:flutter/material.dart';
import 'package:getwidget/getwidget.dart';
class App extends StatefulWidget {
@override
_AppState createState() => _AppState();
}
class _AppState extends State<App> {
bool _dismissable = false;
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text("ToastApp"),
),
body: GFFloatingWidget(
horizontalPosition: 0.0,
verticalPosition: 230,
child: GFToast(
alignment: Alignment.bottomCenter,
width: 380,
type: GFToastType.fullWidth,
text: 'This item already has the label “travel”',
button: GFButton(
onPressed: () {
setState(() {
_dismissable = true;
});
},
text: 'Close',
type: GFButtonType.transparent,
color: GFColors.SUCCESS,
),
autoDismiss: _dismissable,
),
//body: Text('body or any kind of widget here..'),
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment