고원빈

ddd

{
// IntelliSense를 사용하여 가능한 특성에 대해 알아보세요.
// 기존 특성에 대한 설명을 보려면 가리킵니다.
// 자세한 내용을 보려면 https://go.microsoft.com/fwlink/?linkid=830387을(를) 방문하세요.
"version": "0.2.0",
"configurations": [
{
"name": "flutter_application_1",
"cwd": "frontend\\flutter_application_1",
"request": "launch",
"type": "dart"
}
]
}
\ No newline at end of file
SERVER_URL=http://192.168.0.3:4717/api/
\ No newline at end of file
SERVER_URL=http://192.168.154.240:4444/api/
\ No newline at end of file
......
import 'package:flutter/material.dart';
import 'dart:convert';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:http/http.dart' as http;
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:intl/intl.dart';
......@@ -84,13 +83,7 @@ class _DashBoardState extends State<DashBoard> {
Icons.settings,
color: Colors.black,
),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) => SettingPage(),
));
},
onPressed: () {},
)
],
),
......@@ -174,6 +167,8 @@ Widget mainpage(BuildContext context) {
Future<Medicine> _getmedicine() async {
String usertoken = await UserSecureStorage.getUserToken();
String medicineid = await UserSecureStorage.getMedicineId();
print(medicineid);
http.Response medicineresponse = await http.get(
Uri.encodeFull(
DotEnv().env['SERVER_URL'] + 'medicine/' + medicineid.toString()),
......@@ -184,8 +179,6 @@ Widget mainpage(BuildContext context) {
Map<String, dynamic> data = jsonDecode(medicineresponse.body);
_medicineInformation = Medicine.fromJson(data);
}
print(1);
print(_medicineInformation.company);
return _medicineInformation;
}
......@@ -510,7 +503,7 @@ Widget ineerInformationpage(BuildContext context) {
textScaleFactor: 1.0,
style: TextStyle(
color: Colors.white,
fontSize: 76,
fontSize: 50,
fontFamily: 'NotoSansKR',
fontWeight: FontWeight.w800),
),
......@@ -520,7 +513,7 @@ Widget ineerInformationpage(BuildContext context) {
textScaleFactor: 1.0,
style: TextStyle(
color: Colors.white,
fontSize: 60,
fontSize: 50,
fontFamily: 'NotoSansKR',
fontWeight: FontWeight.w800),
)
......@@ -576,7 +569,7 @@ Widget ineerInformationpage(BuildContext context) {
textScaleFactor: 1.0,
style: TextStyle(
color: Colors.white,
fontSize: 80,
fontSize: 50,
fontFamily: 'NotoSansKR',
fontWeight: FontWeight.w800),
),
......@@ -586,7 +579,7 @@ Widget ineerInformationpage(BuildContext context) {
textScaleFactor: 1.0,
style: TextStyle(
color: Colors.white,
fontSize: 60,
fontSize: 50,
fontFamily: 'NotoSansKR',
fontWeight: FontWeight.w800),
)
......@@ -760,8 +753,6 @@ Widget outerInformationpage(BuildContext context) {
print(jsonData);
_bottleinformation = Bottle.fromJson(jsonData);
}
print(1);
print(_bottleinformation.toJson());
return _bottleinformation;
}
......
......@@ -200,7 +200,7 @@ class _BottleListState extends State<BottleList> {
context,
MaterialPageRoute(
builder: (BuildContext context) => DashBoard(
pageNumber: 1,
pageNumber: 0,
),
),
);
......
......@@ -22,6 +22,8 @@ class _DetailMedicineState extends State<DetailMedicine> {
//약 등록
Future<String> patchMedcine() async {
String usertoken = await UserSecureStorage.getUserToken();
print(widget.searchMedicine.medicineId);
print(widget.bottleId);
http.Response response = await http.patch(
Uri.encodeFull(
DotEnv().env['SERVER_URL'] + 'bottle/' + widget.bottleId),
......@@ -33,8 +35,10 @@ class _DetailMedicineState extends State<DetailMedicine> {
'medicineId': widget.searchMedicine.medicineId,
'dosage': medicineDosageController.text
}));
print(response.body);
if (response.statusCode == 200) {
String usertoken = await UserSecureStorage.setMedicineId(
widget.searchMedicine.medicineId.toString());
return "Complete";
} else if (response.statusCode == 404) {
return "약병이 존재하지 않습니다.";
......
......@@ -44,7 +44,7 @@ class _SignInPageState extends State<SignInPage> {
if (response.statusCode == 200) {
Map<String, dynamic> data = jsonDecode(response.body);
user = User.fromJson(data);
print(user);
UserSecureStorage.setUserToken(user.token);
return "로그인 성공";
} else if (response.statusCode == 400) {
return "올바르지 않은 아이디 및 패스워드";
......@@ -56,12 +56,14 @@ class _SignInPageState extends State<SignInPage> {
//Get Hub List 함수
Future<String> getHubList() async {
String usertoken = await UserSecureStorage.getUserToken();
print(usertoken);
http.Response response = await http.get(
Uri.encodeFull(DotEnv().env['SERVER_URL'] + 'hub'),
headers: {"authorization": usertoken},
);
print(response.statusCode);
List<dynamic> values = new List<dynamic>();
print(1234125);
print(values);
if (_hublist.length != 0) {
_hublist.clear();
......@@ -231,7 +233,10 @@ class _SignInPageState extends State<SignInPage> {
});
} else {
if (saveMessage == "로그인 성공") {
UserSecureStorage.setUserToken(
user.token);
var result = await getHubList();
print("Result");
print(result);
if (result == "Not Found") {
Navigator.push(
......@@ -242,11 +247,9 @@ class _SignInPageState extends State<SignInPage> {
RegisterHub(),
));
} else if (result == "get완료") {
UserSecureStorage.setUserToken(
user.token);
UserSecureStorage.setUserId(
user.userId);
print('asdg');
print('getgetget');
Navigator.push(
context,
MaterialPageRoute(
......
......@@ -23,14 +23,18 @@ class _SignUpLocalState extends State<SignUpLocal> {
bool passwordValidationVisible = true;
Future<String> signup_Validate() async {
print(Uri.encodeFull(DotEnv().env['SERVER_URL'] + 'auth/register'));
http.Response response = await http.post(
Uri.encodeFull(DotEnv().env['SERVER_URL'] + 'auth/register'),
headers: {"Content-Type": "application/json"},
body: jsonEncode({
body: jsonEncode(
{
'userId': emailController.text,
'password': passwordController.text,
'passwordCheck': passwordValidController.text
}));
},
),
);
print(response.statusCode);
if (response.statusCode == 201) {
......
class Bottle {
final int bottleId;
final int temperature;
final int humidity;
final int balance;
final String temperature;
final String humidity;
final String balance;
final DateTime recentOpen;
final int medicineId;
final int hubId;
......@@ -19,11 +19,12 @@ class Bottle {
this.dosage});
factory Bottle.fromJson(Map<String, dynamic> parsedJson) {
print(parsedJson['temparture']);
return Bottle(
bottleId: parsedJson['bottleId'],
temperature: parsedJson['temperature'],
humidity: parsedJson['humidity'],
balance: parsedJson['balance'],
temperature: parsedJson['temperature'].toString(),
humidity: parsedJson['humidity'].toString(),
balance: parsedJson['balance'].toString(),
recentOpen: DateTime.parse(parsedJson['recentOpen']),
medicineId: parsedJson['medicineId'],
hubId: parsedJson['hubId'],
......
......@@ -96,7 +96,7 @@ packages:
name: flutter_blue
url: "https://pub.dartlang.org"
source: hosted
version: "0.7.3"
version: "0.7.2"
flutter_datetime_picker:
dependency: "direct main"
description:
......@@ -274,7 +274,7 @@ packages:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.2"
version: "1.9.0"
platform:
dependency: transitive
description:
......@@ -370,7 +370,7 @@ packages:
name: sqflite
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.2+4"
version: "1.3.1+2"
sqflite_common:
dependency: transitive
description:
......@@ -454,7 +454,7 @@ packages:
name: xdg_directories
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.2"
version: "0.1.0"
sdks:
dart: ">=2.10.2 <2.11.0"
flutter: ">=1.22.2 <2.0.0"
dart: ">=2.10.0-110 <2.11.0"
flutter: ">=1.20.0 <2.0.0"
......