Showing
3 changed files
with
147 additions
and
94 deletions
... | @@ -23,3 +23,7 @@ | ... | @@ -23,3 +23,7 @@ |
23 | ### 2021-05-09 | 23 | ### 2021-05-09 |
24 | + Appbar 기능 구현 | 24 | + Appbar 기능 구현 |
25 | appbar 관련 디자인은 추후 구현 예정 | 25 | appbar 관련 디자인은 추후 구현 예정 |
26 | + | ||
27 | +### 2021-05-10 | ||
28 | ++ Appbar 디자인 변경 및 Navgation Bar 구현 | ||
29 | ++ Setting은 별도의 페이지로 구성 | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -5,6 +5,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; | ... | @@ -5,6 +5,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; |
5 | 5 | ||
6 | class DashBoard extends StatefulWidget { | 6 | class DashBoard extends StatefulWidget { |
7 | int pageNumber = 1; | 7 | int pageNumber = 1; |
8 | + DashBoard({Key key, this.pageNumber}) : super(key: key); | ||
8 | 9 | ||
9 | @override | 10 | @override |
10 | _DashBoardState createState() => _DashBoardState(); | 11 | _DashBoardState createState() => _DashBoardState(); |
... | @@ -16,131 +17,179 @@ class _DashBoardState extends State<DashBoard> { | ... | @@ -16,131 +17,179 @@ class _DashBoardState extends State<DashBoard> { |
16 | Widget build(BuildContext context) { | 17 | Widget build(BuildContext context) { |
17 | _selectedIndex = widget.pageNumber; | 18 | _selectedIndex = widget.pageNumber; |
18 | final Size size = MediaQuery.of(context).size; | 19 | final Size size = MediaQuery.of(context).size; |
20 | + | ||
21 | + var _tabs = [ | ||
22 | + ineerInformationpage(context), | ||
23 | + mainpage(context), | ||
24 | + outerInformationpage(context), | ||
25 | + setting(context), | ||
26 | + ]; | ||
27 | + | ||
19 | return Scaffold( | 28 | return Scaffold( |
20 | backgroundColor: Color(0xffe5f4ff), | 29 | backgroundColor: Color(0xffe5f4ff), |
21 | - appBar: PreferredSize( | 30 | + appBar: AppBar( |
22 | - preferredSize: Size.fromHeight(65), | 31 | + iconTheme: IconThemeData(color: Colors.black), |
23 | - child: Container( | ||
24 | - padding: const EdgeInsets.fromLTRB(0, 10, 0, 0), | ||
25 | - color: Colors.white, | ||
26 | - child: AppBar( | ||
27 | backgroundColor: Colors.white, | 32 | backgroundColor: Colors.white, |
28 | - actions: <Widget>[ | 33 | + title: Text( |
29 | - Container( | 34 | + 'Medicine Box', |
30 | - width: size.width * 0.25, | ||
31 | - child: FlatButton( | ||
32 | - onPressed: () => { | ||
33 | - _onItemTapped(0), | ||
34 | - }, | ||
35 | - child: Stack( | ||
36 | - children: <Widget>[ | ||
37 | - Container( | ||
38 | - margin: EdgeInsets.fromLTRB(0, 4, 0, 0), | ||
39 | - padding: EdgeInsets.fromLTRB(5, 0, 5, 5), | ||
40 | - child: Text( | ||
41 | - '임시1', | ||
42 | style: TextStyle( | 35 | style: TextStyle( |
43 | - color: widget.pageNumber == 0 | 36 | + color: Colors.black, |
44 | - ? Color(0xff1674f6) | 37 | + fontSize: 20, |
45 | - : null, | ||
46 | - fontSize: 14, | ||
47 | fontFamily: 'Noto', | 38 | fontFamily: 'Noto', |
48 | fontWeight: FontWeight.bold), | 39 | fontWeight: FontWeight.bold), |
49 | ), | 40 | ), |
41 | + actions: [ | ||
42 | + IconButton( | ||
43 | + icon: Icon( | ||
44 | + Icons.settings, | ||
45 | + color: Colors.black, | ||
50 | ), | 46 | ), |
47 | + onPressed: () {}, | ||
48 | + ) | ||
51 | ], | 49 | ], |
52 | ), | 50 | ), |
51 | + drawer: Drawer( | ||
52 | + child: ListView( | ||
53 | + children: [ | ||
54 | + DrawerHeader( | ||
55 | + child: Text('Drawer Header'), | ||
56 | + decoration: BoxDecoration( | ||
57 | + color: Colors.blue, | ||
53 | ), | 58 | ), |
54 | ), | 59 | ), |
55 | - Container( | 60 | + ListTile( |
56 | - width: size.width * 0.25, | 61 | + title: Text('Test 1'), |
57 | - child: FlatButton( | 62 | + onTap: () {}, |
58 | - onPressed: () => { | ||
59 | - _onItemTapped(1), | ||
60 | - }, | ||
61 | - child: Stack( | ||
62 | - children: <Widget>[ | ||
63 | - Container( | ||
64 | - margin: EdgeInsets.fromLTRB(0, 4, 0, 0), | ||
65 | - padding: EdgeInsets.fromLTRB(5, 0, 5, 5), | ||
66 | - child: Text( | ||
67 | - '임시2', | ||
68 | - style: TextStyle( | ||
69 | - color: widget.pageNumber == 1 | ||
70 | - ? Color(0xff1674f6) | ||
71 | - : null, | ||
72 | - fontSize: 14, | ||
73 | - fontFamily: 'Noto', | ||
74 | - fontWeight: FontWeight.bold), | ||
75 | ), | 63 | ), |
64 | + ListTile( | ||
65 | + title: Text('Test 2'), | ||
66 | + onTap: () {}, | ||
76 | ), | 67 | ), |
77 | - ], | 68 | + ListTile( |
69 | + title: Text('Test 3'), | ||
70 | + onTap: () {}, | ||
78 | ), | 71 | ), |
72 | + ], | ||
79 | ), | 73 | ), |
80 | ), | 74 | ), |
81 | - Container( | 75 | + body: _tabs[_selectedIndex], |
82 | - width: size.width * 0.25, | 76 | + bottomNavigationBar: BottomNavigationBar( |
83 | - child: FlatButton( | 77 | + type: BottomNavigationBarType.fixed, |
84 | - onPressed: () => { | 78 | + backgroundColor: Colors.grey, |
85 | - _onItemTapped(2), | 79 | + selectedItemColor: Colors.blue, |
80 | + unselectedItemColor: Colors.white.withOpacity(.60), | ||
81 | + selectedFontSize: 14, | ||
82 | + unselectedFontSize: 14, | ||
83 | + currentIndex: _selectedIndex, | ||
84 | + onTap: (int index) => { | ||
85 | + setState(() { | ||
86 | + _onItemTapped(index); | ||
87 | + }) | ||
86 | }, | 88 | }, |
87 | - child: Stack( | 89 | + items: [ |
88 | - children: <Widget>[ | 90 | + BottomNavigationBarItem(icon: Icon(Icons.favorite), label: 'Inner'), |
89 | - Container( | 91 | + BottomNavigationBarItem(icon: Icon(Icons.home), label: 'Home'), |
90 | - margin: EdgeInsets.fromLTRB(0, 4, 0, 0), | 92 | + BottomNavigationBarItem( |
91 | - padding: EdgeInsets.fromLTRB(5, 0, 5, 5), | 93 | + label: 'Outer', |
92 | - child: Text( | 94 | + icon: Icon(Icons.favorite), |
93 | - '임시3', | 95 | + ) |
94 | - style: TextStyle( | ||
95 | - color: widget.pageNumber == 2 | ||
96 | - ? Color(0xff1674f6) | ||
97 | - : null, | ||
98 | - fontSize: 14, | ||
99 | - fontFamily: 'Noto', | ||
100 | - fontWeight: FontWeight.bold), | ||
101 | - ), | ||
102 | - ), | ||
103 | ], | 96 | ], |
104 | ), | 97 | ), |
98 | + ); | ||
99 | + } | ||
100 | + | ||
101 | + void _onItemTapped(int index) { | ||
102 | + setState(() { | ||
103 | + widget.pageNumber = index; | ||
104 | + }); | ||
105 | + } | ||
106 | +} | ||
107 | + | ||
108 | +Widget mainpage(BuildContext context) { | ||
109 | + final Size size = MediaQuery.of(context).size; | ||
110 | + /* | ||
111 | + Main 화면 | ||
112 | + 약의 정보를 가져와서 출력을 하는 곳 | ||
113 | + 유저 이메일 | ||
114 | + 약 이름 | ||
115 | + 약 제조사 | ||
116 | + */ | ||
117 | + return Scaffold( | ||
118 | + backgroundColor: Color(0xffe5f4ff), | ||
119 | + body: Container( | ||
120 | + height: size.height * 0.6, | ||
121 | + margin: EdgeInsets.fromLTRB(0, 30, 0, 0), | ||
122 | + padding: EdgeInsets.fromLTRB(5, 0, 5, 5), | ||
123 | + decoration: BoxDecoration( | ||
124 | + border: Border.all(), | ||
125 | + borderRadius: BorderRadius.all( | ||
126 | + Radius.circular(4.0) // <--- border radius here | ||
105 | ), | 127 | ), |
106 | ), | 128 | ), |
107 | - Container( | 129 | + child: Column( |
108 | - width: size.width * 0.25, | 130 | + crossAxisAlignment: CrossAxisAlignment.center, |
109 | - child: FlatButton( | ||
110 | - onPressed: () => { | ||
111 | - _onItemTapped(3), | ||
112 | - }, | ||
113 | - child: Stack( | ||
114 | children: <Widget>[ | 131 | children: <Widget>[ |
115 | - Column( | ||
116 | - mainAxisAlignment: MainAxisAlignment.center, | ||
117 | - children: [ | ||
118 | Container( | 132 | Container( |
119 | - margin: EdgeInsets.fromLTRB(0, 4, 0, 0), | 133 | + margin: EdgeInsets.fromLTRB(0, 30, 0, 0), |
120 | - padding: EdgeInsets.fromLTRB(5, 0, 5, 5), | 134 | + height: size.height * 0.1, |
121 | - child: Image.asset( | 135 | + decoration: BoxDecoration( |
122 | - 'images/setting.png', | 136 | + border: Border.all(), |
123 | - color: widget.pageNumber == 3 | 137 | + borderRadius: BorderRadius.all( |
124 | - ? Color(0xff1674f6) | 138 | + Radius.circular(4.0) // <--- border radius here |
125 | - : null, | ||
126 | ), | 139 | ), |
127 | ), | 140 | ), |
128 | - ], | ||
129 | - ) | ||
130 | - ], | ||
131 | ), | 141 | ), |
142 | + Container( | ||
143 | + margin: EdgeInsets.fromLTRB(0, 30, 0, 0), | ||
144 | + height: size.height * 0.1, | ||
145 | + decoration: BoxDecoration( | ||
146 | + border: Border.all(), | ||
147 | + borderRadius: BorderRadius.all( | ||
148 | + Radius.circular(4.0) // <--- border radius here | ||
132 | ), | 149 | ), |
133 | ), | 150 | ), |
134 | - ], | ||
135 | ), | 151 | ), |
152 | + ], | ||
136 | ), | 153 | ), |
137 | ), | 154 | ), |
138 | ); | 155 | ); |
139 | - } | 156 | +} |
140 | 157 | ||
141 | - void _onItemTapped(int index) { | 158 | +Widget ineerInformationpage(BuildContext context) { |
142 | - setState(() { | 159 | + /* |
143 | - widget.pageNumber = index; | 160 | + 약병 내부 정보 화면 |
144 | - }); | 161 | + 약병 내부 온도 약병 내부 습도 약병 내부 현황 최근 계폐 시간 을 표시 |
145 | - } | 162 | + 맨처음 Inside Information 출력 |
163 | + | ||
164 | + 이거 고민이 그냥 저기에 있는 대로 할것인지 아니면 appbar를 저렇게 할 것인지 | ||
165 | + | ||
166 | + 저거는 container을 잘 성정 하고 text를 설정 해야 할 듯 | ||
167 | + | ||
168 | + | ||
169 | + */ | ||
170 | + return Scaffold( | ||
171 | + backgroundColor: Colors.white, | ||
172 | + ); | ||
173 | +} | ||
174 | + | ||
175 | +Widget outerInformationpage(BuildContext context) { | ||
176 | + return Scaffold( | ||
177 | + backgroundColor: Colors.blue, | ||
178 | + ); | ||
179 | +} | ||
180 | + | ||
181 | +Widget setting(BuildContext context) { | ||
182 | + return Scaffold( | ||
183 | + backgroundColor: Colors.green, | ||
184 | + ); | ||
146 | } | 185 | } |
186 | + | ||
187 | +/* | ||
188 | +bottom navbar로 이동 | ||
189 | +appbar로는 저거 만들어서 사용 | ||
190 | +설정 smartmedicine box를 app bar 로 구현 | ||
191 | +이건 우선 작업 후 추후 작업 | ||
192 | + | ||
193 | + | ||
194 | + | ||
195 | +*/ | ... | ... |
... | @@ -173,7 +173,7 @@ class _SignInPageState extends State<SignInPage> { | ... | @@ -173,7 +173,7 @@ class _SignInPageState extends State<SignInPage> { |
173 | context, | 173 | context, |
174 | MaterialPageRoute( | 174 | MaterialPageRoute( |
175 | builder: (BuildContext context) => | 175 | builder: (BuildContext context) => |
176 | - DashBoard(), | 176 | + DashBoard(pageNumber: 0), |
177 | )); | 177 | )); |
178 | } | 178 | } |
179 | } | 179 | } | ... | ... |
-
Please register or login to post a comment