-
Notifications
You must be signed in to change notification settings - Fork 4
/
toast_demo.dart
43 lines (41 loc) · 1.2 KB
/
toast_demo.dart
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
import 'package:flutter/material.dart';
import 'package:flutter_ui/material.dart';
class Toast extends StatelessWidget {
@override
Widget build(BuildContext context) {
void _pressed(String message, MPosition position) {
MToast.show(msg: message, position: position, length: MToastLength.SHORT);
}
return Scaffold(
appBar: AppBar(
title: Text('toast'),
),
body: Center(
child: GridView.count(
crossAxisCount: 1,
padding: EdgeInsets.all(10),
mainAxisSpacing: 5,
crossAxisSpacing: 5,
childAspectRatio: 8 / 1,
children: <Widget>[
RaisedButton(
child: Text('top toast'),
onPressed: () => _pressed('top toast', MPosition.TOP),
),
RaisedButton(
child: Text('center toast'),
onPressed: () => _pressed('center toast', MPosition.CENTER),
),
RaisedButton(
child: Text('bottom toast'),
onPressed: () => _pressed('bottom toast', MPosition.BOTTOM),
),
RaisedButton(
child: Text('cancel'),
onPressed: () => MToast.cancel(),
)
],
)),
);
}
}