고원빈

[frontend] DashBoard 1차 작업 완료

...@@ -70,7 +70,15 @@ appbar 관련 디자인은 추후 구현 예정 ...@@ -70,7 +70,15 @@ appbar 관련 디자인은 추후 구현 예정
70 ### 2021-05-22 70 ### 2021-05-22
71 + 약병 검색 기능 구현 중 71 + 약병 검색 기능 구현 중
72 72
73 -### 2021-0523 73 +### 2021-05-23
74 + 로그인 하여 메인페이지 과정 구현 완료 74 + 로그인 하여 메인페이지 과정 구현 완료
75 + 폴더 정리 75 + 폴더 정리
76 76
77 +
78 +### 2021-05-24
79 +회원 가입 --> 허브 등록 --> 약병 등록 -->로그인 페이지로
80 +로그인 --> 허브 리스트 --> 약병 리스트 --> 메인 페이지
81 ++ 시나리오 수정 완료
82 ++ 메인 페이지 데이터 출력 완료
83 +
84 +
......
...@@ -5,18 +5,46 @@ import 'package:http/http.dart' as http; ...@@ -5,18 +5,46 @@ import 'package:http/http.dart' as http;
5 import 'package:flutter_dotenv/flutter_dotenv.dart'; 5 import 'package:flutter_dotenv/flutter_dotenv.dart';
6 import '../models/Bottle.dart'; 6 import '../models/Bottle.dart';
7 import '../DashBoard.dart'; 7 import '../DashBoard.dart';
8 +import '../models/Medicine.dart';
8 9
9 class BottleList extends StatefulWidget { 10 class BottleList extends StatefulWidget {
10 List<Bottle> bottlelist; 11 List<Bottle> bottlelist;
11 - BottleList({Key key, this.bottlelist}) : super(key: key); 12 + String hubid;
13 + BottleList({Key key, this.bottlelist, this.hubid}) : super(key: key);
12 14
13 @override 15 @override
14 _BottleListState createState() => _BottleListState(); 16 _BottleListState createState() => _BottleListState();
15 } 17 }
16 18
17 class _BottleListState extends State<BottleList> { 19 class _BottleListState extends State<BottleList> {
20 + Bottle _bottleinformation = new Bottle();
21 + Medicine _medicineinformation = new Medicine();
22 +
23 + Future<Bottle> getbottle(int index) async {
24 + http.Response response = await http.get(Uri.encodeFull(
25 + DotEnv().env['SERVER_URL'] +
26 + 'bottle/' +
27 + widget.bottlelist[index].bottleId.toString()));
28 +
29 + if (response.statusCode == 200) {
30 + Map<String, dynamic> jsonData = jsonDecode(response.body);
31 + print(jsonData);
32 + _bottleinformation = Bottle.fromJson(jsonData);
33 + }
34 + }
35 +
36 + Future<Bottle> getmedicine(int index) async {
37 + http.Response medicineresponse = await http.get(Uri.encodeFull(
38 + DotEnv().env['SERVER_URL'] +
39 + 'medicine/' +
40 + widget.bottlelist[index].medicineId.toString()));
41 + if (medicineresponse.statusCode == 200) {
42 + Map<String, dynamic> data = jsonDecode(medicineresponse.body);
43 + _medicineinformation = Medicine.fromJson(data);
44 + }
45 + }
46 +
18 Widget build(BuildContext context) { 47 Widget build(BuildContext context) {
19 - print(widget.bottlelist);
20 final Size size = MediaQuery.of(context).size; 48 final Size size = MediaQuery.of(context).size;
21 return Scaffold( 49 return Scaffold(
22 body: Container( 50 body: Container(
...@@ -62,13 +90,19 @@ class _BottleListState extends State<BottleList> { ...@@ -62,13 +90,19 @@ class _BottleListState extends State<BottleList> {
62 fontWeight: FontWeight.bold), 90 fontWeight: FontWeight.bold),
63 ), 91 ),
64 trailing: Icon(Icons.arrow_forward), 92 trailing: Icon(Icons.arrow_forward),
65 - onTap: () { 93 + onTap: () async {
94 + getbottle(index);
95 + getmedicine(index);
96 + print(_bottleinformation);
97 + print(_medicineinformation);
98 +
66 Navigator.push( 99 Navigator.push(
67 context, 100 context,
68 MaterialPageRoute( 101 MaterialPageRoute(
69 builder: (BuildContext context) => DashBoard( 102 builder: (BuildContext context) => DashBoard(
70 pageNumber: 1, 103 pageNumber: 1,
71 - bottleID: widget.bottlelist[index].bottleId, 104 + bottleInformation: _bottleinformation,
105 + medicineInformation: _medicineinformation,
72 ), 106 ),
73 )); 107 ));
74 }), 108 }),
......
1 import 'package:Smart_Medicine_Box/src/screens/DashBoard.dart'; 1 import 'package:Smart_Medicine_Box/src/screens/DashBoard.dart';
2 +import 'package:Smart_Medicine_Box/src/screens/Homepage.dart';
2 import 'package:flutter/material.dart'; 3 import 'package:flutter/material.dart';
3 import 'package:flutter/cupertino.dart'; 4 import 'package:flutter/cupertino.dart';
4 import 'dart:convert'; 5 import 'dart:convert';
...@@ -28,7 +29,6 @@ class _DetailMedicineState extends State<DetailMedicine> { ...@@ -28,7 +29,6 @@ class _DetailMedicineState extends State<DetailMedicine> {
28 'dosage': medicineDosageController.text 29 'dosage': medicineDosageController.text
29 })); 30 }));
30 31
31 - print(response.statusCode);
32 if (response.statusCode == 200) { 32 if (response.statusCode == 200) {
33 return "Complete"; 33 return "Complete";
34 } else if (response.statusCode == 404) { 34 } else if (response.statusCode == 404) {
...@@ -210,11 +210,9 @@ class _DetailMedicineState extends State<DetailMedicine> { ...@@ -210,11 +210,9 @@ class _DetailMedicineState extends State<DetailMedicine> {
210 context, 210 context,
211 MaterialPageRoute( 211 MaterialPageRoute(
212 builder: (BuildContext context) => 212 builder: (BuildContext context) =>
213 - DashBoard( 213 + HomePage(),
214 - pageNumber: 1, 214 + ),
215 - bottleID: int.parse( 215 + );
216 - widget.bottleId),
217 - )));
218 }) 216 })
219 ], 217 ],
220 ); 218 );
......
...@@ -95,7 +95,8 @@ class _HubListState extends State<HubList> { ...@@ -95,7 +95,8 @@ class _HubListState extends State<HubList> {
95 builder: (BuildContext context) => 95 builder: (BuildContext context) =>
96 BottleList( 96 BottleList(
97 bottlelist: _bottleList, 97 bottlelist: _bottleList,
98 - ), 98 + hubid: widget.hublist[index]
99 + .toString()),
99 )); 100 ));
100 } else if (result == "Not Found") { 101 } else if (result == "Not Found") {
101 showDialog( 102 showDialog(
......
...@@ -117,11 +117,12 @@ class _RegisterBottleState extends State<RegisterBottle> { ...@@ -117,11 +117,12 @@ class _RegisterBottleState extends State<RegisterBottle> {
117 MaterialPageRoute( 117 MaterialPageRoute(
118 builder: (BuildContext context) => 118 builder: (BuildContext context) =>
119 SearchMedicine( 119 SearchMedicine(
120 - bottleId: 120 + bottleId: medicineBottleIDController.text,
121 - medicineBottleIDController 121 + ),
122 - .text, 122 + ),
123 - ))); 123 + );
124 - }) 124 + },
125 + ),
125 ], 126 ],
126 ); 127 );
127 }); 128 });
......
...@@ -8,7 +8,6 @@ import 'DetailMedicine.dart'; ...@@ -8,7 +8,6 @@ import 'DetailMedicine.dart';
8 8
9 class SearchMedicine extends StatefulWidget { 9 class SearchMedicine extends StatefulWidget {
10 String bottleId; 10 String bottleId;
11 -
12 SearchMedicine({Key key, this.bottleId}) : super(key: key); 11 SearchMedicine({Key key, this.bottleId}) : super(key: key);
13 @override 12 @override
14 _SearchMedicineState createState() => _SearchMedicineState(); 13 _SearchMedicineState createState() => _SearchMedicineState();
......
...@@ -3,7 +3,7 @@ import 'package:flutter/material.dart'; ...@@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
3 import 'package:http/http.dart' as http; 3 import 'package:http/http.dart' as http;
4 import 'package:flutter_dotenv/flutter_dotenv.dart'; 4 import 'package:flutter_dotenv/flutter_dotenv.dart';
5 5
6 -import '../Homepage.dart'; 6 +import 'RegsiterHub.dart';
7 7
8 class SignUpLocal extends StatefulWidget { 8 class SignUpLocal extends StatefulWidget {
9 @override 9 @override
...@@ -182,7 +182,7 @@ class _SignUpLocalState extends State<SignUpLocal> { ...@@ -182,7 +182,7 @@ class _SignUpLocalState extends State<SignUpLocal> {
182 context, 182 context,
183 MaterialPageRoute( 183 MaterialPageRoute(
184 builder: (BuildContext context) => 184 builder: (BuildContext context) =>
185 - HomePage())); 185 + RegisterHub()));
186 }) 186 })
187 ], 187 ],
188 ); 188 );
......
...@@ -156,6 +156,13 @@ packages: ...@@ -156,6 +156,13 @@ packages:
156 url: "https://pub.dartlang.org" 156 url: "https://pub.dartlang.org"
157 source: hosted 157 source: hosted
158 version: "3.1.4" 158 version: "3.1.4"
159 + infinite_listview:
160 + dependency: transitive
161 + description:
162 + name: infinite_listview
163 + url: "https://pub.dartlang.org"
164 + source: hosted
165 + version: "1.0.1+1"
159 intl: 166 intl:
160 dependency: "direct main" 167 dependency: "direct main"
161 description: 168 description:
...@@ -198,6 +205,13 @@ packages: ...@@ -198,6 +205,13 @@ packages:
198 url: "https://pub.dartlang.org" 205 url: "https://pub.dartlang.org"
199 source: hosted 206 source: hosted
200 version: "0.9.7" 207 version: "0.9.7"
208 + numberpicker:
209 + dependency: "direct main"
210 + description:
211 + name: numberpicker
212 + url: "https://pub.dartlang.org"
213 + source: hosted
214 + version: "1.3.0"
201 page_transition: 215 page_transition:
202 dependency: "direct main" 216 dependency: "direct main"
203 description: 217 description:
......
...@@ -37,6 +37,7 @@ dependencies: ...@@ -37,6 +37,7 @@ dependencies:
37 cupertino_icons: ^0.1.3 37 cupertino_icons: ^0.1.3
38 http: ^0.12.0+4 38 http: ^0.12.0+4
39 flutter_dotenv: ^2.1.0 39 flutter_dotenv: ^2.1.0
40 + numberpicker: ^1.3.0
40 41
41 dev_dependencies: 42 dev_dependencies:
42 flutter_test: 43 flutter_test:
......