Showing
9 changed files
with
57 additions
and
40 deletions
.vscode/launch.json
0 → 100644
| 1 | +{ | ||
| 2 | + // IntelliSense를 사용하여 가능한 특성에 대해 알아보세요. | ||
| 3 | + // 기존 특성에 대한 설명을 보려면 가리킵니다. | ||
| 4 | + // 자세한 내용을 보려면 https://go.microsoft.com/fwlink/?linkid=830387을(를) 방문하세요. | ||
| 5 | + "version": "0.2.0", | ||
| 6 | + "configurations": [ | ||
| 7 | + { | ||
| 8 | + "name": "flutter_application_1", | ||
| 9 | + "cwd": "frontend\\flutter_application_1", | ||
| 10 | + "request": "launch", | ||
| 11 | + "type": "dart" | ||
| 12 | + } | ||
| 13 | + ] | ||
| 14 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
| 2 | import 'dart:convert'; | 2 | import 'dart:convert'; |
| 3 | -import 'package:shared_preferences/shared_preferences.dart'; | ||
| 4 | import 'package:http/http.dart' as http; | 3 | import 'package:http/http.dart' as http; |
| 5 | import 'package:flutter_dotenv/flutter_dotenv.dart'; | 4 | import 'package:flutter_dotenv/flutter_dotenv.dart'; |
| 6 | import 'package:intl/intl.dart'; | 5 | import 'package:intl/intl.dart'; |
| ... | @@ -84,13 +83,7 @@ class _DashBoardState extends State<DashBoard> { | ... | @@ -84,13 +83,7 @@ class _DashBoardState extends State<DashBoard> { |
| 84 | Icons.settings, | 83 | Icons.settings, |
| 85 | color: Colors.black, | 84 | color: Colors.black, |
| 86 | ), | 85 | ), |
| 87 | - onPressed: () { | 86 | + onPressed: () {}, |
| 88 | - Navigator.push( | ||
| 89 | - context, | ||
| 90 | - MaterialPageRoute( | ||
| 91 | - builder: (BuildContext context) => SettingPage(), | ||
| 92 | - )); | ||
| 93 | - }, | ||
| 94 | ) | 87 | ) |
| 95 | ], | 88 | ], |
| 96 | ), | 89 | ), |
| ... | @@ -174,6 +167,8 @@ Widget mainpage(BuildContext context) { | ... | @@ -174,6 +167,8 @@ Widget mainpage(BuildContext context) { |
| 174 | Future<Medicine> _getmedicine() async { | 167 | Future<Medicine> _getmedicine() async { |
| 175 | String usertoken = await UserSecureStorage.getUserToken(); | 168 | String usertoken = await UserSecureStorage.getUserToken(); |
| 176 | String medicineid = await UserSecureStorage.getMedicineId(); | 169 | String medicineid = await UserSecureStorage.getMedicineId(); |
| 170 | + print(medicineid); | ||
| 171 | + | ||
| 177 | http.Response medicineresponse = await http.get( | 172 | http.Response medicineresponse = await http.get( |
| 178 | Uri.encodeFull( | 173 | Uri.encodeFull( |
| 179 | DotEnv().env['SERVER_URL'] + 'medicine/' + medicineid.toString()), | 174 | DotEnv().env['SERVER_URL'] + 'medicine/' + medicineid.toString()), |
| ... | @@ -184,8 +179,6 @@ Widget mainpage(BuildContext context) { | ... | @@ -184,8 +179,6 @@ Widget mainpage(BuildContext context) { |
| 184 | Map<String, dynamic> data = jsonDecode(medicineresponse.body); | 179 | Map<String, dynamic> data = jsonDecode(medicineresponse.body); |
| 185 | _medicineInformation = Medicine.fromJson(data); | 180 | _medicineInformation = Medicine.fromJson(data); |
| 186 | } | 181 | } |
| 187 | - print(1); | ||
| 188 | - print(_medicineInformation.company); | ||
| 189 | return _medicineInformation; | 182 | return _medicineInformation; |
| 190 | } | 183 | } |
| 191 | 184 | ||
| ... | @@ -510,7 +503,7 @@ Widget ineerInformationpage(BuildContext context) { | ... | @@ -510,7 +503,7 @@ Widget ineerInformationpage(BuildContext context) { |
| 510 | textScaleFactor: 1.0, | 503 | textScaleFactor: 1.0, |
| 511 | style: TextStyle( | 504 | style: TextStyle( |
| 512 | color: Colors.white, | 505 | color: Colors.white, |
| 513 | - fontSize: 76, | 506 | + fontSize: 50, |
| 514 | fontFamily: 'NotoSansKR', | 507 | fontFamily: 'NotoSansKR', |
| 515 | fontWeight: FontWeight.w800), | 508 | fontWeight: FontWeight.w800), |
| 516 | ), | 509 | ), |
| ... | @@ -520,7 +513,7 @@ Widget ineerInformationpage(BuildContext context) { | ... | @@ -520,7 +513,7 @@ Widget ineerInformationpage(BuildContext context) { |
| 520 | textScaleFactor: 1.0, | 513 | textScaleFactor: 1.0, |
| 521 | style: TextStyle( | 514 | style: TextStyle( |
| 522 | color: Colors.white, | 515 | color: Colors.white, |
| 523 | - fontSize: 60, | 516 | + fontSize: 50, |
| 524 | fontFamily: 'NotoSansKR', | 517 | fontFamily: 'NotoSansKR', |
| 525 | fontWeight: FontWeight.w800), | 518 | fontWeight: FontWeight.w800), |
| 526 | ) | 519 | ) |
| ... | @@ -576,7 +569,7 @@ Widget ineerInformationpage(BuildContext context) { | ... | @@ -576,7 +569,7 @@ Widget ineerInformationpage(BuildContext context) { |
| 576 | textScaleFactor: 1.0, | 569 | textScaleFactor: 1.0, |
| 577 | style: TextStyle( | 570 | style: TextStyle( |
| 578 | color: Colors.white, | 571 | color: Colors.white, |
| 579 | - fontSize: 80, | 572 | + fontSize: 50, |
| 580 | fontFamily: 'NotoSansKR', | 573 | fontFamily: 'NotoSansKR', |
| 581 | fontWeight: FontWeight.w800), | 574 | fontWeight: FontWeight.w800), |
| 582 | ), | 575 | ), |
| ... | @@ -586,7 +579,7 @@ Widget ineerInformationpage(BuildContext context) { | ... | @@ -586,7 +579,7 @@ Widget ineerInformationpage(BuildContext context) { |
| 586 | textScaleFactor: 1.0, | 579 | textScaleFactor: 1.0, |
| 587 | style: TextStyle( | 580 | style: TextStyle( |
| 588 | color: Colors.white, | 581 | color: Colors.white, |
| 589 | - fontSize: 60, | 582 | + fontSize: 50, |
| 590 | fontFamily: 'NotoSansKR', | 583 | fontFamily: 'NotoSansKR', |
| 591 | fontWeight: FontWeight.w800), | 584 | fontWeight: FontWeight.w800), |
| 592 | ) | 585 | ) |
| ... | @@ -760,8 +753,6 @@ Widget outerInformationpage(BuildContext context) { | ... | @@ -760,8 +753,6 @@ Widget outerInformationpage(BuildContext context) { |
| 760 | print(jsonData); | 753 | print(jsonData); |
| 761 | _bottleinformation = Bottle.fromJson(jsonData); | 754 | _bottleinformation = Bottle.fromJson(jsonData); |
| 762 | } | 755 | } |
| 763 | - print(1); | ||
| 764 | - print(_bottleinformation.toJson()); | ||
| 765 | return _bottleinformation; | 756 | return _bottleinformation; |
| 766 | } | 757 | } |
| 767 | 758 | ... | ... |
| ... | @@ -200,7 +200,7 @@ class _BottleListState extends State<BottleList> { | ... | @@ -200,7 +200,7 @@ class _BottleListState extends State<BottleList> { |
| 200 | context, | 200 | context, |
| 201 | MaterialPageRoute( | 201 | MaterialPageRoute( |
| 202 | builder: (BuildContext context) => DashBoard( | 202 | builder: (BuildContext context) => DashBoard( |
| 203 | - pageNumber: 1, | 203 | + pageNumber: 0, |
| 204 | ), | 204 | ), |
| 205 | ), | 205 | ), |
| 206 | ); | 206 | ); | ... | ... |
| ... | @@ -22,6 +22,8 @@ class _DetailMedicineState extends State<DetailMedicine> { | ... | @@ -22,6 +22,8 @@ class _DetailMedicineState extends State<DetailMedicine> { |
| 22 | //약 등록 | 22 | //약 등록 |
| 23 | Future<String> patchMedcine() async { | 23 | Future<String> patchMedcine() async { |
| 24 | String usertoken = await UserSecureStorage.getUserToken(); | 24 | String usertoken = await UserSecureStorage.getUserToken(); |
| 25 | + print(widget.searchMedicine.medicineId); | ||
| 26 | + print(widget.bottleId); | ||
| 25 | http.Response response = await http.patch( | 27 | http.Response response = await http.patch( |
| 26 | Uri.encodeFull( | 28 | Uri.encodeFull( |
| 27 | DotEnv().env['SERVER_URL'] + 'bottle/' + widget.bottleId), | 29 | DotEnv().env['SERVER_URL'] + 'bottle/' + widget.bottleId), |
| ... | @@ -33,8 +35,10 @@ class _DetailMedicineState extends State<DetailMedicine> { | ... | @@ -33,8 +35,10 @@ class _DetailMedicineState extends State<DetailMedicine> { |
| 33 | 'medicineId': widget.searchMedicine.medicineId, | 35 | 'medicineId': widget.searchMedicine.medicineId, |
| 34 | 'dosage': medicineDosageController.text | 36 | 'dosage': medicineDosageController.text |
| 35 | })); | 37 | })); |
| 36 | - | 38 | + print(response.body); |
| 37 | if (response.statusCode == 200) { | 39 | if (response.statusCode == 200) { |
| 40 | + String usertoken = await UserSecureStorage.setMedicineId( | ||
| 41 | + widget.searchMedicine.medicineId.toString()); | ||
| 38 | return "Complete"; | 42 | return "Complete"; |
| 39 | } else if (response.statusCode == 404) { | 43 | } else if (response.statusCode == 404) { |
| 40 | return "약병이 존재하지 않습니다."; | 44 | return "약병이 존재하지 않습니다."; | ... | ... |
| ... | @@ -44,7 +44,7 @@ class _SignInPageState extends State<SignInPage> { | ... | @@ -44,7 +44,7 @@ class _SignInPageState extends State<SignInPage> { |
| 44 | if (response.statusCode == 200) { | 44 | if (response.statusCode == 200) { |
| 45 | Map<String, dynamic> data = jsonDecode(response.body); | 45 | Map<String, dynamic> data = jsonDecode(response.body); |
| 46 | user = User.fromJson(data); | 46 | user = User.fromJson(data); |
| 47 | - print(user); | 47 | + UserSecureStorage.setUserToken(user.token); |
| 48 | return "로그인 성공"; | 48 | return "로그인 성공"; |
| 49 | } else if (response.statusCode == 400) { | 49 | } else if (response.statusCode == 400) { |
| 50 | return "올바르지 않은 아이디 및 패스워드"; | 50 | return "올바르지 않은 아이디 및 패스워드"; |
| ... | @@ -56,12 +56,14 @@ class _SignInPageState extends State<SignInPage> { | ... | @@ -56,12 +56,14 @@ class _SignInPageState extends State<SignInPage> { |
| 56 | //Get Hub List 함수 | 56 | //Get Hub List 함수 |
| 57 | Future<String> getHubList() async { | 57 | Future<String> getHubList() async { |
| 58 | String usertoken = await UserSecureStorage.getUserToken(); | 58 | String usertoken = await UserSecureStorage.getUserToken(); |
| 59 | + print(usertoken); | ||
| 59 | http.Response response = await http.get( | 60 | http.Response response = await http.get( |
| 60 | Uri.encodeFull(DotEnv().env['SERVER_URL'] + 'hub'), | 61 | Uri.encodeFull(DotEnv().env['SERVER_URL'] + 'hub'), |
| 61 | headers: {"authorization": usertoken}, | 62 | headers: {"authorization": usertoken}, |
| 62 | ); | 63 | ); |
| 63 | - | 64 | + print(response.statusCode); |
| 64 | List<dynamic> values = new List<dynamic>(); | 65 | List<dynamic> values = new List<dynamic>(); |
| 66 | + print(1234125); | ||
| 65 | print(values); | 67 | print(values); |
| 66 | if (_hublist.length != 0) { | 68 | if (_hublist.length != 0) { |
| 67 | _hublist.clear(); | 69 | _hublist.clear(); |
| ... | @@ -231,7 +233,10 @@ class _SignInPageState extends State<SignInPage> { | ... | @@ -231,7 +233,10 @@ class _SignInPageState extends State<SignInPage> { |
| 231 | }); | 233 | }); |
| 232 | } else { | 234 | } else { |
| 233 | if (saveMessage == "로그인 성공") { | 235 | if (saveMessage == "로그인 성공") { |
| 236 | + UserSecureStorage.setUserToken( | ||
| 237 | + user.token); | ||
| 234 | var result = await getHubList(); | 238 | var result = await getHubList(); |
| 239 | + print("Result"); | ||
| 235 | print(result); | 240 | print(result); |
| 236 | if (result == "Not Found") { | 241 | if (result == "Not Found") { |
| 237 | Navigator.push( | 242 | Navigator.push( |
| ... | @@ -242,11 +247,9 @@ class _SignInPageState extends State<SignInPage> { | ... | @@ -242,11 +247,9 @@ class _SignInPageState extends State<SignInPage> { |
| 242 | RegisterHub(), | 247 | RegisterHub(), |
| 243 | )); | 248 | )); |
| 244 | } else if (result == "get완료") { | 249 | } else if (result == "get완료") { |
| 245 | - UserSecureStorage.setUserToken( | ||
| 246 | - user.token); | ||
| 247 | UserSecureStorage.setUserId( | 250 | UserSecureStorage.setUserId( |
| 248 | user.userId); | 251 | user.userId); |
| 249 | - print('asdg'); | 252 | + print('getgetget'); |
| 250 | Navigator.push( | 253 | Navigator.push( |
| 251 | context, | 254 | context, |
| 252 | MaterialPageRoute( | 255 | MaterialPageRoute( | ... | ... |
| ... | @@ -23,14 +23,18 @@ class _SignUpLocalState extends State<SignUpLocal> { | ... | @@ -23,14 +23,18 @@ class _SignUpLocalState extends State<SignUpLocal> { |
| 23 | bool passwordValidationVisible = true; | 23 | bool passwordValidationVisible = true; |
| 24 | 24 | ||
| 25 | Future<String> signup_Validate() async { | 25 | Future<String> signup_Validate() async { |
| 26 | + print(Uri.encodeFull(DotEnv().env['SERVER_URL'] + 'auth/register')); | ||
| 26 | http.Response response = await http.post( | 27 | http.Response response = await http.post( |
| 27 | - Uri.encodeFull(DotEnv().env['SERVER_URL'] + 'auth/register'), | 28 | + Uri.encodeFull(DotEnv().env['SERVER_URL'] + 'auth/register'), |
| 28 | - headers: {"Content-Type": "application/json"}, | 29 | + headers: {"Content-Type": "application/json"}, |
| 29 | - body: jsonEncode({ | 30 | + body: jsonEncode( |
| 31 | + { | ||
| 30 | 'userId': emailController.text, | 32 | 'userId': emailController.text, |
| 31 | 'password': passwordController.text, | 33 | 'password': passwordController.text, |
| 32 | 'passwordCheck': passwordValidController.text | 34 | 'passwordCheck': passwordValidController.text |
| 33 | - })); | 35 | + }, |
| 36 | + ), | ||
| 37 | + ); | ||
| 34 | 38 | ||
| 35 | print(response.statusCode); | 39 | print(response.statusCode); |
| 36 | if (response.statusCode == 201) { | 40 | if (response.statusCode == 201) { | ... | ... |
| 1 | class Bottle { | 1 | class Bottle { |
| 2 | final int bottleId; | 2 | final int bottleId; |
| 3 | - final int temperature; | 3 | + final String temperature; |
| 4 | - final int humidity; | 4 | + final String humidity; |
| 5 | - final int balance; | 5 | + final String balance; |
| 6 | final DateTime recentOpen; | 6 | final DateTime recentOpen; |
| 7 | final int medicineId; | 7 | final int medicineId; |
| 8 | final int hubId; | 8 | final int hubId; |
| ... | @@ -19,11 +19,12 @@ class Bottle { | ... | @@ -19,11 +19,12 @@ class Bottle { |
| 19 | this.dosage}); | 19 | this.dosage}); |
| 20 | 20 | ||
| 21 | factory Bottle.fromJson(Map<String, dynamic> parsedJson) { | 21 | factory Bottle.fromJson(Map<String, dynamic> parsedJson) { |
| 22 | + print(parsedJson['temparture']); | ||
| 22 | return Bottle( | 23 | return Bottle( |
| 23 | bottleId: parsedJson['bottleId'], | 24 | bottleId: parsedJson['bottleId'], |
| 24 | - temperature: parsedJson['temperature'], | 25 | + temperature: parsedJson['temperature'].toString(), |
| 25 | - humidity: parsedJson['humidity'], | 26 | + humidity: parsedJson['humidity'].toString(), |
| 26 | - balance: parsedJson['balance'], | 27 | + balance: parsedJson['balance'].toString(), |
| 27 | recentOpen: DateTime.parse(parsedJson['recentOpen']), | 28 | recentOpen: DateTime.parse(parsedJson['recentOpen']), |
| 28 | medicineId: parsedJson['medicineId'], | 29 | medicineId: parsedJson['medicineId'], |
| 29 | hubId: parsedJson['hubId'], | 30 | hubId: parsedJson['hubId'], | ... | ... |
| ... | @@ -96,7 +96,7 @@ packages: | ... | @@ -96,7 +96,7 @@ packages: |
| 96 | name: flutter_blue | 96 | name: flutter_blue |
| 97 | url: "https://pub.dartlang.org" | 97 | url: "https://pub.dartlang.org" |
| 98 | source: hosted | 98 | source: hosted |
| 99 | - version: "0.7.3" | 99 | + version: "0.7.2" |
| 100 | flutter_datetime_picker: | 100 | flutter_datetime_picker: |
| 101 | dependency: "direct main" | 101 | dependency: "direct main" |
| 102 | description: | 102 | description: |
| ... | @@ -274,7 +274,7 @@ packages: | ... | @@ -274,7 +274,7 @@ packages: |
| 274 | name: pedantic | 274 | name: pedantic |
| 275 | url: "https://pub.dartlang.org" | 275 | url: "https://pub.dartlang.org" |
| 276 | source: hosted | 276 | source: hosted |
| 277 | - version: "1.9.2" | 277 | + version: "1.9.0" |
| 278 | platform: | 278 | platform: |
| 279 | dependency: transitive | 279 | dependency: transitive |
| 280 | description: | 280 | description: |
| ... | @@ -370,7 +370,7 @@ packages: | ... | @@ -370,7 +370,7 @@ packages: |
| 370 | name: sqflite | 370 | name: sqflite |
| 371 | url: "https://pub.dartlang.org" | 371 | url: "https://pub.dartlang.org" |
| 372 | source: hosted | 372 | source: hosted |
| 373 | - version: "1.3.2+4" | 373 | + version: "1.3.1+2" |
| 374 | sqflite_common: | 374 | sqflite_common: |
| 375 | dependency: transitive | 375 | dependency: transitive |
| 376 | description: | 376 | description: |
| ... | @@ -454,7 +454,7 @@ packages: | ... | @@ -454,7 +454,7 @@ packages: |
| 454 | name: xdg_directories | 454 | name: xdg_directories |
| 455 | url: "https://pub.dartlang.org" | 455 | url: "https://pub.dartlang.org" |
| 456 | source: hosted | 456 | source: hosted |
| 457 | - version: "0.1.2" | 457 | + version: "0.1.0" |
| 458 | sdks: | 458 | sdks: |
| 459 | - dart: ">=2.10.2 <2.11.0" | 459 | + dart: ">=2.10.0-110 <2.11.0" |
| 460 | - flutter: ">=1.22.2 <2.0.0" | 460 | + flutter: ">=1.20.0 <2.0.0" | ... | ... |
-
Please register or login to post a comment