1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | import 'package:flutter/material.dart'; import 'package:fluttertoast/fluttertoast.dart'; void main() => runApp(MyApp()); class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( title: 'My App', theme: ThemeData(primarySwatch: Colors.amber), debugShowCheckedModeBanner: false, home: MyPage(), ); } } class MyPage extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( body: MySnackBar(), appBar: AppBar( title: Text('appBar Title'), centerTitle: true, elevation: 0.0, actions: [ IconButton( icon: Icon(Icons.shopping_cart), onPressed: () { print('clicked search'); }, ), IconButton( icon: Icon(Icons.search), onPressed: () { print('clicked search'); }, ), ], ), drawer: Drawer( child: ListView( padding: EdgeInsets.zero, children: [ UserAccountsDrawerHeader( currentAccountPicture: CircleAvatar( backgroundImage: AssetImage('assets/workspace-vector-free-icon-set-36.png'), backgroundColor: Colors.white, ), otherAccountsPictures: [ CircleAvatar( backgroundImage: AssetImage('assets/workspace-vector-free-icon-set-30.png'), backgroundColor: Colors.white, ) ], accountName: Text('Gonpress'), accountEmail: Text('gonpress@naver.com'), onDetailsPressed: () { print('clicked~~'); }, decoration: BoxDecoration( color: Colors.amber[200], borderRadius: BorderRadius.only( bottomLeft: Radius.circular(20.0), bottomRight: Radius.circular(20.0), )), ), ListTile( leading: Icon(Icons.home, color: Colors.grey[850]), title: Text('Home'), onTap: () { print('Home is Clicked'); }, trailing: Icon(Icons.add, color: Colors.grey[550]), ), ListTile( leading: Icon(Icons.settings, color: Colors.grey[850]), title: Text('Setting'), onTap: () { print('Setting is Clicked'); }, trailing: Icon(Icons.add, color: Colors.grey[550]), ), ListTile( leading: Icon(Icons.question_answer, color: Colors.grey[850]), title: Text('Q&A'), onTap: () { print('Q&A is Clicked'); }, trailing: Icon(Icons.add, color: Colors.grey[550]), ), ], )), ); } } class MySnackBar extends StatelessWidget { @override Widget build(BuildContext context) { return Center( child: Row( children: [ SizedBox(width: 30), RaisedButton( child: Text('SnackBar Message'), color: Colors.amber, onPressed: () { Scaffold.of(context).showSnackBar( SnackBar( content: Text( 'Hellow ~~', textAlign: TextAlign.center, style: TextStyle( color: Colors.white, ), ), backgroundColor: Colors.teal, duration: Duration(milliseconds: 1000), ), ); }, ), SizedBox(width: 40), RaisedButton( child: Text('Toast Message'), color: Colors.amber[900], onPressed: () { flutterToast(); }, ), ], )); } } void flutterToast() { Fluttertoast.showToast( msg: 'Hello ~ This is Flutter Toast Message. Can you see the Text?', gravity: ToastGravity.BOTTOM, backgroundColor: Colors.greenAccent, fontSize: 20, textColor: Colors.white, toastLength: Toast.LENGTH_LONG); } | cs |