DEV Community

Cover image for Flutter Toast Widget
GetWidget
GetWidget

Posted on • Updated on

Flutter Toast Widget

Does your Flutter app have a Toast widget then why not try our GFToast widget component to build a nice Flutter Toast Widget?

Alt Text

What is the use of Toast Widget in the Flutter App?

It Could be useful to briefly inform to your app users when certain actions take place. For example, when a user swipes away a message in a list, you might want to inform them that the message has been deleted. You might even want to give them an option to undo the action. In short, this widget component has been using to display quick warning or error messages.

Usage

GFToast should be wrapped inside the GFFloating Widget. The child of the GFFloatingWidget takes GFToast as its argument and the body takes any kind of widgets. The simple code is as shown below.

import 'package:getwidget/getwidget.dart';

 return Scaffold(
   body:GFFloatingWidget(
     child:GFToast(
     text: 'This item already has the label “travel”',
   ),
   body:Text('body or any kind of widget here..')
 )
)
Enter fullscreen mode Exit fullscreen mode

Toast with Call to Action Button

Alt Text

import 'package:getwidget/getwidget.dart';

GFToast(
  text:'This item already has the label “travel”',
  button: GFButton(
     onPressed: () {},
     text: 'Close',
     type: GFButtonType.transparent,
     color: GFColor.success,
   ),
   autoDismiss: false,
),
Enter fullscreen mode Exit fullscreen mode

Read More GFToast Widget: https://docs.getwidget.dev/gf-toast

If you are new then you can start from Getting Start.

If you will face any issue or have any suggestions then get connected on GitHub: GetWidget GitHub

Top comments (0)