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 16:00:22 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
831f24da0115cac6b6a8bd2fe24f872dfdaaa919
831f24da
1 parent
104f91c8
[frontend] app 뒤로가기 설정 변경
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
55 additions
and
4 deletions
frontend/README.md
frontend/flutter_application_1/lib/src/screens/DashBoard.dart
frontend/flutter_application_1/lib/src/screens/Homepage.dart
frontend/flutter_application_1/lib/src/screens/Register/BottleList.dart
frontend/flutter_application_1/lib/src/screens/Register/RegisterBottle.dart
frontend/flutter_application_1/lib/src/screens/Register/RegsiterHub.dart
frontend/README.md
View file @
831f24d
...
...
@@ -87,3 +87,6 @@ appbar 관련 디자인은 추후 구현 예정
### 2021-05-26
+
future buillder 변경
### 2021-05-27
+
app 뒤로가기 설정 변경
\ No newline at end of file
...
...
frontend/flutter_application_1/lib/src/screens/DashBoard.dart
View file @
831f24d
...
...
@@ -9,6 +9,7 @@ import '../utils/user_secure_stoarge.dart';
import
'models/Bottle.dart'
;
import
'models/Medicine.dart'
;
import
'package:Smart_Medicine_Box/src/screens/SettingPage.dart'
;
import
'Register/BottleList.dart'
;
class
DashBoard
extends
StatefulWidget
{
int
pageNumber
;
...
...
@@ -24,6 +25,35 @@ class DashBoard extends StatefulWidget {
class
_DashBoardState
extends
State
<
DashBoard
>
{
int
_selectedIndex
=
0
;
List
<
Bottle
>
_bottleList
=
new
List
<
Bottle
>();
//Get BottleList
Future
<
String
>
getBottleList
()
async
{
String
usertoken
=
await
UserSecureStorage
.
getUserToken
();
String
hubid
=
await
UserSecureStorage
.
getHubId
();
http
.
Response
response
=
await
http
.
get
(
Uri
.
encodeFull
(
DotEnv
().
env
[
'SERVER_URL'
]
+
'bottle/hub/'
+
hubid
),
headers:
{
"authorization"
:
usertoken
},
);
print
(
response
.
body
);
if
(
_bottleList
.
length
!=
0
)
{
_bottleList
.
clear
();
}
if
(
response
.
statusCode
==
200
)
{
List
<
dynamic
>
values
=
new
List
<
dynamic
>();
values
=
json
.
decode
(
response
.
body
);
for
(
int
i
=
0
;
i
<
values
.
length
;
i
++)
{
Map
<
String
,
dynamic
>
map
=
values
[
i
];
_bottleList
.
add
(
Bottle
.
fromJson
(
map
));
return
"GET"
;
}
}
else
if
(
response
.
statusCode
==
404
)
{
return
"Not Found"
;
}
else
{
return
"Error"
;
}
return
"Error"
;
}
Widget
build
(
BuildContext
context
)
{
_selectedIndex
=
widget
.
pageNumber
;
...
...
@@ -33,7 +63,8 @@ class _DashBoardState extends State<DashBoard> {
outerInformationpage
(
context
),
];
return
Scaffold
(
return
WillPopScope
(
child:
Scaffold
(
backgroundColor:
Color
(
0xffe5f4ff
),
appBar:
AppBar
(
iconTheme:
IconThemeData
(
color:
Colors
.
black
),
...
...
@@ -109,6 +140,16 @@ class _DashBoardState extends State<DashBoard> {
)
],
),
),
onWillPop:
()
async
{
await
getBottleList
();
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
BuildContext
context
)
=>
BottleList
(
bottlelist:
_bottleList
),
));
},
);
}
...
...
@@ -314,7 +355,6 @@ Widget mainpage(BuildContext context) {
}
Widget
ineerInformationpage
(
BuildContext
context
)
{
Bottle
_bottleinformation
=
new
Bottle
();
//get bottle
Future
<
Bottle
>
_getbottle
()
async
{
String
usertoken
=
await
UserSecureStorage
.
getUserToken
();
...
...
frontend/flutter_application_1/lib/src/screens/Homepage.dart
View file @
831f24d
...
...
@@ -55,7 +55,7 @@ class _HomePageState extends State<HomePage> {
textScaleFactor:
1.0
,
style:
TextStyle
(
color:
Color
(
0xff004ca2
),
fontSize:
2
0
,
fontSize:
3
0
,
fontFamily:
'Noto'
,
fontWeight:
FontWeight
.
bold
),
),
...
...
frontend/flutter_application_1/lib/src/screens/Register/BottleList.dart
View file @
831f24d
...
...
@@ -19,7 +19,8 @@ class BottleList extends StatefulWidget {
class
_BottleListState
extends
State
<
BottleList
>
{
Widget
build
(
BuildContext
context
)
{
final
Size
size
=
MediaQuery
.
of
(
context
).
size
;
return
Scaffold
(
return
WillPopScope
(
child:
Scaffold
(
body:
Container
(
height:
size
.
height
,
child:
Column
(
...
...
@@ -86,6 +87,10 @@ class _BottleListState extends State<BottleList> {
)
],
)),
),
onWillPop:
()
{
SystemNavigator
.
pop
();
},
);
}
}
...
...
frontend/flutter_application_1/lib/src/screens/Register/RegisterBottle.dart
View file @
831f24d
...
...
@@ -117,6 +117,8 @@ class _RegisterBottleState extends State<RegisterBottle> {
new
FlatButton
(
child:
new
Text
(
'Close'
),
onPressed:
()
{
UserSecureStorage
.
setBottleId
(
medicineBottleIDController
.
text
);
Navigator
.
push
(
context
,
MaterialPageRoute
(
...
...
frontend/flutter_application_1/lib/src/screens/Register/RegsiterHub.dart
View file @
831f24d
...
...
@@ -121,6 +121,7 @@ class _RegisterHubState extends State<RegisterHub> {
print
(
saveMessage
);
if
(
saveMessage
==
"허브 등록 완료"
)
{
UserSecureStorage
.
setHubId
(
medicineHubIDController
.
text
);
print
(
UserSecureStorage
.
getHubId
());
Navigator
.
push
(
context
,
MaterialPageRoute
(
...
...
Please
register
or
login
to post a comment