Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2021-1-capstone-design1
/
RIT_Project1
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
1
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
고원빈
2021-05-31 23:55:45 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
38a6a7e80f705c3d223d150a634deae06b5a23f0
38a6a7e8
1 parent
17518a0f
ddd
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
57 additions
and
40 deletions
.vscode/launch.json
frontend/flutter_application_1/.env
frontend/flutter_application_1/lib/src/screens/DashBoard.dart
frontend/flutter_application_1/lib/src/screens/Register/BottleList.dart
frontend/flutter_application_1/lib/src/screens/Register/DetailMedicine.dart
frontend/flutter_application_1/lib/src/screens/Register/SignInPage.dart
frontend/flutter_application_1/lib/src/screens/Register/SignUpLocal.dart
frontend/flutter_application_1/lib/src/screens/models/Bottle.dart
frontend/flutter_application_1/pubspec.lock
.vscode/launch.json
0 → 100644
View file @
38a6a7e
{
//
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
frontend/flutter_application_1/.env
View file @
38a6a7e
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
...
...
frontend/flutter_application_1/lib/src/screens/DashBoard.dart
View file @
38a6a7e
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:
6
0
,
fontSize:
5
0
,
fontFamily:
'NotoSansKR'
,
fontWeight:
FontWeight
.
w800
),
)
...
...
@@ -576,7 +569,7 @@ Widget ineerInformationpage(BuildContext context) {
textScaleFactor:
1.0
,
style:
TextStyle
(
color:
Colors
.
white
,
fontSize:
8
0
,
fontSize:
5
0
,
fontFamily:
'NotoSansKR'
,
fontWeight:
FontWeight
.
w800
),
),
...
...
@@ -586,7 +579,7 @@ Widget ineerInformationpage(BuildContext context) {
textScaleFactor:
1.0
,
style:
TextStyle
(
color:
Colors
.
white
,
fontSize:
6
0
,
fontSize:
5
0
,
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
;
}
...
...
frontend/flutter_application_1/lib/src/screens/Register/BottleList.dart
View file @
38a6a7e
...
...
@@ -200,7 +200,7 @@ class _BottleListState extends State<BottleList> {
context
,
MaterialPageRoute
(
builder:
(
BuildContext
context
)
=>
DashBoard
(
pageNumber:
1
,
pageNumber:
0
,
),
),
);
...
...
frontend/flutter_application_1/lib/src/screens/Register/DetailMedicine.dart
View file @
38a6a7e
...
...
@@ -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
"약병이 존재하지 않습니다."
;
...
...
frontend/flutter_application_1/lib/src/screens/Register/SignInPage.dart
View file @
38a6a7e
...
...
@@ -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
(
...
...
frontend/flutter_application_1/lib/src/screens/Register/SignUpLocal.dart
View file @
38a6a7e
...
...
@@ -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
({
Uri
.
encodeFull
(
DotEnv
().
env
[
'SERVER_URL'
]
+
'auth/register'
),
headers:
{
"Content-Type"
:
"application/json"
},
body:
jsonEncode
(
{
'userId'
:
emailController
.
text
,
'password'
:
passwordController
.
text
,
'passwordCheck'
:
passwordValidController
.
text
}));
},
),
);
print
(
response
.
statusCode
);
if
(
response
.
statusCode
==
201
)
{
...
...
frontend/flutter_application_1/lib/src/screens/models/Bottle.dart
View file @
38a6a7e
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'
],
...
...
frontend/flutter_application_1/pubspec.lock
View file @
38a6a7e
...
...
@@ -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.2
2.2
<2.0.0"
dart: ">=2.10.
0-110
<2.11.0"
flutter: ">=1.2
0.0
<2.0.0"
...
...
Please
register
or
login
to post a comment