고원빈

[frontend] 2021-06-02

...@@ -97,3 +97,6 @@ appbar 관련 디자인은 추후 구현 예정 ...@@ -97,3 +97,6 @@ appbar 관련 디자인은 추후 구현 예정
97 97
98 ### 2021-05-30 98 ### 2021-05-30
99 + Sqlite 생성 99 + Sqlite 생성
100 +
101 +### 2021-06-01
102 ++ datetime 형식 한국 시간으로 변경
...\ No newline at end of file ...\ No newline at end of file
......
1 -SERVER_URL=http://192.168.154.240:4444/api/
...\ No newline at end of file ...\ No newline at end of file
1 +SERVER_URL=http://192.168.0.3:4717/api/
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -5,6 +5,7 @@ import 'package:flutter_dotenv/flutter_dotenv.dart'; ...@@ -5,6 +5,7 @@ import 'package:flutter_dotenv/flutter_dotenv.dart';
5 5
6 Future main() async { 6 Future main() async {
7 await DotEnv().load('.env'); 7 await DotEnv().load('.env');
8 +
8 runApp(MyApp()); 9 runApp(MyApp());
9 } 10 }
10 11
......
...@@ -10,6 +10,7 @@ import 'models/Medicine.dart'; ...@@ -10,6 +10,7 @@ import 'models/Medicine.dart';
10 import 'package:Smart_Medicine_Box/src/screens/SettingPage.dart'; 10 import 'package:Smart_Medicine_Box/src/screens/SettingPage.dart';
11 import 'Register/BottleList.dart'; 11 import 'Register/BottleList.dart';
12 import 'Register/SearchMedicine.dart'; 12 import 'Register/SearchMedicine.dart';
13 +import 'package:intl/date_symbol_data_local.dart';
13 14
14 class DashBoard extends StatefulWidget { 15 class DashBoard extends StatefulWidget {
15 int pageNumber; 16 int pageNumber;
...@@ -34,7 +35,6 @@ class _DashBoardState extends State<DashBoard> { ...@@ -34,7 +35,6 @@ class _DashBoardState extends State<DashBoard> {
34 Uri.encodeFull(DotEnv().env['SERVER_URL'] + 'bottle/hub/' + hubid), 35 Uri.encodeFull(DotEnv().env['SERVER_URL'] + 'bottle/hub/' + hubid),
35 headers: {"authorization": usertoken}, 36 headers: {"authorization": usertoken},
36 ); 37 );
37 - print(response.body);
38 if (_bottleList.length != 0) { 38 if (_bottleList.length != 0) {
39 _bottleList.clear(); 39 _bottleList.clear();
40 } 40 }
...@@ -83,7 +83,13 @@ class _DashBoardState extends State<DashBoard> { ...@@ -83,7 +83,13 @@ class _DashBoardState extends State<DashBoard> {
83 Icons.settings, 83 Icons.settings,
84 color: Colors.black, 84 color: Colors.black,
85 ), 85 ),
86 - onPressed: () {}, 86 + onPressed: () {
87 + Navigator.push(
88 + context,
89 + MaterialPageRoute(
90 + builder: (BuildContext context) => SettingPage(),
91 + ));
92 + },
87 ) 93 )
88 ], 94 ],
89 ), 95 ),
...@@ -96,18 +102,6 @@ class _DashBoardState extends State<DashBoard> { ...@@ -96,18 +102,6 @@ class _DashBoardState extends State<DashBoard> {
96 color: Colors.blue, 102 color: Colors.blue,
97 ), 103 ),
98 ), 104 ),
99 - ListTile(
100 - title: Text('Test 1'),
101 - onTap: () {},
102 - ),
103 - ListTile(
104 - title: Text('Test 2'),
105 - onTap: () {},
106 - ),
107 - ListTile(
108 - title: Text('Test 3'),
109 - onTap: () {},
110 - ),
111 ], 105 ],
112 ), 106 ),
113 ), 107 ),
...@@ -167,7 +161,6 @@ Widget mainpage(BuildContext context) { ...@@ -167,7 +161,6 @@ Widget mainpage(BuildContext context) {
167 Future<Medicine> _getmedicine() async { 161 Future<Medicine> _getmedicine() async {
168 String usertoken = await UserSecureStorage.getUserToken(); 162 String usertoken = await UserSecureStorage.getUserToken();
169 String medicineid = await UserSecureStorage.getMedicineId(); 163 String medicineid = await UserSecureStorage.getMedicineId();
170 - print(medicineid);
171 164
172 http.Response medicineresponse = await http.get( 165 http.Response medicineresponse = await http.get(
173 Uri.encodeFull( 166 Uri.encodeFull(
...@@ -750,7 +743,7 @@ Widget outerInformationpage(BuildContext context) { ...@@ -750,7 +743,7 @@ Widget outerInformationpage(BuildContext context) {
750 743
751 if (response.statusCode == 200) { 744 if (response.statusCode == 200) {
752 Map<String, dynamic> jsonData = jsonDecode(response.body); 745 Map<String, dynamic> jsonData = jsonDecode(response.body);
753 - print(jsonData); 746 +
754 _bottleinformation = Bottle.fromJson(jsonData); 747 _bottleinformation = Bottle.fromJson(jsonData);
755 } 748 }
756 return _bottleinformation; 749 return _bottleinformation;
...@@ -773,8 +766,6 @@ Widget outerInformationpage(BuildContext context) { ...@@ -773,8 +766,6 @@ Widget outerInformationpage(BuildContext context) {
773 ), 766 ),
774 ); 767 );
775 } else { 768 } else {
776 - print(123412);
777 - print(snapshot.data.dosage);
778 return Container( 769 return Container(
779 height: size.height * 0.9, 770 height: size.height * 0.9,
780 margin: EdgeInsets.fromLTRB(0, 30, 0, 0), 771 margin: EdgeInsets.fromLTRB(0, 30, 0, 0),
...@@ -877,67 +868,6 @@ Widget outerInformationpage(BuildContext context) { ...@@ -877,67 +868,6 @@ Widget outerInformationpage(BuildContext context) {
877 ], 868 ],
878 ), 869 ),
879 ), 870 ),
880 - Container(
881 - margin: EdgeInsets.fromLTRB(0, 0, 0, 0),
882 - height: size.height * 0.20,
883 - width: size.width,
884 - child: Column(
885 - children: <Widget>[
886 - Flexible(
887 - child: Column(
888 - mainAxisAlignment: MainAxisAlignment.center,
889 - children: <Widget>[
890 - Container(
891 - padding: EdgeInsets.fromLTRB(5, 5, 5, 0),
892 - width: size.width * 0.9,
893 - height: size.height * 0.18,
894 - decoration: BoxDecoration(
895 - color: Color(0xff8E97FD),
896 - borderRadius: BorderRadius.circular(10.0),
897 - ),
898 - child: Column(
899 - children: [
900 - Container(
901 - width: size.width,
902 - height: size.height * 0.05,
903 - child: Center(
904 - child: Text(
905 - '약 복용 시간',
906 - textAlign: TextAlign.center,
907 - textScaleFactor: 1.0,
908 - style: TextStyle(
909 - color: Colors.white,
910 - fontSize: 28,
911 - fontFamily: 'NotoSansKR',
912 - fontWeight: FontWeight.w800),
913 - ),
914 - ),
915 - ),
916 - Container(
917 - width: size.width,
918 - height: size.height * 0.12,
919 - child: Center(
920 - child: Text(
921 - '15:57',
922 - textAlign: TextAlign.center,
923 - textScaleFactor: 1.0,
924 - style: TextStyle(
925 - color: Colors.white,
926 - fontSize: 70,
927 - fontFamily: 'NotoSansKR',
928 - fontWeight: FontWeight.w800),
929 - ),
930 - ),
931 - ),
932 - ],
933 - ),
934 - ),
935 - ],
936 - ),
937 - ),
938 - ],
939 - ),
940 - ),
941 ], 871 ],
942 ), 872 ),
943 ); 873 );
......
...@@ -50,7 +50,6 @@ class _BottleListState extends State<BottleList> { ...@@ -50,7 +50,6 @@ class _BottleListState extends State<BottleList> {
50 _userbottleList = await provider.getAllBottle(); 50 _userbottleList = await provider.getAllBottle();
51 for (int i = 0; i < _userbottleList.length; i++) { 51 for (int i = 0; i < _userbottleList.length; i++) {
52 print(_userbottleList[i].bottleId); 52 print(_userbottleList[i].bottleId);
53 - print(12345678);
54 } 53 }
55 54
56 print(provider.getAllBottle()); 55 print(provider.getAllBottle());
...@@ -172,9 +171,7 @@ class _BottleListState extends State<BottleList> { ...@@ -172,9 +171,7 @@ class _BottleListState extends State<BottleList> {
172 Icons.create_sharp, 171 Icons.create_sharp,
173 color: Colors.black, 172 color: Colors.black,
174 ), 173 ),
175 - onPressed: () { 174 + onPressed: () {},
176 - print("asdfg");
177 - },
178 ), 175 ),
179 ), 176 ),
180 ], 177 ],
......
...@@ -22,8 +22,7 @@ class _DetailMedicineState extends State<DetailMedicine> { ...@@ -22,8 +22,7 @@ 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); 25 +
26 - print(widget.bottleId);
27 http.Response response = await http.patch( 26 http.Response response = await http.patch(
28 Uri.encodeFull( 27 Uri.encodeFull(
29 DotEnv().env['SERVER_URL'] + 'bottle/' + widget.bottleId), 28 DotEnv().env['SERVER_URL'] + 'bottle/' + widget.bottleId),
...@@ -35,7 +34,7 @@ class _DetailMedicineState extends State<DetailMedicine> { ...@@ -35,7 +34,7 @@ class _DetailMedicineState extends State<DetailMedicine> {
35 'medicineId': widget.searchMedicine.medicineId, 34 'medicineId': widget.searchMedicine.medicineId,
36 'dosage': medicineDosageController.text 35 'dosage': medicineDosageController.text
37 })); 36 }));
38 - print(response.body); 37 +
39 if (response.statusCode == 200) { 38 if (response.statusCode == 200) {
40 String usertoken = await UserSecureStorage.setMedicineId( 39 String usertoken = await UserSecureStorage.setMedicineId(
41 widget.searchMedicine.medicineId.toString()); 40 widget.searchMedicine.medicineId.toString());
......
...@@ -27,7 +27,7 @@ class _HubListState extends State<HubList> { ...@@ -27,7 +27,7 @@ class _HubListState extends State<HubList> {
27 DotEnv().env['SERVER_URL'] + 'bottle/hub/' + hubid.toString()), 27 DotEnv().env['SERVER_URL'] + 'bottle/hub/' + hubid.toString()),
28 headers: {"authorization": usertoken}, 28 headers: {"authorization": usertoken},
29 ); 29 );
30 - print(response.body); 30 +
31 if (_bottleList.length != 0) { 31 if (_bottleList.length != 0) {
32 _bottleList.clear(); 32 _bottleList.clear();
33 } 33 }
...@@ -51,12 +51,24 @@ class _HubListState extends State<HubList> { ...@@ -51,12 +51,24 @@ class _HubListState extends State<HubList> {
51 Widget build(BuildContext context) { 51 Widget build(BuildContext context) {
52 final Size size = MediaQuery.of(context).size; 52 final Size size = MediaQuery.of(context).size;
53 return Scaffold( 53 return Scaffold(
54 + appBar: AppBar(
55 + backgroundColor: Colors.white,
56 + leading: new Icon(Icons.medical_services_rounded,
57 + color: Colors.black, size: 45.0),
58 + title: Text(
59 + 'Smart Medicine Box',
60 + style: TextStyle(
61 + color: Colors.black,
62 + fontSize: 23,
63 + fontFamily: 'Noto',
64 + fontWeight: FontWeight.bold),
65 + ),
66 + ),
54 body: Container( 67 body: Container(
55 height: size.height, 68 height: size.height,
56 child: Column( 69 child: Column(
57 mainAxisAlignment: MainAxisAlignment.center, 70 mainAxisAlignment: MainAxisAlignment.center,
58 children: <Widget>[ 71 children: <Widget>[
59 - SizedBox(height: 70),
60 Container( 72 Container(
61 height: size.height * 0.1, 73 height: size.height * 0.1,
62 width: size.width, 74 width: size.width,
...@@ -80,7 +92,10 @@ class _HubListState extends State<HubList> { ...@@ -80,7 +92,10 @@ class _HubListState extends State<HubList> {
80 itemBuilder: (BuildContext context, int index) { 92 itemBuilder: (BuildContext context, int index) {
81 return Container( 93 return Container(
82 padding: EdgeInsets.all(8.0), 94 padding: EdgeInsets.all(8.0),
83 - decoration: BoxDecoration(border: Border.all()), 95 + decoration: BoxDecoration(
96 + border: Border.all(),
97 + borderRadius: BorderRadius.all(Radius.circular(25.0)),
98 + ),
84 child: ListTile( 99 child: ListTile(
85 title: Text( 100 title: Text(
86 'HUB ID: ' + '${widget.hublist[index]}', 101 'HUB ID: ' + '${widget.hublist[index]}',
......
...@@ -21,7 +21,7 @@ class _RegisterBottleState extends State<RegisterBottle> { ...@@ -21,7 +21,7 @@ class _RegisterBottleState extends State<RegisterBottle> {
21 Future<String> registerhub_Validate() async { 21 Future<String> registerhub_Validate() async {
22 String usertoken = await UserSecureStorage.getUserToken(); 22 String usertoken = await UserSecureStorage.getUserToken();
23 String hubid = await UserSecureStorage.getHubId(); 23 String hubid = await UserSecureStorage.getHubId();
24 - print(hubid); 24 +
25 http.Response bottleresponse = await http.post( 25 http.Response bottleresponse = await http.post(
26 Uri.encodeFull(DotEnv().env['SERVER_URL'] + 'bottle'), 26 Uri.encodeFull(DotEnv().env['SERVER_URL'] + 'bottle'),
27 headers: { 27 headers: {
......
...@@ -118,10 +118,8 @@ class _RegisterHubState extends State<RegisterHub> { ...@@ -118,10 +118,8 @@ class _RegisterHubState extends State<RegisterHub> {
118 child: RaisedButton( 118 child: RaisedButton(
119 onPressed: () async { 119 onPressed: () async {
120 String saveMessage = await registerhub_Validate(); 120 String saveMessage = await registerhub_Validate();
121 - print(saveMessage);
122 if (saveMessage == "허브 등록 완료") { 121 if (saveMessage == "허브 등록 완료") {
123 UserSecureStorage.setHubId(medicineHubIDController.text); 122 UserSecureStorage.setHubId(medicineHubIDController.text);
124 - print(UserSecureStorage.getHubId());
125 Navigator.push( 123 Navigator.push(
126 context, 124 context,
127 MaterialPageRoute( 125 MaterialPageRoute(
......
...@@ -28,7 +28,6 @@ class _SignInPageState extends State<SignInPage> { ...@@ -28,7 +28,6 @@ class _SignInPageState extends State<SignInPage> {
28 28
29 //Login 함수 29 //Login 함수
30 Future<String> login(String _email, String _password) async { 30 Future<String> login(String _email, String _password) async {
31 - print(Uri.encodeFull(DotEnv().env['SERVER_URL'] + 'auth/login'));
32 http.Response response = await http.post( 31 http.Response response = await http.post(
33 Uri.encodeFull(DotEnv().env['SERVER_URL'] + 'auth/login'), 32 Uri.encodeFull(DotEnv().env['SERVER_URL'] + 'auth/login'),
34 headers: {"Content-Type": "application/json"}, 33 headers: {"Content-Type": "application/json"},
...@@ -39,8 +38,6 @@ class _SignInPageState extends State<SignInPage> { ...@@ -39,8 +38,6 @@ class _SignInPageState extends State<SignInPage> {
39 }, 38 },
40 ), 39 ),
41 ); 40 );
42 - print(response.statusCode);
43 -
44 if (response.statusCode == 200) { 41 if (response.statusCode == 200) {
45 Map<String, dynamic> data = jsonDecode(response.body); 42 Map<String, dynamic> data = jsonDecode(response.body);
46 user = User.fromJson(data); 43 user = User.fromJson(data);
...@@ -56,15 +53,11 @@ class _SignInPageState extends State<SignInPage> { ...@@ -56,15 +53,11 @@ class _SignInPageState extends State<SignInPage> {
56 //Get Hub List 함수 53 //Get Hub List 함수
57 Future<String> getHubList() async { 54 Future<String> getHubList() async {
58 String usertoken = await UserSecureStorage.getUserToken(); 55 String usertoken = await UserSecureStorage.getUserToken();
59 - print(usertoken);
60 http.Response response = await http.get( 56 http.Response response = await http.get(
61 Uri.encodeFull(DotEnv().env['SERVER_URL'] + 'hub'), 57 Uri.encodeFull(DotEnv().env['SERVER_URL'] + 'hub'),
62 headers: {"authorization": usertoken}, 58 headers: {"authorization": usertoken},
63 ); 59 );
64 - print(response.statusCode);
65 List<dynamic> values = new List<dynamic>(); 60 List<dynamic> values = new List<dynamic>();
66 - print(1234125);
67 - print(values);
68 if (_hublist.length != 0) { 61 if (_hublist.length != 0) {
69 _hublist.clear(); 62 _hublist.clear();
70 } 63 }
...@@ -117,6 +110,9 @@ class _SignInPageState extends State<SignInPage> { ...@@ -117,6 +110,9 @@ class _SignInPageState extends State<SignInPage> {
117 fontFamily: 'Noto', 110 fontFamily: 'Noto',
118 fontWeight: FontWeight.bold)), 111 fontWeight: FontWeight.bold)),
119 ), 112 ),
113 + SizedBox(
114 + height: 40,
115 + ),
120 Padding( 116 Padding(
121 padding: const EdgeInsets.fromLTRB(20, 0, 20, 0), 117 padding: const EdgeInsets.fromLTRB(20, 0, 20, 0),
122 child: new Column( 118 child: new Column(
...@@ -211,7 +207,6 @@ class _SignInPageState extends State<SignInPage> { ...@@ -211,7 +207,6 @@ class _SignInPageState extends State<SignInPage> {
211 String saveMessage = await login( 207 String saveMessage = await login(
212 emailController.text, 208 emailController.text,
213 passwordController.text); 209 passwordController.text);
214 - print(saveMessage);
215 if (emailController.text.isEmpty || 210 if (emailController.text.isEmpty ||
216 passwordController.text.isEmpty) { 211 passwordController.text.isEmpty) {
217 showDialog( 212 showDialog(
...@@ -236,8 +231,6 @@ class _SignInPageState extends State<SignInPage> { ...@@ -236,8 +231,6 @@ class _SignInPageState extends State<SignInPage> {
236 UserSecureStorage.setUserToken( 231 UserSecureStorage.setUserToken(
237 user.token); 232 user.token);
238 var result = await getHubList(); 233 var result = await getHubList();
239 - print("Result");
240 - print(result);
241 if (result == "Not Found") { 234 if (result == "Not Found") {
242 Navigator.push( 235 Navigator.push(
243 context, 236 context,
...@@ -249,7 +242,6 @@ class _SignInPageState extends State<SignInPage> { ...@@ -249,7 +242,6 @@ class _SignInPageState extends State<SignInPage> {
249 } else if (result == "get완료") { 242 } else if (result == "get완료") {
250 UserSecureStorage.setUserId( 243 UserSecureStorage.setUserId(
251 user.userId); 244 user.userId);
252 - print('getgetget');
253 Navigator.push( 245 Navigator.push(
254 context, 246 context,
255 MaterialPageRoute( 247 MaterialPageRoute(
......
...@@ -23,7 +23,6 @@ class _SignUpLocalState extends State<SignUpLocal> { ...@@ -23,7 +23,6 @@ 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'));
27 http.Response response = await http.post( 26 http.Response response = await http.post(
28 Uri.encodeFull(DotEnv().env['SERVER_URL'] + 'auth/register'), 27 Uri.encodeFull(DotEnv().env['SERVER_URL'] + 'auth/register'),
29 headers: {"Content-Type": "application/json"}, 28 headers: {"Content-Type": "application/json"},
...@@ -35,8 +34,6 @@ class _SignUpLocalState extends State<SignUpLocal> { ...@@ -35,8 +34,6 @@ class _SignUpLocalState extends State<SignUpLocal> {
35 }, 34 },
36 ), 35 ),
37 ); 36 );
38 -
39 - print(response.statusCode);
40 if (response.statusCode == 201) { 37 if (response.statusCode == 201) {
41 return "정보 입력 완료"; 38 return "정보 입력 완료";
42 } else { 39 } else {
......
1 +import 'package:Smart_Medicine_Box/src/screens/SettingPage/HubModifyList.dart';
1 import 'package:flutter/material.dart'; 2 import 'package:flutter/material.dart';
2 import 'package:Smart_Medicine_Box/src/screens/DashBoard.dart'; 3 import 'package:Smart_Medicine_Box/src/screens/DashBoard.dart';
3 import 'package:Smart_Medicine_Box/src/screens/SettingPage/Alarm.dart'; 4 import 'package:Smart_Medicine_Box/src/screens/SettingPage/Alarm.dart';
4 -import 'package:Smart_Medicine_Box/src/screens/SettingPage/Bluetooth.dart';
5 import 'package:Smart_Medicine_Box/src/screens/SettingPage/DEVInformation.dart'; 5 import 'package:Smart_Medicine_Box/src/screens/SettingPage/DEVInformation.dart';
6 import 'package:Smart_Medicine_Box/src/screens/SettingPage/InformationModify.dart'; 6 import 'package:Smart_Medicine_Box/src/screens/SettingPage/InformationModify.dart';
7 +import '../screens/Register/HubList.dart';
7 8
8 class SettingPage extends StatefulWidget { 9 class SettingPage extends StatefulWidget {
9 @override 10 @override
...@@ -112,7 +113,7 @@ class _SettingPageState extends State<SettingPage> { ...@@ -112,7 +113,7 @@ class _SettingPageState extends State<SettingPage> {
112 fontFamily: 'Noto', 113 fontFamily: 'Noto',
113 fontWeight: FontWeight.bold), 114 fontWeight: FontWeight.bold),
114 ), 115 ),
115 - color: Color(0xff8E97FD), 116 + color: Color(0xff0B1E33),
116 shape: RoundedRectangleBorder( 117 shape: RoundedRectangleBorder(
117 borderRadius: BorderRadius.circular(50)), 118 borderRadius: BorderRadius.circular(50)),
118 ), 119 ),
...@@ -128,11 +129,12 @@ class _SettingPageState extends State<SettingPage> { ...@@ -128,11 +129,12 @@ class _SettingPageState extends State<SettingPage> {
128 Navigator.push( 129 Navigator.push(
129 context, 130 context,
130 MaterialPageRoute( 131 MaterialPageRoute(
131 - builder: (BuildContext context) => Bluetooth(), 132 + builder: (BuildContext context) =>
133 + HubModifyList(),
132 )); 134 ));
133 }, 135 },
134 child: Text( 136 child: Text(
135 - '블루투스 설정', 137 + '허브 등록',
136 textScaleFactor: 1.0, 138 textScaleFactor: 1.0,
137 style: TextStyle( 139 style: TextStyle(
138 color: Colors.white, 140 color: Colors.white,
...@@ -140,7 +142,7 @@ class _SettingPageState extends State<SettingPage> { ...@@ -140,7 +142,7 @@ class _SettingPageState extends State<SettingPage> {
140 fontFamily: 'Noto', 142 fontFamily: 'Noto',
141 fontWeight: FontWeight.bold), 143 fontWeight: FontWeight.bold),
142 ), 144 ),
143 - color: Color(0xff8E97FD), 145 + color: Color(0xff0B1E33),
144 shape: RoundedRectangleBorder( 146 shape: RoundedRectangleBorder(
145 borderRadius: BorderRadius.circular(50)), 147 borderRadius: BorderRadius.circular(50)),
146 ), 148 ),
...@@ -169,7 +171,7 @@ class _SettingPageState extends State<SettingPage> { ...@@ -169,7 +171,7 @@ class _SettingPageState extends State<SettingPage> {
169 fontFamily: 'Noto', 171 fontFamily: 'Noto',
170 fontWeight: FontWeight.bold), 172 fontWeight: FontWeight.bold),
171 ), 173 ),
172 - color: Color(0xff8E97FD), 174 + color: Color(0xff0B1E33),
173 shape: RoundedRectangleBorder( 175 shape: RoundedRectangleBorder(
174 borderRadius: BorderRadius.circular(50)), 176 borderRadius: BorderRadius.circular(50)),
175 ), 177 ),
...@@ -198,7 +200,7 @@ class _SettingPageState extends State<SettingPage> { ...@@ -198,7 +200,7 @@ class _SettingPageState extends State<SettingPage> {
198 fontFamily: 'Noto', 200 fontFamily: 'Noto',
199 fontWeight: FontWeight.bold), 201 fontWeight: FontWeight.bold),
200 ), 202 ),
201 - color: Color(0xff8E97FD), 203 + color: Color(0xff0B1E33),
202 shape: RoundedRectangleBorder( 204 shape: RoundedRectangleBorder(
203 borderRadius: BorderRadius.circular(50)), 205 borderRadius: BorderRadius.circular(50)),
204 ), 206 ),
...@@ -228,11 +230,12 @@ class _SettingPageState extends State<SettingPage> { ...@@ -228,11 +230,12 @@ class _SettingPageState extends State<SettingPage> {
228 }) 230 })
229 }, 231 },
230 items: [ 232 items: [
231 - BottomNavigationBarItem(icon: Icon(Icons.favorite), label: 'In'), 233 + BottomNavigationBarItem(
234 + icon: Icon(Icons.device_thermostat), label: 'In'),
232 BottomNavigationBarItem(icon: Icon(Icons.home), label: 'Home'), 235 BottomNavigationBarItem(icon: Icon(Icons.home), label: 'Home'),
233 BottomNavigationBarItem( 236 BottomNavigationBarItem(
234 label: 'Out', 237 label: 'Out',
235 - icon: Icon(Icons.favorite), 238 + icon: Icon(Icons.access_time),
236 ) 239 )
237 ], 240 ],
238 ), 241 ),
......
1 -import 'package:flutter/material.dart';
2 -import 'package:Smart_Medicine_Box/src/screens/SettingPage.dart';
3 -import 'package:flutter_blue/flutter_blue.dart';
4 -
5 -class Bluetooth extends StatefulWidget {
6 - @override
7 - _BluetoothState createState() => _BluetoothState();
8 -}
9 -
10 -FlutterBlue flutterBlue;
11 -
12 -class _BluetoothState extends State<Bluetooth> {
13 - @override
14 - void initState() {
15 - super.initState();
16 - flutterBlue = FlutterBlue.instance;
17 - }
18 -
19 - void _startscan() {
20 - flutterBlue.startScan(timeout: Duration(seconds: 12));
21 - var subscription = flutterBlue.scanResults.listen((results) {
22 - // do something with scan results
23 - for (ScanResult r in results) {
24 - print(
25 - 'Device Name : ${r.device.name} // Device ID : ${r.device.id} // Device rssi: ${r.rssi}');
26 - }
27 - });
28 - }
29 -
30 - Widget build(BuildContext context) {
31 - Widget _buildItem(ScanResult s) {
32 - return ListTile(
33 - leading: Text(s.rssi.toString()),
34 - title: Text(s.device.name),
35 - subtitle: Text(s.device.id.id),
36 - onTap: () =>
37 - Navigator.of(context).push(MaterialPageRoute(builder: (context) {
38 - return Device(device: s.device);
39 - })),
40 - );
41 - }
42 -
43 - Widget _buildList(List<ScanResult> scanResults) {
44 - return Column(
45 - children: scanResults.map((v) => _buildItem(v)).toList(),
46 - );
47 - }
48 -
49 - return MaterialApp(
50 - title: 'Welcome to Flutter',
51 - home: Scaffold(
52 - appBar: AppBar(
53 - iconTheme: IconThemeData(color: Colors.black),
54 - backgroundColor: Colors.white,
55 - title: Text(
56 - 'Smart Medicine Box',
57 - style: TextStyle(
58 - color: Colors.black,
59 - fontSize: 20,
60 - fontFamily: 'Noto',
61 - fontWeight: FontWeight.bold),
62 - ),
63 - actions: [
64 - IconButton(
65 - icon: Icon(
66 - Icons.settings,
67 - color: Colors.black,
68 - ),
69 - onPressed: () {
70 - Navigator.push(
71 - context,
72 - MaterialPageRoute(
73 - builder: (BuildContext context) => SettingPage(),
74 - ));
75 - },
76 - )
77 - ],
78 - ),
79 - drawer: Drawer(
80 - child: ListView(
81 - children: [
82 - DrawerHeader(
83 - child: Text('Drawer Header'),
84 - decoration: BoxDecoration(
85 - color: Colors.blue,
86 - ),
87 - ),
88 - ListTile(
89 - title: Text('Test 1'),
90 - onTap: () {},
91 - ),
92 - ListTile(
93 - title: Text('Test 2'),
94 - onTap: () {},
95 - ),
96 - ListTile(
97 - title: Text('Test 3'),
98 - onTap: () {},
99 - ),
100 - ],
101 - ),
102 - ),
103 - body: SingleChildScrollView(
104 - child: StreamBuilder<List<ScanResult>>(
105 - stream: FlutterBlue.instance.scanResults,
106 - initialData: [],
107 - builder: (c, snapshot) {
108 - return _buildList(snapshot.data);
109 - }),
110 - ),
111 - floatingActionButton: StreamBuilder<bool>(
112 - stream: FlutterBlue.instance.isScanning,
113 - initialData: false,
114 - builder: (c, snapshot) {
115 - if (snapshot.data) {
116 - return FloatingActionButton(
117 - child: Icon(Icons.stop),
118 - onPressed: () => FlutterBlue.instance.stopScan(),
119 - backgroundColor: Colors.red,
120 - );
121 - } else {
122 - return FloatingActionButton(
123 - child: Icon(Icons.search),
124 - onPressed: () => FlutterBlue.instance
125 - .startScan(timeout: Duration(seconds: 4)));
126 - }
127 - },
128 - ),
129 - ),
130 - );
131 - }
132 -}
133 -
134 -class Device extends StatefulWidget {
135 - Device({Key key, this.device}) : super(key: key);
136 - final BluetoothDevice device;
137 - @override
138 - _DeviceState createState() => _DeviceState();
139 -}
140 -
141 -class _DeviceState extends State<Device> {
142 - void initState() {
143 - super.initState();
144 - widget.device.connect();
145 - }
146 -
147 - @override
148 - void dispose() {
149 - widget.device.disconnect();
150 - super.dispose();
151 - }
152 -
153 - Widget _buildIconButton() {
154 - return StreamBuilder<BluetoothDeviceState>(
155 - stream: widget.device.state,
156 - initialData: BluetoothDeviceState.connecting,
157 - builder: (c, snapshot) {
158 - if (snapshot.data != BluetoothDeviceState.connected)
159 - return Icon(Icons.warning);
160 - return IconButton(
161 - icon: Icon(Icons.bluetooth_searching),
162 - onPressed: () => widget.device.discoverServices(),
163 - );
164 - });
165 - }
166 -
167 - @override
168 - Widget build(BuildContext context) {
169 - return Scaffold(
170 - appBar: AppBar(
171 - title: Text(widget.device.name),
172 - actions: <Widget>[
173 - _buildIconButton(),
174 - ],
175 - ),
176 - body: Text('hello'),
177 - );
178 - }
179 -}
1 import 'package:flutter/material.dart'; 1 import 'package:flutter/material.dart';
2 -import 'package:flutter/services.dart'; 2 +
3 -import '../../shared/colors.dart'; 3 +import 'package:Smart_Medicine_Box/src/screens/SettingPage.dart';
4 -import 'package:flutter_screenutil/flutter_screenutil.dart';
5 4
6 class DEVInformation extends StatefulWidget { 5 class DEVInformation extends StatefulWidget {
7 @override 6 @override
...@@ -10,16 +9,36 @@ class DEVInformation extends StatefulWidget { ...@@ -10,16 +9,36 @@ class DEVInformation extends StatefulWidget {
10 9
11 class _DEVInformationState extends State<DEVInformation> { 10 class _DEVInformationState extends State<DEVInformation> {
12 Widget build(BuildContext context) { 11 Widget build(BuildContext context) {
13 - return MaterialApp( 12 + final Size size = MediaQuery.of(context).size;
14 - title: 'Welcome to Flutter', 13 + return Scaffold(
15 - home: Scaffold(
16 appBar: AppBar( 14 appBar: AppBar(
17 - title: Text('Welcome to Flutter'), 15 + iconTheme: IconThemeData(color: Colors.black),
16 + backgroundColor: Colors.white,
17 + title: Text(
18 + 'Smart Medicine Box',
19 + style: TextStyle(
20 + color: Colors.black,
21 + fontSize: 20,
22 + fontFamily: 'Noto',
23 + fontWeight: FontWeight.bold),
18 ), 24 ),
19 - body: Center( 25 + actions: [
20 - child: Text('개발자 정보 작업 구역'), 26 + IconButton(
27 + icon: Icon(
28 + Icons.settings,
29 + color: Colors.black,
21 ), 30 ),
31 + onPressed: () {
32 + Navigator.push(
33 + context,
34 + MaterialPageRoute(
35 + builder: (BuildContext context) => SettingPage(),
36 + ));
37 + },
38 + )
39 + ],
22 ), 40 ),
41 + body: Text('1234'),
23 ); 42 );
24 } 43 }
25 } 44 }
......
1 +import 'package:flutter/cupertino.dart';
2 +import 'package:flutter/material.dart';
3 +import 'dart:convert';
4 +import 'package:http/http.dart' as http;
5 +import 'package:flutter_dotenv/flutter_dotenv.dart';
6 +// Screen import
7 +import '../models/Bottle.dart';
8 +import '../../utils/user_secure_stoarge.dart';
9 +
10 +class HubModifyList extends StatefulWidget {
11 + List<int> hublist;
12 + HubModifyList({Key key, this.hublist}) : super(key: key);
13 +
14 + @override
15 + _HubModifyListState createState() => _HubModifyListState();
16 +}
17 +
18 +class _HubModifyListState extends State<HubModifyList> {
19 + List<int> _hublist = new List<int>();
20 + //Get Hub List 함수
21 + Future<String> getHubList() async {
22 + String usertoken = await UserSecureStorage.getUserToken();
23 + http.Response response = await http.get(
24 + Uri.encodeFull(DotEnv().env['SERVER_URL'] + 'hub'),
25 + headers: {"authorization": usertoken},
26 + );
27 + List<dynamic> values = new List<dynamic>();
28 + if (_hublist.length != 0) {
29 + _hublist.clear();
30 + }
31 + if (response.statusCode == 200) {
32 + values = json.decode(response.body);
33 + for (int i = 0; i < values.length; i++) {
34 + _hublist.add(values[i]['hubId']);
35 + }
36 + print(_hublist);
37 + return "get완료";
38 + } else if (response.statusCode == 404) {
39 + return "Not Found";
40 + } else {
41 + return "Error";
42 + }
43 + }
44 +
45 + Widget build(BuildContext context) {
46 + final Size size = MediaQuery.of(context).size;
47 + return Scaffold(
48 + appBar: AppBar(
49 + backgroundColor: Colors.white,
50 + leading: new Icon(Icons.medical_services_rounded,
51 + color: Colors.black, size: 45.0),
52 + title: Text(
53 + 'Smart Medicine Box',
54 + style: TextStyle(
55 + color: Colors.black,
56 + fontSize: 23,
57 + fontFamily: 'Noto',
58 + fontWeight: FontWeight.bold),
59 + ),
60 + ),
61 + body: FutureBuilder(
62 + future: getHubList(),
63 + builder: (BuildContext context, AsyncSnapshot snapshot) {
64 + if (snapshot.hasData == false) {
65 + return CircularProgressIndicator();
66 + } else if (snapshot.hasError) {
67 + return Padding(
68 + padding: const EdgeInsets.all(8.0),
69 + child: Text(
70 + 'Error: ${snapshot.error}',
71 + style: TextStyle(fontSize: 15),
72 + ),
73 + );
74 + } else {
75 + return Container(
76 + height: size.height,
77 + child: Column(
78 + mainAxisAlignment: MainAxisAlignment.center,
79 + children: <Widget>[
80 + Container(
81 + height: size.height * 0.1,
82 + width: size.width,
83 + child: Center(
84 + child: Text(
85 + '등록된 허브 리스트',
86 + textScaleFactor: 1.0,
87 + style: TextStyle(
88 + fontSize: 28,
89 + fontFamily: 'Noto',
90 + fontWeight: FontWeight.bold),
91 + ),
92 + ),
93 + decoration: BoxDecoration(border: Border.all()),
94 + ),
95 + SizedBox(height: 30),
96 + Expanded(
97 + child: ListView.separated(
98 + padding: const EdgeInsets.all(30),
99 + itemCount:
100 + _hublist.length == null ? 0 : _hublist.length,
101 + itemBuilder: (BuildContext context, int index) {
102 + return Container(
103 + padding: EdgeInsets.all(8.0),
104 + decoration: BoxDecoration(
105 + border: Border.all(),
106 + borderRadius:
107 + BorderRadius.all(Radius.circular(25.0)),
108 + ),
109 + child: ListTile(
110 + title: Text(
111 + 'HUB ID: ' + '${_hublist[index]}',
112 + style: TextStyle(
113 + color: Colors.black,
114 + fontSize: 20,
115 + fontFamily: 'Noto',
116 + fontWeight: FontWeight.bold),
117 + ),
118 + trailing: Icon(Icons.highlight_remove),
119 + onTap: () async {
120 + print('삭제 할거임');
121 + }),
122 + );
123 + },
124 + separatorBuilder: (BuildContext contetx, int index) =>
125 + const Divider(),
126 + ),
127 + ),
128 + Container(
129 + padding: EdgeInsets.fromLTRB(0, 20, 0, 20),
130 + width: size.width * 0.8,
131 + height: size.height * 0.13,
132 + margin: EdgeInsets.only(bottom: 0),
133 + child: FlatButton(
134 + height: size.height * 0.07,
135 + onPressed: () {},
136 + child: Text(
137 + '허브 추가',
138 + textScaleFactor: 1.0,
139 + style: TextStyle(
140 + color: Colors.white,
141 + fontSize: 24,
142 + fontFamily: 'Noto',
143 + fontWeight: FontWeight.bold),
144 + ),
145 + color: Color(0xff0B1E33),
146 + shape: RoundedRectangleBorder(
147 + borderRadius: BorderRadius.circular(50)),
148 + ),
149 + ),
150 + ],
151 + ),
152 + );
153 + }
154 + }),
155 + );
156 + }
157 +}
...@@ -77,24 +77,18 @@ class CustomPicker extends CommonPickerModel { ...@@ -77,24 +77,18 @@ class CustomPicker extends CommonPickerModel {
77 DateTime finalTime() { 77 DateTime finalTime() {
78 var leftindex; 78 var leftindex;
79 79
80 - print(indexs);
81 -
82 if (indexs == 1) { 80 if (indexs == 1) {
83 - if(this.currentLeftIndex() == 12){ 81 + if (this.currentLeftIndex() == 12) {
84 leftindex = 12; 82 leftindex = 12;
85 } else { 83 } else {
86 leftindex = this.currentLeftIndex() + 12; 84 leftindex = this.currentLeftIndex() + 12;
87 } 85 }
88 -
89 -
90 } else if (indexs == 0) { 86 } else if (indexs == 0) {
91 - if(this.currentLeftIndex() == 12){ 87 + if (this.currentLeftIndex() == 12) {
92 leftindex = 0; 88 leftindex = 0;
93 } else { 89 } else {
94 leftindex = this.currentLeftIndex(); 90 leftindex = this.currentLeftIndex();
95 } 91 }
96 -
97 -
98 } 92 }
99 93
100 return currentTime.isUtc 94 return currentTime.isUtc
......
...@@ -19,13 +19,12 @@ class Bottle { ...@@ -19,13 +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']);
23 return Bottle( 22 return Bottle(
24 bottleId: parsedJson['bottleId'], 23 bottleId: parsedJson['bottleId'],
25 temperature: parsedJson['temperature'].toString(), 24 temperature: parsedJson['temperature'].toString(),
26 humidity: parsedJson['humidity'].toString(), 25 humidity: parsedJson['humidity'].toString(),
27 balance: parsedJson['balance'].toString(), 26 balance: parsedJson['balance'].toString(),
28 - recentOpen: DateTime.parse(parsedJson['recentOpen']), 27 + recentOpen: DateTime.parse(parsedJson['recentOpen']).toLocal(),
29 medicineId: parsedJson['medicineId'], 28 medicineId: parsedJson['medicineId'],
30 hubId: parsedJson['hubId'], 29 hubId: parsedJson['hubId'],
31 dosage: parsedJson['dosage'], 30 dosage: parsedJson['dosage'],
......