고원빈

1

{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"windowsSdkVersion": "10.0.18362.0",
"compilerPath": "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29910/bin/Hostx64/x64/cl.exe",
"cStandard": "c17",
"cppStandard": "c++17",
"intelliSenseMode": "windows-msvc-x64"
}
],
"version": 4
}
\ No newline at end of file
{
"project_info": {
"project_number": "515101468848",
"project_id": "smartmedicinebox-e7163",
"storage_bucket": "smartmedicinebox-e7163.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:515101468848:android:ca3083a7ae6e9e83cff375",
"android_client_info": {
"package_name": "com.example.Smart_Medicine_Box"
}
},
"oauth_client": [
{
"client_id": "515101468848-a5p2ifirr30l80fcetedid91vrcj1v8h.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyCkglFpl-CsPetG2C--9BZjiXILK3-TZT0"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "515101468848-a5p2ifirr30l80fcetedid91vrcj1v8h.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
}
],
"configuration_version": "1"
}
\ No newline at end of file
......@@ -15,7 +15,6 @@
<application
android:name="io.flutter.app.FlutterApplication"
android:label="Smart_Medicine_Box"
android:requestLegacyExternalStorage="true"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
......
......@@ -8,6 +8,7 @@ buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.10'
}
}
......
// Copyright (c) 2018, codegrue. All rights reserved. Use of this source code
// is governed by the MIT license that can be found in the LICENSE file.
import '../flutter_material_pickers.dart';
import 'package:flutter/material.dart';
import '../interfaces/common_dialog_properties.dart';
// copied from flutter calendar picker
const Duration _dialogSizeAnimationDuration = Duration(milliseconds: 200);
/// This is a support widget that returns an Dialog with checkboxes as a Widget.
/// It is designed to be used in the showDialog method of other fields.
class ResponsiveDialog extends StatefulWidget
implements ICommonDialogProperties {
ResponsiveDialog({
this.context,
String title,
Widget child,
this.headerColor,
this.headerTextColor,
this.backgroundColor,
this.buttonTextColor,
this.forcePortrait = false,
double maxLongSide,
double maxShortSide,
this.hideButtons = false,
this.okPressed,
this.cancelPressed,
this.confirmText,
this.cancelText,
}) : title = title ?? "Title Here",
child = child ?? Text("Content Here"),
maxLongSide = maxLongSide ?? 600,
maxShortSide = maxShortSide ?? 400;
// Variables
final BuildContext context;
@override
final String title;
final Widget child;
final bool forcePortrait;
@override
final Color headerColor;
@override
final Color headerTextColor;
@override
final Color backgroundColor;
@override
final Color buttonTextColor;
@override
final double maxLongSide;
@override
final double maxShortSide;
final bool hideButtons;
@override
final String confirmText;
@override
final String cancelText;
// Events
final VoidCallback cancelPressed;
final VoidCallback okPressed;
@override
_ResponsiveDialogState createState() => _ResponsiveDialogState();
}
class _ResponsiveDialogState extends State<ResponsiveDialog> {
Color _headerColor;
Color _headerTextColor;
Color _backgroundColor;
Color _buttonTextColor;
Widget header(BuildContext context, Orientation orientation) {
return Container(
color: _headerColor,
height: (orientation == Orientation.portrait)
? kPickerHeaderPortraitHeight
: null,
width: (orientation == Orientation.landscape)
? kPickerHeaderLandscapeWidth
: null,
child: Center(
child: Text(
widget.title,
style: TextStyle(
color: _headerTextColor,
fontSize: 23,
fontFamily: 'Noto',
fontWeight: FontWeight.bold),
),
),
padding: EdgeInsets.all(20.0),
);
}
Widget actionBar(BuildContext context) {
if (widget.hideButtons) return Container();
var localizations = MaterialLocalizations.of(context);
return Container(
height: kDialogActionBarHeight,
child: Container(
decoration: BoxDecoration(
border: Border(
top: BorderSide(width: 1.0, color: _headerColor),
),
),
child: ButtonBar(
children: <Widget>[
FlatButton(
textColor: _buttonTextColor,
child: Text('취소'),
onPressed: () => (widget.cancelPressed == null)
? Navigator.of(context).pop()
: widget.cancelPressed(),
),
FlatButton(
textColor: _buttonTextColor,
child: Text('확인'),
onPressed: () => (widget.okPressed == null)
? Navigator.of(context).pop()
: widget.okPressed(),
),
],
),
),
);
}
@override
Widget build(BuildContext context) {
assert(context != null);
var theme = Theme.of(context);
_headerColor = widget.headerColor ?? theme.primaryColor;
_headerTextColor =
widget.headerTextColor ?? theme.primaryTextTheme.headline6.color;
_buttonTextColor = widget.buttonTextColor ?? theme.textTheme.button.color;
_backgroundColor = widget.backgroundColor ?? theme.dialogBackgroundColor;
final Orientation orientation = MediaQuery.of(context).orientation;
// constrain the dialog from expanding to full screen
final Size dialogSize = (orientation == Orientation.portrait)
? Size(widget.maxShortSide, widget.maxLongSide)
: Size(widget.maxLongSide, widget.maxShortSide);
return Dialog(
backgroundColor: _backgroundColor,
child: AnimatedContainer(
width: dialogSize.width,
height: dialogSize.height * 0.8,
duration: _dialogSizeAnimationDuration,
child: OrientationBuilder(
builder: (BuildContext context, Orientation orientation) {
assert(orientation != null);
assert(context != null);
if (widget.forcePortrait) orientation = Orientation.portrait;
switch (orientation) {
case Orientation.portrait:
return Column(
children: <Widget>[
header(context, orientation),
Expanded(
child: Container(
child: widget.child,
),
),
actionBar(context),
],
);
case Orientation.landscape:
return Row(
children: <Widget>[
header(context, orientation),
Expanded(
child: Column(
children: <Widget>[
Expanded(
child: widget.child,
),
actionBar(context),
],
),
),
],
);
}
return null;
},
),
),
);
}
}
// Copyright (c) 2018, codegrue. All rights reserved. Use of this source code
// is governed by the MIT license that can be found in the LICENSE file.
import 'package:flutter/material.dart';
import '../pickers/scroll_picker.dart';
import 'responsive_dialog.dart';
import '../interfaces/common_dialog_properties.dart';
/// This is a support widget that returns an Dialog with checkboxes as a Widget.
/// It is designed to be used in the showDialog method of other fields.
class ScrollPickerDialog extends StatefulWidget
implements ICommonDialogProperties {
ScrollPickerDialog({
this.title,
this.items,
this.initialItem,
this.headerColor,
this.headerTextColor,
this.backgroundColor,
this.buttonTextColor,
this.maxLongSide,
this.maxShortSide,
this.confirmText,
this.cancelText,
});
// Variables
final List<String> items;
final String initialItem;
@override
final String title;
@override
final Color headerColor;
@override
final Color headerTextColor;
@override
final Color backgroundColor;
@override
final Color buttonTextColor;
@override
final double maxLongSide;
@override
final double maxShortSide;
@override
final String confirmText;
@override
final String cancelText;
@override
State<ScrollPickerDialog> createState() =>
_ScrollPickerDialogState(initialItem);
}
class _ScrollPickerDialogState extends State<ScrollPickerDialog> {
_ScrollPickerDialogState(this.selectedItem);
String selectedItem;
@override
Widget build(BuildContext context) {
assert(context != null);
return ResponsiveDialog(
context: context,
title: widget.title,
headerColor: widget.headerColor,
headerTextColor: widget.headerTextColor,
backgroundColor: widget.backgroundColor,
buttonTextColor: widget.buttonTextColor,
maxLongSide: widget.maxLongSide,
maxShortSide: widget.maxLongSide,
confirmText: widget.confirmText,
cancelText: widget.cancelText,
child: ScrollPicker(
items: widget.items,
initialValue: selectedItem,
onChanged: (value) => setState(() => selectedItem = value),
),
okPressed: () => Navigator.of(context).pop(selectedItem),
);
}
}
// Copyright (c) 2018, codegrue. All rights reserved. Use of this source code
// is governed by the MIT license that can be found in the LICENSE file.
/// Package for building card based settings forms
library flutter_material_pickers;
/// Helpers
export 'package:Smart_Medicine_Box/helpers/show_scroll_picker.dart';
// Constants
const double kPickerHeaderPortraitHeight = 80.0;
const double kPickerHeaderLandscapeWidth = 168.0;
const double kDialogActionBarHeight = 52.0;
const double kDialogMargin = 30.0;
// Copyright (c) 2018, codegrue. All rights reserved. Use of this source code
// is governed by the MIT license that can be found in the LICENSE file.
import 'package:flutter/material.dart';
import '../dialogs/scroll_picker_dialog.dart';
/// Allows selection of a string via a slot machine carousel
void showMaterialScrollPicker({
BuildContext context,
String title,
List<String> items,
String selectedItem,
Color headerColor,
Color headerTextColor,
Color backgroundColor,
Color buttonTextColor,
String confirmText,
String cancelText,
double maxLongSide,
double maxShortSide,
ValueChanged<String> onChanged,
VoidCallback onConfirmed,
VoidCallback onCancelled,
}) {
showDialog<String>(
context: context,
builder: (BuildContext context) {
return ScrollPickerDialog(
items: items,
title: title,
initialItem: selectedItem,
headerColor: headerColor,
headerTextColor: headerTextColor,
backgroundColor: backgroundColor,
buttonTextColor: buttonTextColor,
confirmText: confirmText,
cancelText: cancelText,
maxLongSide: maxLongSide,
maxShortSide: maxLongSide,
);
},
).then((selection) {
if (onChanged != null && selection != null) onChanged(selection);
if (onCancelled != null && selection == null) onCancelled();
if (onConfirmed != null && selection != null) onConfirmed();
});
}
import 'package:flutter/material.dart';
abstract class ICommonDialogProperties {
final String title = null;
final Color headerColor = null;
final Color headerTextColor = null;
final Color backgroundColor = null;
final Color buttonTextColor = null;
final double maxLongSide = null;
final double maxShortSide = null;
final String confirmText = null;
final String cancelText = null;
}
// Copyright (c) 2018, codegrue. All rights reserved. Use of this source code
// is governed by the MIT license that can be found in the LICENSE file.
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
/// This helper widget manages the scrollable content inside a picker widget.
class ScrollPicker extends StatefulWidget {
ScrollPicker({
Key key,
@required this.items,
@required this.initialValue,
@required this.onChanged,
}) : assert(items != null),
super(key: key);
// Events
final ValueChanged<String> onChanged;
// Variables
final List<String> items;
final String initialValue;
@override
_ScrollPickerState createState() => _ScrollPickerState(initialValue);
}
class _ScrollPickerState extends State<ScrollPicker> {
_ScrollPickerState(this.selectedValue);
// Constants
static const double itemHeight = 50.0;
// Variables
double widgetHeight;
int numberOfVisibleItems;
int numberOfPaddingRows;
double visibleItemsHeight;
double offset;
String selectedValue;
ScrollController scrollController;
@override
void initState() {
super.initState();
int initialItem = widget.items.indexOf(selectedValue);
scrollController = FixedExtentScrollController(initialItem: initialItem);
}
@override
Widget build(BuildContext context) {
final ThemeData themeData = Theme.of(context);
TextStyle defaultStyle = themeData.textTheme.bodyText2;
TextStyle selectedStyle =
themeData.textTheme.headline5.copyWith(color: themeData.accentColor);
return LayoutBuilder(
builder: (BuildContext context, BoxConstraints constraints) {
widgetHeight = constraints.maxHeight;
return Stack(
children: <Widget>[
GestureDetector(
onTapUp: _itemTapped,
child: ListWheelScrollView.useDelegate(
childDelegate: ListWheelChildBuilderDelegate(
builder: (BuildContext context, int index) {
if (index < 0 || index > widget.items.length - 1) {
return null;
}
var value = widget.items[index];
final TextStyle itemStyle =
(value == selectedValue) ? selectedStyle : defaultStyle;
return Center(
child: Text(value, style: itemStyle),
);
}),
controller: scrollController,
itemExtent: itemHeight,
onSelectedItemChanged: _onSelectedItemChanged,
physics: FixedExtentScrollPhysics(),
),
),
Center(child: Divider()),
Center(
child: Container(
height: itemHeight,
decoration: BoxDecoration(
border: Border(
top: BorderSide(color: themeData.accentColor, width: 1.0),
bottom:
BorderSide(color: themeData.accentColor, width: 1.0),
),
),
),
)
],
);
},
);
}
void _itemTapped(TapUpDetails details) {
Offset position = details.localPosition;
double center = widgetHeight / 2;
double changeBy = position.dy - center;
double newPosition = scrollController.offset + changeBy;
// animate to and center on the selected item
scrollController.animateTo(newPosition,
duration: Duration(milliseconds: 500), curve: Curves.easeInOut);
}
void _onSelectedItemChanged(int index) {
String newValue = widget.items[index];
if (newValue != selectedValue) {
selectedValue = newValue;
widget.onChanged(newValue);
}
}
}
......@@ -10,7 +10,7 @@ import 'models/Medicine.dart';
import 'package:Smart_Medicine_Box/src/screens/SettingPage.dart';
import 'BottleList.dart';
import 'MainPage.dart';
import 'Register/SearchMedicine.dart';
import 'FeedBack.dart';
class DashBoard extends StatefulWidget {
int pageNumber;
......@@ -60,7 +60,7 @@ class _DashBoardState extends State<DashBoard> {
var _tabs = [
ineerInformationpage(context),
MainPage(),
feedBackPage(context),
FeedbackPage(),
];
return WillPopScope(
......@@ -502,149 +502,3 @@ Widget ineerInformationpage(BuildContext context) {
),
);
}
Widget feedBackPage(BuildContext context) {
Bottle _bottleinformation = new Bottle();
//get bottle
Future<Bottle> _getbottle() async {
String usertoken = await UserSecureStorage.getUserToken();
String bottleid = await UserSecureStorage.getBottleId();
Bottle _bottleinformation = new Bottle();
http.Response response = await http.get(
Uri.encodeFull(DotEnv().env['SERVER_URL'] + 'bottle/' + bottleid),
headers: {"authorization": usertoken});
if (response.statusCode == 200) {
Map<String, dynamic> jsonData = jsonDecode(response.body);
_bottleinformation = Bottle.fromJson(jsonData);
}
return _bottleinformation;
}
final Size size = MediaQuery.of(context).size;
return Scaffold(
backgroundColor: Colors.white,
body: FutureBuilder(
future: _getbottle(),
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 * 0.9,
margin: EdgeInsets.fromLTRB(0, 30, 0, 0),
padding: EdgeInsets.fromLTRB(5, 0, 5, 5),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Container(
padding: EdgeInsets.fromLTRB(5, 5, 5, 5),
height: size.height * 0.08,
width: size.width,
child: Center(
child: Text(
'Outside Information',
textAlign: TextAlign.center,
textScaleFactor: 1.0,
style: TextStyle(
color: Colors.black,
fontSize: 32,
fontFamily: 'NotoSansKR',
fontWeight: FontWeight.w700),
),
),
),
Container(
padding: EdgeInsets.fromLTRB(5, 0, 5, 5),
margin: EdgeInsets.fromLTRB(0, 10, 0, 0),
height: size.height * 0.20,
width: size.width,
child: Column(
children: <Widget>[
Flexible(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Container(
padding: EdgeInsets.fromLTRB(5, 5, 5, 0),
width: size.width * 0.9,
height: size.height * 0.18,
decoration: BoxDecoration(
color: Color(0xff8E97FD),
borderRadius: BorderRadius.circular(10.0),
),
child: Column(
children: [
Container(
width: size.width,
height: size.height * 0.05,
child: Center(
child: Text(
'권장 약 복용량',
textAlign: TextAlign.center,
textScaleFactor: 1.0,
style: TextStyle(
color: Colors.white,
fontSize: 28,
fontFamily: 'NotoSansKR',
fontWeight: FontWeight.w800),
),
),
),
Container(
width: size.width,
height: size.height * 0.12,
child: Row(
mainAxisAlignment:
MainAxisAlignment.center,
children: [
Text(
snapshot.data.dosage == null
? '-'
: snapshot.data.dosage
.toString(),
textAlign: TextAlign.center,
textScaleFactor: 1.0,
style: TextStyle(
color: Colors.white,
fontSize: 80,
fontFamily: 'NotoSansKR',
fontWeight: FontWeight.w800),
),
Text(
' 개',
textScaleFactor: 1.0,
style: TextStyle(
color: Colors.white,
fontSize: 64,
fontFamily: 'NotoSansKR',
fontWeight: FontWeight.w800),
)
],
),
),
],
),
),
],
),
),
],
),
),
],
),
);
}
}),
);
}
......
......@@ -8,7 +8,7 @@ import '../utils/user_secure_stoarge.dart';
import 'models/Medicine.dart';
import 'Register/SearchMedicine.dart';
//import 'package:flutter_material_pickers/flutter_material_pickers.dart';
import '../../flutter_material_pickers.dart';
class MainPage extends StatefulWidget {
@override
......@@ -16,11 +16,11 @@ class MainPage extends StatefulWidget {
}
class _MainPageState extends State<MainPage> {
String _seletedDoctor = '';
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();
......@@ -106,7 +106,7 @@ class _MainPageState extends State<MainPage> {
Text(
_medicineInformation.company == null
? '-'
: '대강 처방의 이름',
: _seletedDoctor,
style: TextStyle(
color: Colors.black,
fontSize: 16,
......@@ -272,14 +272,15 @@ class _MainPageState extends State<MainPage> {
child: FlatButton(
padding: EdgeInsets.fromLTRB(0, 5, 0, 5),
onPressed: () async {
/*showMaterialScrollPicker(
await showMaterialScrollPicker(
context: context,
title: '처방의',
items: doctorlist,
selectedItem: seletedDoctor,
onChanged: (value) =>
setState(() => seletedDoctor = value),
);*/
selectedItem: _seletedDoctor,
onChanged: (value) => setState(() {
_seletedDoctor = value;
}),
);
},
child: Text(
'처방의 변경',
......
......@@ -407,12 +407,9 @@ class _AlarmnState extends State<Alarm> {
times[index - 1] = timeString;
timesHours[index - 1] = timeHour;
timesMinutes[index - 1] = timesMinite;
_prefs.setString('time' + (saveIndex[index - 1]).toString(),
savetimeStrings);
print(savetimeStrings);
setState(() {
savetimeStrings = savetimeStrings;
});
......
class BottleMedicine {
int dosage;
int bottleId;
int medicineId;
String doctorId;
String doctorName;
DateTime regDtm;
BottleMedicine(
{this.dosage,
this.bottleId,
this.medicineId,
this.doctorId,
this.doctorName,
this.regDtm});
factory BottleMedicine.fromJson(Map<String, dynamic> parsedJson) {
return BottleMedicine(
dosage: parsedJson['dosage'],
bottleId: parsedJson['bottleId'],
medicineId: parsedJson['medicineId'],
doctorId: parsedJson['doctorId'],
regDtm: DateTime.parse(parsedJson['regDtm']).toLocal(),
);
}
Map<String, dynamic> toJson() => {
"dosage": dosage,
"bottleId": bottleId,
"medicineId": medicineId,
"doctorId": doctorId,
"doctorName": doctorName,
"regDtm": regDtm
};
}
import 'BottleMedicine.dart';
class Doctor {
String fdbType;
String doctorId;
String feedback;
DateTime fdbDtm;
BottleMedicine bmId;
Doctor({this.fdbType, this.doctorId, this.feedback, this.fdbDtm, this.bmId});
factory Doctor.fromJson(Map<String, dynamic> parsedJson) {
var list = parsedJson['bmId'] as List;
List<BottleMedicine> data =
list.map((i) => BottleMedicine.fromJson(i)).toList();
return Doctor(
fdbType: parsedJson['fdbType'],
doctorId: parsedJson['doctorId'],
feedback: parsedJson['feedback'],
fdbDtm: DateTime.parse(parsedJson['fdbDtm']).toLocal(),
bmId: data[0],
);
}
}