main.dart
1.54 KB
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
import 'package:flutter/material.dart';
import 'package:get/get.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return GetMaterialApp(
title: 'Scaffold demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(),
debugShowCheckedModeBanner: false,
);
}
}
class MyHomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Test'),
centerTitle: true,
backgroundColor: Colors.green,
),
bottomNavigationBar: SizedBox(
width: double.infinity,
child: ElevatedButton(
child: Text('Tap me when Snackbar appears'),
onPressed: () {
print('This should clicked');
},
),
),
body: Center(
child: ElevatedButton(
child: Text('Open Snackbar'),
onPressed: () {
Get.snackbar(
"Snackbar Showed",
"Please click the button on BottomNavigationBar",
icon: Icon(Icons.check, color: Colors.green),
backgroundColor: Colors.white,
snackStyle: SnackStyle.floating,
borderRadius: 20,
isDismissible: false,
snackPosition: SnackPosition.bottom,
margin: EdgeInsets.fromLTRB(50, 15, 50, 15),
);
},
),
),
);
}
}