daily pastebin goal
44%
SHARE
TWEET

Untitled

a guest Jun 13th, 2018 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import 'package:flutter/material.dart';
  2.  
  3. void main() => runApp(new SnackBarDemo());
  4.  
  5. class SnackBarDemo extends StatelessWidget {
  6.   @override
  7.   Widget build(BuildContext context) {
  8.     return new MaterialApp(
  9.       title: 'SnackBar Demo',
  10.       home: new Scaffold(
  11.         appBar: new AppBar(
  12.           title: new Text('SnackBar Demo'),
  13.         ),
  14.         body: new SnackBarPage(),
  15.       ),
  16.     );
  17.   }
  18. }
  19.  
  20. class SnackBarPage extends StatelessWidget {
  21.   @override
  22.   Widget build(BuildContext context) {
  23.     return new Center(
  24.       child: new RaisedButton(
  25.         onPressed: () {
  26.           final snackBar = new SnackBar(
  27.             content: new Text('Yay! A SnackBar!'),
  28.             action: new SnackBarAction(
  29.               label: 'Undo',
  30.               onPressed: () {
  31.                 // Some code to undo the change!
  32.               },
  33.             ),
  34.           );
  35.  
  36.           // Find the Scaffold in the Widget tree and use it to show a SnackBar!
  37.           Scaffold.of(context).showSnackBar(snackBar);
  38.         },
  39.         child: new Text('Show SnackBar'),
  40.       ),
  41.     );
  42.   }
  43. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top