고원빈

temp

<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/frontend.iml" filepath="$PROJECT_DIR$/.idea/frontend.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="147dc7b8-1063-4e12-b6bb-adb3717b8080" name="Default Changelist" comment="" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="ProjectId" id="1wtiCZt9s9osC3izQmO4Etd3c5k" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/flutter_application_1" />
<property name="project.structure.last.edited" value="Project" />
<property name="project.structure.proportion" value="0.0" />
<property name="project.structure.side.proportion" value="0.0" />
</component>
<component name="SvnConfiguration">
<configuration />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="147dc7b8-1063-4e12-b6bb-adb3717b8080" name="Default Changelist" comment="" />
<created>1629284158268</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1629284158268</updated>
</task>
<servers />
</component>
<component name="WindowStateProjectService">
<state x="740" y="278" key="FileChooserDialogImpl" timestamp="1629284197342">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state x="740" y="278" key="FileChooserDialogImpl/-1920.0.1920.1040/0.0.1920.1040@0.0.1920.1040" timestamp="1629284197342" />
<state x="440" y="98" key="SettingsEditor" timestamp="1629284186082">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state x="440" y="98" key="SettingsEditor/-1920.0.1920.1040/0.0.1920.1040@0.0.1920.1040" timestamp="1629284186082" />
</component>
</project>
\ No newline at end of file
......@@ -15,6 +15,7 @@
<application
android:name="io.flutter.app.FlutterApplication"
android:label="Smart_Medicine_Box"
android:requestLegacyExternalStorage="true"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
......
......@@ -2,3 +2,4 @@ org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
android.enableR8=true
org.gradle.jvmargs=-Xmx4608m
\ No newline at end of file
......
import 'dart:convert';
import 'package:Smart_Medicine_Box/src/screens/Register/DoctorRequest.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:http/http.dart' as http;
import 'package:flutter_dotenv/flutter_dotenv.dart';
import '../models/Bottle.dart';
import '../DashBoard.dart';
import '../../utils/user_secure_stoarge.dart';
import 'models/Bottle.dart';
import 'DashBoard.dart';
import '../utils/user_secure_stoarge.dart';
class BottleList extends StatefulWidget {
BottleList({Key key}) : super(key: key);
......@@ -15,9 +16,12 @@ class BottleList extends StatefulWidget {
}
class _BottleListState extends State<BottleList> {
int newalarm = 0;
String valueText;
List<Bottle> _bottleList = new List<Bottle>();
TextEditingController _textFieldController = TextEditingController();
Future<String> getBottleList() async {
String hubid = await UserSecureStorage.getHubId();
String usertoken = await UserSecureStorage.getUserToken();
......@@ -90,7 +94,7 @@ class _BottleListState extends State<BottleList> {
width: size.width,
child: Center(
child: Text(
'등록된 약병 리스트',
'BOTTLE LIST',
textScaleFactor: 1.0,
style: TextStyle(
fontSize: 28,
......@@ -133,13 +137,13 @@ class _BottleListState extends State<BottleList> {
style: BorderStyle.solid),
),
),
height: 40,
height: 30,
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Container(
height: 40,
height: 30,
child: Center(
child: Text(
'${_bottleList[index].bottleId}',
......@@ -151,35 +155,29 @@ class _BottleListState extends State<BottleList> {
),
),
),
Container(
child: IconButton(
alignment: Alignment(0.9, 0),
icon: Icon(
Icons.create_sharp,
color: Colors.black,
),
onPressed: () {},
),
),
],
),
),
SizedBox(height: 10),
SizedBox(height: 5),
Container(
height: 90,
height: 70,
child: Icon(
Icons.medical_services_outlined,
size: 100,
size: 70,
),
)
],
),
),
onTap: () {
UserSecureStorage.setBottleId(
_bottleList[index].bottleId.toString());
UserSecureStorage.setMedicineId(
_bottleList[index].medicineId.toString());
if (_bottleList[index].medicineId == null) {
//약병에 약이 없는 경우
} else {
UserSecureStorage.setBottleId(
_bottleList[index].bottleId.toString());
UserSecureStorage.setMedicineId(
_bottleList[index].medicineId.toString());
}
Navigator.push(
context,
MaterialPageRoute(
......@@ -199,6 +197,53 @@ class _BottleListState extends State<BottleList> {
}
},
),
floatingActionButton: Container(
child: FittedBox(
child: Stack(
alignment: Alignment(1.4, -1.5),
children: [
FloatingActionButton(
onPressed: () {
//여기 누르면 넘어가는데 아마 숫자가 있을 경우만 넘어가도록 하기
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) => DoctorRequest(),
),
);
},
child: Icon(Icons.email_outlined),
backgroundColor: Colors.blue,
),
newalarm != 0
? Container(
// This is your Badge
child: Center(
// child 문을 ? : 를 이용하여 구분하자
child: Text(newalarm.toString(),
style: TextStyle(color: Colors.white)),
),
padding: EdgeInsets.all(8),
constraints:
BoxConstraints(minHeight: 32, minWidth: 32),
decoration: BoxDecoration(
// This controls the shadow
boxShadow: [
BoxShadow(
spreadRadius: 1,
blurRadius: 5,
color: Colors.black.withAlpha(50))
],
borderRadius: BorderRadius.circular(16),
color:
Colors.blue, // This would be color of the Badge
),
)
: new Container()
],
),
),
),
),
onWillPop: () {
SystemNavigator.pop();
......
......@@ -8,9 +8,9 @@ import '../utils/user_secure_stoarge.dart';
import 'models/Bottle.dart';
import 'models/Medicine.dart';
import 'package:Smart_Medicine_Box/src/screens/SettingPage.dart';
import 'Register/BottleList.dart';
import 'BottleList.dart';
import 'MainPage.dart';
import 'Register/SearchMedicine.dart';
import 'package:intl/date_symbol_data_local.dart';
class DashBoard extends StatefulWidget {
int pageNumber;
......@@ -59,8 +59,8 @@ class _DashBoardState extends State<DashBoard> {
_selectedIndex = widget.pageNumber;
var _tabs = [
ineerInformationpage(context),
mainpage(context),
outerInformationpage(context),
MainPage(),
feedBackPage(context),
];
return WillPopScope(
......@@ -131,8 +131,8 @@ class _DashBoardState extends State<DashBoard> {
icon: Icon(Icons.device_thermostat), label: 'In'),
BottomNavigationBarItem(icon: Icon(Icons.home), label: 'Home'),
BottomNavigationBarItem(
label: 'Out',
icon: Icon(Icons.access_time),
label: 'Feedback',
icon: Icon(Icons.feedback),
)
],
),
......@@ -155,233 +155,6 @@ class _DashBoardState extends State<DashBoard> {
}
}
Widget mainpage(BuildContext context) {
Medicine _medicineInformation = new Medicine();
Future<Medicine> _getmedicine() async {
String usertoken = await UserSecureStorage.getUserToken();
String medicineid = await UserSecureStorage.getMedicineId();
http.Response medicineresponse = await http.get(
Uri.encodeFull(
DotEnv().env['SERVER_URL'] + 'medicine/' + medicineid.toString()),
headers: {"authorization": usertoken},
);
if (medicineresponse.statusCode == 200) {
Map<String, dynamic> data = jsonDecode(medicineresponse.body);
_medicineInformation = Medicine.fromJson(data);
}
return _medicineInformation;
}
final Size size = MediaQuery.of(context).size;
return Scaffold(
backgroundColor: Colors.white,
body: SingleChildScrollView(
child: FutureBuilder(
future: _getmedicine(),
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(
margin: EdgeInsets.fromLTRB(0, 30, 0, 0),
padding: EdgeInsets.fromLTRB(5, 0, 5, 5),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
SizedBox(height: 20),
Container(
width: size.width,
padding: EdgeInsets.fromLTRB(5, 0, 5, 5),
margin: EdgeInsets.all(15),
decoration: BoxDecoration(
border: Border.all(),
borderRadius: BorderRadius.all(Radius.circular(
25.0) // <--- border radius here
),
),
child: Column(
children: [
SizedBox(height: 30),
Container(
child: Center(
child: Text(
'${snapshot.data.name}' == null
? '-'
: '${snapshot.data.name}',
style: TextStyle(
color: Colors.black,
fontSize: 24,
fontFamily: 'NotoSansKR',
fontWeight: FontWeight.w700)),
),
),
SizedBox(height: 30),
Container(
width: size.width,
alignment: Alignment(0.9, 0),
child: Wrap(
children: [
Text(
'제조사: ',
style: TextStyle(
color: Colors.grey,
fontSize: 14,
),
),
Text(
_medicineInformation.company == null
? '-'
: _medicineInformation.company,
style: TextStyle(
color: Colors.grey,
fontSize: 14,
),
),
],
),
),
SizedBox(height: 30),
Container(
width: size.width,
padding: EdgeInsets.fromLTRB(5, 0, 5, 0),
alignment: Alignment(-1, 0),
child: Wrap(
children: [
Text(
'타겟 층 : ',
style: TextStyle(
color: Colors.grey,
fontSize: 14,
),
),
Text(
_medicineInformation.target == null
? '-'
: _medicineInformation.target,
style: TextStyle(
color: Colors.grey,
fontSize: 14,
),
),
],
),
),
SizedBox(height: 15),
Container(
width: size.width,
padding: EdgeInsets.fromLTRB(5, 0, 5, 0),
alignment: Alignment(-1, 0),
child: Wrap(
children: [
Text(
'복약 정보 : ',
style: TextStyle(
color: Colors.grey,
fontSize: 14,
),
),
Text(
_medicineInformation.dosage == null
? '-'
: _medicineInformation.dosage,
style: TextStyle(
color: Colors.grey,
fontSize: 14,
),
),
],
),
),
SizedBox(height: 10),
Container(
width: size.width,
padding: EdgeInsets.fromLTRB(5, 10, 5, 10),
alignment: Alignment(-1, 0),
child: Column(
children: [
SizedBox(
height: 12,
),
Container(
width: size.width,
child: Text(
'경고',
style: TextStyle(
color: Colors.redAccent, fontSize: 14),
),
),
SizedBox(height: 12),
Container(
width: size.width,
child: Text(
_medicineInformation.warn == null
? '-'
: _medicineInformation.warn,
style: TextStyle(
color: Colors.redAccent, fontSize: 14),
),
),
],
),
),
],
),
),
GestureDetector(
child: Container(
width: size.width * 0.8,
height: 46,
margin: EdgeInsets.only(bottom: 0),
child: FlatButton(
padding: EdgeInsets.fromLTRB(0, 5, 0, 5),
onPressed: () async {
String bottleid =
await UserSecureStorage.getBottleId();
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) => SearchMedicine(
bottleId: bottleid,
),
),
);
},
child: Text(
'약 검색',
textScaleFactor: 1.0,
style: TextStyle(
color: Colors.white,
fontSize: 16,
fontFamily: 'Noto',
fontWeight: FontWeight.bold),
),
color: Color(0xff1674f6),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(50)),
),
),
),
],
),
);
}
},
),
),
);
}
Widget ineerInformationpage(BuildContext context) {
//get bottle
Future<Bottle> _getbottle() async {
......@@ -473,7 +246,7 @@ Widget ineerInformationpage(BuildContext context) {
textScaleFactor: 1.0,
style: TextStyle(
color: Colors.white,
fontSize: 24,
fontSize: 20,
fontFamily: 'NotoSansKR',
fontWeight: FontWeight.w800),
),
......@@ -538,7 +311,7 @@ Widget ineerInformationpage(BuildContext context) {
textScaleFactor: 1.0,
style: TextStyle(
color: Colors.white,
fontSize: 24,
fontSize: 20,
fontFamily: 'NotoSansKR',
fontWeight: FontWeight.w800),
),
......@@ -621,7 +394,7 @@ Widget ineerInformationpage(BuildContext context) {
textScaleFactor: 1.0,
style: TextStyle(
color: Colors.white,
fontSize: 24,
fontSize: 20,
fontFamily: 'NotoSansKR',
fontWeight: FontWeight.w800),
),
......@@ -687,7 +460,7 @@ Widget ineerInformationpage(BuildContext context) {
textScaleFactor: 1.0,
style: TextStyle(
color: Colors.white,
fontSize: 24,
fontSize: 20,
fontFamily: 'NotoSansKR',
fontWeight: FontWeight.w800),
),
......@@ -706,7 +479,7 @@ Widget ineerInformationpage(BuildContext context) {
textScaleFactor: 1.0,
style: TextStyle(
color: Colors.white,
fontSize: 60,
fontSize: 40,
fontFamily: 'NotoSansKR',
fontWeight: FontWeight.w800),
),
......@@ -730,7 +503,7 @@ Widget ineerInformationpage(BuildContext context) {
);
}
Widget outerInformationpage(BuildContext context) {
Widget feedBackPage(BuildContext context) {
Bottle _bottleinformation = new Bottle();
//get bottle
Future<Bottle> _getbottle() async {
......
import 'package:flutter/material.dart';
import 'dart:convert';
import 'package:http/http.dart' as http;
import 'package:flutter_dotenv/flutter_dotenv.dart';
import '../utils/user_secure_stoarge.dart';
import 'models/Medicine.dart';
import 'Register/SearchMedicine.dart';
//import 'package:flutter_material_pickers/flutter_material_pickers.dart';
class MainPage extends StatefulWidget {
@override
_MainPageState createState() => _MainPageState();
}
class _MainPageState extends State<MainPage> {
Widget build(BuildContext context) {
Medicine _medicineInformation = new Medicine();
List<String> doctorlist = ['temp1', 'temp2', 'temp3', 'temp4'];
String seletedDoctor = '';
Future<Medicine> _getmedicine() async {
String usertoken = await UserSecureStorage.getUserToken();
String medicineid = await UserSecureStorage.getMedicineId();
http.Response medicineresponse = await http.get(
Uri.encodeFull(
DotEnv().env['SERVER_URL'] + 'medicine/' + medicineid.toString()),
headers: {"authorization": usertoken},
);
if (medicineresponse.statusCode == 200) {
Map<String, dynamic> data = jsonDecode(medicineresponse.body);
_medicineInformation = Medicine.fromJson(data);
}
return _medicineInformation;
}
final Size size = MediaQuery.of(context).size;
return Scaffold(
backgroundColor: Colors.white,
body: SingleChildScrollView(
child: FutureBuilder(
future: _getmedicine(),
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(
margin: EdgeInsets.fromLTRB(0, 30, 0, 0),
padding: EdgeInsets.fromLTRB(5, 0, 5, 5),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
SizedBox(height: 10),
Container(
width: size.width,
padding: EdgeInsets.fromLTRB(5, 0, 5, 5),
margin: EdgeInsets.all(15),
decoration: BoxDecoration(
border: Border.all(),
borderRadius: BorderRadius.all(Radius.circular(
25.0) // <--- border radius here
),
),
child: Column(
children: [
SizedBox(height: 20),
Container(
child: Center(
child: Text(
'${snapshot.data.name}' == null
? '-'
: '${snapshot.data.name}',
style: TextStyle(
color: Colors.black,
fontSize: 24,
fontFamily: 'NotoSansKR',
fontWeight: FontWeight.w700)),
),
),
SizedBox(height: 10),
Container(
width: size.width,
alignment: Alignment(0.9, 0),
child: Wrap(
children: [
Text(
'처방의: ',
style: TextStyle(
color: Colors.black,
fontSize: 16,
fontFamily: 'NotoSansKR',
fontWeight: FontWeight.w700),
),
Text(
_medicineInformation.company == null
? '-'
: '대강 처방의 이름',
style: TextStyle(
color: Colors.black,
fontSize: 16,
fontFamily: 'NotoSansKR',
fontWeight: FontWeight.w700),
),
],
),
),
SizedBox(height: 20),
Container(
width: size.width,
alignment: Alignment(0.9, 0),
child: Wrap(
children: [
Text(
'제조사: ',
style: TextStyle(
color: Colors.grey,
fontSize: 14,
),
),
Text(
_medicineInformation.company == null
? '-'
: _medicineInformation.company,
style: TextStyle(
color: Colors.grey,
fontSize: 14,
),
),
],
),
),
SizedBox(height: 30),
Container(
width: size.width,
padding: EdgeInsets.fromLTRB(5, 0, 5, 0),
alignment: Alignment(-1, 0),
child: Wrap(
children: [
Text(
'타겟 층 : ',
style: TextStyle(
color: Colors.grey,
fontSize: 14,
),
),
Text(
_medicineInformation.target == null
? '-'
: _medicineInformation.target,
style: TextStyle(
color: Colors.grey,
fontSize: 14,
),
),
],
),
),
SizedBox(height: 15),
Container(
width: size.width,
padding: EdgeInsets.fromLTRB(5, 0, 5, 0),
alignment: Alignment(-1, 0),
child: Wrap(
children: [
Text(
'복약 정보 : ',
style: TextStyle(
color: Colors.grey,
fontSize: 14,
),
),
Text(
_medicineInformation.dosage == null
? '-'
: _medicineInformation.dosage,
style: TextStyle(
color: Colors.grey,
fontSize: 14,
),
),
],
),
),
SizedBox(height: 10),
Container(
width: size.width,
padding: EdgeInsets.fromLTRB(5, 10, 5, 10),
alignment: Alignment(-1, 0),
child: Column(
children: [
SizedBox(
height: 12,
),
Container(
width: size.width,
child: Text(
'경고',
style: TextStyle(
color: Colors.redAccent, fontSize: 14),
),
),
SizedBox(height: 12),
Container(
width: size.width,
child: Text(
_medicineInformation.warn == null
? '-'
: _medicineInformation.warn,
style: TextStyle(
color: Colors.redAccent, fontSize: 14),
),
),
],
),
),
],
),
),
GestureDetector(
child: Container(
width: size.width * 0.8,
height: 46,
margin: EdgeInsets.only(bottom: 0),
child: FlatButton(
padding: EdgeInsets.fromLTRB(0, 5, 0, 5),
onPressed: () async {
String bottleid =
await UserSecureStorage.getBottleId();
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) =>
SearchMedicine(
bottleId: bottleid,
),
),
);
},
child: Text(
'약 검색',
textScaleFactor: 1.0,
style: TextStyle(
color: Colors.white,
fontSize: 16,
fontFamily: 'Noto',
fontWeight: FontWeight.bold),
),
color: Color(0xff1674f6),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(50)),
),
),
),
SizedBox(height: 20),
GestureDetector(
child: Container(
width: size.width * 0.8,
height: 46,
margin: EdgeInsets.only(bottom: 0),
child: FlatButton(
padding: EdgeInsets.fromLTRB(0, 5, 0, 5),
onPressed: () async {
/*showMaterialScrollPicker(
context: context,
title: '처방의',
items: doctorlist,
selectedItem: seletedDoctor,
onChanged: (value) =>
setState(() => seletedDoctor = value),
);*/
},
child: Text(
'처방의 변경',
textScaleFactor: 1.0,
style: TextStyle(
color: Colors.white,
fontSize: 16,
fontFamily: 'Noto',
fontWeight: FontWeight.bold),
),
color: Color(0xff1674f6),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(50)),
),
),
),
],
),
);
}
},
),
),
);
}
}
import 'dart:convert';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'package:flutter_dotenv/flutter_dotenv.dart';
import '../../utils/user_secure_stoarge.dart';
class DoctorRequest extends StatefulWidget {
@override
_DoctorRequestState createState() => _DoctorRequestState();
}
class _DoctorRequestState extends State<DoctorRequest> {
List<int> _doctorlist = new List<int>();
Future<String> getDoctorRequestList() async {
String usertoken = await UserSecureStorage.getUserToken();
http.Response response = await http.get(
Uri.encodeFull(DotEnv().env['SERVER_URL'] + 'hub'),
headers: {"authorization": usertoken},
);
List<dynamic> values = new List<dynamic>();
if (_doctorlist.length != 0) {
_doctorlist.clear();
}
if (response.statusCode == 200) {
values = json.decode(response.body);
for (int i = 0; i < values.length; i++) {
_doctorlist.add(values[i]['hubId']);
}
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 Scaffold(
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: getDoctorRequestList(),
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>[
Container(
height: size.height * 0.1,
width: size.width,
child: Center(
child: Text(
'담당의 등록 요청',
textScaleFactor: 1.0,
style: TextStyle(
fontSize: 24,
fontFamily: 'Noto',
fontWeight: FontWeight.bold),
),
),
decoration:
BoxDecoration(border: Border.all(), color: Colors.blue),
),
SizedBox(height: 30),
Expanded(
child: ListView.separated(
padding: const EdgeInsets.all(30),
itemCount: _doctorlist.length,
itemBuilder: (BuildContext context, int index) {
return Container(
padding: EdgeInsets.all(8.0),
decoration: BoxDecoration(
border: Border.all(),
borderRadius:
BorderRadius.all(Radius.circular(25.0)),
),
child: ListTile(
title: Text(
'DoctorID: ' + '${_doctorlist[index]}',
style: TextStyle(
color: Colors.black,
fontSize: 20,
fontFamily: 'Noto',
fontWeight: FontWeight.bold),
),
trailing: Icon(Icons.check),
onTap: () async {
await showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: new Text('담당의 등록'),
content: new Text('담당의 등록이 완료 되었습니다.'),
actions: <Widget>[
new FlatButton(
child: new Text('Close'),
onPressed: () {
Navigator.of(context).pop();
},
),
],
);
},
);
Navigator.of(context).pop();
},
),
);
},
separatorBuilder: (BuildContext contetx, int index) =>
const Divider(),
),
)
],
),
);
}
},
),
);
}
}
import 'dart:convert';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'dart:convert';
import 'package:flutter/services.dart';
import 'package:http/http.dart' as http;
import 'package:flutter_dotenv/flutter_dotenv.dart';
// Screen import
import 'RegisterBottle.dart';
import '../models/Bottle.dart';
import 'BottleList.dart';
import 'RegisterBottle.dart';
import '../BottleList.dart';
import '../../utils/user_secure_stoarge.dart';
class HubList extends StatefulWidget {
......@@ -19,6 +20,7 @@ class HubList extends StatefulWidget {
class _HubListState extends State<HubList> {
List<Bottle> _bottleList = new List<Bottle>();
List<int> _hublist = new List<int>();
//Get BottleList
Future<String> getBottleList(int hubid) async {
String usertoken = await UserSecureStorage.getUserToken();
......@@ -48,113 +50,160 @@ class _HubListState extends State<HubList> {
return "Error";
}
Future<String> getHubList() async {
String usertoken = await UserSecureStorage.getUserToken();
http.Response response = await http.get(
Uri.encodeFull(DotEnv().env['SERVER_URL'] + 'hub'),
headers: {"authorization": usertoken},
);
List<dynamic> values = new List<dynamic>();
if (_hublist.length != 0) {
_hublist.clear();
}
if (response.statusCode == 200) {
values = json.decode(response.body);
for (int i = 0; i < values.length; i++) {
_hublist.add(values[i]['hubId']);
}
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 Scaffold(
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),
return WillPopScope(
child: Scaffold(
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: Container(
height: size.height,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Container(
height: size.height * 0.1,
width: size.width,
child: Center(
child: Text(
'등록된 허브 리스트',
textScaleFactor: 1.0,
style: TextStyle(
fontSize: 28,
fontFamily: 'Noto',
fontWeight: FontWeight.bold),
),
body: FutureBuilder(
future: getHubList(),
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),
),
decoration: BoxDecoration(border: Border.all()),
),
SizedBox(height: 30),
Expanded(
child: ListView.separated(
padding: const EdgeInsets.all(30),
itemCount: widget.hublist.length,
itemBuilder: (BuildContext context, int index) {
return Container(
padding: EdgeInsets.all(8.0),
decoration: BoxDecoration(
border: Border.all(),
borderRadius: BorderRadius.all(Radius.circular(25.0)),
),
child: ListTile(
title: Text(
'HUB ID: ' + '${widget.hublist[index]}',
);
} else {
return Container(
height: size.height,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Container(
height: size.height * 0.1,
width: size.width,
child: Center(
child: Text(
'등록된 허브 리스트',
textScaleFactor: 1.0,
style: TextStyle(
color: Colors.black,
fontSize: 20,
fontSize: 28,
fontFamily: 'Noto',
fontWeight: FontWeight.bold),
),
trailing: Icon(Icons.arrow_forward),
onTap: () async {
//허브 id로 가져와서 있으면 바로 넘기기
var result =
await getBottleList(widget.hublist[index]);
if (result == "GET") {
UserSecureStorage.setHubId(
widget.hublist[index].toString());
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) =>
BottleList(),
));
} else if (result == "Not Found") {
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: new Text('Error'),
content: new Text('등록된 약병이 없습니다.'),
actions: <Widget>[
new FlatButton(
child: new Text('등록'),
onPressed: () {
UserSecureStorage.setHubId(
widget.hublist[index].toString());
Navigator.push(
context,
MaterialPageRoute(
builder:
(BuildContext context) =>
RegisterBottle(),
));
})
],
);
),
decoration: BoxDecoration(border: Border.all()),
),
SizedBox(height: 30),
Expanded(
child: ListView.separated(
padding: const EdgeInsets.all(30),
itemCount: _hublist.length,
itemBuilder: (BuildContext context, int index) {
return Container(
padding: EdgeInsets.all(8.0),
decoration: BoxDecoration(
border: Border.all(),
borderRadius:
BorderRadius.all(Radius.circular(25.0)),
),
child: ListTile(
title: Text(
'HUB ID: ' + '${_hublist[index]}',
style: TextStyle(
color: Colors.black,
fontSize: 20,
fontFamily: 'Noto',
fontWeight: FontWeight.bold),
),
trailing: Icon(Icons.arrow_forward),
onTap: () async {
//허브 id로 가져와서 있으면 바로 넘기기
var result =
await getBottleList(_hublist[index]);
if (result == "GET") {
UserSecureStorage.setHubId(
_hublist[index].toString());
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) =>
BottleList(),
));
} else if (result == "Not Found") {
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: new Text('Error'),
content: new Text('등록된 약병이 없습니다.'),
actions: <Widget>[
new FlatButton(
child: new Text('등록'),
onPressed: () {
UserSecureStorage.setHubId(
_hublist[index].toString());
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext
context) =>
RegisterBottle(),
));
})
],
);
},
);
}
},
);
}
),
);
},
separatorBuilder: (BuildContext contetx, int index) =>
const Divider(),
),
);
},
separatorBuilder: (BuildContext contetx, int index) =>
const Divider(),
)
],
),
)
],
)),
);
}
},
),
),
onWillPop: () {
SystemNavigator.pop();
},
);
}
}
......
import 'package:Smart_Medicine_Box/src/screens/DashBoard.dart';
import 'package:Smart_Medicine_Box/src/screens/Register/BottleList.dart';
import 'package:flutter/cupertino.dart';
import 'dart:convert';
import 'package:flutter/material.dart';
......@@ -7,6 +5,7 @@ import 'package:http/http.dart' as http;
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'SearchMedicine.dart';
import '../BottleList.dart';
import '../../utils/user_secure_stoarge.dart';
class RegisterBottle extends StatefulWidget {
......@@ -139,7 +138,6 @@ class _RegisterBottleState extends State<RegisterBottle> {
);
} else if (saveMessage == "등록 완료" &&
widget.modify_bottle == true) {
print('asdg');
await showDialog(
context: context,
builder: (BuildContext context) {
......
......@@ -8,6 +8,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.5.0-nullsafety.1"
badges:
dependency: "direct main"
description:
name: badges
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
boolean_selector:
dependency: transitive
description:
......@@ -125,6 +132,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
flutter_picker:
dependency: "direct main"
description:
name: flutter_picker
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.5"
flutter_screenutil:
dependency: "direct main"
description:
......
......@@ -38,9 +38,12 @@ dependencies:
http: ^0.12.0+4
flutter_dotenv: ^2.1.0
numberpicker: ^1.3.0
flutter_secure_storage: ^3.3.5
flutter_secure_storage: ^3.3.5
sqflite: ^1.1.6
path_provider: ^1.2.0
badges: ^1.1.1
flutter_picker: ^1.1.5
dev_dependencies:
flutter_test:
......