Showing
10 changed files
with
278 additions
and
145 deletions
| ... | @@ -70,7 +70,15 @@ appbar 관련 디자인은 추후 구현 예정 | ... | @@ -70,7 +70,15 @@ appbar 관련 디자인은 추후 구현 예정 |
| 70 | ### 2021-05-22 | 70 | ### 2021-05-22 |
| 71 | + 약병 검색 기능 구현 중 | 71 | + 약병 검색 기능 구현 중 |
| 72 | 72 | ||
| 73 | -### 2021-0523 | 73 | +### 2021-05-23 |
| 74 | + 로그인 하여 메인페이지 과정 구현 완료 | 74 | + 로그인 하여 메인페이지 과정 구현 완료 |
| 75 | + 폴더 정리 | 75 | + 폴더 정리 |
| 76 | 76 | ||
| 77 | + | ||
| 78 | +### 2021-05-24 | ||
| 79 | +회원 가입 --> 허브 등록 --> 약병 등록 -->로그인 페이지로 | ||
| 80 | +로그인 --> 허브 리스트 --> 약병 리스트 --> 메인 페이지 | ||
| 81 | ++ 시나리오 수정 완료 | ||
| 82 | ++ 메인 페이지 데이터 출력 완료 | ||
| 83 | + | ||
| 84 | + | ... | ... |
| 1 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
| 2 | -import 'package:Smart_Medicine_Box/src/screens/SettingPage.dart'; | ||
| 3 | import 'dart:convert'; | 2 | import 'dart:convert'; |
| 4 | import 'package:shared_preferences/shared_preferences.dart'; | 3 | import 'package:shared_preferences/shared_preferences.dart'; |
| 5 | import 'package:http/http.dart' as http; | 4 | import 'package:http/http.dart' as http; |
| 6 | import 'package:flutter_dotenv/flutter_dotenv.dart'; | 5 | import 'package:flutter_dotenv/flutter_dotenv.dart'; |
| 7 | 6 | ||
| 7 | +import 'models/Bottle.dart'; | ||
| 8 | +import 'models/Medicine.dart'; | ||
| 9 | +import 'package:Smart_Medicine_Box/src/screens/SettingPage.dart'; | ||
| 10 | + | ||
| 8 | class DashBoard extends StatefulWidget { | 11 | class DashBoard extends StatefulWidget { |
| 9 | int pageNumber; | 12 | int pageNumber; |
| 10 | - int bottleID; | 13 | + Bottle bottleInformation; |
| 11 | - DashBoard({Key key, this.pageNumber, this.bottleID}) : super(key: key); | 14 | + Medicine medicineInformation; |
| 15 | + | ||
| 16 | + DashBoard( | ||
| 17 | + {Key key, | ||
| 18 | + this.pageNumber, | ||
| 19 | + this.bottleInformation, | ||
| 20 | + this.medicineInformation}) | ||
| 21 | + : super(key: key); | ||
| 12 | 22 | ||
| 13 | @override | 23 | @override |
| 14 | _DashBoardState createState() => _DashBoardState(); | 24 | _DashBoardState createState() => _DashBoardState(); |
| 15 | } | 25 | } |
| 16 | 26 | ||
| 17 | class _DashBoardState extends State<DashBoard> { | 27 | class _DashBoardState extends State<DashBoard> { |
| 28 | + Bottle _bottleinformation = new Bottle(); | ||
| 18 | int _selectedIndex = 0; | 29 | int _selectedIndex = 0; |
| 19 | - | 30 | + Medicine _medicineInformation = new Medicine(); |
| 20 | Widget build(BuildContext context) { | 31 | Widget build(BuildContext context) { |
| 21 | _selectedIndex = widget.pageNumber; | 32 | _selectedIndex = widget.pageNumber; |
| 22 | - | 33 | + _medicineInformation = widget.medicineInformation; |
| 34 | + _bottleinformation = widget.bottleInformation; | ||
| 23 | var _tabs = [ | 35 | var _tabs = [ |
| 24 | - ineerInformationpage(context), | 36 | + ineerInformationpage(context, _bottleinformation), |
| 25 | - mainpage(context), | 37 | + mainpage(context, _medicineInformation), |
| 26 | - outerInformationpage(context), | 38 | + outerInformationpage(context, _bottleinformation), |
| 27 | ]; | 39 | ]; |
| 28 | 40 | ||
| 29 | return Scaffold( | 41 | return Scaffold( |
| ... | @@ -112,7 +124,7 @@ class _DashBoardState extends State<DashBoard> { | ... | @@ -112,7 +124,7 @@ class _DashBoardState extends State<DashBoard> { |
| 112 | } | 124 | } |
| 113 | } | 125 | } |
| 114 | 126 | ||
| 115 | -Widget mainpage(BuildContext context) { | 127 | +Widget mainpage(BuildContext context, Medicine medicineInformation) { |
| 116 | Future<String> getHubList() async { | 128 | Future<String> getHubList() async { |
| 117 | SharedPreferences prefs = await SharedPreferences.getInstance(); | 129 | SharedPreferences prefs = await SharedPreferences.getInstance(); |
| 118 | 130 | ||
| ... | @@ -122,117 +134,165 @@ Widget mainpage(BuildContext context) { | ... | @@ -122,117 +134,165 @@ Widget mainpage(BuildContext context) { |
| 122 | print(response.statusCode); | 134 | print(response.statusCode); |
| 123 | } | 135 | } |
| 124 | 136 | ||
| 137 | + //현재 접속 중인 허브 리스트 id와 약병 리스트 id 출력 | ||
| 138 | + //약 상세 정보 가져오기 --> 이건 Detail Medicine에서 가져 오면 됨 | ||
| 125 | final Size size = MediaQuery.of(context).size; | 139 | final Size size = MediaQuery.of(context).size; |
| 126 | - /* | ||
| 127 | - Main 화면 | ||
| 128 | - 약의 정보를 가져와서 출력을 하는 곳 | ||
| 129 | - 유저 이메일 | ||
| 130 | - 약 이름 | ||
| 131 | - 약 제조사 | ||
| 132 | - */ | ||
| 133 | return Scaffold( | 140 | return Scaffold( |
| 134 | backgroundColor: Colors.white, | 141 | backgroundColor: Colors.white, |
| 135 | - body: Container( | 142 | + body: SingleChildScrollView( |
| 136 | - height: size.height * 0.6, | 143 | + child: Container( |
| 137 | - margin: EdgeInsets.fromLTRB(0, 30, 0, 0), | 144 | + margin: EdgeInsets.fromLTRB(0, 30, 0, 0), |
| 138 | - padding: EdgeInsets.fromLTRB(5, 0, 5, 5), | 145 | + padding: EdgeInsets.fromLTRB(5, 0, 5, 5), |
| 139 | - child: Column( | 146 | + child: Column( |
| 140 | - crossAxisAlignment: CrossAxisAlignment.center, | 147 | + crossAxisAlignment: CrossAxisAlignment.center, |
| 141 | - children: <Widget>[ | 148 | + children: <Widget>[ |
| 142 | - Container( | 149 | + SizedBox(height: 20), |
| 143 | - padding: EdgeInsets.fromLTRB(5, 0, 5, 5), | 150 | + Container( |
| 144 | - margin: EdgeInsets.fromLTRB(0, 30, 0, 0), | 151 | + width: size.width, |
| 145 | - height: size.height * 0.15, | 152 | + padding: EdgeInsets.fromLTRB(5, 0, 5, 5), |
| 146 | - width: size.width, | 153 | + margin: EdgeInsets.all(15), |
| 147 | - decoration: BoxDecoration( | 154 | + decoration: BoxDecoration( |
| 148 | - border: Border.all(), | 155 | + border: Border.all(), |
| 149 | - borderRadius: BorderRadius.all( | 156 | + borderRadius: BorderRadius.all( |
| 150 | - Radius.circular(4.0) // <--- border radius here | 157 | + Radius.circular(25.0) // <--- border radius here |
| 158 | + ), | ||
| 159 | + ), | ||
| 160 | + child: Column( | ||
| 161 | + children: [ | ||
| 162 | + SizedBox(height: 30), | ||
| 163 | + Container( | ||
| 164 | + child: Center( | ||
| 165 | + child: Text( | ||
| 166 | + medicineInformation.name == null | ||
| 167 | + ? '-' | ||
| 168 | + : medicineInformation.name, | ||
| 169 | + style: TextStyle( | ||
| 170 | + color: Colors.black, | ||
| 171 | + fontSize: 24, | ||
| 172 | + fontFamily: 'NotoSansKR', | ||
| 173 | + fontWeight: FontWeight.w700)), | ||
| 174 | + ), | ||
| 151 | ), | 175 | ), |
| 152 | - ), | 176 | + SizedBox(height: 30), |
| 153 | - child: new Column( | 177 | + Container( |
| 154 | - crossAxisAlignment: CrossAxisAlignment.start, | 178 | + width: size.width, |
| 155 | - children: [ | 179 | + alignment: Alignment(0.9, 0), |
| 156 | - Text( | 180 | + child: Wrap( |
| 157 | - '약 이름:', | 181 | + children: [ |
| 158 | - style: TextStyle( | 182 | + Text( |
| 159 | - color: Colors.black, | 183 | + '제조사: ', |
| 160 | - fontSize: 24, | 184 | + style: TextStyle( |
| 161 | - fontFamily: 'NotoSansKR', | 185 | + color: Colors.grey, |
| 162 | - fontWeight: FontWeight.w700), | 186 | + fontSize: 14, |
| 163 | - ), | 187 | + ), |
| 164 | - Text( | 188 | + ), |
| 165 | - '무슨 무슨 비타민 ', | 189 | + Text( |
| 166 | - style: TextStyle( | 190 | + medicineInformation.company == null |
| 167 | - color: Colors.black, | 191 | + ? '-' |
| 168 | - fontSize: 36, | 192 | + : medicineInformation.company, |
| 169 | - fontFamily: 'NotoSansKR', | 193 | + style: TextStyle( |
| 170 | - fontWeight: FontWeight.w700), | 194 | + color: Colors.grey, |
| 171 | - ), | 195 | + fontSize: 14, |
| 172 | - ], | 196 | + ), |
| 173 | - ), | 197 | + ), |
| 174 | - ), | 198 | + ], |
| 175 | - Container( | 199 | + ), |
| 176 | - padding: EdgeInsets.fromLTRB(5, 0, 5, 5), | ||
| 177 | - margin: EdgeInsets.fromLTRB(0, 30, 0, 0), | ||
| 178 | - height: size.height * 0.15, | ||
| 179 | - width: size.width, | ||
| 180 | - decoration: BoxDecoration( | ||
| 181 | - border: Border.all(), | ||
| 182 | - borderRadius: BorderRadius.all( | ||
| 183 | - Radius.circular(4.0) // <--- border radius here | ||
| 184 | ), | 200 | ), |
| 185 | - ), | 201 | + SizedBox(height: 30), |
| 186 | - child: new Column( | 202 | + Container( |
| 187 | - crossAxisAlignment: CrossAxisAlignment.start, | 203 | + width: size.width, |
| 188 | - children: [ | 204 | + padding: EdgeInsets.fromLTRB(5, 0, 5, 0), |
| 189 | - Text( | 205 | + alignment: Alignment(-1, 0), |
| 190 | - '약 제조사:', | 206 | + child: Wrap( |
| 191 | - style: TextStyle( | 207 | + children: [ |
| 192 | - color: Colors.black, | 208 | + Text( |
| 193 | - fontSize: 24, | 209 | + '타겟 층 : ', |
| 194 | - fontFamily: 'NotoSansKR', | 210 | + style: TextStyle( |
| 195 | - fontWeight: FontWeight.w700), | 211 | + color: Colors.grey, |
| 196 | - ), | 212 | + fontSize: 14, |
| 197 | - Text( | 213 | + ), |
| 198 | - 'Test123', | 214 | + ), |
| 199 | - style: TextStyle( | 215 | + Text( |
| 200 | - color: Colors.black, | 216 | + medicineInformation.target == null |
| 201 | - fontSize: 32, | 217 | + ? '-' |
| 202 | - fontFamily: 'NotoSansKR', | 218 | + : medicineInformation.target, |
| 203 | - fontWeight: FontWeight.w700), | 219 | + style: TextStyle( |
| 204 | - ), | 220 | + color: Colors.grey, |
| 205 | - ], | 221 | + fontSize: 14, |
| 206 | - ), | 222 | + ), |
| 207 | - ), | 223 | + ), |
| 208 | - Container( | 224 | + ], |
| 209 | - height: 80, | 225 | + ), |
| 210 | - padding: const EdgeInsets.fromLTRB(20, 20, 20, 20), | 226 | + ), |
| 211 | - child: RaisedButton( | 227 | + SizedBox(height: 15), |
| 212 | - onPressed: () async { | 228 | + Container( |
| 213 | - String saveMessage = await getHubList(); | 229 | + width: size.width, |
| 214 | - }, | 230 | + padding: EdgeInsets.fromLTRB(5, 0, 5, 0), |
| 215 | - shape: RoundedRectangleBorder( | 231 | + alignment: Alignment(-1, 0), |
| 216 | - borderRadius: new BorderRadius.circular(18.0), | 232 | + child: Wrap( |
| 217 | - side: BorderSide(color: Colors.blue)), | 233 | + children: [ |
| 218 | - color: Color(0xff1674f6), | 234 | + Text( |
| 219 | - child: Text( | 235 | + '복약 정보 : ', |
| 220 | - '회원 가입', | 236 | + style: TextStyle( |
| 221 | - textScaleFactor: 1.0, | 237 | + color: Colors.grey, |
| 222 | - style: TextStyle( | 238 | + fontSize: 14, |
| 223 | - fontSize: 16, | 239 | + ), |
| 224 | - color: Colors.white, | 240 | + ), |
| 225 | - fontWeight: FontWeight.bold), | 241 | + Text( |
| 242 | + medicineInformation.dosage == null | ||
| 243 | + ? '-' | ||
| 244 | + : medicineInformation.dosage, | ||
| 245 | + style: TextStyle( | ||
| 246 | + color: Colors.grey, | ||
| 247 | + fontSize: 14, | ||
| 248 | + ), | ||
| 249 | + ), | ||
| 250 | + ], | ||
| 251 | + ), | ||
| 252 | + ), | ||
| 253 | + SizedBox(height: 10), | ||
| 254 | + Container( | ||
| 255 | + width: size.width, | ||
| 256 | + padding: EdgeInsets.fromLTRB(5, 10, 5, 10), | ||
| 257 | + alignment: Alignment(-1, 0), | ||
| 258 | + child: Column( | ||
| 259 | + children: [ | ||
| 260 | + SizedBox( | ||
| 261 | + height: 12, | ||
| 262 | + ), | ||
| 263 | + Container( | ||
| 264 | + width: size.width, | ||
| 265 | + child: Text( | ||
| 266 | + '경고', | ||
| 267 | + style: TextStyle( | ||
| 268 | + color: Colors.redAccent, fontSize: 14), | ||
| 269 | + ), | ||
| 270 | + ), | ||
| 271 | + SizedBox(height: 12), | ||
| 272 | + Container( | ||
| 273 | + width: size.width, | ||
| 274 | + child: Text( | ||
| 275 | + medicineInformation.warn == null | ||
| 276 | + ? '-' | ||
| 277 | + : medicineInformation.warn, | ||
| 278 | + style: TextStyle( | ||
| 279 | + color: Colors.redAccent, fontSize: 14), | ||
| 280 | + ), | ||
| 281 | + ), | ||
| 282 | + ], | ||
| 283 | + ), | ||
| 284 | + ), | ||
| 285 | + ], | ||
| 226 | ), | 286 | ), |
| 227 | ), | 287 | ), |
| 228 | - ) | 288 | + ], |
| 229 | - ], | 289 | + ), |
| 230 | ), | 290 | ), |
| 231 | ), | 291 | ), |
| 232 | ); | 292 | ); |
| 233 | } | 293 | } |
| 234 | 294 | ||
| 235 | -Widget ineerInformationpage(BuildContext context) { | 295 | +Widget ineerInformationpage(BuildContext context, Bottle bottleinformation) { |
| 236 | final Size size = MediaQuery.of(context).size; | 296 | final Size size = MediaQuery.of(context).size; |
| 237 | return Scaffold( | 297 | return Scaffold( |
| 238 | backgroundColor: Colors.white, | 298 | backgroundColor: Colors.white, |
| ... | @@ -306,7 +366,12 @@ Widget ineerInformationpage(BuildContext context) { | ... | @@ -306,7 +366,12 @@ Widget ineerInformationpage(BuildContext context) { |
| 306 | mainAxisAlignment: MainAxisAlignment.center, | 366 | mainAxisAlignment: MainAxisAlignment.center, |
| 307 | children: [ | 367 | children: [ |
| 308 | Text( | 368 | Text( |
| 309 | - '14', | 369 | + bottleinformation.temperature |
| 370 | + .toString() == | ||
| 371 | + null | ||
| 372 | + ? '-' | ||
| 373 | + : bottleinformation.temperature | ||
| 374 | + .toString(), | ||
| 310 | textAlign: TextAlign.center, | 375 | textAlign: TextAlign.center, |
| 311 | textScaleFactor: 1.0, | 376 | textScaleFactor: 1.0, |
| 312 | style: TextStyle( | 377 | style: TextStyle( |
| ... | @@ -367,7 +432,11 @@ Widget ineerInformationpage(BuildContext context) { | ... | @@ -367,7 +432,11 @@ Widget ineerInformationpage(BuildContext context) { |
| 367 | mainAxisAlignment: MainAxisAlignment.center, | 432 | mainAxisAlignment: MainAxisAlignment.center, |
| 368 | children: [ | 433 | children: [ |
| 369 | Text( | 434 | Text( |
| 370 | - '57', | 435 | + bottleinformation.humidity.toString() == |
| 436 | + null | ||
| 437 | + ? '-' | ||
| 438 | + : bottleinformation.humidity | ||
| 439 | + .toString(), | ||
| 371 | textAlign: TextAlign.center, | 440 | textAlign: TextAlign.center, |
| 372 | textScaleFactor: 1.0, | 441 | textScaleFactor: 1.0, |
| 373 | style: TextStyle( | 442 | style: TextStyle( |
| ... | @@ -445,7 +514,11 @@ Widget ineerInformationpage(BuildContext context) { | ... | @@ -445,7 +514,11 @@ Widget ineerInformationpage(BuildContext context) { |
| 445 | mainAxisAlignment: MainAxisAlignment.center, | 514 | mainAxisAlignment: MainAxisAlignment.center, |
| 446 | children: [ | 515 | children: [ |
| 447 | Text( | 516 | Text( |
| 448 | - '57', | 517 | + bottleinformation.balance.toString() == |
| 518 | + null | ||
| 519 | + ? '-' | ||
| 520 | + : bottleinformation.balance | ||
| 521 | + .toString(), | ||
| 449 | textAlign: TextAlign.center, | 522 | textAlign: TextAlign.center, |
| 450 | textScaleFactor: 1.0, | 523 | textScaleFactor: 1.0, |
| 451 | style: TextStyle( | 524 | style: TextStyle( |
| ... | @@ -503,7 +576,9 @@ Widget ineerInformationpage(BuildContext context) { | ... | @@ -503,7 +576,9 @@ Widget ineerInformationpage(BuildContext context) { |
| 503 | height: size.height * 0.14, | 576 | height: size.height * 0.14, |
| 504 | child: Center( | 577 | child: Center( |
| 505 | child: Text( | 578 | child: Text( |
| 506 | - '15:57', | 579 | + bottleinformation.recentOpen == null |
| 580 | + ? '-' | ||
| 581 | + : bottleinformation.recentOpen, | ||
| 507 | textAlign: TextAlign.center, | 582 | textAlign: TextAlign.center, |
| 508 | textScaleFactor: 1.0, | 583 | textScaleFactor: 1.0, |
| 509 | style: TextStyle( | 584 | style: TextStyle( |
| ... | @@ -529,7 +604,7 @@ Widget ineerInformationpage(BuildContext context) { | ... | @@ -529,7 +604,7 @@ Widget ineerInformationpage(BuildContext context) { |
| 529 | ); | 604 | ); |
| 530 | } | 605 | } |
| 531 | 606 | ||
| 532 | -Widget outerInformationpage(BuildContext context) { | 607 | +Widget outerInformationpage(BuildContext context, Bottle bottleinformation) { |
| 533 | final Size size = MediaQuery.of(context).size; | 608 | final Size size = MediaQuery.of(context).size; |
| 534 | return Scaffold( | 609 | return Scaffold( |
| 535 | backgroundColor: Colors.white, | 610 | backgroundColor: Colors.white, |
| ... | @@ -601,7 +676,9 @@ Widget outerInformationpage(BuildContext context) { | ... | @@ -601,7 +676,9 @@ Widget outerInformationpage(BuildContext context) { |
| 601 | mainAxisAlignment: MainAxisAlignment.center, | 676 | mainAxisAlignment: MainAxisAlignment.center, |
| 602 | children: [ | 677 | children: [ |
| 603 | Text( | 678 | Text( |
| 604 | - '2', | 679 | + bottleinformation.toString() == null |
| 680 | + ? '-' | ||
| 681 | + : bottleinformation.toString(), | ||
| 605 | textAlign: TextAlign.center, | 682 | textAlign: TextAlign.center, |
| 606 | textScaleFactor: 1.0, | 683 | textScaleFactor: 1.0, |
| 607 | style: TextStyle( | 684 | style: TextStyle( | ... | ... |
| ... | @@ -5,18 +5,46 @@ import 'package:http/http.dart' as http; | ... | @@ -5,18 +5,46 @@ import 'package:http/http.dart' as http; |
| 5 | import 'package:flutter_dotenv/flutter_dotenv.dart'; | 5 | import 'package:flutter_dotenv/flutter_dotenv.dart'; |
| 6 | import '../models/Bottle.dart'; | 6 | import '../models/Bottle.dart'; |
| 7 | import '../DashBoard.dart'; | 7 | import '../DashBoard.dart'; |
| 8 | +import '../models/Medicine.dart'; | ||
| 8 | 9 | ||
| 9 | class BottleList extends StatefulWidget { | 10 | class BottleList extends StatefulWidget { |
| 10 | List<Bottle> bottlelist; | 11 | List<Bottle> bottlelist; |
| 11 | - BottleList({Key key, this.bottlelist}) : super(key: key); | 12 | + String hubid; |
| 13 | + BottleList({Key key, this.bottlelist, this.hubid}) : super(key: key); | ||
| 12 | 14 | ||
| 13 | @override | 15 | @override |
| 14 | _BottleListState createState() => _BottleListState(); | 16 | _BottleListState createState() => _BottleListState(); |
| 15 | } | 17 | } |
| 16 | 18 | ||
| 17 | class _BottleListState extends State<BottleList> { | 19 | class _BottleListState extends State<BottleList> { |
| 20 | + Bottle _bottleinformation = new Bottle(); | ||
| 21 | + Medicine _medicineinformation = new Medicine(); | ||
| 22 | + | ||
| 23 | + Future<Bottle> getbottle(int index) async { | ||
| 24 | + http.Response response = await http.get(Uri.encodeFull( | ||
| 25 | + DotEnv().env['SERVER_URL'] + | ||
| 26 | + 'bottle/' + | ||
| 27 | + widget.bottlelist[index].bottleId.toString())); | ||
| 28 | + | ||
| 29 | + if (response.statusCode == 200) { | ||
| 30 | + Map<String, dynamic> jsonData = jsonDecode(response.body); | ||
| 31 | + print(jsonData); | ||
| 32 | + _bottleinformation = Bottle.fromJson(jsonData); | ||
| 33 | + } | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + Future<Bottle> getmedicine(int index) async { | ||
| 37 | + http.Response medicineresponse = await http.get(Uri.encodeFull( | ||
| 38 | + DotEnv().env['SERVER_URL'] + | ||
| 39 | + 'medicine/' + | ||
| 40 | + widget.bottlelist[index].medicineId.toString())); | ||
| 41 | + if (medicineresponse.statusCode == 200) { | ||
| 42 | + Map<String, dynamic> data = jsonDecode(medicineresponse.body); | ||
| 43 | + _medicineinformation = Medicine.fromJson(data); | ||
| 44 | + } | ||
| 45 | + } | ||
| 46 | + | ||
| 18 | Widget build(BuildContext context) { | 47 | Widget build(BuildContext context) { |
| 19 | - print(widget.bottlelist); | ||
| 20 | final Size size = MediaQuery.of(context).size; | 48 | final Size size = MediaQuery.of(context).size; |
| 21 | return Scaffold( | 49 | return Scaffold( |
| 22 | body: Container( | 50 | body: Container( |
| ... | @@ -62,13 +90,19 @@ class _BottleListState extends State<BottleList> { | ... | @@ -62,13 +90,19 @@ class _BottleListState extends State<BottleList> { |
| 62 | fontWeight: FontWeight.bold), | 90 | fontWeight: FontWeight.bold), |
| 63 | ), | 91 | ), |
| 64 | trailing: Icon(Icons.arrow_forward), | 92 | trailing: Icon(Icons.arrow_forward), |
| 65 | - onTap: () { | 93 | + onTap: () async { |
| 94 | + getbottle(index); | ||
| 95 | + getmedicine(index); | ||
| 96 | + print(_bottleinformation); | ||
| 97 | + print(_medicineinformation); | ||
| 98 | + | ||
| 66 | Navigator.push( | 99 | Navigator.push( |
| 67 | context, | 100 | context, |
| 68 | MaterialPageRoute( | 101 | MaterialPageRoute( |
| 69 | builder: (BuildContext context) => DashBoard( | 102 | builder: (BuildContext context) => DashBoard( |
| 70 | pageNumber: 1, | 103 | pageNumber: 1, |
| 71 | - bottleID: widget.bottlelist[index].bottleId, | 104 | + bottleInformation: _bottleinformation, |
| 105 | + medicineInformation: _medicineinformation, | ||
| 72 | ), | 106 | ), |
| 73 | )); | 107 | )); |
| 74 | }), | 108 | }), | ... | ... |
| 1 | import 'package:Smart_Medicine_Box/src/screens/DashBoard.dart'; | 1 | import 'package:Smart_Medicine_Box/src/screens/DashBoard.dart'; |
| 2 | +import 'package:Smart_Medicine_Box/src/screens/Homepage.dart'; | ||
| 2 | import 'package:flutter/material.dart'; | 3 | import 'package:flutter/material.dart'; |
| 3 | import 'package:flutter/cupertino.dart'; | 4 | import 'package:flutter/cupertino.dart'; |
| 4 | import 'dart:convert'; | 5 | import 'dart:convert'; |
| ... | @@ -28,7 +29,6 @@ class _DetailMedicineState extends State<DetailMedicine> { | ... | @@ -28,7 +29,6 @@ class _DetailMedicineState extends State<DetailMedicine> { |
| 28 | 'dosage': medicineDosageController.text | 29 | 'dosage': medicineDosageController.text |
| 29 | })); | 30 | })); |
| 30 | 31 | ||
| 31 | - print(response.statusCode); | ||
| 32 | if (response.statusCode == 200) { | 32 | if (response.statusCode == 200) { |
| 33 | return "Complete"; | 33 | return "Complete"; |
| 34 | } else if (response.statusCode == 404) { | 34 | } else if (response.statusCode == 404) { |
| ... | @@ -207,14 +207,12 @@ class _DetailMedicineState extends State<DetailMedicine> { | ... | @@ -207,14 +207,12 @@ class _DetailMedicineState extends State<DetailMedicine> { |
| 207 | child: new Text('Close'), | 207 | child: new Text('Close'), |
| 208 | onPressed: () { | 208 | onPressed: () { |
| 209 | Navigator.push( | 209 | Navigator.push( |
| 210 | - context, | 210 | + context, |
| 211 | - MaterialPageRoute( | 211 | + MaterialPageRoute( |
| 212 | - builder: (BuildContext context) => | 212 | + builder: (BuildContext context) => |
| 213 | - DashBoard( | 213 | + HomePage(), |
| 214 | - pageNumber: 1, | 214 | + ), |
| 215 | - bottleID: int.parse( | 215 | + ); |
| 216 | - widget.bottleId), | ||
| 217 | - ))); | ||
| 218 | }) | 216 | }) |
| 219 | ], | 217 | ], |
| 220 | ); | 218 | ); | ... | ... |
| ... | @@ -94,8 +94,9 @@ class _HubListState extends State<HubList> { | ... | @@ -94,8 +94,9 @@ class _HubListState extends State<HubList> { |
| 94 | MaterialPageRoute( | 94 | MaterialPageRoute( |
| 95 | builder: (BuildContext context) => | 95 | builder: (BuildContext context) => |
| 96 | BottleList( | 96 | BottleList( |
| 97 | - bottlelist: _bottleList, | 97 | + bottlelist: _bottleList, |
| 98 | - ), | 98 | + hubid: widget.hublist[index] |
| 99 | + .toString()), | ||
| 99 | )); | 100 | )); |
| 100 | } else if (result == "Not Found") { | 101 | } else if (result == "Not Found") { |
| 101 | showDialog( | 102 | showDialog( | ... | ... |
| ... | @@ -110,18 +110,19 @@ class _RegisterBottleState extends State<RegisterBottle> { | ... | @@ -110,18 +110,19 @@ class _RegisterBottleState extends State<RegisterBottle> { |
| 110 | content: new Text('약병 등록이 완료 되었습니다.'), | 110 | content: new Text('약병 등록이 완료 되었습니다.'), |
| 111 | actions: <Widget>[ | 111 | actions: <Widget>[ |
| 112 | new FlatButton( | 112 | new FlatButton( |
| 113 | - child: new Text('Close'), | 113 | + child: new Text('Close'), |
| 114 | - onPressed: () { | 114 | + onPressed: () { |
| 115 | - Navigator.push( | 115 | + Navigator.push( |
| 116 | - context, | 116 | + context, |
| 117 | - MaterialPageRoute( | 117 | + MaterialPageRoute( |
| 118 | - builder: (BuildContext context) => | 118 | + builder: (BuildContext context) => |
| 119 | - SearchMedicine( | 119 | + SearchMedicine( |
| 120 | - bottleId: | 120 | + bottleId: medicineBottleIDController.text, |
| 121 | - medicineBottleIDController | 121 | + ), |
| 122 | - .text, | 122 | + ), |
| 123 | - ))); | 123 | + ); |
| 124 | - }) | 124 | + }, |
| 125 | + ), | ||
| 125 | ], | 126 | ], |
| 126 | ); | 127 | ); |
| 127 | }); | 128 | }); | ... | ... |
| ... | @@ -8,7 +8,6 @@ import 'DetailMedicine.dart'; | ... | @@ -8,7 +8,6 @@ import 'DetailMedicine.dart'; |
| 8 | 8 | ||
| 9 | class SearchMedicine extends StatefulWidget { | 9 | class SearchMedicine extends StatefulWidget { |
| 10 | String bottleId; | 10 | String bottleId; |
| 11 | - | ||
| 12 | SearchMedicine({Key key, this.bottleId}) : super(key: key); | 11 | SearchMedicine({Key key, this.bottleId}) : super(key: key); |
| 13 | @override | 12 | @override |
| 14 | _SearchMedicineState createState() => _SearchMedicineState(); | 13 | _SearchMedicineState createState() => _SearchMedicineState(); | ... | ... |
| ... | @@ -3,7 +3,7 @@ import 'package:flutter/material.dart'; | ... | @@ -3,7 +3,7 @@ import 'package:flutter/material.dart'; |
| 3 | import 'package:http/http.dart' as http; | 3 | import 'package:http/http.dart' as http; |
| 4 | import 'package:flutter_dotenv/flutter_dotenv.dart'; | 4 | import 'package:flutter_dotenv/flutter_dotenv.dart'; |
| 5 | 5 | ||
| 6 | -import '../Homepage.dart'; | 6 | +import 'RegsiterHub.dart'; |
| 7 | 7 | ||
| 8 | class SignUpLocal extends StatefulWidget { | 8 | class SignUpLocal extends StatefulWidget { |
| 9 | @override | 9 | @override |
| ... | @@ -182,7 +182,7 @@ class _SignUpLocalState extends State<SignUpLocal> { | ... | @@ -182,7 +182,7 @@ class _SignUpLocalState extends State<SignUpLocal> { |
| 182 | context, | 182 | context, |
| 183 | MaterialPageRoute( | 183 | MaterialPageRoute( |
| 184 | builder: (BuildContext context) => | 184 | builder: (BuildContext context) => |
| 185 | - HomePage())); | 185 | + RegisterHub())); |
| 186 | }) | 186 | }) |
| 187 | ], | 187 | ], |
| 188 | ); | 188 | ); | ... | ... |
| ... | @@ -156,6 +156,13 @@ packages: | ... | @@ -156,6 +156,13 @@ packages: |
| 156 | url: "https://pub.dartlang.org" | 156 | url: "https://pub.dartlang.org" |
| 157 | source: hosted | 157 | source: hosted |
| 158 | version: "3.1.4" | 158 | version: "3.1.4" |
| 159 | + infinite_listview: | ||
| 160 | + dependency: transitive | ||
| 161 | + description: | ||
| 162 | + name: infinite_listview | ||
| 163 | + url: "https://pub.dartlang.org" | ||
| 164 | + source: hosted | ||
| 165 | + version: "1.0.1+1" | ||
| 159 | intl: | 166 | intl: |
| 160 | dependency: "direct main" | 167 | dependency: "direct main" |
| 161 | description: | 168 | description: |
| ... | @@ -198,6 +205,13 @@ packages: | ... | @@ -198,6 +205,13 @@ packages: |
| 198 | url: "https://pub.dartlang.org" | 205 | url: "https://pub.dartlang.org" |
| 199 | source: hosted | 206 | source: hosted |
| 200 | version: "0.9.7" | 207 | version: "0.9.7" |
| 208 | + numberpicker: | ||
| 209 | + dependency: "direct main" | ||
| 210 | + description: | ||
| 211 | + name: numberpicker | ||
| 212 | + url: "https://pub.dartlang.org" | ||
| 213 | + source: hosted | ||
| 214 | + version: "1.3.0" | ||
| 201 | page_transition: | 215 | page_transition: |
| 202 | dependency: "direct main" | 216 | dependency: "direct main" |
| 203 | description: | 217 | description: | ... | ... |
| ... | @@ -37,6 +37,7 @@ dependencies: | ... | @@ -37,6 +37,7 @@ dependencies: |
| 37 | cupertino_icons: ^0.1.3 | 37 | cupertino_icons: ^0.1.3 |
| 38 | http: ^0.12.0+4 | 38 | http: ^0.12.0+4 |
| 39 | flutter_dotenv: ^2.1.0 | 39 | flutter_dotenv: ^2.1.0 |
| 40 | + numberpicker: ^1.3.0 | ||
| 40 | 41 | ||
| 41 | dev_dependencies: | 42 | dev_dependencies: |
| 42 | flutter_test: | 43 | flutter_test: | ... | ... |
-
Please register or login to post a comment