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-30 01:44:09 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
bab36bc75906bc21e691a76782a7e57f2c2471e2
bab36bc7
1 parent
831f24da
[frontend] 새로 고침 + ui 변경
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
199 additions
and
36 deletions
frontend/README.md
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/HubList.dart
frontend/flutter_application_1/lib/src/screens/models/UserBottle.dart
frontend/flutter_application_1/pubspec.lock
frontend/flutter_application_1/pubspec.yaml
frontend/README.md
View file @
bab36bc
...
...
@@ -90,3 +90,7 @@ appbar 관련 디자인은 추후 구현 예정
### 2021-05-27
+
app 뒤로가기 설정 변경
### 2021-05-29
+
약병 리스트 ui 변경
+
DashBoard 새로고침
\ No newline at end of file
...
...
frontend/flutter_application_1/lib/src/screens/DashBoard.dart
View file @
bab36bc
...
...
@@ -118,6 +118,13 @@ class _DashBoardState extends State<DashBoard> {
),
),
body:
_tabs
[
_selectedIndex
],
floatingActionButton:
FloatingActionButton
(
onPressed:
()
{
setState
(()
{});
},
child:
const
Icon
(
Icons
.
refresh_outlined
),
backgroundColor:
Colors
.
blue
,
),
bottomNavigationBar:
BottomNavigationBar
(
type:
BottomNavigationBarType
.
fixed
,
backgroundColor:
Colors
.
grey
,
...
...
@@ -132,11 +139,12 @@ class _DashBoardState extends State<DashBoard> {
})
},
items:
[
BottomNavigationBarItem
(
icon:
Icon
(
Icons
.
favorite
),
label:
'In'
),
BottomNavigationBarItem
(
icon:
Icon
(
Icons
.
device_thermostat
),
label:
'In'
),
BottomNavigationBarItem
(
icon:
Icon
(
Icons
.
home
),
label:
'Home'
),
BottomNavigationBarItem
(
label:
'Out'
,
icon:
Icon
(
Icons
.
favorit
e
),
icon:
Icon
(
Icons
.
access_tim
e
),
)
],
),
...
...
@@ -146,8 +154,7 @@ class _DashBoardState extends State<DashBoard> {
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
BuildContext
context
)
=>
BottleList
(
bottlelist:
_bottleList
),
builder:
(
BuildContext
context
)
=>
BottleList
(),
));
},
);
...
...
frontend/flutter_application_1/lib/src/screens/Register/BottleList.dart
View file @
bab36bc
...
...
@@ -5,30 +5,85 @@ import 'package:http/http.dart' as http;
import
'package:flutter_dotenv/flutter_dotenv.dart'
;
import
'../models/Bottle.dart'
;
import
'../DashBoard.dart'
;
import
'../models/Medicine.dart'
;
import
'../../utils/user_secure_stoarge.dart'
;
class
BottleList
extends
StatefulWidget
{
List
<
Bottle
>
bottlelist
;
BottleList
({
Key
key
,
this
.
bottlelist
})
:
super
(
key:
key
);
BottleList
({
Key
key
})
:
super
(
key:
key
);
@override
_BottleListState
createState
()
=>
_BottleListState
();
}
class
_BottleListState
extends
State
<
BottleList
>
{
List
<
Bottle
>
_bottleList
=
new
List
<
Bottle
>();
Future
<
String
>
getBottleList
()
async
{
String
hubid
=
await
UserSecureStorage
.
getHubId
();
String
usertoken
=
await
UserSecureStorage
.
getUserToken
();
http
.
Response
response
=
await
http
.
get
(
Uri
.
encodeFull
(
DotEnv
().
env
[
'SERVER_URL'
]
+
'bottle/hub/'
+
hubid
.
toString
()),
headers:
{
"authorization"
:
usertoken
},
);
print
(
response
.
body
);
print
(
1
);
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"
;
}
}
Widget
build
(
BuildContext
context
)
{
final
Size
size
=
MediaQuery
.
of
(
context
).
size
;
return
WillPopScope
(
child:
Scaffold
(
body:
Container
(
appBar:
AppBar
(
backgroundColor:
Colors
.
white
,
leading:
new
Icon
(
Icons
.
medical_services_rounded
,
color:
Colors
.
black
,
size:
45.0
),
title:
Text
(
'Smart Medicine Box'
,
style:
TextStyle
(
color:
Colors
.
black
,
fontSize:
23
,
fontFamily:
'Noto'
,
fontWeight:
FontWeight
.
bold
),
),
),
body:
FutureBuilder
(
future:
getBottleList
(),
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
,
child:
Column
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
<
Widget
>[
SizedBox
(
height:
7
0
),
SizedBox
(
height:
1
0
),
Container
(
height:
size
.
height
*
0.1
,
height:
size
.
height
*
0.07
,
width:
size
.
width
,
child:
Center
(
child:
Text
(
...
...
@@ -40,35 +95,90 @@ class _BottleListState extends State<BottleList> {
fontWeight:
FontWeight
.
bold
),
),
),
decoration:
BoxDecoration
(
border:
Border
.
all
()),
),
SizedBox
(
height:
3
0
),
SizedBox
(
height:
1
0
),
Expanded
(
child:
ListView
.
separated
(
child:
GridView
.
builder
(
padding:
const
EdgeInsets
.
all
(
30
),
itemCount:
widget
.
bottlelist
.
length
==
null
?
0
:
widget
.
bottlelist
.
length
,
itemCount:
_bottleList
.
length
==
null
?
0
:
_bottleList
.
length
,
gridDelegate:
SliverGridDelegateWithMaxCrossAxisExtent
(
maxCrossAxisExtent:
200
,
crossAxisSpacing:
10
,
mainAxisSpacing:
10
,
),
itemBuilder:
(
BuildContext
context
,
int
index
)
{
return
Container
(
padding:
EdgeInsets
.
all
(
8.0
),
decoration:
BoxDecoration
(
border:
Border
.
all
()),
child:
ListTile
(
title:
Text
(
'BOTTLE ID : '
+
'
${widget.bottlelist[index].bottleId}
'
,
return
InkResponse
(
splashColor:
Colors
.
transparent
,
child:
Container
(
height:
140
,
padding:
const
EdgeInsets
.
all
(
10
),
decoration:
BoxDecoration
(
border:
Border
.
all
(),
borderRadius:
BorderRadius
.
all
(
Radius
.
circular
(
16.0
),
),
),
child:
Column
(
children:
[
Container
(
decoration:
BoxDecoration
(
border:
Border
(
bottom:
BorderSide
(
color:
Colors
.
black
,
width:
1
,
style:
BorderStyle
.
solid
),
),
),
height:
40
,
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
Container
(
height:
40
,
child:
Center
(
child:
Text
(
'
${_bottleList[index].bottleId}
'
,
style:
TextStyle
(
color:
Colors
.
black
,
fontSize:
20
,
fontFamily:
'Noto'
,
fontWeight:
FontWeight
.
bold
),
),
trailing:
Icon
(
Icons
.
arrow_forward
),
onTap:
()
async
{
),
),
Container
(
child:
IconButton
(
alignment:
Alignment
(
0.9
,
0
),
icon:
Icon
(
Icons
.
create_sharp
,
color:
Colors
.
black
,
),
onPressed:
()
{
print
(
"asdfg"
);
},
),
),
],
),
),
SizedBox
(
height:
10
),
Container
(
height:
90
,
child:
Icon
(
Icons
.
medical_services_outlined
,
size:
100
,
),
)
],
),
),
onTap:
()
{
UserSecureStorage
.
setBottleId
(
widget
.
bottlel
ist
[
index
].
bottleId
.
toString
());
_bottleL
ist
[
index
].
bottleId
.
toString
());
UserSecureStorage
.
setMedicineId
(
widget
.
bottlel
ist
[
index
].
medicineId
.
toString
());
_bottleL
ist
[
index
].
medicineId
.
toString
());
Navigator
.
push
(
context
,
MaterialPageRoute
(
...
...
@@ -78,15 +188,16 @@ class _BottleListState extends State<BottleList> {
),
);
},
),
);
},
separatorBuilder:
(
BuildContext
contetx
,
int
index
)
=>
const
Divider
(),
),
)
],
)),
),
);
}
},
),
),
onWillPop:
()
{
SystemNavigator
.
pop
();
...
...
frontend/flutter_application_1/lib/src/screens/Register/HubList.dart
View file @
bab36bc
...
...
@@ -102,9 +102,7 @@ class _HubListState extends State<HubList> {
context
,
MaterialPageRoute
(
builder:
(
BuildContext
context
)
=>
BottleList
(
bottlelist:
_bottleList
,
),
BottleList
(),
));
}
else
if
(
result
==
"Not Found"
)
{
showDialog
(
...
...
frontend/flutter_application_1/lib/src/screens/models/UserBottle.dart
0 → 100644
View file @
bab36bc
class
UserBottle
{
String
bottleId
;
String
bottleName
;
UserBottle
({
this
.
bottleId
,
this
.
bottleName
});
}
frontend/flutter_application_1/pubspec.lock
View file @
bab36bc
...
...
@@ -233,6 +233,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0-nullsafety.1"
path_provider:
dependency: "direct main"
description:
name: path_provider
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.28"
path_provider_linux:
dependency: transitive
description:
...
...
@@ -240,6 +247,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.1+2"
path_provider_macos:
dependency: transitive
description:
name: path_provider_macos
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.4+8"
path_provider_platform_interface:
dependency: transitive
description:
...
...
@@ -350,6 +364,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0-nullsafety.2"
sqflite:
dependency: "direct main"
description:
name: sqflite
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.2+4"
sqflite_common:
dependency: transitive
description:
name: sqflite_common
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.3+3"
stack_trace:
dependency: transitive
description:
...
...
@@ -371,6 +399,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0-nullsafety.1"
synchronized:
dependency: transitive
description:
name: synchronized
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.0+2"
term_glyph:
dependency: transitive
description:
...
...
@@ -421,5 +456,5 @@ packages:
source: hosted
version: "0.1.2"
sdks:
dart: ">=2.10.
0-110
<2.11.0"
flutter: ">=1.2
0.0
<2.0.0"
dart: ">=2.10.
2
<2.11.0"
flutter: ">=1.2
2.2
<2.0.0"
...
...
frontend/flutter_application_1/pubspec.yaml
View file @
bab36bc
...
...
@@ -39,6 +39,8 @@ dependencies:
flutter_dotenv
:
^2.1.0
numberpicker
:
^1.3.0
flutter_secure_storage
:
^3.3.5
sqflite
:
^1.1.6
path_provider
:
^1.2.0
dev_dependencies
:
flutter_test
:
...
...
Please
register
or
login
to post a comment