고원빈

[frontend] DashBoard 1차 작업 완료

......@@ -70,7 +70,15 @@ appbar 관련 디자인은 추후 구현 예정
### 2021-05-22
+ 약병 검색 기능 구현 중
### 2021-0523
### 2021-05-23
+ 로그인 하여 메인페이지 과정 구현 완료
+ 폴더 정리
### 2021-05-24
회원 가입 --> 허브 등록 --> 약병 등록 -->로그인 페이지로
로그인 --> 허브 리스트 --> 약병 리스트 --> 메인 페이지
+ 시나리오 수정 완료
+ 메인 페이지 데이터 출력 완료
......
......@@ -5,18 +5,46 @@ import 'package:http/http.dart' as http;
import 'package:flutter_dotenv/flutter_dotenv.dart';
import '../models/Bottle.dart';
import '../DashBoard.dart';
import '../models/Medicine.dart';
class BottleList extends StatefulWidget {
List<Bottle> bottlelist;
BottleList({Key key, this.bottlelist}) : super(key: key);
String hubid;
BottleList({Key key, this.bottlelist, this.hubid}) : super(key: key);
@override
_BottleListState createState() => _BottleListState();
}
class _BottleListState extends State<BottleList> {
Bottle _bottleinformation = new Bottle();
Medicine _medicineinformation = new Medicine();
Future<Bottle> getbottle(int index) async {
http.Response response = await http.get(Uri.encodeFull(
DotEnv().env['SERVER_URL'] +
'bottle/' +
widget.bottlelist[index].bottleId.toString()));
if (response.statusCode == 200) {
Map<String, dynamic> jsonData = jsonDecode(response.body);
print(jsonData);
_bottleinformation = Bottle.fromJson(jsonData);
}
}
Future<Bottle> getmedicine(int index) async {
http.Response medicineresponse = await http.get(Uri.encodeFull(
DotEnv().env['SERVER_URL'] +
'medicine/' +
widget.bottlelist[index].medicineId.toString()));
if (medicineresponse.statusCode == 200) {
Map<String, dynamic> data = jsonDecode(medicineresponse.body);
_medicineinformation = Medicine.fromJson(data);
}
}
Widget build(BuildContext context) {
print(widget.bottlelist);
final Size size = MediaQuery.of(context).size;
return Scaffold(
body: Container(
......@@ -62,13 +90,19 @@ class _BottleListState extends State<BottleList> {
fontWeight: FontWeight.bold),
),
trailing: Icon(Icons.arrow_forward),
onTap: () {
onTap: () async {
getbottle(index);
getmedicine(index);
print(_bottleinformation);
print(_medicineinformation);
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) => DashBoard(
pageNumber: 1,
bottleID: widget.bottlelist[index].bottleId,
bottleInformation: _bottleinformation,
medicineInformation: _medicineinformation,
),
));
}),
......
import 'package:Smart_Medicine_Box/src/screens/DashBoard.dart';
import 'package:Smart_Medicine_Box/src/screens/Homepage.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'dart:convert';
......@@ -28,7 +29,6 @@ class _DetailMedicineState extends State<DetailMedicine> {
'dosage': medicineDosageController.text
}));
print(response.statusCode);
if (response.statusCode == 200) {
return "Complete";
} else if (response.statusCode == 404) {
......@@ -210,11 +210,9 @@ class _DetailMedicineState extends State<DetailMedicine> {
context,
MaterialPageRoute(
builder: (BuildContext context) =>
DashBoard(
pageNumber: 1,
bottleID: int.parse(
widget.bottleId),
)));
HomePage(),
),
);
})
],
);
......
......@@ -95,7 +95,8 @@ class _HubListState extends State<HubList> {
builder: (BuildContext context) =>
BottleList(
bottlelist: _bottleList,
),
hubid: widget.hublist[index]
.toString()),
));
} else if (result == "Not Found") {
showDialog(
......
......@@ -117,11 +117,12 @@ class _RegisterBottleState extends State<RegisterBottle> {
MaterialPageRoute(
builder: (BuildContext context) =>
SearchMedicine(
bottleId:
medicineBottleIDController
.text,
)));
})
bottleId: medicineBottleIDController.text,
),
),
);
},
),
],
);
});
......
......@@ -8,7 +8,6 @@ import 'DetailMedicine.dart';
class SearchMedicine extends StatefulWidget {
String bottleId;
SearchMedicine({Key key, this.bottleId}) : super(key: key);
@override
_SearchMedicineState createState() => _SearchMedicineState();
......
......@@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'package:flutter_dotenv/flutter_dotenv.dart';
import '../Homepage.dart';
import 'RegsiterHub.dart';
class SignUpLocal extends StatefulWidget {
@override
......@@ -182,7 +182,7 @@ class _SignUpLocalState extends State<SignUpLocal> {
context,
MaterialPageRoute(
builder: (BuildContext context) =>
HomePage()));
RegisterHub()));
})
],
);
......
......@@ -156,6 +156,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.4"
infinite_listview:
dependency: transitive
description:
name: infinite_listview
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1+1"
intl:
dependency: "direct main"
description:
......@@ -198,6 +205,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.7"
numberpicker:
dependency: "direct main"
description:
name: numberpicker
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
page_transition:
dependency: "direct main"
description:
......
......@@ -37,6 +37,7 @@ dependencies:
cupertino_icons: ^0.1.3
http: ^0.12.0+4
flutter_dotenv: ^2.1.0
numberpicker: ^1.3.0
dev_dependencies:
flutter_test:
......