Showing
15 changed files
with
367 additions
and
36 deletions
frontend/.idea/frontend.iml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<module type="JAVA_MODULE" version="4"> | ||
3 | + <component name="NewModuleRootManager" inherit-compiler-output="true"> | ||
4 | + <exclude-output /> | ||
5 | + <content url="file://$MODULE_DIR$" /> | ||
6 | + <orderEntry type="inheritedJdk" /> | ||
7 | + <orderEntry type="sourceFolder" forTests="false" /> | ||
8 | + </component> | ||
9 | +</module> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
frontend/.idea/modules.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<project version="4"> | ||
3 | + <component name="ProjectModuleManager"> | ||
4 | + <modules> | ||
5 | + <module fileurl="file://$PROJECT_DIR$/.idea/frontend.iml" filepath="$PROJECT_DIR$/.idea/frontend.iml" /> | ||
6 | + </modules> | ||
7 | + </component> | ||
8 | +</project> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
frontend/.idea/vcs.xml
0 → 100644
frontend/.idea/workspace.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<project version="4"> | ||
3 | + <component name="ChangeListManager"> | ||
4 | + <list default="true" id="147dc7b8-1063-4e12-b6bb-adb3717b8080" name="Default Changelist" comment="" /> | ||
5 | + <option name="SHOW_DIALOG" value="false" /> | ||
6 | + <option name="HIGHLIGHT_CONFLICTS" value="true" /> | ||
7 | + <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> | ||
8 | + <option name="LAST_RESOLUTION" value="IGNORE" /> | ||
9 | + </component> | ||
10 | + <component name="Git.Settings"> | ||
11 | + <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" /> | ||
12 | + </component> | ||
13 | + <component name="ProjectId" id="1wtiCZt9s9osC3izQmO4Etd3c5k" /> | ||
14 | + <component name="ProjectViewState"> | ||
15 | + <option name="hideEmptyMiddlePackages" value="true" /> | ||
16 | + <option name="showLibraryContents" value="true" /> | ||
17 | + </component> | ||
18 | + <component name="PropertiesComponent"> | ||
19 | + <property name="RunOnceActivity.OpenProjectViewOnStart" value="true" /> | ||
20 | + <property name="RunOnceActivity.ShowReadmeOnStart" value="true" /> | ||
21 | + <property name="last_opened_file_path" value="$PROJECT_DIR$/flutter_application_1" /> | ||
22 | + <property name="project.structure.last.edited" value="Project" /> | ||
23 | + <property name="project.structure.proportion" value="0.0" /> | ||
24 | + <property name="project.structure.side.proportion" value="0.0" /> | ||
25 | + </component> | ||
26 | + <component name="SvnConfiguration"> | ||
27 | + <configuration /> | ||
28 | + </component> | ||
29 | + <component name="TaskManager"> | ||
30 | + <task active="true" id="Default" summary="Default task"> | ||
31 | + <changelist id="147dc7b8-1063-4e12-b6bb-adb3717b8080" name="Default Changelist" comment="" /> | ||
32 | + <created>1629284158268</created> | ||
33 | + <option name="number" value="Default" /> | ||
34 | + <option name="presentableId" value="Default" /> | ||
35 | + <updated>1629284158268</updated> | ||
36 | + </task> | ||
37 | + <servers /> | ||
38 | + </component> | ||
39 | + <component name="WindowStateProjectService"> | ||
40 | + <state x="740" y="278" key="FileChooserDialogImpl" timestamp="1629284197342"> | ||
41 | + <screen x="0" y="0" width="1920" height="1040" /> | ||
42 | + </state> | ||
43 | + <state x="740" y="278" key="FileChooserDialogImpl/-1920.0.1920.1040/0.0.1920.1040@0.0.1920.1040" timestamp="1629284197342" /> | ||
44 | + <state x="440" y="98" key="SettingsEditor" timestamp="1629284186082"> | ||
45 | + <screen x="0" y="0" width="1920" height="1040" /> | ||
46 | + </state> | ||
47 | + <state x="440" y="98" key="SettingsEditor/-1920.0.1920.1040/0.0.1920.1040@0.0.1920.1040" timestamp="1629284186082" /> | ||
48 | + </component> | ||
49 | +</project> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
... | @@ -15,6 +15,7 @@ | ... | @@ -15,6 +15,7 @@ |
15 | <application | 15 | <application |
16 | android:name="io.flutter.app.FlutterApplication" | 16 | android:name="io.flutter.app.FlutterApplication" |
17 | android:label="Smart_Medicine_Box" | 17 | android:label="Smart_Medicine_Box" |
18 | + android:requestLegacyExternalStorage="true" | ||
18 | android:icon="@mipmap/ic_launcher"> | 19 | android:icon="@mipmap/ic_launcher"> |
19 | <activity | 20 | <activity |
20 | android:name=".MainActivity" | 21 | android:name=".MainActivity" | ... | ... |
... | @@ -2,3 +2,4 @@ org.gradle.jvmargs=-Xmx1536M | ... | @@ -2,3 +2,4 @@ org.gradle.jvmargs=-Xmx1536M |
2 | android.useAndroidX=true | 2 | android.useAndroidX=true |
3 | android.enableJetifier=true | 3 | android.enableJetifier=true |
4 | android.enableR8=true | 4 | android.enableR8=true |
5 | +org.gradle.jvmargs=-Xmx4608m | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
1 | import 'dart:convert'; | 1 | import 'dart:convert'; |
2 | +import 'package:Smart_Medicine_Box/src/screens/Register/DoctorRequest.dart'; | ||
2 | import 'package:flutter/material.dart'; | 3 | import 'package:flutter/material.dart'; |
3 | import 'package:flutter/services.dart'; | 4 | import 'package:flutter/services.dart'; |
4 | import 'package:http/http.dart' as http; | 5 | import 'package:http/http.dart' as http; |
5 | import 'package:flutter_dotenv/flutter_dotenv.dart'; | 6 | import 'package:flutter_dotenv/flutter_dotenv.dart'; |
6 | -import '../models/Bottle.dart'; | 7 | +import 'models/Bottle.dart'; |
7 | -import '../DashBoard.dart'; | 8 | +import 'DashBoard.dart'; |
8 | -import '../../utils/user_secure_stoarge.dart'; | 9 | +import '../utils/user_secure_stoarge.dart'; |
9 | 10 | ||
10 | class BottleList extends StatefulWidget { | 11 | class BottleList extends StatefulWidget { |
11 | BottleList({Key key}) : super(key: key); | 12 | BottleList({Key key}) : super(key: key); |
... | @@ -15,9 +16,12 @@ class BottleList extends StatefulWidget { | ... | @@ -15,9 +16,12 @@ class BottleList extends StatefulWidget { |
15 | } | 16 | } |
16 | 17 | ||
17 | class _BottleListState extends State<BottleList> { | 18 | class _BottleListState extends State<BottleList> { |
19 | + int newalarm = 0; | ||
20 | + | ||
18 | String valueText; | 21 | String valueText; |
19 | List<Bottle> _bottleList = new List<Bottle>(); | 22 | List<Bottle> _bottleList = new List<Bottle>(); |
20 | TextEditingController _textFieldController = TextEditingController(); | 23 | TextEditingController _textFieldController = TextEditingController(); |
24 | + | ||
21 | Future<String> getBottleList() async { | 25 | Future<String> getBottleList() async { |
22 | String hubid = await UserSecureStorage.getHubId(); | 26 | String hubid = await UserSecureStorage.getHubId(); |
23 | String usertoken = await UserSecureStorage.getUserToken(); | 27 | String usertoken = await UserSecureStorage.getUserToken(); |
... | @@ -90,7 +94,7 @@ class _BottleListState extends State<BottleList> { | ... | @@ -90,7 +94,7 @@ class _BottleListState extends State<BottleList> { |
90 | width: size.width, | 94 | width: size.width, |
91 | child: Center( | 95 | child: Center( |
92 | child: Text( | 96 | child: Text( |
93 | - '등록된 약병 리스트', | 97 | + 'BOTTLE LIST', |
94 | textScaleFactor: 1.0, | 98 | textScaleFactor: 1.0, |
95 | style: TextStyle( | 99 | style: TextStyle( |
96 | fontSize: 28, | 100 | fontSize: 28, |
... | @@ -133,13 +137,13 @@ class _BottleListState extends State<BottleList> { | ... | @@ -133,13 +137,13 @@ class _BottleListState extends State<BottleList> { |
133 | style: BorderStyle.solid), | 137 | style: BorderStyle.solid), |
134 | ), | 138 | ), |
135 | ), | 139 | ), |
136 | - height: 40, | 140 | + height: 30, |
137 | child: Row( | 141 | child: Row( |
138 | mainAxisAlignment: | 142 | mainAxisAlignment: |
139 | MainAxisAlignment.spaceBetween, | 143 | MainAxisAlignment.spaceBetween, |
140 | children: [ | 144 | children: [ |
141 | Container( | 145 | Container( |
142 | - height: 40, | 146 | + height: 30, |
143 | child: Center( | 147 | child: Center( |
144 | child: Text( | 148 | child: Text( |
145 | '${_bottleList[index].bottleId}', | 149 | '${_bottleList[index].bottleId}', |
... | @@ -151,35 +155,29 @@ class _BottleListState extends State<BottleList> { | ... | @@ -151,35 +155,29 @@ class _BottleListState extends State<BottleList> { |
151 | ), | 155 | ), |
152 | ), | 156 | ), |
153 | ), | 157 | ), |
154 | - Container( | ||
155 | - child: IconButton( | ||
156 | - alignment: Alignment(0.9, 0), | ||
157 | - icon: Icon( | ||
158 | - Icons.create_sharp, | ||
159 | - color: Colors.black, | ||
160 | - ), | ||
161 | - onPressed: () {}, | ||
162 | - ), | ||
163 | - ), | ||
164 | ], | 158 | ], |
165 | ), | 159 | ), |
166 | ), | 160 | ), |
167 | - SizedBox(height: 10), | 161 | + SizedBox(height: 5), |
168 | Container( | 162 | Container( |
169 | - height: 90, | 163 | + height: 70, |
170 | child: Icon( | 164 | child: Icon( |
171 | Icons.medical_services_outlined, | 165 | Icons.medical_services_outlined, |
172 | - size: 100, | 166 | + size: 70, |
173 | ), | 167 | ), |
174 | ) | 168 | ) |
175 | ], | 169 | ], |
176 | ), | 170 | ), |
177 | ), | 171 | ), |
178 | onTap: () { | 172 | onTap: () { |
173 | + if (_bottleList[index].medicineId == null) { | ||
174 | + //약병에 약이 없는 경우 | ||
175 | + } else { | ||
179 | UserSecureStorage.setBottleId( | 176 | UserSecureStorage.setBottleId( |
180 | _bottleList[index].bottleId.toString()); | 177 | _bottleList[index].bottleId.toString()); |
181 | UserSecureStorage.setMedicineId( | 178 | UserSecureStorage.setMedicineId( |
182 | _bottleList[index].medicineId.toString()); | 179 | _bottleList[index].medicineId.toString()); |
180 | + } | ||
183 | Navigator.push( | 181 | Navigator.push( |
184 | context, | 182 | context, |
185 | MaterialPageRoute( | 183 | MaterialPageRoute( |
... | @@ -199,6 +197,53 @@ class _BottleListState extends State<BottleList> { | ... | @@ -199,6 +197,53 @@ class _BottleListState extends State<BottleList> { |
199 | } | 197 | } |
200 | }, | 198 | }, |
201 | ), | 199 | ), |
200 | + floatingActionButton: Container( | ||
201 | + child: FittedBox( | ||
202 | + child: Stack( | ||
203 | + alignment: Alignment(1.4, -1.5), | ||
204 | + children: [ | ||
205 | + FloatingActionButton( | ||
206 | + onPressed: () { | ||
207 | + //여기 누르면 넘어가는데 아마 숫자가 있을 경우만 넘어가도록 하기 | ||
208 | + Navigator.push( | ||
209 | + context, | ||
210 | + MaterialPageRoute( | ||
211 | + builder: (BuildContext context) => DoctorRequest(), | ||
212 | + ), | ||
213 | + ); | ||
214 | + }, | ||
215 | + child: Icon(Icons.email_outlined), | ||
216 | + backgroundColor: Colors.blue, | ||
217 | + ), | ||
218 | + newalarm != 0 | ||
219 | + ? Container( | ||
220 | + // This is your Badge | ||
221 | + child: Center( | ||
222 | + // child 문을 ? : 를 이용하여 구분하자 | ||
223 | + child: Text(newalarm.toString(), | ||
224 | + style: TextStyle(color: Colors.white)), | ||
225 | + ), | ||
226 | + padding: EdgeInsets.all(8), | ||
227 | + constraints: | ||
228 | + BoxConstraints(minHeight: 32, minWidth: 32), | ||
229 | + decoration: BoxDecoration( | ||
230 | + // This controls the shadow | ||
231 | + boxShadow: [ | ||
232 | + BoxShadow( | ||
233 | + spreadRadius: 1, | ||
234 | + blurRadius: 5, | ||
235 | + color: Colors.black.withAlpha(50)) | ||
236 | + ], | ||
237 | + borderRadius: BorderRadius.circular(16), | ||
238 | + color: | ||
239 | + Colors.blue, // This would be color of the Badge | ||
240 | + ), | ||
241 | + ) | ||
242 | + : new Container() | ||
243 | + ], | ||
244 | + ), | ||
245 | + ), | ||
246 | + ), | ||
202 | ), | 247 | ), |
203 | onWillPop: () { | 248 | onWillPop: () { |
204 | SystemNavigator.pop(); | 249 | SystemNavigator.pop(); | ... | ... |
This diff is collapsed. Click to expand it.
File mode changed
This diff is collapsed. Click to expand it.
1 | +import 'dart:convert'; | ||
2 | +import 'package:flutter/cupertino.dart'; | ||
3 | +import 'package:flutter/material.dart'; | ||
4 | +import 'package:http/http.dart' as http; | ||
5 | +import 'package:flutter_dotenv/flutter_dotenv.dart'; | ||
6 | +import '../../utils/user_secure_stoarge.dart'; | ||
7 | + | ||
8 | +class DoctorRequest extends StatefulWidget { | ||
9 | + @override | ||
10 | + _DoctorRequestState createState() => _DoctorRequestState(); | ||
11 | +} | ||
12 | + | ||
13 | +class _DoctorRequestState extends State<DoctorRequest> { | ||
14 | + List<int> _doctorlist = new List<int>(); | ||
15 | + | ||
16 | + Future<String> getDoctorRequestList() async { | ||
17 | + String usertoken = await UserSecureStorage.getUserToken(); | ||
18 | + http.Response response = await http.get( | ||
19 | + Uri.encodeFull(DotEnv().env['SERVER_URL'] + 'hub'), | ||
20 | + headers: {"authorization": usertoken}, | ||
21 | + ); | ||
22 | + List<dynamic> values = new List<dynamic>(); | ||
23 | + if (_doctorlist.length != 0) { | ||
24 | + _doctorlist.clear(); | ||
25 | + } | ||
26 | + if (response.statusCode == 200) { | ||
27 | + values = json.decode(response.body); | ||
28 | + for (int i = 0; i < values.length; i++) { | ||
29 | + _doctorlist.add(values[i]['hubId']); | ||
30 | + } | ||
31 | + return "get완료"; | ||
32 | + } else if (response.statusCode == 404) { | ||
33 | + return "Not Found"; | ||
34 | + } else { | ||
35 | + return "Error"; | ||
36 | + } | ||
37 | + } | ||
38 | + | ||
39 | + Widget build(BuildContext context) { | ||
40 | + final Size size = MediaQuery.of(context).size; | ||
41 | + return Scaffold( | ||
42 | + appBar: AppBar( | ||
43 | + backgroundColor: Colors.white, | ||
44 | + leading: new Icon(Icons.medical_services_rounded, | ||
45 | + color: Colors.black, size: 45.0), | ||
46 | + title: Text( | ||
47 | + 'Smart Medicine Box', | ||
48 | + style: TextStyle( | ||
49 | + color: Colors.black, | ||
50 | + fontSize: 23, | ||
51 | + fontFamily: 'Noto', | ||
52 | + fontWeight: FontWeight.bold), | ||
53 | + ), | ||
54 | + ), | ||
55 | + body: FutureBuilder( | ||
56 | + future: getDoctorRequestList(), | ||
57 | + builder: (BuildContext context, AsyncSnapshot snapshot) { | ||
58 | + if (snapshot.hasData == false) { | ||
59 | + return CircularProgressIndicator(); | ||
60 | + } else if (snapshot.hasError) { | ||
61 | + return Padding( | ||
62 | + padding: const EdgeInsets.all(8.0), | ||
63 | + child: Text( | ||
64 | + 'Error: ${snapshot.error}', | ||
65 | + style: TextStyle(fontSize: 15), | ||
66 | + ), | ||
67 | + ); | ||
68 | + } else { | ||
69 | + return Container( | ||
70 | + height: size.height, | ||
71 | + child: Column( | ||
72 | + mainAxisAlignment: MainAxisAlignment.center, | ||
73 | + children: <Widget>[ | ||
74 | + Container( | ||
75 | + height: size.height * 0.1, | ||
76 | + width: size.width, | ||
77 | + child: Center( | ||
78 | + child: Text( | ||
79 | + '담당의 등록 요청', | ||
80 | + textScaleFactor: 1.0, | ||
81 | + style: TextStyle( | ||
82 | + fontSize: 24, | ||
83 | + fontFamily: 'Noto', | ||
84 | + fontWeight: FontWeight.bold), | ||
85 | + ), | ||
86 | + ), | ||
87 | + decoration: | ||
88 | + BoxDecoration(border: Border.all(), color: Colors.blue), | ||
89 | + ), | ||
90 | + SizedBox(height: 30), | ||
91 | + Expanded( | ||
92 | + child: ListView.separated( | ||
93 | + padding: const EdgeInsets.all(30), | ||
94 | + itemCount: _doctorlist.length, | ||
95 | + itemBuilder: (BuildContext context, int index) { | ||
96 | + return Container( | ||
97 | + padding: EdgeInsets.all(8.0), | ||
98 | + decoration: BoxDecoration( | ||
99 | + border: Border.all(), | ||
100 | + borderRadius: | ||
101 | + BorderRadius.all(Radius.circular(25.0)), | ||
102 | + ), | ||
103 | + child: ListTile( | ||
104 | + title: Text( | ||
105 | + 'DoctorID: ' + '${_doctorlist[index]}', | ||
106 | + style: TextStyle( | ||
107 | + color: Colors.black, | ||
108 | + fontSize: 20, | ||
109 | + fontFamily: 'Noto', | ||
110 | + fontWeight: FontWeight.bold), | ||
111 | + ), | ||
112 | + trailing: Icon(Icons.check), | ||
113 | + onTap: () async { | ||
114 | + await showDialog( | ||
115 | + context: context, | ||
116 | + builder: (BuildContext context) { | ||
117 | + return AlertDialog( | ||
118 | + title: new Text('담당의 등록'), | ||
119 | + content: new Text('담당의 등록이 완료 되었습니다.'), | ||
120 | + actions: <Widget>[ | ||
121 | + new FlatButton( | ||
122 | + child: new Text('Close'), | ||
123 | + onPressed: () { | ||
124 | + Navigator.of(context).pop(); | ||
125 | + }, | ||
126 | + ), | ||
127 | + ], | ||
128 | + ); | ||
129 | + }, | ||
130 | + ); | ||
131 | + Navigator.of(context).pop(); | ||
132 | + }, | ||
133 | + ), | ||
134 | + ); | ||
135 | + }, | ||
136 | + separatorBuilder: (BuildContext contetx, int index) => | ||
137 | + const Divider(), | ||
138 | + ), | ||
139 | + ) | ||
140 | + ], | ||
141 | + ), | ||
142 | + ); | ||
143 | + } | ||
144 | + }, | ||
145 | + ), | ||
146 | + ); | ||
147 | + } | ||
148 | +} |
1 | +import 'dart:convert'; | ||
1 | import 'package:flutter/cupertino.dart'; | 2 | import 'package:flutter/cupertino.dart'; |
2 | import 'package:flutter/material.dart'; | 3 | import 'package:flutter/material.dart'; |
3 | -import 'dart:convert'; | 4 | +import 'package:flutter/services.dart'; |
4 | import 'package:http/http.dart' as http; | 5 | import 'package:http/http.dart' as http; |
5 | import 'package:flutter_dotenv/flutter_dotenv.dart'; | 6 | import 'package:flutter_dotenv/flutter_dotenv.dart'; |
6 | // Screen import | 7 | // Screen import |
7 | -import 'RegisterBottle.dart'; | ||
8 | import '../models/Bottle.dart'; | 8 | import '../models/Bottle.dart'; |
9 | -import 'BottleList.dart'; | 9 | +import 'RegisterBottle.dart'; |
10 | +import '../BottleList.dart'; | ||
10 | import '../../utils/user_secure_stoarge.dart'; | 11 | import '../../utils/user_secure_stoarge.dart'; |
11 | 12 | ||
12 | class HubList extends StatefulWidget { | 13 | class HubList extends StatefulWidget { |
... | @@ -19,6 +20,7 @@ class HubList extends StatefulWidget { | ... | @@ -19,6 +20,7 @@ class HubList extends StatefulWidget { |
19 | 20 | ||
20 | class _HubListState extends State<HubList> { | 21 | class _HubListState extends State<HubList> { |
21 | List<Bottle> _bottleList = new List<Bottle>(); | 22 | List<Bottle> _bottleList = new List<Bottle>(); |
23 | + List<int> _hublist = new List<int>(); | ||
22 | //Get BottleList | 24 | //Get BottleList |
23 | Future<String> getBottleList(int hubid) async { | 25 | Future<String> getBottleList(int hubid) async { |
24 | String usertoken = await UserSecureStorage.getUserToken(); | 26 | String usertoken = await UserSecureStorage.getUserToken(); |
... | @@ -48,9 +50,33 @@ class _HubListState extends State<HubList> { | ... | @@ -48,9 +50,33 @@ class _HubListState extends State<HubList> { |
48 | return "Error"; | 50 | return "Error"; |
49 | } | 51 | } |
50 | 52 | ||
53 | + Future<String> getHubList() async { | ||
54 | + String usertoken = await UserSecureStorage.getUserToken(); | ||
55 | + http.Response response = await http.get( | ||
56 | + Uri.encodeFull(DotEnv().env['SERVER_URL'] + 'hub'), | ||
57 | + headers: {"authorization": usertoken}, | ||
58 | + ); | ||
59 | + List<dynamic> values = new List<dynamic>(); | ||
60 | + if (_hublist.length != 0) { | ||
61 | + _hublist.clear(); | ||
62 | + } | ||
63 | + if (response.statusCode == 200) { | ||
64 | + values = json.decode(response.body); | ||
65 | + for (int i = 0; i < values.length; i++) { | ||
66 | + _hublist.add(values[i]['hubId']); | ||
67 | + } | ||
68 | + return "get완료"; | ||
69 | + } else if (response.statusCode == 404) { | ||
70 | + return "Not Found"; | ||
71 | + } else { | ||
72 | + return "Error"; | ||
73 | + } | ||
74 | + } | ||
75 | + | ||
51 | Widget build(BuildContext context) { | 76 | Widget build(BuildContext context) { |
52 | final Size size = MediaQuery.of(context).size; | 77 | final Size size = MediaQuery.of(context).size; |
53 | - return Scaffold( | 78 | + return WillPopScope( |
79 | + child: Scaffold( | ||
54 | appBar: AppBar( | 80 | appBar: AppBar( |
55 | backgroundColor: Colors.white, | 81 | backgroundColor: Colors.white, |
56 | leading: new Icon(Icons.medical_services_rounded, | 82 | leading: new Icon(Icons.medical_services_rounded, |
... | @@ -64,7 +90,21 @@ class _HubListState extends State<HubList> { | ... | @@ -64,7 +90,21 @@ class _HubListState extends State<HubList> { |
64 | fontWeight: FontWeight.bold), | 90 | fontWeight: FontWeight.bold), |
65 | ), | 91 | ), |
66 | ), | 92 | ), |
67 | - body: Container( | 93 | + body: FutureBuilder( |
94 | + future: getHubList(), | ||
95 | + builder: (BuildContext context, AsyncSnapshot snapshot) { | ||
96 | + if (snapshot.hasData == false) { | ||
97 | + return CircularProgressIndicator(); | ||
98 | + } else if (snapshot.hasError) { | ||
99 | + return Padding( | ||
100 | + padding: const EdgeInsets.all(8.0), | ||
101 | + child: Text( | ||
102 | + 'Error: ${snapshot.error}', | ||
103 | + style: TextStyle(fontSize: 15), | ||
104 | + ), | ||
105 | + ); | ||
106 | + } else { | ||
107 | + return Container( | ||
68 | height: size.height, | 108 | height: size.height, |
69 | child: Column( | 109 | child: Column( |
70 | mainAxisAlignment: MainAxisAlignment.center, | 110 | mainAxisAlignment: MainAxisAlignment.center, |
... | @@ -88,17 +128,18 @@ class _HubListState extends State<HubList> { | ... | @@ -88,17 +128,18 @@ class _HubListState extends State<HubList> { |
88 | Expanded( | 128 | Expanded( |
89 | child: ListView.separated( | 129 | child: ListView.separated( |
90 | padding: const EdgeInsets.all(30), | 130 | padding: const EdgeInsets.all(30), |
91 | - itemCount: widget.hublist.length, | 131 | + itemCount: _hublist.length, |
92 | itemBuilder: (BuildContext context, int index) { | 132 | itemBuilder: (BuildContext context, int index) { |
93 | return Container( | 133 | return Container( |
94 | padding: EdgeInsets.all(8.0), | 134 | padding: EdgeInsets.all(8.0), |
95 | decoration: BoxDecoration( | 135 | decoration: BoxDecoration( |
96 | border: Border.all(), | 136 | border: Border.all(), |
97 | - borderRadius: BorderRadius.all(Radius.circular(25.0)), | 137 | + borderRadius: |
138 | + BorderRadius.all(Radius.circular(25.0)), | ||
98 | ), | 139 | ), |
99 | child: ListTile( | 140 | child: ListTile( |
100 | title: Text( | 141 | title: Text( |
101 | - 'HUB ID: ' + '${widget.hublist[index]}', | 142 | + 'HUB ID: ' + '${_hublist[index]}', |
102 | style: TextStyle( | 143 | style: TextStyle( |
103 | color: Colors.black, | 144 | color: Colors.black, |
104 | fontSize: 20, | 145 | fontSize: 20, |
... | @@ -109,10 +150,10 @@ class _HubListState extends State<HubList> { | ... | @@ -109,10 +150,10 @@ class _HubListState extends State<HubList> { |
109 | onTap: () async { | 150 | onTap: () async { |
110 | //허브 id로 가져와서 있으면 바로 넘기기 | 151 | //허브 id로 가져와서 있으면 바로 넘기기 |
111 | var result = | 152 | var result = |
112 | - await getBottleList(widget.hublist[index]); | 153 | + await getBottleList(_hublist[index]); |
113 | if (result == "GET") { | 154 | if (result == "GET") { |
114 | UserSecureStorage.setHubId( | 155 | UserSecureStorage.setHubId( |
115 | - widget.hublist[index].toString()); | 156 | + _hublist[index].toString()); |
116 | Navigator.push( | 157 | Navigator.push( |
117 | context, | 158 | context, |
118 | MaterialPageRoute( | 159 | MaterialPageRoute( |
... | @@ -131,12 +172,12 @@ class _HubListState extends State<HubList> { | ... | @@ -131,12 +172,12 @@ class _HubListState extends State<HubList> { |
131 | child: new Text('등록'), | 172 | child: new Text('등록'), |
132 | onPressed: () { | 173 | onPressed: () { |
133 | UserSecureStorage.setHubId( | 174 | UserSecureStorage.setHubId( |
134 | - widget.hublist[index].toString()); | 175 | + _hublist[index].toString()); |
135 | Navigator.push( | 176 | Navigator.push( |
136 | context, | 177 | context, |
137 | MaterialPageRoute( | 178 | MaterialPageRoute( |
138 | - builder: | 179 | + builder: (BuildContext |
139 | - (BuildContext context) => | 180 | + context) => |
140 | RegisterBottle(), | 181 | RegisterBottle(), |
141 | )); | 182 | )); |
142 | }) | 183 | }) |
... | @@ -154,7 +195,15 @@ class _HubListState extends State<HubList> { | ... | @@ -154,7 +195,15 @@ class _HubListState extends State<HubList> { |
154 | ), | 195 | ), |
155 | ) | 196 | ) |
156 | ], | 197 | ], |
157 | - )), | 198 | + ), |
199 | + ); | ||
200 | + } | ||
201 | + }, | ||
202 | + ), | ||
203 | + ), | ||
204 | + onWillPop: () { | ||
205 | + SystemNavigator.pop(); | ||
206 | + }, | ||
158 | ); | 207 | ); |
159 | } | 208 | } |
160 | } | 209 | } | ... | ... |
1 | -import 'package:Smart_Medicine_Box/src/screens/DashBoard.dart'; | ||
2 | -import 'package:Smart_Medicine_Box/src/screens/Register/BottleList.dart'; | ||
3 | import 'package:flutter/cupertino.dart'; | 1 | import 'package:flutter/cupertino.dart'; |
4 | import 'dart:convert'; | 2 | import 'dart:convert'; |
5 | import 'package:flutter/material.dart'; | 3 | import 'package:flutter/material.dart'; |
... | @@ -7,6 +5,7 @@ import 'package:http/http.dart' as http; | ... | @@ -7,6 +5,7 @@ import 'package:http/http.dart' as http; |
7 | import 'package:flutter_dotenv/flutter_dotenv.dart'; | 5 | import 'package:flutter_dotenv/flutter_dotenv.dart'; |
8 | 6 | ||
9 | import 'SearchMedicine.dart'; | 7 | import 'SearchMedicine.dart'; |
8 | +import '../BottleList.dart'; | ||
10 | import '../../utils/user_secure_stoarge.dart'; | 9 | import '../../utils/user_secure_stoarge.dart'; |
11 | 10 | ||
12 | class RegisterBottle extends StatefulWidget { | 11 | class RegisterBottle extends StatefulWidget { |
... | @@ -139,7 +138,6 @@ class _RegisterBottleState extends State<RegisterBottle> { | ... | @@ -139,7 +138,6 @@ class _RegisterBottleState extends State<RegisterBottle> { |
139 | ); | 138 | ); |
140 | } else if (saveMessage == "등록 완료" && | 139 | } else if (saveMessage == "등록 완료" && |
141 | widget.modify_bottle == true) { | 140 | widget.modify_bottle == true) { |
142 | - print('asdg'); | ||
143 | await showDialog( | 141 | await showDialog( |
144 | context: context, | 142 | context: context, |
145 | builder: (BuildContext context) { | 143 | builder: (BuildContext context) { | ... | ... |
... | @@ -8,6 +8,13 @@ packages: | ... | @@ -8,6 +8,13 @@ packages: |
8 | url: "https://pub.dartlang.org" | 8 | url: "https://pub.dartlang.org" |
9 | source: hosted | 9 | source: hosted |
10 | version: "2.5.0-nullsafety.1" | 10 | version: "2.5.0-nullsafety.1" |
11 | + badges: | ||
12 | + dependency: "direct main" | ||
13 | + description: | ||
14 | + name: badges | ||
15 | + url: "https://pub.dartlang.org" | ||
16 | + source: hosted | ||
17 | + version: "1.2.0" | ||
11 | boolean_selector: | 18 | boolean_selector: |
12 | dependency: transitive | 19 | dependency: transitive |
13 | description: | 20 | description: |
... | @@ -125,6 +132,13 @@ packages: | ... | @@ -125,6 +132,13 @@ packages: |
125 | url: "https://pub.dartlang.org" | 132 | url: "https://pub.dartlang.org" |
126 | source: hosted | 133 | source: hosted |
127 | version: "1.0.1" | 134 | version: "1.0.1" |
135 | + flutter_picker: | ||
136 | + dependency: "direct main" | ||
137 | + description: | ||
138 | + name: flutter_picker | ||
139 | + url: "https://pub.dartlang.org" | ||
140 | + source: hosted | ||
141 | + version: "1.1.5" | ||
128 | flutter_screenutil: | 142 | flutter_screenutil: |
129 | dependency: "direct main" | 143 | dependency: "direct main" |
130 | description: | 144 | description: | ... | ... |
... | @@ -41,6 +41,9 @@ dependencies: | ... | @@ -41,6 +41,9 @@ dependencies: |
41 | flutter_secure_storage: ^3.3.5 | 41 | flutter_secure_storage: ^3.3.5 |
42 | sqflite: ^1.1.6 | 42 | sqflite: ^1.1.6 |
43 | path_provider: ^1.2.0 | 43 | path_provider: ^1.2.0 |
44 | + badges: ^1.1.1 | ||
45 | + flutter_picker: ^1.1.5 | ||
46 | + | ||
44 | 47 | ||
45 | dev_dependencies: | 48 | dev_dependencies: |
46 | flutter_test: | 49 | flutter_test: | ... | ... |
-
Please register or login to post a comment