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-27 12:39:08 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
104f91c884e09798a9702da2ec3a8061bee4ed78
104f91c8
1 parent
ba1656c2
[frontend] Error 해결
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
215 additions
and
113 deletions
frontend/README.md
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/HubList.dart
frontend/flutter_application_1/lib/src/screens/Register/RegisterBottle.dart
frontend/flutter_application_1/lib/src/screens/Register/RegsiterHub.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/utils/user_secure_stoarge.dart
frontend/README.md
View file @
104f91c
...
...
@@ -84,3 +84,6 @@ appbar 관련 디자인은 추후 구현 예정
### 2021-05-25
+
로그인 권한 문제 해결
### 2021-05-26
+
future buillder 변경
\ No newline at end of file
...
...
frontend/flutter_application_1/.env
View file @
104f91c
SERVER_URL=
\ No newline at end of file
SERVER_URL=http://192.168.0.3:4717/api/
\ No newline at end of file
...
...
frontend/flutter_application_1/lib/src/screens/DashBoard.dart
View file @
104f91c
...
...
@@ -5,39 +5,32 @@ import 'package:http/http.dart' as http;
import
'package:flutter_dotenv/flutter_dotenv.dart'
;
import
'package:intl/intl.dart'
;
import
'../utils/user_secure_stoarge.dart'
;
import
'models/Bottle.dart'
;
import
'models/Medicine.dart'
;
import
'package:Smart_Medicine_Box/src/screens/SettingPage.dart'
;
class
DashBoard
extends
StatefulWidget
{
int
pageNumber
;
Bottle
bottleInformation
;
Medicine
medicineInformation
;
DashBoard
(
{
Key
key
,
DashBoard
(
{
Key
key
,
this
.
pageNumber
,
this
.
bottleInformation
,
this
.
medicineInformation
})
:
super
(
key:
key
);
})
:
super
(
key:
key
);
@override
_DashBoardState
createState
()
=>
_DashBoardState
();
}
class
_DashBoardState
extends
State
<
DashBoard
>
{
Bottle
_bottleinformation
=
new
Bottle
();
int
_selectedIndex
=
0
;
Medicine
_medicineInformation
=
new
Medicine
();
Widget
build
(
BuildContext
context
)
{
_selectedIndex
=
widget
.
pageNumber
;
_medicineInformation
=
widget
.
medicineInformation
;
_bottleinformation
=
widget
.
bottleInformation
;
var
_tabs
=
[
ineerInformationpage
(
context
,
_bottleinformation
),
mainpage
(
context
,
_medicineInformation
),
outerInformationpage
(
context
,
_bottleinformation
),
ineerInformationpage
(
context
),
mainpage
(
context
),
outerInformationpage
(
context
),
];
return
Scaffold
(
...
...
@@ -126,12 +119,46 @@ class _DashBoardState extends State<DashBoard> {
}
}
Widget
mainpage
(
BuildContext
context
,
Medicine
medicineInformation
)
{
Widget
mainpage
(
BuildContext
context
)
{
Medicine
_medicineInformation
=
new
Medicine
();
Future
<
Medicine
>
_getmedicine
()
async
{
String
usertoken
=
await
UserSecureStorage
.
getUserToken
();
String
medicineid
=
await
UserSecureStorage
.
getMedicineId
();
http
.
Response
medicineresponse
=
await
http
.
get
(
Uri
.
encodeFull
(
DotEnv
().
env
[
'SERVER_URL'
]
+
'medicine/'
+
medicineid
.
toString
()),
headers:
{
"authorization"
:
usertoken
},
);
if
(
medicineresponse
.
statusCode
==
200
)
{
Map
<
String
,
dynamic
>
data
=
jsonDecode
(
medicineresponse
.
body
);
_medicineInformation
=
Medicine
.
fromJson
(
data
);
}
print
(
1
);
print
(
_medicineInformation
.
company
);
return
_medicineInformation
;
}
final
Size
size
=
MediaQuery
.
of
(
context
).
size
;
return
Scaffold
(
backgroundColor:
Colors
.
white
,
body:
SingleChildScrollView
(
child:
Container
(
child:
FutureBuilder
(
future:
_getmedicine
(),
builder:
(
BuildContext
context
,
AsyncSnapshot
snapshot
)
{
if
(
snapshot
.
hasData
==
false
)
{
return
CircularProgressIndicator
();
}
else
if
(
snapshot
.
hasError
)
{
return
Padding
(
padding:
const
EdgeInsets
.
all
(
8.0
),
child:
Text
(
'Error:
${snapshot.error}
'
,
style:
TextStyle
(
fontSize:
15
),
),
);
}
else
{
return
Container
(
margin:
EdgeInsets
.
fromLTRB
(
0
,
30
,
0
,
0
),
padding:
EdgeInsets
.
fromLTRB
(
5
,
0
,
5
,
5
),
child:
Column
(
...
...
@@ -144,8 +171,8 @@ Widget mainpage(BuildContext context, Medicine medicineInformation) {
margin:
EdgeInsets
.
all
(
15
),
decoration:
BoxDecoration
(
border:
Border
.
all
(),
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
25.0
)
// <--- border radius here
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
25.0
)
// <--- border radius here
),
),
child:
Column
(
...
...
@@ -154,9 +181,9 @@ Widget mainpage(BuildContext context, Medicine medicineInformation) {
Container
(
child:
Center
(
child:
Text
(
medicineInformation
.
name
==
null
'
${snapshot.data.name}
'
==
null
?
'-'
:
medicineInformation
.
name
,
:
'
${snapshot.data.name}
'
,
style:
TextStyle
(
color:
Colors
.
black
,
fontSize:
24
,
...
...
@@ -178,9 +205,9 @@ Widget mainpage(BuildContext context, Medicine medicineInformation) {
),
),
Text
(
medicineInformation
.
company
==
null
_
medicineInformation
.
company
==
null
?
'-'
:
medicineInformation
.
company
,
:
_
medicineInformation
.
company
,
style:
TextStyle
(
color:
Colors
.
grey
,
fontSize:
14
,
...
...
@@ -204,9 +231,9 @@ Widget mainpage(BuildContext context, Medicine medicineInformation) {
),
),
Text
(
medicineInformation
.
target
==
null
_
medicineInformation
.
target
==
null
?
'-'
:
medicineInformation
.
target
,
:
_
medicineInformation
.
target
,
style:
TextStyle
(
color:
Colors
.
grey
,
fontSize:
14
,
...
...
@@ -230,9 +257,9 @@ Widget mainpage(BuildContext context, Medicine medicineInformation) {
),
),
Text
(
medicineInformation
.
dosage
==
null
_
medicineInformation
.
dosage
==
null
?
'-'
:
medicineInformation
.
dosage
,
:
_
medicineInformation
.
dosage
,
style:
TextStyle
(
color:
Colors
.
grey
,
fontSize:
14
,
...
...
@@ -263,9 +290,9 @@ Widget mainpage(BuildContext context, Medicine medicineInformation) {
Container
(
width:
size
.
width
,
child:
Text
(
medicineInformation
.
warn
==
null
_
medicineInformation
.
warn
==
null
?
'-'
:
medicineInformation
.
warn
,
:
_
medicineInformation
.
warn
,
style:
TextStyle
(
color:
Colors
.
redAccent
,
fontSize:
14
),
),
...
...
@@ -278,16 +305,51 @@ Widget mainpage(BuildContext context, Medicine medicineInformation) {
),
],
),
);
}
},
),
),
);
}
Widget
ineerInformationpage
(
BuildContext
context
,
Bottle
bottleinformation
)
{
Widget
ineerInformationpage
(
BuildContext
context
)
{
Bottle
_bottleinformation
=
new
Bottle
();
//get bottle
Future
<
Bottle
>
_getbottle
()
async
{
String
usertoken
=
await
UserSecureStorage
.
getUserToken
();
String
bottleid
=
await
UserSecureStorage
.
getBottleId
();
Bottle
_bottleinformation
=
new
Bottle
();
http
.
Response
response
=
await
http
.
get
(
Uri
.
encodeFull
(
DotEnv
().
env
[
'SERVER_URL'
]
+
'bottle/'
+
bottleid
),
headers:
{
"authorization"
:
usertoken
});
if
(
response
.
statusCode
==
200
)
{
Map
<
String
,
dynamic
>
jsonData
=
jsonDecode
(
response
.
body
);
_bottleinformation
=
Bottle
.
fromJson
(
jsonData
);
}
return
_bottleinformation
;
}
final
Size
size
=
MediaQuery
.
of
(
context
).
size
;
return
Scaffold
(
backgroundColor:
Colors
.
white
,
body:
Container
(
body:
FutureBuilder
(
future:
_getbottle
(),
builder:
(
BuildContext
context
,
AsyncSnapshot
snapshot
)
{
if
(
snapshot
.
hasData
==
false
)
{
return
CircularProgressIndicator
();
}
else
if
(
snapshot
.
hasError
)
{
return
Padding
(
padding:
const
EdgeInsets
.
all
(
8.0
),
child:
Text
(
'Error:
${snapshot.error}
'
,
style:
TextStyle
(
fontSize:
15
),
),
);
}
else
{
return
Container
(
height:
size
.
height
*
0.9
,
margin:
EdgeInsets
.
fromLTRB
(
0
,
30
,
0
,
0
),
padding:
EdgeInsets
.
fromLTRB
(
5
,
0
,
5
,
5
),
...
...
@@ -354,15 +416,14 @@ Widget ineerInformationpage(BuildContext context, Bottle bottleinformation) {
height:
size
.
height
*
0.145
,
child:
Center
(
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
[
Text
(
bottleinformation
.
temperature
.
toString
()
==
'
${snapshot.data.temperature}
'
==
null
?
'-'
:
bottleinformation
.
temperature
.
toString
(),
:
'
${snapshot.data.temperature}
'
,
textAlign:
TextAlign
.
center
,
textScaleFactor:
1.0
,
style:
TextStyle
(
...
...
@@ -420,13 +481,14 @@ Widget ineerInformationpage(BuildContext context, Bottle bottleinformation) {
height:
size
.
height
*
0.14
,
child:
Center
(
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
[
Text
(
bottleinformation
.
humidity
.
toString
()
==
snapshot
.
data
.
humidity
.
toString
()
==
null
?
'-'
:
bottleinformation
.
humidity
:
snapshot
.
data
.
humidity
.
toString
(),
textAlign:
TextAlign
.
center
,
textScaleFactor:
1.0
,
...
...
@@ -502,13 +564,14 @@ Widget ineerInformationpage(BuildContext context, Bottle bottleinformation) {
height:
size
.
height
*
0.14
,
child:
Center
(
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
[
Text
(
bottleinformation
.
balance
.
toString
()
==
snapshot
.
data
.
balance
.
toString
()
==
null
?
'-'
:
bottleinformation
.
balance
:
snapshot
.
data
.
balance
.
toString
(),
textAlign:
TextAlign
.
center
,
textScaleFactor:
1.0
,
...
...
@@ -567,10 +630,10 @@ Widget ineerInformationpage(BuildContext context, Bottle bottleinformation) {
height:
size
.
height
*
0.14
,
child:
Center
(
child:
Text
(
bottleinformation
.
recentOpen
==
null
snapshot
.
data
.
recentOpen
==
null
?
'-'
:
DateFormat
.
Hm
()
.
format
(
bottleinformation
.
recentOpen
),
:
DateFormat
.
Hm
().
format
(
snapshot
.
data
.
recentOpen
),
textAlign:
TextAlign
.
center
,
textScaleFactor:
1.0
,
style:
TextStyle
(
...
...
@@ -592,15 +655,54 @@ Widget ineerInformationpage(BuildContext context, Bottle bottleinformation) {
),
],
),
);
}
},
),
);
}
Widget
outerInformationpage
(
BuildContext
context
,
Bottle
bottleinformation
)
{
Widget
outerInformationpage
(
BuildContext
context
)
{
Bottle
_bottleinformation
=
new
Bottle
();
//get bottle
Future
<
Bottle
>
_getbottle
()
async
{
String
usertoken
=
await
UserSecureStorage
.
getUserToken
();
String
bottleid
=
await
UserSecureStorage
.
getBottleId
();
Bottle
_bottleinformation
=
new
Bottle
();
http
.
Response
response
=
await
http
.
get
(
Uri
.
encodeFull
(
DotEnv
().
env
[
'SERVER_URL'
]
+
'bottle/'
+
bottleid
),
headers:
{
"authorization"
:
usertoken
});
if
(
response
.
statusCode
==
200
)
{
Map
<
String
,
dynamic
>
jsonData
=
jsonDecode
(
response
.
body
);
print
(
jsonData
);
_bottleinformation
=
Bottle
.
fromJson
(
jsonData
);
}
print
(
1
);
print
(
_bottleinformation
.
toJson
());
return
_bottleinformation
;
}
final
Size
size
=
MediaQuery
.
of
(
context
).
size
;
return
Scaffold
(
backgroundColor:
Colors
.
white
,
body:
Container
(
body:
FutureBuilder
(
future:
_getbottle
(),
builder:
(
BuildContext
context
,
AsyncSnapshot
snapshot
)
{
if
(
snapshot
.
hasData
==
false
)
{
return
CircularProgressIndicator
();
}
else
if
(
snapshot
.
hasError
)
{
return
Padding
(
padding:
const
EdgeInsets
.
all
(
8.0
),
child:
Text
(
'Error:
${snapshot.error}
'
,
style:
TextStyle
(
fontSize:
15
),
),
);
}
else
{
print
(
123412
);
print
(
snapshot
.
data
.
dosage
);
return
Container
(
height:
size
.
height
*
0.9
,
margin:
EdgeInsets
.
fromLTRB
(
0
,
30
,
0
,
0
),
padding:
EdgeInsets
.
fromLTRB
(
5
,
0
,
5
,
5
),
...
...
@@ -665,12 +767,14 @@ Widget outerInformationpage(BuildContext context, Bottle bottleinformation) {
width:
size
.
width
,
height:
size
.
height
*
0.12
,
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
[
Text
(
bottleinformation
.
dosage
==
null
snapshot
.
data
.
dosage
==
null
?
'-'
:
bottleinformation
.
dosage
.
toString
(),
:
snapshot
.
data
.
dosage
.
toString
(),
textAlign:
TextAlign
.
center
,
textScaleFactor:
1.0
,
style:
TextStyle
(
...
...
@@ -763,16 +867,8 @@ Widget outerInformationpage(BuildContext context, Bottle bottleinformation) {
),
],
),
),
);
}
}),
);
}
/*
bottom navbar로 이동
appbar로는 저거 만들어서 사용
설정 smartmedicine box를 app bar 로 구현
이건 우선 작업 후 추후 작업
*/
...
...
frontend/flutter_application_1/lib/src/screens/Register/BottleList.dart
View file @
104f91c
...
...
@@ -10,46 +10,13 @@ import '../../utils/user_secure_stoarge.dart';
class
BottleList
extends
StatefulWidget
{
List
<
Bottle
>
bottlelist
;
String
hubid
;
BottleList
({
Key
key
,
this
.
bottlelist
,
this
.
hubid
})
:
super
(
key:
key
);
BottleList
({
Key
key
,
this
.
bottlelist
})
:
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
{
String
usertoken
=
await
UserSecureStorage
.
getUserToken
();
http
.
Response
response
=
await
http
.
get
(
Uri
.
encodeFull
(
DotEnv
().
env
[
'SERVER_URL'
]
+
'bottle/'
+
widget
.
bottlelist
[
index
].
bottleId
.
toString
()),
headers:
{
"authorization"
:
usertoken
});
if
(
response
.
statusCode
==
200
)
{
Map
<
String
,
dynamic
>
jsonData
=
jsonDecode
(
response
.
body
);
print
(
jsonData
);
_bottleinformation
=
Bottle
.
fromJson
(
jsonData
);
}
}
Future
<
Bottle
>
getmedicine
(
int
index
)
async
{
String
usertoken
=
await
UserSecureStorage
.
getUserToken
();
http
.
Response
medicineresponse
=
await
http
.
get
(
Uri
.
encodeFull
(
DotEnv
().
env
[
'SERVER_URL'
]
+
'medicine/'
+
widget
.
bottlelist
[
index
].
medicineId
.
toString
()),
headers:
{
"authorization"
:
usertoken
},
);
if
(
medicineresponse
.
statusCode
==
200
)
{
Map
<
String
,
dynamic
>
data
=
jsonDecode
(
medicineresponse
.
body
);
_medicineinformation
=
Medicine
.
fromJson
(
data
);
}
}
Widget
build
(
BuildContext
context
)
{
final
Size
size
=
MediaQuery
.
of
(
context
).
size
;
return
Scaffold
(
...
...
@@ -97,15 +64,15 @@ class _BottleListState extends State<BottleList> {
),
trailing:
Icon
(
Icons
.
arrow_forward
),
onTap:
()
async
{
await
getbottle
(
index
);
await
getmedicine
(
index
);
UserSecureStorage
.
setBottleId
(
widget
.
bottlelist
[
index
].
bottleId
.
toString
());
UserSecureStorage
.
setMedicineId
(
widget
.
bottlelist
[
index
].
medicineId
.
toString
());
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
BuildContext
context
)
=>
DashBoard
(
pageNumber:
1
,
bottleInformation:
_bottleinformation
,
medicineInformation:
_medicineinformation
,
),
),
);
...
...
frontend/flutter_application_1/lib/src/screens/Register/DetailMedicine.dart
View file @
104f91c
...
...
@@ -215,7 +215,9 @@ class _DetailMedicineState extends State<DetailMedicine> {
context
,
MaterialPageRoute
(
builder:
(
BuildContext
context
)
=>
HomePage
(),
DashBoard
(
pageNumber:
1
,
),
),
);
})
...
...
frontend/flutter_application_1/lib/src/screens/Register/HubList.dart
View file @
104f91c
...
...
@@ -45,6 +45,7 @@ class _HubListState extends State<HubList> {
}
else
{
return
"Error"
;
}
return
"Error"
;
}
Widget
build
(
BuildContext
context
)
{
...
...
@@ -95,14 +96,15 @@ class _HubListState extends State<HubList> {
var
result
=
await
getBottleList
(
widget
.
hublist
[
index
]);
if
(
result
==
"GET"
)
{
UserSecureStorage
.
setHubId
(
widget
.
hublist
[
index
].
toString
());
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
BuildContext
context
)
=>
BottleList
(
bottlelist:
_bottleList
,
hubid:
widget
.
hublist
[
index
]
.
toString
()),
),
));
}
else
if
(
result
==
"Not Found"
)
{
showDialog
(
...
...
@@ -115,15 +117,15 @@ class _HubListState extends State<HubList> {
new
FlatButton
(
child:
new
Text
(
'등록'
),
onPressed:
()
{
UserSecureStorage
.
setHubId
(
widget
.
hublist
[
index
]
.
toString
());
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
BuildContext
context
)
=>
RegisterBottle
(
hubid:
widget
.
hublist
[
index
]
.
toString
()),
RegisterBottle
(),
));
})
],
...
...
frontend/flutter_application_1/lib/src/screens/Register/RegisterBottle.dart
View file @
104f91c
...
...
@@ -20,16 +20,16 @@ class _RegisterBottleState extends State<RegisterBottle> {
Future
<
String
>
registerhub_Validate
()
async
{
String
usertoken
=
await
UserSecureStorage
.
getUserToken
();
String
hubid
=
await
UserSecureStorage
.
getHubId
();
print
(
hubid
);
http
.
Response
bottleresponse
=
await
http
.
post
(
Uri
.
encodeFull
(
DotEnv
().
env
[
'SERVER_URL'
]
+
'bottle'
),
headers:
{
"Content-Type"
:
"application/json"
,
"authorization"
:
usertoken
},
body:
jsonEncode
({
'bottleId'
:
medicineBottleIDController
.
text
,
'hubId'
:
widget
.
hubid
}));
body:
jsonEncode
(
{
'bottleId'
:
medicineBottleIDController
.
text
,
'hubId'
:
hubid
}));
if
(
bottleresponse
.
statusCode
==
201
)
{
return
"등록 완료"
;
...
...
frontend/flutter_application_1/lib/src/screens/Register/RegsiterHub.dart
View file @
104f91c
...
...
@@ -120,6 +120,7 @@ class _RegisterHubState extends State<RegisterHub> {
String
saveMessage
=
await
registerhub_Validate
();
print
(
saveMessage
);
if
(
saveMessage
==
"허브 등록 완료"
)
{
UserSecureStorage
.
setHubId
(
medicineHubIDController
.
text
);
Navigator
.
push
(
context
,
MaterialPageRoute
(
...
...
frontend/flutter_application_1/lib/src/screens/Register/SignInPage.dart
View file @
104f91c
...
...
@@ -28,6 +28,7 @@ class _SignInPageState extends State<SignInPage> {
//Login 함수
Future
<
String
>
login
(
String
_email
,
String
_password
)
async
{
print
(
Uri
.
encodeFull
(
DotEnv
().
env
[
'SERVER_URL'
]
+
'auth/login'
));
http
.
Response
response
=
await
http
.
post
(
Uri
.
encodeFull
(
DotEnv
().
env
[
'SERVER_URL'
]
+
'auth/login'
),
headers:
{
"Content-Type"
:
"application/json"
},
...
...
@@ -38,6 +39,7 @@ class _SignInPageState extends State<SignInPage> {
},
),
);
print
(
response
.
statusCode
);
if
(
response
.
statusCode
==
200
)
{
Map
<
String
,
dynamic
>
data
=
jsonDecode
(
response
.
body
);
...
...
@@ -51,7 +53,7 @@ class _SignInPageState extends State<SignInPage> {
}
}
//Get
Bottle
List 함수
//Get
Hub
List 함수
Future
<
String
>
getHubList
()
async
{
String
usertoken
=
await
UserSecureStorage
.
getUserToken
();
http
.
Response
response
=
await
http
.
get
(
...
...
@@ -207,6 +209,7 @@ class _SignInPageState extends State<SignInPage> {
String
saveMessage
=
await
login
(
emailController
.
text
,
passwordController
.
text
);
print
(
saveMessage
);
if
(
emailController
.
text
.
isEmpty
||
passwordController
.
text
.
isEmpty
)
{
showDialog
(
...
...
@@ -227,7 +230,6 @@ class _SignInPageState extends State<SignInPage> {
);
});
}
else
{
saveMessage
=
"로그인 성공"
;
if
(
saveMessage
==
"로그인 성공"
)
{
var
result
=
await
getHubList
();
print
(
result
);
...
...
@@ -242,6 +244,9 @@ class _SignInPageState extends State<SignInPage> {
}
else
if
(
result
==
"get완료"
)
{
UserSecureStorage
.
setUserToken
(
user
.
token
);
UserSecureStorage
.
setUserId
(
user
.
userId
);
print
(
'asdg'
);
Navigator
.
push
(
context
,
MaterialPageRoute
(
...
...
@@ -250,6 +255,8 @@ class _SignInPageState extends State<SignInPage> {
HubList
(
hublist:
_hublist
),
));
}
else
{}
}
else
{
print
(
'Error'
);
}
}
},
...
...
frontend/flutter_application_1/lib/src/screens/Register/SignUpLocal.dart
View file @
104f91c
import
'dart:convert'
;
import
'package:Smart_Medicine_Box/src/screens/Homepage.dart'
;
import
'package:flutter/material.dart'
;
import
'package:http/http.dart'
as
http
;
import
'package:flutter_dotenv/flutter_dotenv.dart'
;
...
...
@@ -182,7 +183,7 @@ class _SignUpLocalState extends State<SignUpLocal> {
context
,
MaterialPageRoute
(
builder:
(
BuildContext
context
)
=>
RegisterHub
()));
HomePage
()));
})
],
);
...
...
frontend/flutter_application_1/lib/src/utils/user_secure_stoarge.dart
View file @
104f91c
...
...
@@ -7,6 +7,12 @@ class UserSecureStorage {
static
const
_keyUserId
=
'userid'
;
static
const
_keyBottleId
=
'bottleid'
;
static
const
_keyMedicineId
=
'medicineid'
;
static
const
_keyhubId
=
'hubid'
;
static
Future
setUserId
(
String
userid
)
async
=>
await
_storage
.
write
(
key:
_keyUserId
,
value:
userid
);
...
...
@@ -18,4 +24,21 @@ class UserSecureStorage {
static
Future
<
String
>
getUserToken
()
async
=>
await
_storage
.
read
(
key:
_keyToken
);
static
Future
setBottleId
(
String
bottleid
)
async
=>
await
_storage
.
write
(
key:
_keyBottleId
,
value:
bottleid
);
static
Future
<
String
>
getBottleId
()
async
=>
await
_storage
.
read
(
key:
_keyBottleId
);
static
Future
setMedicineId
(
String
medicineid
)
async
=>
await
_storage
.
write
(
key:
_keyMedicineId
,
value:
medicineid
);
static
Future
<
String
>
getMedicineId
()
async
=>
await
_storage
.
read
(
key:
_keyMedicineId
);
static
Future
setHubId
(
String
hubid
)
async
=>
await
_storage
.
write
(
key:
_keyhubId
,
value:
hubid
);
static
Future
<
String
>
getHubId
()
async
=>
await
_storage
.
read
(
key:
_keyhubId
);
}
...
...
Please
register
or
login
to post a comment