/
container.dart
108 lines (99 loc) · 2.62 KB
/
container.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
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
import 'package:flutter/material.dart';
class ContainerScreen extends StatefulWidget {
@override
_ContainerScreen createState() => _ContainerScreen();
}
class _ContainerScreen extends State<ContainerScreen> {
var _index = 0;
final scaffoldKey = GlobalKey<ScaffoldState>();
@override
Widget build(BuildContext context) {
var appBar = AppBar(
title: const Text("Container"),
actions: [
IconButton(
icon: Icon(Icons.more_vert),
onPressed: () {
scaffoldKey.currentState?.openEndDrawer();
},
),
],
);
var drawer = Drawer(
child: ListView(
children: [
Container(
color: Colors.red,
height: 50,
child: Center(
child: Text(
"抽屜選單",
style: TextStyle(
color: Colors.white,
fontSize: 20,
),
),
),
),
ListTile(
leading: Icon(Icons.exit_to_app),
title: Text('EXIT'),
onTap: () => Navigator.pop(context),
),
],
),
);
var body = Column(
children: [
Center(
child: Container(
constraints: BoxConstraints.tightFor(
width: 200.0,
height: 150.0,
),
padding: EdgeInsets.all(10.0),
margin: const EdgeInsets.all(20.0),
decoration: BoxDecoration(
color: Color(0xFFFFE3D4),
border: Border.all(
color: Color(0xFFffd700),
width: 2,
),
borderRadius: BorderRadius.circular(4),
),
transform: Matrix4.rotationZ(0.1),
child: Image.asset(
"assets/images/xFrame.jpg",
),
),
),
],
);
var bottomNavigationBar = BottomNavigationBar(
items: [
BottomNavigationBarItem(icon: Icon(Icons.home_outlined), label: "首頁"),
BottomNavigationBarItem(
icon: Icon(Icons.add_a_photo_outlined), label: '相機'),
BottomNavigationBarItem(
icon: Icon(Icons.bug_report_outlined), label: "bug"),
],
currentIndex: _index,
onTap: (index) {
setState(() {
_index = index;
});
if (index == 0) {
Navigator.pop(context);
}
},
);
return Scaffold(
key: scaffoldKey,
appBar: appBar,
drawer: drawer,
endDrawer: drawer,
body: body,
bottomNavigationBar: bottomNavigationBar,
);
}
}