고원빈

[frontend] 2021-05-23

......@@ -67,3 +67,5 @@ appbar 관련 디자인은 추후 구현 예정
### 2021-05-21
+ 약병 ,허브 리스트 출력 구현
### 2021-05-22
+ 약병 검색 기능 구현 중
\ No newline at end of file
......
......@@ -16,6 +16,7 @@ class BottleList extends StatefulWidget {
class _BottleListState extends State<BottleList> {
Widget build(BuildContext context) {
print(widget.bottlelist);
final Size size = MediaQuery.of(context).size;
return Scaffold(
body: Container(
......
......@@ -5,6 +5,8 @@ import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'SearchMedicine.dart';
class RegisterBottle extends StatefulWidget {
final String hubid;
RegisterBottle({Key key, this.hubid}) : super(key: key);
......@@ -117,9 +119,7 @@ class _RegisterBottleState extends State<RegisterBottle> {
context,
MaterialPageRoute(
builder: (BuildContext context) =>
DashBoard(
pageNumber: 1,
)));
SearchMedicine()));
})
],
);
......@@ -129,19 +129,13 @@ class _RegisterBottleState extends State<RegisterBottle> {
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: new Text('약병 등록'),
title: new Text('오류'),
content: new Text(saveMessage),
actions: <Widget>[
new FlatButton(
child: new Text('Close'),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) =>
DashBoard(
pageNumber: 1,
)));
Navigator.of(context).pop();
})
],
);
......
......@@ -50,7 +50,7 @@ class _RegisterHubState extends State<RegisterHub> {
child: Row(
children: <Widget>[
Text(
'약병 등록',
'허브 등록',
textScaleFactor: 1.0,
style: TextStyle(fontSize: 34),
)
......@@ -62,7 +62,7 @@ class _RegisterHubState extends State<RegisterHub> {
child: Row(
children: <Widget>[
Text(
'SmartMedicine 회원가입',
'SmartMedicine 허브 등록',
textScaleFactor: 1.0,
style: TextStyle(fontSize: 16),
)
......
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:http/http.dart' as http;
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'models/Bottle.dart';
import 'DashBoard.dart';
class SearchMedicine extends StatefulWidget {
@override
_SearchMedicineState createState() => _SearchMedicineState();
}
class _SearchMedicineState extends State<SearchMedicine> {
final medicineNameController = TextEditingController();
final medicineFactureController = TextEditingController();
Widget build(BuildContext context) {
bool isForward = false;
final Size size = MediaQuery.of(context).size;
// int goals = 60;
// int points = 75;
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.white,
leading: new Icon(Icons.medical_services_rounded,
color: Colors.black, size: 45.0),
title: Text(
'Smart Medicine Box',
style: TextStyle(
color: Colors.black,
fontSize: 23,
fontFamily: 'Noto',
fontWeight: FontWeight.bold),
),
),
body: Container(
height: size.height,
padding: const EdgeInsets.all(10),
decoration: BoxDecoration(
border: Border.all(),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
SizedBox(height: 20),
Container(
height: size.height * 0.13,
decoration: BoxDecoration(
border: Border.all(),
color: Colors.white,
borderRadius: BorderRadius.circular(25),
),
child: Row(
children: [
Column(
children: [
Container(
height: size.height * 0.0635,
width: size.width * 0.75,
child: Row(
children: [
Container(
width: size.width * 0.16,
padding: const EdgeInsets.fromLTRB(10, 0, 0, 0),
child: Text('약이름:',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 16,
fontFamily: 'NotoSansKR',
fontWeight: FontWeight.w600)),
),
Container(
padding: const EdgeInsets.fromLTRB(5, 0, 0, 0),
width: size.width * 0.55,
child: TextFormField(
keyboardType: TextInputType.text,
controller: medicineNameController,
decoration: InputDecoration(
border: InputBorder.none,
focusedBorder: InputBorder.none,
enabledBorder: InputBorder.none,
errorBorder: InputBorder.none,
disabledBorder: InputBorder.none,
hintText: '약 이름을 입력하세요',
),
style: TextStyle(
fontSize: 16,
fontFamily: 'NotoSansKR',
fontWeight: FontWeight.w600)),
)
],
),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: Colors.black,
width: 1,
style: BorderStyle.solid),
right: BorderSide(
color: Colors.black,
width: 1,
style: BorderStyle.solid),
),
),
),
Container(
height: size.height * 0.0635,
width: size.width * 0.75,
child: Row(
children: [
Container(
width: size.width * 0.16,
padding: const EdgeInsets.fromLTRB(5, 0, 0, 3),
child: Text('제조사:',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 16,
fontFamily: 'NotoSansKR',
fontWeight: FontWeight.w600)),
),
Container(
padding: const EdgeInsets.fromLTRB(6, 0, 0, 0),
width: size.width * 0.50,
child: TextFormField(
keyboardType: TextInputType.text,
controller: medicineFactureController,
decoration: InputDecoration(
border: InputBorder.none,
focusedBorder: InputBorder.none,
enabledBorder: InputBorder.none,
errorBorder: InputBorder.none,
disabledBorder: InputBorder.none,
hintText: '약 제조사 이름을 입력하세요',
),
style: TextStyle(
fontSize: 16,
fontFamily: 'NotoSansKR',
fontWeight: FontWeight.w600)),
)
],
),
decoration: BoxDecoration(
border: Border(
right: BorderSide(
color: Colors.black,
width: 1,
style: BorderStyle.solid),
),
),
),
],
),
Container(
height: size.height * 0.0635 * 2,
width: size.width * 0.14,
padding: const EdgeInsets.fromLTRB(10, 0, 0, 0),
child: IconButton(
icon: Icon(Icons.search, size: 40),
onPressed: () {
//검색 함수를 여기다가
},
),
),
],
),
),
SizedBox(height: 20),
Expanded(
child: ListView.separated(
itemBuilder: (BuildContext context, int index) {},
separatorBuilder: (BuildContext contetx, int index) =>
const Divider(),
itemCount: 0))
],
),
),
);
}
}
......@@ -48,14 +48,15 @@ class _SignInPageState extends State<SignInPage> {
await http.get(Uri.encodeFull(DotEnv().env['SERVER_URL'] + 'hub'));
List<dynamic> values = new List<dynamic>();
values = json.decode(response.body);
if (_hublist.length != 0) {
_hublist.clear();
}
if (response.statusCode == 200) {
values = json.decode(response.body);
for (int i = 0; i < values.length; i++) {
_hublist.add(values[i]['hubId']);
}
if (response.statusCode == 200) {
return "get완료";
} else if (response.statusCode == 404) {
return "Not Found";
......
......@@ -19,8 +19,6 @@ class Bottle {
this.dosage});
factory Bottle.fromJson(Map<String, dynamic> parsedJson) {
var list = parsedJson['data'] as List;
return Bottle(
bottleId: parsedJson['bottleId'],
temperature: parsedJson['temperature'],
......
class Medicine {
final int medicineId;
final String antiEffect;
final String company;
final String dosage;
final String name;
final String target;
final String warn;
Medicine(
{this.medicineId,
this.antiEffect,
this.company,
this.dosage,
this.name,
this.target,
this.warn});
factory Medicine.fromJson(Map<String, dynamic> parsedJson) {
return Medicine(
medicineId: parsedJson['medicineId'],
antiEffect: parsedJson['antiEffect'],
company: parsedJson['company'],
dosage: parsedJson['dosage'],
name: parsedJson['name'],
target: parsedJson['target'],
warn: parsedJson['warn'],
);
}
Map<String, dynamic> toJson() => {
"medicineId": medicineId,
"antiEffect": antiEffect,
"company": company,
"dosage": dosage,
"name": name,
"target": target,
"warn": warn,
};
}