Improve back button function in all screens

This commit is contained in:
hanie.khodkari
2025-03-19 18:38:40 +03:30
parent d99ecb2783
commit 58cd3d9f3f
35 changed files with 4715 additions and 5007 deletions
+248 -269
View File
@@ -75,297 +75,276 @@ class _CycleAddScreenState extends State<CycleAddScreen> {
final double _devicewidth = _media.size.width; final double _devicewidth = _media.size.width;
final double _deviceBlockSize = _devicewidth / 100; final double _deviceBlockSize = _devicewidth / 100;
return Consumer<CyclesProvider>(builder: (context, cyclesProvider, _) { return Consumer<CyclesProvider>(builder: (context, cyclesProvider, _) {
return PopScope( return SafeArea(
canPop: false, child: GestureDetector(
onPopInvoked: (didPop) { onTap: () {
if (didPop) return; FocusManager.instance.primaryFocus?.unfocus();
Navigator.of(context).pushNamed(Routes.homePage); },
// cyclesProvider.resetLoadingButton(); child: Scaffold(
// Navigator.pushReplacementNamed( appBar: AppBar(
// context, titleSpacing: -10,
// Routes.cycleResultScreen, title: Text(
// ); 'Cycles',
// return true; style: TextStyle(
}, color: Colors.white,
child: SafeArea(
child: GestureDetector(
onTap: () {
FocusManager.instance.primaryFocus?.unfocus();
},
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text(
'Cycles',
style: TextStyle(
color: Colors.white,
),
),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () {
cyclesProvider.resetLoadingButton();
Navigator.of(context)
.pushReplacementNamed(Routes.cycleResultScreen);
},
), ),
), ),
body: Consumer<ConnectivityProvider>( backgroundColor: Colors.black,
builder: (ct, connection, _) { leading: IconButton(
return connection.conStatus != 'offline' icon: Icon(
? isInit Icons.keyboard_arrow_left,
? Center( color: Colors.white,
child: CircularProgressIndicator( size: 35,
color: Colors.black, ),
), onPressed: () {
) cyclesProvider.resetLoadingButton();
: Form( Navigator.of(context)
key: _form, .pushReplacementNamed(Routes.cycleResultScreen);
child: Padding( },
padding: EdgeInsets.all(20), ),
child: ListView( ),
// crossAxisAlignment: CrossAxisAlignment.start, body: Consumer<ConnectivityProvider>(
children: <Widget>[ builder: (ct, connection, _) {
Text( return connection.conStatus != 'offline'
'Add a Cycle', ? isInit
style: TextStyle( ? Center(
fontWeight: FontWeight.w700, child: CircularProgressIndicator(
fontSize: 6 * _deviceBlockSize, color: Colors.black,
letterSpacing: 3,
), ),
), )
SizedBox( : Form(
height: 20, key: _form,
), child: Padding(
Row( padding: EdgeInsets.all(20),
children: [ child: ListView(
Flexible( // crossAxisAlignment: CrossAxisAlignment.start,
flex: 8, children: <Widget>[
child: TextFormField( Text(
validator: (val) { 'Add a Cycle',
if (val!.isEmpty) { style: TextStyle(
return 'Strilizer ID required!'; fontWeight: FontWeight.w700,
} fontSize: 6 * _deviceBlockSize,
return null; letterSpacing: 3,
},
controller: striizerIdCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons
.sortNumericDown,
size: 7 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
isDense: true,
labelText: 'Strilizer ID',
contentPadding:
EdgeInsets.symmetric(
vertical: 2,
horizontal: 3,
), ),
), ),
style: TextStyle( SizedBox(
fontWeight: FontWeight.w700, height: 20,
fontSize: 5 * _deviceBlockSize,
), ),
keyboardType: Row(
TextInputType.visiblePassword, children: [
textInputAction: Flexible(
TextInputAction.next, flex: 8,
onFieldSubmitted: (_) { child: TextFormField(
FocusScope.of(context) validator: (val) {
.requestFocus( if (val!.isEmpty) {
_cycleNumberFocusNode); return 'Strilizer ID required!';
}, }
), return null;
), },
Flexible( controller: striizerIdCTRL,
flex: 1, decoration: InputDecoration(
child: InkWell( icon: Icon(
onTap: () { FontAwesomeIcons.sortNumericDown,
scan().then( size: 7 * _deviceBlockSize,
(String result) { ),
if (result == 'cancel') { labelStyle: TextStyle(
print('cancel'); fontWeight: FontWeight.w100,
} else if (result == fontSize: 4 * _deviceBlockSize,
'error') { ),
print('error'); isDense: true,
} else if (result == labelText: 'Strilizer ID',
'access') { contentPadding:
print('access'); EdgeInsets.symmetric(
} else { vertical: 2,
print(result); horizontal: 3,
striizerIdCTRL.text = ),
result; ),
} style: TextStyle(
}, fontWeight: FontWeight.w700,
); fontSize: 5 * _deviceBlockSize,
}, ),
child: Container( keyboardType:
padding: EdgeInsets.all(8), TextInputType.visiblePassword,
decoration: BoxDecoration( textInputAction: TextInputAction.next,
shape: BoxShape.circle, onFieldSubmitted: (_) {
color: Colors.black, FocusScope.of(context).requestFocus(
_cycleNumberFocusNode);
},
),
),
Flexible(
flex: 1,
child: InkWell(
onTap: () {
scan().then(
(String result) {
if (result == 'cancel') {
print('cancel');
} else if (result == 'error') {
print('error');
} else if (result == 'access') {
print('access');
} else {
print(result);
striizerIdCTRL.text = result;
}
},
);
},
child: Container(
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black,
),
child: Icon(
Icons.qr_code_scanner,
size: 5 * _deviceBlockSize,
color: Colors.white,
),
),
),
),
],
),
SizedBox(
height: 20,
),
TextFormField(
validator: (val) {
if (val!.isEmpty) {
return 'Cycle number required!';
}
return null;
},
controller: cycleNumberCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 7 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
isDense: true,
labelText: 'Cycle Number',
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
), ),
child: Icon( style: TextStyle(
Icons.qr_code_scanner, fontWeight: FontWeight.w700,
size: 5 * _deviceBlockSize, fontSize: 5 * _deviceBlockSize,
color: Colors.white, ),
focusNode: _cycleNumberFocusNode,
keyboardType: TextInputType.number,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(_descriptionFocosNode);
},
),
SizedBox(
height: 30,
),
CycleAddDatePicker(
dateCTRL: dateCTRL,
deviceBlockSize: _deviceBlockSize,
),
SizedBox(
height: 20.0,
),
Container(
margin: EdgeInsets.symmetric(vertical: 10),
child: Text(
'Labels included',
style: TextStyle(
color: kPink,
letterSpacing: 2,
fontSize: 5 * _deviceBlockSize,
),
), ),
), ),
), Consumer<CyclesProvider>(
), builder: (ctx, cycleProvider, _) =>
], ListView.builder(
), physics: NeverScrollableScrollPhysics(),
SizedBox( shrinkWrap: true,
height: 20, itemBuilder: (ctx, index) => AddLabelBox(
),
TextFormField(
validator: (val) {
if (val!.isEmpty) {
return 'Cycle number required!';
}
return null;
},
controller: cycleNumberCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 7 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
isDense: true,
labelText: 'Cycle Number',
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
focusNode: _cycleNumberFocusNode,
keyboardType: TextInputType.number,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context).requestFocus(
_descriptionFocosNode);
},
),
SizedBox(
height: 30,
),
CycleAddDatePicker(
dateCTRL: dateCTRL,
deviceBlockSize: _deviceBlockSize,
),
SizedBox(
height: 20.0,
),
Container(
margin:
EdgeInsets.symmetric(vertical: 10),
child: Text(
'Labels included',
style: TextStyle(
color: kPink,
letterSpacing: 2,
fontSize: 5 * _deviceBlockSize,
),
),
),
Consumer<CyclesProvider>(
builder: (ctx, cycleProvider, _) =>
ListView.builder(
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemBuilder: (ctx, index) =>
AddLabelBox(
text: 'Select Labels included', text: 'Select Labels included',
iconColor: kPinkSub, iconColor: kPinkSub,
deviceBlockSize: _deviceBlockSize, deviceBlockSize: _deviceBlockSize,
values: values:
cycleProvider.labelValues[index], cycleProvider.labelValues[index],
vals: cycleProvider.labelVals, vals: cycleProvider.labelVals,
initialLabelValue: initialLabelValue:
cycleProvider.initialLabelValue, cycleProvider.initialLabelValue,
index: index, index: index,
hasRemoveButton: hasRemoveButton:
cycleProvider.labelValues.length > cycleProvider.labelValues.length > 1
1 ? true
? true : false,
: false,
), ),
itemCount: itemCount:
cycleProvider.labelValues.length, cycleProvider.labelValues.length,
), ),
), ),
SizedBox( SizedBox(
height: 30, height: 30,
), ),
TextFormField( TextFormField(
controller: descriptionCTRL, controller: descriptionCTRL,
decoration: InputDecoration( decoration: InputDecoration(
icon: Icon( icon: Icon(
FontAwesomeIcons.alignLeft, FontAwesomeIcons.alignLeft,
size: 7 * _deviceBlockSize, size: 7 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
isDense: true,
labelText: 'Description',
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
keyboardType: TextInputType.multiline,
focusNode: _descriptionFocosNode,
minLines: 1,
maxLines: 5,
),
SizedBox(
height: 70,
),
CycleAddSaveButton(
form: _form,
labelValues: Provider.of<CyclesProvider>(
context,
listen: false,
).labelValues,
cycleNumberCTRL: cycleNumberCTRL,
dateValue: dateCTRL.text,
descriptionCTRL: descriptionCTRL,
striizerIdCTRL: striizerIdCTRL,
deviceBlockSize: _deviceBlockSize,
),
SizedBox(
height: 100,
),
],
), ),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
isDense: true,
labelText: 'Description',
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
), ),
style: TextStyle( )
fontWeight: FontWeight.w700, : ConnectionErrorBox();
fontSize: 5 * _deviceBlockSize, },
),
keyboardType: TextInputType.multiline,
focusNode: _descriptionFocosNode,
minLines: 1,
maxLines: 5,
),
SizedBox(
height: 70,
),
CycleAddSaveButton(
form: _form,
labelValues: Provider.of<CyclesProvider>(
context,
listen: false,
).labelValues,
cycleNumberCTRL: cycleNumberCTRL,
dateValue: dateCTRL.text,
descriptionCTRL: descriptionCTRL,
striizerIdCTRL: striizerIdCTRL,
deviceBlockSize: _deviceBlockSize,
),
SizedBox(
height: 100,
),
],
),
),
)
: ConnectionErrorBox();
},
),
), ),
), ),
),); ),
);
}); });
} }
} }
+35 -42
View File
@@ -52,51 +52,44 @@ class _CycleDetailScreenState extends State<CycleDetailScreen> {
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5); // final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
final double _devicewidth = _media.size.width; final double _devicewidth = _media.size.width;
final double _deviceBlockSize = _devicewidth / 100; final double _deviceBlockSize = _devicewidth / 100;
return PopScope( return SafeArea(
canPop: false, child: Scaffold(
onPopInvoked: (didPop) { appBar: AppBar(
if (didPop) return; titleSpacing: -10,
Navigator.of(context).pushNamed(Routes.homePage); title: Text(
}, 'Cycles',
child: SafeArea( style: TextStyle(
child: Scaffold( color: Colors.white,
appBar: AppBar(
titleSpacing: -10,
title: Text(
'Cycles',
style: TextStyle(
color: Colors.white,
),
),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
), ),
), ),
body: Consumer<ConnectivityProvider>(builder: (ct, connection, _) { backgroundColor: Colors.black,
return connection.conStatus != 'offline' leading: IconButton(
? isInit icon: Icon(
? Center( Icons.keyboard_arrow_left,
child: CircularProgressIndicator( color: Colors.white,
color: Colors.black, size: 35,
), ),
) onPressed: () => Navigator.of(context).pop(),
: isEmpty ),
? Center(
child: Text('This Cycle doesnt exists!'),
)
: CycleDetailsDataBox(
datas: datas!,
deviceBlockSize: _deviceBlockSize,
)
: ConnectionErrorBox();
}),
), ),
body: Consumer<ConnectivityProvider>(builder: (ct, connection, _) {
return connection.conStatus != 'offline'
? isInit
? Center(
child: CircularProgressIndicator(
color: Colors.black,
),
)
: isEmpty
? Center(
child: Text('This Cycle doesnt exists!'),
)
: CycleDetailsDataBox(
datas: datas!,
deviceBlockSize: _deviceBlockSize,
)
: ConnectionErrorBox();
}),
), ),
); );
} }
+249 -261
View File
@@ -91,271 +91,259 @@ class _CycleFilterScreenState extends State<CycleFilterScreen> {
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5); // final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
final double _devicewidth = _media.size.width; final double _devicewidth = _media.size.width;
final double _deviceBlockSize = _devicewidth / 100; final double _deviceBlockSize = _devicewidth / 100;
return PopScope( return SafeArea(
canPop: false, child: GestureDetector(
onPopInvoked: (didPop) { onTap: () {
if (didPop) return; FocusManager.instance.primaryFocus?.unfocus();
Navigator.of(context).pushNamed(Routes.homePage); },
// Navigator.pushReplacementNamed( child: Scaffold(
// context, appBar: AppBar(
// Routes.cycleResultScreen, titleSpacing: -10,
// ); title: Text(
// return true; 'Cycles',
}, style: TextStyle(
child: SafeArea( color: Colors.white,
child: GestureDetector(
onTap: () {
FocusManager.instance.primaryFocus?.unfocus();
},
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text(
'Cycles',
style: TextStyle(
color: Colors.white,
),
),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context)
.pushReplacementNamed(Routes.cycleResultScreen),
), ),
), ),
body: Consumer<ConnectivityProvider>( backgroundColor: Colors.black,
builder: (ct, connection, _) { leading: IconButton(
return connection.conStatus != 'offline' icon: Icon(
? isInit Icons.keyboard_arrow_left,
? Center( color: Colors.white,
child: CircularProgressIndicator( size: 35,
color: Colors.black, ),
), onPressed: () => Navigator.of(context)
) .pushReplacementNamed(Routes.cycleResultScreen),
: Padding(
padding: EdgeInsets.all(20),
child: ListView(
// crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
'Filter Cycles',
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
),
SizedBox(
height: 20,
),
Row(
children: [
Flexible(
flex: 8,
child: TextFormField(
controller: cycleIdCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Cycle ID',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
keyboardType: TextInputType.number,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context).requestFocus(
_cycleNumberFocusNode);
},
),
),
// Spacer(),
Flexible(
flex: 1,
child: InkWell(
onTap: () {
scan().then(
(String result) {
if (result == 'cancel') {
print('cancel');
} else if (result == 'error') {
print('error');
} else if (result == 'access') {
print('access');
} else {
print(result);
cycleIdCTRL.text = result;
}
},
);
},
child: Container(
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black,
),
child: Icon(
Icons.qr_code_scanner,
size: 5 * _deviceBlockSize,
color: Colors.white,
),
),
),
),
],
),
SizedBox(
height: 30,
),
TextFormField(
controller: cycleNumberCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Cycle Number',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
focusNode: _cycleNumberFocusNode,
keyboardType: TextInputType.visiblePassword,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(_strilizerIdFocusNode);
},
),
SizedBox(
height: 30,
),
Row(
children: [
Flexible(
flex: 8,
child: TextField(
controller: striizerIdCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Strilizer ID',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
focusNode: _strilizerIdFocusNode,
keyboardType:
TextInputType.visiblePassword,
textInputAction: TextInputAction.done,
),
),
Flexible(
flex: 1,
child: InkWell(
onTap: () {
scan().then(
(String result) {
if (result == 'cancel') {
print('cancel');
} else if (result == 'error') {
print('error');
} else if (result == 'access') {
print('access');
} else {
print(result);
striizerIdCTRL.text = result;
}
},
);
},
child: Container(
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black,
),
child: Icon(
Icons.qr_code_scanner,
size: 5 * _deviceBlockSize,
color: Colors.white,
),
),
),
),
],
),
SizedBox(
height: 20,
),
FilterHospitalBox(
deviceBlockSize: _deviceBlockSize,
hospitalCTRL: hospitalCTRL,
hospitalVals: hospitalVals,
label: 'Hospital',
),
SizedBox(
height: 20,
),
CycleFilterDatePicker(
dateCTRL: dateCTRL,
deviceBlockSize: _deviceBlockSize,
),
SizedBox(
height: 70,
),
CycleFilterSaveButton(
hospitalVals: hospitalVals,
hospitalCTRL: hospitalCTRL,
cycleIdCTRL: cycleIdCTRL,
cycleNumberCTRL: cycleNumberCTRL,
striizerIdCTRL: striizerIdCTRL,
dateCTRL: dateCTRL,
deviceBlockSize: _deviceBlockSize,
),
SizedBox(
height: 100,
),
],
),
)
: ConnectionErrorBox();
},
), ),
), ),
body: Consumer<ConnectivityProvider>(
builder: (ct, connection, _) {
return connection.conStatus != 'offline'
? isInit
? Center(
child: CircularProgressIndicator(
color: Colors.black,
),
)
: Padding(
padding: EdgeInsets.all(20),
child: ListView(
// crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
'Filter Cycles',
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
),
SizedBox(
height: 20,
),
Row(
children: [
Flexible(
flex: 8,
child: TextFormField(
controller: cycleIdCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Cycle ID',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
keyboardType: TextInputType.number,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context).requestFocus(
_cycleNumberFocusNode);
},
),
),
// Spacer(),
Flexible(
flex: 1,
child: InkWell(
onTap: () {
scan().then(
(String result) {
if (result == 'cancel') {
print('cancel');
} else if (result == 'error') {
print('error');
} else if (result == 'access') {
print('access');
} else {
print(result);
cycleIdCTRL.text = result;
}
},
);
},
child: Container(
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black,
),
child: Icon(
Icons.qr_code_scanner,
size: 5 * _deviceBlockSize,
color: Colors.white,
),
),
),
),
],
),
SizedBox(
height: 30,
),
TextFormField(
controller: cycleNumberCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Cycle Number',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
focusNode: _cycleNumberFocusNode,
keyboardType: TextInputType.visiblePassword,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(_strilizerIdFocusNode);
},
),
SizedBox(
height: 30,
),
Row(
children: [
Flexible(
flex: 8,
child: TextField(
controller: striizerIdCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Strilizer ID',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
focusNode: _strilizerIdFocusNode,
keyboardType:
TextInputType.visiblePassword,
textInputAction: TextInputAction.done,
),
),
Flexible(
flex: 1,
child: InkWell(
onTap: () {
scan().then(
(String result) {
if (result == 'cancel') {
print('cancel');
} else if (result == 'error') {
print('error');
} else if (result == 'access') {
print('access');
} else {
print(result);
striizerIdCTRL.text = result;
}
},
);
},
child: Container(
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black,
),
child: Icon(
Icons.qr_code_scanner,
size: 5 * _deviceBlockSize,
color: Colors.white,
),
),
),
),
],
),
SizedBox(
height: 20,
),
FilterHospitalBox(
deviceBlockSize: _deviceBlockSize,
hospitalCTRL: hospitalCTRL,
hospitalVals: hospitalVals,
label: 'Hospital',
),
SizedBox(
height: 20,
),
CycleFilterDatePicker(
dateCTRL: dateCTRL,
deviceBlockSize: _deviceBlockSize,
),
SizedBox(
height: 70,
),
CycleFilterSaveButton(
hospitalVals: hospitalVals,
hospitalCTRL: hospitalCTRL,
cycleIdCTRL: cycleIdCTRL,
cycleNumberCTRL: cycleNumberCTRL,
striizerIdCTRL: striizerIdCTRL,
dateCTRL: dateCTRL,
deviceBlockSize: _deviceBlockSize,
),
SizedBox(
height: 100,
),
],
),
)
: ConnectionErrorBox();
},
),
), ),
), ),
); );
@@ -323,7 +323,7 @@ class CycleResultFloatingButton extends StatelessWidget {
InkWell( InkWell(
customBorder: CircleBorder(), customBorder: CircleBorder(),
onTap: () { onTap: () {
Navigator.of(context).pushReplacementNamed(Routes.cycleAddScreen); Navigator.of(context).pushNamed(Routes.cycleAddScreen);
}, },
child: Container( child: Container(
padding: EdgeInsets.all(_deviceBlockSize), padding: EdgeInsets.all(_deviceBlockSize),
+150 -157
View File
@@ -28,181 +28,174 @@ class _CycleScanScreenState extends State<CycleScanScreen> {
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5); // final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
final double _devicewidth = _media.size.width; final double _devicewidth = _media.size.width;
final double _deviceBlockSize = _devicewidth / 100; final double _deviceBlockSize = _devicewidth / 100;
return PopScope( return SafeArea(
canPop: false, child: GestureDetector(
onPopInvoked: (didPop) { onTap: () {
if (didPop) return; FocusManager.instance.primaryFocus?.unfocus();
Navigator.of(context).pushNamed(Routes.homePage); },
}, child: Scaffold(
child: SafeArea( appBar: AppBar(
child: GestureDetector( titleSpacing: -10,
onTap: () { title: Text(
FocusManager.instance.primaryFocus?.unfocus(); 'Cycles',
}, style: TextStyle(
child: Scaffold( color: Colors.white,
appBar: AppBar(
titleSpacing: -10,
title: Text(
'Cycles',
style: TextStyle(
color: Colors.white,
),
),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
), ),
), ),
body: Consumer<ConnectivityProvider>( backgroundColor: Colors.black,
builder: (ct, connection, _) { leading: IconButton(
return connection.conStatus != 'offline' icon: Icon(
? ListView( Icons.keyboard_arrow_left,
padding: EdgeInsets.symmetric(horizontal: 20), color: Colors.white,
children: <Widget>[ size: 35,
Container( ),
padding: EdgeInsets.only(top: 30), onPressed: () => Navigator.of(context).pop(),
child: Text( ),
'Looking for a Cycle?', ),
textAlign: TextAlign.left, body: Consumer<ConnectivityProvider>(
style: TextStyle( builder: (ct, connection, _) {
color: Colors.black, return connection.conStatus != 'offline'
fontSize: 5.5 * _deviceBlockSize, ? ListView(
fontWeight: FontWeight.w700, padding: EdgeInsets.symmetric(horizontal: 20),
letterSpacing: 3, children: <Widget>[
), Container(
padding: EdgeInsets.only(top: 30),
child: Text(
'Looking for a Cycle?',
textAlign: TextAlign.left,
style: TextStyle(
color: Colors.black,
fontSize: 5.5 * _deviceBlockSize,
fontWeight: FontWeight.w700,
letterSpacing: 3,
), ),
), ),
GestureDetector( ),
child: Container( GestureDetector(
margin: EdgeInsets.symmetric(vertical: 10), child: Container(
height: 200, margin: EdgeInsets.symmetric(vertical: 10),
decoration: BoxDecoration(border: Border.all()), height: 200,
child: Center( decoration: BoxDecoration(border: Border.all()),
child: Text( child: Center(
'Please Scan The Cycle Barcode', child: Text(
style: TextStyle( 'Please Scan The Cycle Barcode',
color: Colors.black, style: TextStyle(
fontSize: 5 * _deviceBlockSize, color: Colors.black,
fontWeight: FontWeight.w100, fontSize: 5 * _deviceBlockSize,
letterSpacing: 3,
),
textAlign: TextAlign.center,
),
),
),
onTap: () {
scan().then(
(String result) {
if (result == 'cancel') {
print('cancel');
} else if (result == 'error') {
print('error');
} else if (result == 'access') {
print('access');
} else {
launch(
'https://cssd-doc.com/Show/Cycle/$result',
);
// Navigator.of(context).pushNamed(
// Routes.cycleDetailScreen,
// arguments: result,
// );
}
},
);
},
),
SizedBox(
height: 10.0,
),
Form(
key: _form,
child: TextFormField(
validator: (val) {
if (val!.isEmpty) {
return 'Id required!!';
}
return null;
},
controller: idCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100, fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize, letterSpacing: 3,
),
isDense: true,
labelText: 'Or enter a cycle ID',
contentPadding: EdgeInsets.symmetric(
vertical: 2,
horizontal: 3,
),
focusedBorder: UnderlineInputBorder(
// borderRadius: BorderRadius.only(Radius.circular(4)),
borderSide: BorderSide(
color: Colors.grey,
),
), ),
textAlign: TextAlign.center,
), ),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
keyboardType: TextInputType.number,
), ),
), ),
SizedBox( onTap: () {
height: 70, scan().then(
), (String result) {
InkWell( if (result == 'cancel') {
onTap: () { print('cancel');
if (!_form.currentState!.validate()) { } else if (result == 'error') {
return; print('error');
} else if (result == 'access') {
print('access');
} else {
launch(
'https://cssd-doc.com/Show/Cycle/$result',
);
// Navigator.of(context).pushNamed(
// Routes.cycleDetailScreen,
// arguments: result,
// );
}
},
);
},
),
SizedBox(
height: 10.0,
),
Form(
key: _form,
child: TextFormField(
validator: (val) {
if (val!.isEmpty) {
return 'Id required!!';
} }
launch( return null;
'https://cssd-doc.com/Show/Cycle/${idCTRL.text}',
);
// Navigator.of(context).pushNamed(
// Routes.cycleDetailScreen,
// arguments: idCTRL.text,
// );
}, },
child: Container( controller: idCTRL,
padding: EdgeInsets.symmetric( decoration: InputDecoration(
horizontal: 5 * _deviceBlockSize, icon: Icon(
vertical: 10, FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
), ),
decoration: BoxDecoration( labelStyle: TextStyle(
gradient: LinearGradient( fontWeight: FontWeight.w100,
colors: [kPink, kPinkSub], fontSize: 4 * _deviceBlockSize,
),
isDense: true,
labelText: 'Or enter a cycle ID',
contentPadding: EdgeInsets.symmetric(
vertical: 2,
horizontal: 3,
),
focusedBorder: UnderlineInputBorder(
// borderRadius: BorderRadius.only(Radius.circular(4)),
borderSide: BorderSide(
color: Colors.grey,
), ),
borderRadius: BorderRadius.circular(7),
), ),
child: Align( ),
alignment: Alignment.center, style: TextStyle(
child: Text( fontWeight: FontWeight.w700,
'Search', fontSize: 5 * _deviceBlockSize,
style: TextStyle( ),
color: Colors.white, keyboardType: TextInputType.number,
fontSize: 5 * _deviceBlockSize, ),
), ),
SizedBox(
height: 70,
),
InkWell(
onTap: () {
if (!_form.currentState!.validate()) {
return;
}
launch(
'https://cssd-doc.com/Show/Cycle/${idCTRL.text}',
);
// Navigator.of(context).pushNamed(
// Routes.cycleDetailScreen,
// arguments: idCTRL.text,
// );
},
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 5 * _deviceBlockSize,
vertical: 10,
),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [kPink, kPinkSub],
),
borderRadius: BorderRadius.circular(7),
),
child: Align(
alignment: Alignment.center,
child: Text(
'Search',
style: TextStyle(
color: Colors.white,
fontSize: 5 * _deviceBlockSize,
), ),
), ),
), ),
), ),
], ),
) ],
: ConnectionErrorBox(); )
}, : ConnectionErrorBox();
), },
), ),
), ),
), ),
+261 -273
View File
@@ -115,283 +115,271 @@ class _ItemAddScreenState extends State<ItemAddScreen> {
final double _devicewidth = _media.size.width; final double _devicewidth = _media.size.width;
final double _deviceBlockSize = _devicewidth / 100; final double _deviceBlockSize = _devicewidth / 100;
final itemProviderObject = Provider.of<ItemProvider>(context); final itemProviderObject = Provider.of<ItemProvider>(context);
return PopScope( return SafeArea(
canPop: false, child: GestureDetector(
onPopInvoked: (didPop) { onTap: () {
if (didPop) return; FocusManager.instance.primaryFocus?.unfocus();
Navigator.of(context).pushNamed(Routes.homePage); },
// Navigator.pushReplacementNamed( child: Scaffold(
// context, appBar: AppBar(
// Routes.itemResultScreen, titleSpacing: -10,
// ); title: Text(
// return true; 'Items',
}, style: TextStyle(
child: SafeArea( color: Colors.white,
child: GestureDetector(
onTap: () {
FocusManager.instance.primaryFocus?.unfocus();
},
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text(
'Items',
style: TextStyle(
color: Colors.white,
),
),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context)
.pushReplacementNamed(Routes.itemResultScreen),
), ),
), ),
body: Consumer<ConnectivityProvider>( backgroundColor: Colors.black,
builder: (ct, connection, _) { leading: IconButton(
return connection.conStatus != 'offline' icon: Icon(
? isLoading Icons.keyboard_arrow_left,
? Center( color: Colors.white,
child: CircularProgressIndicator( size: 35,
color: Colors.black, ),
), onPressed: () => Navigator.of(context)
) .pushReplacementNamed(Routes.itemResultScreen),
: Form(
key: _form,
child: Padding(
padding: EdgeInsets.all(20),
child: ListView(
children: <Widget>[
Text(
'Add an Item',
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 6 * _deviceBlockSize,
letterSpacing: 3,
),
),
SizedBox(
height: 20,
),
TextFormField(
validator: (val) {
if (val!.isEmpty) {
return 'Name required!';
}
return null;
},
controller: nameCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.alignLeft,
size: 7 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
isDense: true,
labelText: 'Item Name',
contentPadding: EdgeInsets.symmetric(
vertical: 2,
horizontal: 3,
),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
keyboardType: TextInputType.text,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(_itemSizeFocusNode);
},
),
SizedBox(
height: 30,
),
TextFormField(
validator: (val) {
if (val!.isEmpty) {
return 'Size required!';
}
return null;
},
controller: sizeCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 7 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
isDense: true,
labelText: 'Size',
contentPadding: EdgeInsets.symmetric(
vertical: 2,
horizontal: 3,
),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
focusNode: _itemSizeFocusNode,
keyboardType: TextInputType.number,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(_itemSpecificFocusNode);
},
),
SizedBox(
height: 30,
),
TextFormField(
validator: (val) {
if (val!.isEmpty) {
return 'Specific required!';
}
return null;
},
controller: specificCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.alignLeft,
size: 7 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
isDense: true,
labelText: 'Specific',
contentPadding: EdgeInsets.symmetric(
vertical: 2,
horizontal: 3,
),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
focusNode: _itemSpecificFocusNode,
keyboardType: TextInputType.visiblePassword,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(_itemUdiFocusNode);
},
),
SizedBox(
height: 30,
),
TextFormField(
validator: (val) {
if (val!.isEmpty) {
return 'UDI required!';
}
return null;
},
controller: udiCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.alignLeft,
size: 7 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
isDense: true,
labelText: 'UDI',
contentPadding: EdgeInsets.symmetric(
vertical: 2,
horizontal: 3,
),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
focusNode: _itemUdiFocusNode,
keyboardType: TextInputType.visiblePassword,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(_descriptionFocusNode);
},
),
SizedBox(
height: 30,
),
TextFormField(
controller: descriptionCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.alignLeft,
size: 7 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
isDense: true,
labelText: 'Description',
contentPadding: EdgeInsets.symmetric(
vertical: 2,
horizontal: 3,
),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
keyboardType: TextInputType.multiline,
focusNode: _descriptionFocusNode,
minLines: 1,
maxLines: 5,
),
SizedBox(
height: 30.0,
),
UploaderImage(
deviceBlockSize: _deviceBlockSize,
providerObject: itemProviderObject,
),
SizedBox(
height: 70,
),
ItemAddSaveButton(
onTap: () {
_saveForm(
nameCTRL.text,
sizeCTRL.text,
specificCTRL.text,
udiCTRL.text,
descriptionCTRL.text,
itemProviderObject);
},
deviceBlockSize: _deviceBlockSize,
),
SizedBox(
height: 100,
),
],
),
),
)
: ConnectionErrorBox();
},
), ),
), ),
body: Consumer<ConnectivityProvider>(
builder: (ct, connection, _) {
return connection.conStatus != 'offline'
? isLoading
? Center(
child: CircularProgressIndicator(
color: Colors.black,
),
)
: Form(
key: _form,
child: Padding(
padding: EdgeInsets.all(20),
child: ListView(
children: <Widget>[
Text(
'Add an Item',
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 6 * _deviceBlockSize,
letterSpacing: 3,
),
),
SizedBox(
height: 20,
),
TextFormField(
validator: (val) {
if (val!.isEmpty) {
return 'Name required!';
}
return null;
},
controller: nameCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.alignLeft,
size: 7 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
isDense: true,
labelText: 'Item Name',
contentPadding: EdgeInsets.symmetric(
vertical: 2,
horizontal: 3,
),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
keyboardType: TextInputType.text,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(_itemSizeFocusNode);
},
),
SizedBox(
height: 30,
),
TextFormField(
validator: (val) {
if (val!.isEmpty) {
return 'Size required!';
}
return null;
},
controller: sizeCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 7 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
isDense: true,
labelText: 'Size',
contentPadding: EdgeInsets.symmetric(
vertical: 2,
horizontal: 3,
),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
focusNode: _itemSizeFocusNode,
keyboardType: TextInputType.number,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(_itemSpecificFocusNode);
},
),
SizedBox(
height: 30,
),
TextFormField(
validator: (val) {
if (val!.isEmpty) {
return 'Specific required!';
}
return null;
},
controller: specificCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.alignLeft,
size: 7 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
isDense: true,
labelText: 'Specific',
contentPadding: EdgeInsets.symmetric(
vertical: 2,
horizontal: 3,
),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
focusNode: _itemSpecificFocusNode,
keyboardType: TextInputType.visiblePassword,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(_itemUdiFocusNode);
},
),
SizedBox(
height: 30,
),
TextFormField(
validator: (val) {
if (val!.isEmpty) {
return 'UDI required!';
}
return null;
},
controller: udiCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.alignLeft,
size: 7 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
isDense: true,
labelText: 'UDI',
contentPadding: EdgeInsets.symmetric(
vertical: 2,
horizontal: 3,
),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
focusNode: _itemUdiFocusNode,
keyboardType: TextInputType.visiblePassword,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(_descriptionFocusNode);
},
),
SizedBox(
height: 30,
),
TextFormField(
controller: descriptionCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.alignLeft,
size: 7 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
isDense: true,
labelText: 'Description',
contentPadding: EdgeInsets.symmetric(
vertical: 2,
horizontal: 3,
),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
keyboardType: TextInputType.multiline,
focusNode: _descriptionFocusNode,
minLines: 1,
maxLines: 5,
),
SizedBox(
height: 30.0,
),
UploaderImage(
deviceBlockSize: _deviceBlockSize,
providerObject: itemProviderObject,
),
SizedBox(
height: 70,
),
ItemAddSaveButton(
onTap: () {
_saveForm(
nameCTRL.text,
sizeCTRL.text,
specificCTRL.text,
udiCTRL.text,
descriptionCTRL.text,
itemProviderObject);
},
deviceBlockSize: _deviceBlockSize,
),
SizedBox(
height: 100,
),
],
),
),
)
: ConnectionErrorBox();
},
),
), ),
), ),
); );
+312 -324
View File
@@ -84,334 +84,322 @@ class _ItemFilterScreenState extends State<ItemFilterScreen> {
final _media = MediaQuery.of(context); final _media = MediaQuery.of(context);
final double _devicewidth = _media.size.width; final double _devicewidth = _media.size.width;
final double _deviceBlockSize = _devicewidth / 100; final double _deviceBlockSize = _devicewidth / 100;
return PopScope( return SafeArea(
canPop: false, child: GestureDetector(
onPopInvoked: (didPop) { onTap: () {
if (didPop) return; FocusManager.instance.primaryFocus?.unfocus();
Navigator.of(context).pushNamed(Routes.homePage); },
// Navigator.pushReplacementNamed( child: Scaffold(
// context, appBar: AppBar(
// Routes.itemResultScreen, titleSpacing: -10,
// ); title: Text(
// return true; 'Items',
}, style: TextStyle(
child: SafeArea( color: Colors.white,
child: GestureDetector(
onTap: () {
FocusManager.instance.primaryFocus?.unfocus();
},
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text(
'Items',
style: TextStyle(
color: Colors.white,
),
),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context)
.pushReplacementNamed(Routes.itemResultScreen),
), ),
), ),
body: Consumer<ConnectivityProvider>( backgroundColor: Colors.black,
builder: (ct, connection, _) { leading: IconButton(
return connection.conStatus != 'offline' icon: Icon(
? isInit Icons.keyboard_arrow_left,
? Center( color: Colors.white,
child: CircularProgressIndicator( size: 35,
color: Colors.black, ),
), onPressed: () => Navigator.of(context)
) .pushReplacementNamed(Routes.itemResultScreen),
: Padding(
padding: EdgeInsets.all(20),
child: ListView(
children: <Widget>[
Text(
'Filter Items',
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
),
SizedBox(
height: 20,
),
Row(
children: [
Flexible(
flex: 8,
child: TextFormField(
controller: idCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Item ID',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2,
horizontal: 3,
),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
keyboardType: TextInputType.number,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(_itemNameFocusNode);
},
),
),
// Spacer(),
Flexible(
flex: 1,
child: InkWell(
onTap: () {
scan().then(
(String result) {
if (result == 'cancel') {
print('cancel');
} else if (result == 'error') {
print('error');
} else if (result == 'access') {
print('access');
} else {
print(result);
idCTRL.text = result;
}
},
);
},
child: Container(
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black,
),
child: Icon(
Icons.qr_code_scanner,
size: 5 * _deviceBlockSize,
color: Colors.white,
),
),
),
),
],
),
SizedBox(
height: 30,
),
TextFormField(
controller: nameCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.alignLeft,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Item Name',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
focusNode: _itemNameFocusNode,
keyboardType: TextInputType.text,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(_itemUdiFocusNode);
},
),
SizedBox(
height: 30,
),
Row(
children: [
Flexible(
flex: 8,
child: TextFormField(
controller: udiCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.alignLeft,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'UDI',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2,
horizontal: 3,
),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
focusNode: _itemUdiFocusNode,
keyboardType: TextInputType.text,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(_itemSizeFocusNode);
},
),
),
Flexible(
flex: 1,
child: InkWell(
onTap: () {
scan().then(
(String result) {
if (result == 'cancel') {
print('cancel');
} else if (result == 'error') {
print('error');
} else if (result == 'access') {
print('access');
} else {
print(result);
udiCTRL.text = result;
}
},
);
},
child: Container(
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black,
),
child: Icon(
Icons.qr_code_scanner,
size: 5 * _deviceBlockSize,
color: Colors.white,
),
),
),
),
],
),
SizedBox(
height: 30.0,
),
TextFormField(
controller: sizeCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Size',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
focusNode: _itemSizeFocusNode,
keyboardType: TextInputType.number,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(_itemSpecificFocusNode);
},
),
SizedBox(
height: 30,
),
TextFormField(
controller: specificCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.alignLeft,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Specific',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2,
horizontal: 3,
),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
focusNode: _itemSpecificFocusNode,
keyboardType: TextInputType.visiblePassword,
textInputAction: TextInputAction.next,
),
SizedBox(
height: 30,
),
FilterHospitalBox(
deviceBlockSize: _deviceBlockSize,
hospitalCTRL: hospitalCTRL,
hospitalVals: hospitalVals,
label: 'Hospital',
),
SizedBox(
height: 90,
),
ItemFilterSaveButton(
hospitalVals: hospitalVals,
hospitalCTRL: hospitalCTRL,
idCTRL: idCTRL,
nameCTRL: nameCTRL,
udiCTRL: udiCTRL,
sizeCTRL: sizeCTRL,
specificCTRL: specificCTRL,
deviceBlockSize: _deviceBlockSize,
firstColor: kBlue,
secondColor: kBlueSub,
push: Routes.itemResultScreen,
),
SizedBox(
height: 100,
),
],
),
)
: ConnectionErrorBox();
},
), ),
), ),
body: Consumer<ConnectivityProvider>(
builder: (ct, connection, _) {
return connection.conStatus != 'offline'
? isInit
? Center(
child: CircularProgressIndicator(
color: Colors.black,
),
)
: Padding(
padding: EdgeInsets.all(20),
child: ListView(
children: <Widget>[
Text(
'Filter Items',
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
),
SizedBox(
height: 20,
),
Row(
children: [
Flexible(
flex: 8,
child: TextFormField(
controller: idCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Item ID',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2,
horizontal: 3,
),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
keyboardType: TextInputType.number,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(_itemNameFocusNode);
},
),
),
// Spacer(),
Flexible(
flex: 1,
child: InkWell(
onTap: () {
scan().then(
(String result) {
if (result == 'cancel') {
print('cancel');
} else if (result == 'error') {
print('error');
} else if (result == 'access') {
print('access');
} else {
print(result);
idCTRL.text = result;
}
},
);
},
child: Container(
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black,
),
child: Icon(
Icons.qr_code_scanner,
size: 5 * _deviceBlockSize,
color: Colors.white,
),
),
),
),
],
),
SizedBox(
height: 30,
),
TextFormField(
controller: nameCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.alignLeft,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Item Name',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
focusNode: _itemNameFocusNode,
keyboardType: TextInputType.text,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(_itemUdiFocusNode);
},
),
SizedBox(
height: 30,
),
Row(
children: [
Flexible(
flex: 8,
child: TextFormField(
controller: udiCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.alignLeft,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'UDI',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2,
horizontal: 3,
),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
focusNode: _itemUdiFocusNode,
keyboardType: TextInputType.text,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(_itemSizeFocusNode);
},
),
),
Flexible(
flex: 1,
child: InkWell(
onTap: () {
scan().then(
(String result) {
if (result == 'cancel') {
print('cancel');
} else if (result == 'error') {
print('error');
} else if (result == 'access') {
print('access');
} else {
print(result);
udiCTRL.text = result;
}
},
);
},
child: Container(
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black,
),
child: Icon(
Icons.qr_code_scanner,
size: 5 * _deviceBlockSize,
color: Colors.white,
),
),
),
),
],
),
SizedBox(
height: 30.0,
),
TextFormField(
controller: sizeCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Size',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
focusNode: _itemSizeFocusNode,
keyboardType: TextInputType.number,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(_itemSpecificFocusNode);
},
),
SizedBox(
height: 30,
),
TextFormField(
controller: specificCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.alignLeft,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Specific',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2,
horizontal: 3,
),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
focusNode: _itemSpecificFocusNode,
keyboardType: TextInputType.visiblePassword,
textInputAction: TextInputAction.next,
),
SizedBox(
height: 30,
),
FilterHospitalBox(
deviceBlockSize: _deviceBlockSize,
hospitalCTRL: hospitalCTRL,
hospitalVals: hospitalVals,
label: 'Hospital',
),
SizedBox(
height: 90,
),
ItemFilterSaveButton(
hospitalVals: hospitalVals,
hospitalCTRL: hospitalCTRL,
idCTRL: idCTRL,
nameCTRL: nameCTRL,
udiCTRL: udiCTRL,
sizeCTRL: sizeCTRL,
specificCTRL: specificCTRL,
deviceBlockSize: _deviceBlockSize,
firstColor: kBlue,
secondColor: kBlueSub,
push: Routes.itemResultScreen,
),
SizedBox(
height: 100,
),
],
),
)
: ConnectionErrorBox();
},
),
), ),
), ),
); );
+1 -1
View File
@@ -352,7 +352,7 @@ class ItemResultFloatingButton extends StatelessWidget {
InkWell( InkWell(
customBorder: CircleBorder(), customBorder: CircleBorder(),
onTap: () { onTap: () {
Navigator.of(context).pushReplacementNamed(Routes.itemAddScreen); Navigator.of(context).pushNamed(Routes.itemAddScreen);
}, },
child: Container( child: Container(
padding: EdgeInsets.all(_deviceBlockSize), padding: EdgeInsets.all(_deviceBlockSize),
+150 -158
View File
@@ -5,7 +5,6 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
import '../../config/routes.dart';
import '../../providers/connectivity.dart'; import '../../providers/connectivity.dart';
import '../../widgets/Global/internet_error.dart'; import '../../widgets/Global/internet_error.dart';
@@ -26,181 +25,174 @@ class _ItemScanScreenState extends State<ItemScanScreen> {
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5); // final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
final double _devicewidth = _media.size.width; final double _devicewidth = _media.size.width;
final double _deviceBlockSize = _devicewidth / 100; final double _deviceBlockSize = _devicewidth / 100;
return PopScope( return SafeArea(
canPop: false, child: GestureDetector(
onPopInvoked: (didPop) { onTap: () {
if (didPop) return; FocusManager.instance.primaryFocus?.unfocus();
Navigator.of(context).pushNamed(Routes.homePage); },
}, child: Scaffold(
child: SafeArea( appBar: AppBar(
child: GestureDetector( titleSpacing: -10,
onTap: () { title: Text(
FocusManager.instance.primaryFocus?.unfocus(); 'Items',
}, style: TextStyle(
child: Scaffold( color: Colors.white,
appBar: AppBar(
titleSpacing: -10,
title: Text(
'Items',
style: TextStyle(
color: Colors.white,
),
),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
), ),
), ),
body: Consumer<ConnectivityProvider>( backgroundColor: Colors.black,
builder: (ct, connection, _) { leading: IconButton(
return connection.conStatus != 'offline' icon: Icon(
? ListView( Icons.keyboard_arrow_left,
padding: EdgeInsets.symmetric(horizontal: 20), color: Colors.white,
children: <Widget>[ size: 35,
Container( ),
padding: EdgeInsets.only(top: 30), onPressed: () => Navigator.of(context).pop(),
child: Text( ),
'Looking for an Item?', ),
textAlign: TextAlign.left, body: Consumer<ConnectivityProvider>(
style: TextStyle( builder: (ct, connection, _) {
color: Colors.black, return connection.conStatus != 'offline'
fontSize: 5.5 * _deviceBlockSize, ? ListView(
fontWeight: FontWeight.w700, padding: EdgeInsets.symmetric(horizontal: 20),
letterSpacing: 3, children: <Widget>[
), Container(
padding: EdgeInsets.only(top: 30),
child: Text(
'Looking for an Item?',
textAlign: TextAlign.left,
style: TextStyle(
color: Colors.black,
fontSize: 5.5 * _deviceBlockSize,
fontWeight: FontWeight.w700,
letterSpacing: 3,
), ),
), ),
GestureDetector( ),
child: Container( GestureDetector(
margin: EdgeInsets.symmetric(vertical: 10), child: Container(
height: 200, margin: EdgeInsets.symmetric(vertical: 10),
decoration: BoxDecoration(border: Border.all()), height: 200,
child: Center( decoration: BoxDecoration(border: Border.all()),
child: Text( child: Center(
'Please Scan The Item Barcode', child: Text(
style: TextStyle( 'Please Scan The Item Barcode',
color: Colors.black, style: TextStyle(
fontSize: 5 * _deviceBlockSize, color: Colors.black,
fontWeight: FontWeight.w100, fontSize: 5 * _deviceBlockSize,
letterSpacing: 3,
),
textAlign: TextAlign.center,
),
),
),
onTap: () {
scan().then(
(String result) {
if (result == 'cancel') {
print('cancel');
} else if (result == 'error') {
print('error');
} else if (result == 'access') {
print('access');
} else {
launch(
'https://cssd-doc.com/Show/Item/$result',
);
// Navigator.of(context).pushNamed(
// Routes.cycleDetailScreen,
// arguments: result,
// );
}
},
);
},
),
SizedBox(
height: 10.0,
),
Form(
key: _form,
child: TextFormField(
validator: (val) {
if (val!.isEmpty) {
return 'Id required!!';
}
return null;
},
controller: idCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100, fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize, letterSpacing: 3,
),
isDense: true,
labelText: 'Or enter an Item ID',
contentPadding: EdgeInsets.symmetric(
vertical: 2,
horizontal: 3,
),
focusedBorder: UnderlineInputBorder(
// borderRadius: BorderRadius.only(Radius.circular(4)),
borderSide: BorderSide(
color: Colors.grey,
),
), ),
textAlign: TextAlign.center,
), ),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
keyboardType: TextInputType.number,
), ),
), ),
SizedBox( onTap: () {
height: 70, scan().then(
), (String result) {
InkWell( if (result == 'cancel') {
onTap: () { print('cancel');
if (!_form.currentState!.validate()) { } else if (result == 'error') {
return; print('error');
} else if (result == 'access') {
print('access');
} else {
launch(
'https://cssd-doc.com/Show/Item/$result',
);
// Navigator.of(context).pushNamed(
// Routes.cycleDetailScreen,
// arguments: result,
// );
}
},
);
},
),
SizedBox(
height: 10.0,
),
Form(
key: _form,
child: TextFormField(
validator: (val) {
if (val!.isEmpty) {
return 'Id required!!';
} }
launch( return null;
'https://cssd-doc.com/Show/Item/${idCTRL.text}',
);
// Navigator.of(context).pushNamed(
// Routes.cycleDetailScreen,
// arguments: idCTRL.text,
// );
}, },
child: Container( controller: idCTRL,
padding: EdgeInsets.symmetric( decoration: InputDecoration(
horizontal: 5 * _deviceBlockSize, icon: Icon(
vertical: 10, FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
), ),
decoration: BoxDecoration( labelStyle: TextStyle(
gradient: LinearGradient( fontWeight: FontWeight.w100,
colors: [kBlue, kBlueSub], fontSize: 4 * _deviceBlockSize,
),
isDense: true,
labelText: 'Or enter an Item ID',
contentPadding: EdgeInsets.symmetric(
vertical: 2,
horizontal: 3,
),
focusedBorder: UnderlineInputBorder(
// borderRadius: BorderRadius.only(Radius.circular(4)),
borderSide: BorderSide(
color: Colors.grey,
), ),
borderRadius: BorderRadius.circular(7),
), ),
child: Align( ),
alignment: Alignment.center, style: TextStyle(
child: Text( fontWeight: FontWeight.w700,
'Search', fontSize: 5 * _deviceBlockSize,
style: TextStyle( ),
color: Colors.white, keyboardType: TextInputType.number,
fontSize: 5 * _deviceBlockSize, ),
), ),
SizedBox(
height: 70,
),
InkWell(
onTap: () {
if (!_form.currentState!.validate()) {
return;
}
launch(
'https://cssd-doc.com/Show/Item/${idCTRL.text}',
);
// Navigator.of(context).pushNamed(
// Routes.cycleDetailScreen,
// arguments: idCTRL.text,
// );
},
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 5 * _deviceBlockSize,
vertical: 10,
),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [kBlue, kBlueSub],
),
borderRadius: BorderRadius.circular(7),
),
child: Align(
alignment: Alignment.center,
child: Text(
'Search',
style: TextStyle(
color: Colors.white,
fontSize: 5 * _deviceBlockSize,
), ),
), ),
), ),
), ),
], ),
) ],
: ConnectionErrorBox(); )
}, : ConnectionErrorBox();
), },
), ),
), ),
), ),
+287 -303
View File
@@ -77,314 +77,298 @@ class _LabelAddScreenState extends State<LabelAddScreen> {
// String initialLabelValue; // String initialLabelValue;
return Consumer<LabelsProvider>( return Consumer<LabelsProvider>(
builder: (context, labelsProvider, _) { builder: (context, labelsProvider, _) {
return PopScope( return SafeArea(
canPop: false, child: GestureDetector(
onPopInvoked: (didPop) { onTap: () {
if (didPop) return; FocusManager.instance.primaryFocus?.unfocus();
Navigator.of(context).pushNamed(Routes.homePage); },
// labelsProvider.resetLoadingButton(); child: Scaffold(
// Navigator.pushReplacementNamed( appBar: AppBar(
// context, titleSpacing: -10,
// Routes.labelResultScreen, title: Text(
// ); 'Labels',
// return true; style: TextStyle(
}, color: Colors.white,
child: SafeArea(
child: GestureDetector(
onTap: () {
FocusManager.instance.primaryFocus?.unfocus();
},
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text(
'Labels',
style: TextStyle(
color: Colors.white,
),
),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () {
labelsProvider.resetLoadingButton();
Navigator.of(context)
.pushReplacementNamed(Routes.labelResultScreen);
},
), ),
), ),
body: Consumer<ConnectivityProvider>( backgroundColor: Colors.black,
builder: (ct, connection, _) { leading: IconButton(
return connection.conStatus != 'offline' icon: Icon(
? isInit Icons.keyboard_arrow_left,
? Center( color: Colors.white,
child: CircularProgressIndicator( size: 35,
color: Colors.black, ),
), onPressed: () {
) labelsProvider.resetLoadingButton();
: Form( Navigator.of(context)
key: _form, .pushReplacementNamed(Routes.labelResultScreen);
child: Padding(
padding: EdgeInsets.all(20),
child: ListView(
children: <Widget>[
Text(
'Add a Label',
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 6 * _deviceBlockSize,
letterSpacing: 3,
),
),
SizedBox(
height: 20,
),
Row(
children: [
Flexible(
flex: 8,
child: TextFormField(
onChanged: (val) {
setState(() {
lotNumberCTRL.text = val +
' - ' +
cycleNumberCTRL.text;
});
},
validator: (val) {
if (val!.isEmpty) {
return 'Strilizer ID required!';
}
return null;
},
controller: striizerIdCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons
.sortNumericDown,
size: 7 * _deviceBlockSize),
isDense: true,
labelText: 'Strilizer ID',
contentPadding:
EdgeInsets.symmetric(
vertical: 2,
horizontal: 3),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize:
4 * _deviceBlockSize,
),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
keyboardType:
TextInputType.visiblePassword,
textInputAction:
TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(
_cycleNumberFocusNode);
},
),
),
Flexible(
flex: 1,
child: InkWell(
onTap: () {
scan().then(
(String result) {
if (result == 'cancel') {
print('cancel');
} else if (result ==
'error') {
print('error');
} else if (result ==
'access') {
print('access');
} else {
print(result);
striizerIdCTRL.text =
result;
}
},
);
},
child: Container(
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black,
),
child: Icon(
Icons.qr_code_scanner,
size: 5 * _deviceBlockSize,
color: Colors.white,
),
),
),
),
],
),
SizedBox(
height: 20,
),
TextFormField(
onChanged: (val) {
setState(
() {
lotNumberCTRL.text =
striizerIdCTRL.text +
' - ' +
val;
},
);
},
validator: (val) {
if (val!.isEmpty) {
return 'Cycle number required!';
}
return null;
},
controller: cycleNumberCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 7 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
isDense: true,
labelText: 'Cycle Number',
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
focusNode: _cycleNumberFocusNode,
keyboardType: TextInputType.number,
textInputAction: TextInputAction.done,
),
SizedBox(
height: 20,
),
TextFormField(
readOnly: true,
controller: lotNumberCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 7 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
isDense: true,
labelText: 'Lot Number',
contentPadding: EdgeInsets.symmetric(
vertical: 2,
horizontal: 3,
),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
keyboardType:
TextInputType.visiblePassword,
),
SizedBox(
height: 20,
),
Container(
margin:
EdgeInsets.symmetric(vertical: 10),
child: Text(
'Packages included',
style: TextStyle(
color: kLightBlue,
letterSpacing: 2,
fontSize: 5 * _deviceBlockSize,
),
),
),
Consumer<LabelsProvider>(
builder: (ctx, labelProvider, _) {
return ListView.builder(
physics:
NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemBuilder: (ctx, index) =>
AddPackageBox(
text: 'Package ID',
iconColor: kLightBlueSub,
deviceBlockSize: _deviceBlockSize,
values: labelProvider
.packageValues[index],
vals: labelProvider.packageVals,
initialLabelValue: labelProvider
.initialPackageValue,
index: index,
),
itemCount: labelProvider
.packageValues.length,
);
}),
SizedBox(
height: 10,
),
LabelAddDatePicker(
dateCTRL: sDateCTRL,
deviceBlockSize: _deviceBlockSize,
label: 'Sterile Date',
),
SizedBox(
height: 20,
),
LabelAddDatePicker(
dateCTRL: eDateCTRL,
deviceBlockSize: _deviceBlockSize,
label: 'Expire Date',
),
SizedBox(
height: 70,
),
LabelAddSaveButton(
form: _form,
lotNumberCTRL: lotNumberCTRL,
cycleNumberCTRL: cycleNumberCTRL,
sDateCTRL: sDateCTRL,
packageValue:
Provider.of<LabelsProvider>(
context,
listen: false,
).packageValues,
eDateCTRL: eDateCTRL,
striizerIdCTRL: striizerIdCTRL,
deviceBlockSize: _deviceBlockSize,
),
SizedBox(
height: 100,
),
],
),
),
)
: ConnectionErrorBox();
}, },
), ),
), ),
body: Consumer<ConnectivityProvider>(
builder: (ct, connection, _) {
return connection.conStatus != 'offline'
? isInit
? Center(
child: CircularProgressIndicator(
color: Colors.black,
),
)
: Form(
key: _form,
child: Padding(
padding: EdgeInsets.all(20),
child: ListView(
children: <Widget>[
Text(
'Add a Label',
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 6 * _deviceBlockSize,
letterSpacing: 3,
),
),
SizedBox(
height: 20,
),
Row(
children: [
Flexible(
flex: 8,
child: TextFormField(
onChanged: (val) {
setState(() {
lotNumberCTRL.text = val +
' - ' +
cycleNumberCTRL.text;
});
},
validator: (val) {
if (val!.isEmpty) {
return 'Strilizer ID required!';
}
return null;
},
controller: striizerIdCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons
.sortNumericDown,
size: 7 * _deviceBlockSize),
isDense: true,
labelText: 'Strilizer ID',
contentPadding:
EdgeInsets.symmetric(
vertical: 2,
horizontal: 3),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
keyboardType:
TextInputType.visiblePassword,
textInputAction:
TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(
_cycleNumberFocusNode);
},
),
),
Flexible(
flex: 1,
child: InkWell(
onTap: () {
scan().then(
(String result) {
if (result == 'cancel') {
print('cancel');
} else if (result ==
'error') {
print('error');
} else if (result ==
'access') {
print('access');
} else {
print(result);
striizerIdCTRL.text =
result;
}
},
);
},
child: Container(
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black,
),
child: Icon(
Icons.qr_code_scanner,
size: 5 * _deviceBlockSize,
color: Colors.white,
),
),
),
),
],
),
SizedBox(
height: 20,
),
TextFormField(
onChanged: (val) {
setState(
() {
lotNumberCTRL.text =
striizerIdCTRL.text +
' - ' +
val;
},
);
},
validator: (val) {
if (val!.isEmpty) {
return 'Cycle number required!';
}
return null;
},
controller: cycleNumberCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 7 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
isDense: true,
labelText: 'Cycle Number',
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
focusNode: _cycleNumberFocusNode,
keyboardType: TextInputType.number,
textInputAction: TextInputAction.done,
),
SizedBox(
height: 20,
),
TextFormField(
readOnly: true,
controller: lotNumberCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 7 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
isDense: true,
labelText: 'Lot Number',
contentPadding: EdgeInsets.symmetric(
vertical: 2,
horizontal: 3,
),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
keyboardType:
TextInputType.visiblePassword,
),
SizedBox(
height: 20,
),
Container(
margin:
EdgeInsets.symmetric(vertical: 10),
child: Text(
'Packages included',
style: TextStyle(
color: kLightBlue,
letterSpacing: 2,
fontSize: 5 * _deviceBlockSize,
),
),
),
Consumer<LabelsProvider>(
builder: (ctx, labelProvider, _) {
return ListView.builder(
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemBuilder: (ctx, index) =>
AddPackageBox(
text: 'Package ID',
iconColor: kLightBlueSub,
deviceBlockSize: _deviceBlockSize,
values: labelProvider
.packageValues[index],
vals: labelProvider.packageVals,
initialLabelValue:
labelProvider.initialPackageValue,
index: index,
),
itemCount:
labelProvider.packageValues.length,
);
}),
SizedBox(
height: 10,
),
LabelAddDatePicker(
dateCTRL: sDateCTRL,
deviceBlockSize: _deviceBlockSize,
label: 'Sterile Date',
),
SizedBox(
height: 20,
),
LabelAddDatePicker(
dateCTRL: eDateCTRL,
deviceBlockSize: _deviceBlockSize,
label: 'Expire Date',
),
SizedBox(
height: 70,
),
LabelAddSaveButton(
form: _form,
lotNumberCTRL: lotNumberCTRL,
cycleNumberCTRL: cycleNumberCTRL,
sDateCTRL: sDateCTRL,
packageValue: Provider.of<LabelsProvider>(
context,
listen: false,
).packageValues,
eDateCTRL: eDateCTRL,
striizerIdCTRL: striizerIdCTRL,
deviceBlockSize: _deviceBlockSize,
),
SizedBox(
height: 100,
),
],
),
),
)
: ConnectionErrorBox();
},
),
), ),
), ),
); );
+35 -42
View File
@@ -52,51 +52,44 @@ class _LabelDetailScreenState extends State<LabelDetailScreen> {
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5); // final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
final double _devicewidth = _media.size.width; final double _devicewidth = _media.size.width;
final double _deviceBlockSize = _devicewidth / 100; final double _deviceBlockSize = _devicewidth / 100;
return PopScope( return SafeArea(
canPop: false, child: Scaffold(
onPopInvoked: (didPop) { appBar: AppBar(
if (didPop) return; titleSpacing: -10,
Navigator.of(context).pushNamed(Routes.homePage); title: Text(
}, 'Labels',
child: SafeArea( style: TextStyle(
child: Scaffold( color: Colors.white,
appBar: AppBar(
titleSpacing: -10,
title: Text(
'Labels',
style: TextStyle(
color: Colors.white,
),
),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
), ),
), ),
body: Consumer<ConnectivityProvider>(builder: (ct, connection, _) { backgroundColor: Colors.black,
return connection.conStatus != 'offline' leading: IconButton(
? isInit icon: Icon(
? Center( Icons.keyboard_arrow_left,
child: CircularProgressIndicator( color: Colors.white,
color: Colors.black, size: 35,
), ),
) onPressed: () => Navigator.of(context).pop(),
: isEmpty ),
? Center(
child: Text('This Label dos\'nt exists!'),
)
: LabelDetailsDataBox(
datas: datas!,
deviceBlockSize: _deviceBlockSize,
)
: ConnectionErrorBox();
}),
), ),
body: Consumer<ConnectivityProvider>(builder: (ct, connection, _) {
return connection.conStatus != 'offline'
? isInit
? Center(
child: CircularProgressIndicator(
color: Colors.black,
),
)
: isEmpty
? Center(
child: Text('This Label dos\'nt exists!'),
)
: LabelDetailsDataBox(
datas: datas!,
deviceBlockSize: _deviceBlockSize,
)
: ConnectionErrorBox();
}),
), ),
); );
} }
+239 -251
View File
@@ -80,261 +80,249 @@ class _LabelFilterScreenState extends State<LabelFilterScreen> {
final _media = MediaQuery.of(context); final _media = MediaQuery.of(context);
final double _devicewidth = _media.size.width; final double _devicewidth = _media.size.width;
final double _deviceBlockSize = _devicewidth / 100; final double _deviceBlockSize = _devicewidth / 100;
return PopScope( return SafeArea(
canPop: false, child: GestureDetector(
onPopInvoked: (didPop) { onTap: () {
if (didPop) return; FocusManager.instance.primaryFocus?.unfocus();
Navigator.of(context).pushNamed(Routes.homePage); },
// Navigator.pushReplacementNamed( child: Scaffold(
// context, appBar: AppBar(
// Routes.labelResultScreen, titleSpacing: -10,
// ); title: Text(
// return true; 'Labels',
}, style: TextStyle(
child: SafeArea( color: Colors.white,
child: GestureDetector(
onTap: () {
FocusManager.instance.primaryFocus?.unfocus();
},
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text(
'Labels',
style: TextStyle(
color: Colors.white,
),
),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context)
.pushReplacementNamed(Routes.labelResultScreen),
), ),
), ),
body: Consumer<ConnectivityProvider>( backgroundColor: Colors.black,
builder: (ct, connection, _) { leading: IconButton(
return connection.conStatus != 'offline' icon: Icon(
? isInit Icons.keyboard_arrow_left,
? Center( color: Colors.white,
child: CircularProgressIndicator( size: 35,
color: Colors.black, ),
), onPressed: () => Navigator.of(context)
) .pushReplacementNamed(Routes.labelResultScreen),
: Padding(
padding: EdgeInsets.all(20),
child: ListView(
children: <Widget>[
Text(
'Filter Labels',
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
),
SizedBox(
height: 20,
),
Row(
children: [
Flexible(
flex: 8,
child: TextFormField(
controller: labelIdCTRl,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Label ID',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
keyboardType: TextInputType.number,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context).requestFocus(
_cycleNumberFocusNode);
},
),
),
Flexible(
flex: 1,
child: InkWell(
onTap: () {
scan().then(
(String result) {
if (result == 'cancel') {
print('cancel');
} else if (result == 'error') {
print('error');
} else if (result == 'access') {
print('access');
} else {
print(result);
labelIdCTRl.text = result;
}
},
);
},
child: Container(
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black,
),
child: Icon(
Icons.qr_code_scanner,
size: 5 * _deviceBlockSize,
color: Colors.white,
),
),
),
),
],
),
SizedBox(
height: 30,
),
TextFormField(
controller: cycleNumberCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Cycle Number',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
focusNode: _cycleNumberFocusNode,
keyboardType: TextInputType.visiblePassword,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(_strilizerIdFocusNode);
},
),
SizedBox(
height: 30,
),
Row(
children: [
Flexible(
flex: 8,
child: TextFormField(
controller: striizerIdCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Strilizer ID',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
textInputAction: TextInputAction.done,
keyboardType:
TextInputType.visiblePassword,
focusNode: _strilizerIdFocusNode,
),
),
Flexible(
flex: 1,
child: InkWell(
onTap: () {
scan().then(
(String result) {
if (result == 'cancel') {
print('cancel');
} else if (result == 'error') {
print('error');
} else if (result == 'access') {
print('access');
} else {
print(result);
striizerIdCTRL.text = result;
}
},
);
},
child: Container(
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black,
),
child: Icon(
Icons.qr_code_scanner,
size: 5 * _deviceBlockSize,
color: Colors.white,
),
),
),
),
],
),
SizedBox(
height: 30,
),
LabelFilterSelectorBox(
deviceBlockSize: _deviceBlockSize,
hospitalCTRL: hospitalCTRL,
hospitalVals: hospitalVals,
),
SizedBox(
height: 70,
),
LabelFilterSaveButton(
hospitalVals: hospitalVals,
hospitalCTRL: hospitalCTRL,
labelIdCTRl: labelIdCTRl,
cycleNumberCTRL: cycleNumberCTRL,
striizerIdCTRL: striizerIdCTRL,
deviceBlockSize: _deviceBlockSize,
),
SizedBox(
height: 50,
),
// DropDownBox(values: ['Washer ID']),
],
),
)
: ConnectionErrorBox();
},
), ),
), ),
body: Consumer<ConnectivityProvider>(
builder: (ct, connection, _) {
return connection.conStatus != 'offline'
? isInit
? Center(
child: CircularProgressIndicator(
color: Colors.black,
),
)
: Padding(
padding: EdgeInsets.all(20),
child: ListView(
children: <Widget>[
Text(
'Filter Labels',
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
),
SizedBox(
height: 20,
),
Row(
children: [
Flexible(
flex: 8,
child: TextFormField(
controller: labelIdCTRl,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Label ID',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
keyboardType: TextInputType.number,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context).requestFocus(
_cycleNumberFocusNode);
},
),
),
Flexible(
flex: 1,
child: InkWell(
onTap: () {
scan().then(
(String result) {
if (result == 'cancel') {
print('cancel');
} else if (result == 'error') {
print('error');
} else if (result == 'access') {
print('access');
} else {
print(result);
labelIdCTRl.text = result;
}
},
);
},
child: Container(
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black,
),
child: Icon(
Icons.qr_code_scanner,
size: 5 * _deviceBlockSize,
color: Colors.white,
),
),
),
),
],
),
SizedBox(
height: 30,
),
TextFormField(
controller: cycleNumberCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Cycle Number',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
focusNode: _cycleNumberFocusNode,
keyboardType: TextInputType.visiblePassword,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(_strilizerIdFocusNode);
},
),
SizedBox(
height: 30,
),
Row(
children: [
Flexible(
flex: 8,
child: TextFormField(
controller: striizerIdCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Strilizer ID',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
textInputAction: TextInputAction.done,
keyboardType:
TextInputType.visiblePassword,
focusNode: _strilizerIdFocusNode,
),
),
Flexible(
flex: 1,
child: InkWell(
onTap: () {
scan().then(
(String result) {
if (result == 'cancel') {
print('cancel');
} else if (result == 'error') {
print('error');
} else if (result == 'access') {
print('access');
} else {
print(result);
striizerIdCTRL.text = result;
}
},
);
},
child: Container(
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black,
),
child: Icon(
Icons.qr_code_scanner,
size: 5 * _deviceBlockSize,
color: Colors.white,
),
),
),
),
],
),
SizedBox(
height: 30,
),
LabelFilterSelectorBox(
deviceBlockSize: _deviceBlockSize,
hospitalCTRL: hospitalCTRL,
hospitalVals: hospitalVals,
),
SizedBox(
height: 70,
),
LabelFilterSaveButton(
hospitalVals: hospitalVals,
hospitalCTRL: hospitalCTRL,
labelIdCTRl: labelIdCTRl,
cycleNumberCTRL: cycleNumberCTRL,
striizerIdCTRL: striizerIdCTRL,
deviceBlockSize: _deviceBlockSize,
),
SizedBox(
height: 50,
),
// DropDownBox(values: ['Washer ID']),
],
),
)
: ConnectionErrorBox();
},
),
), ),
), ),
); );
+59 -66
View File
@@ -30,79 +30,72 @@ class _LabelScanScreenState extends State<LabelScanScreen> {
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5); // final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
final double _devicewidth = _media.size.width; final double _devicewidth = _media.size.width;
final double _deviceBlockSize = _devicewidth / 100; final double _deviceBlockSize = _devicewidth / 100;
return PopScope( return SafeArea(
canPop: false, child: GestureDetector(
onPopInvoked: (didPop) { onTap: () {
if (didPop) return; FocusManager.instance.primaryFocus?.unfocus();
Navigator.of(context).pushNamed(Routes.homePage); },
}, child: Scaffold(
child: SafeArea( appBar: AppBar(
child: GestureDetector( titleSpacing: -10,
onTap: () { title: Text(
FocusManager.instance.primaryFocus?.unfocus(); 'Labels',
}, style: TextStyle(
child: Scaffold( color: Colors.white,
appBar: AppBar(
titleSpacing: -10,
title: Text(
'Labels',
style: TextStyle(
color: Colors.white,
),
),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
), ),
), ),
body: Consumer<ConnectivityProvider>( backgroundColor: Colors.black,
builder: (ct, connection, _) { leading: IconButton(
return connection.conStatus != 'offline' icon: Icon(
? ListView( Icons.keyboard_arrow_left,
padding: EdgeInsets.symmetric(horizontal: 20), color: Colors.white,
children: <Widget>[ size: 35,
Container( ),
padding: EdgeInsets.only(top: 30), onPressed: () => Navigator.of(context).pop(),
child: Text( ),
'Looking for a Label?', ),
textAlign: TextAlign.left, body: Consumer<ConnectivityProvider>(
style: TextStyle( builder: (ct, connection, _) {
color: Colors.black, return connection.conStatus != 'offline'
fontSize: 5.5 * _deviceBlockSize, ? ListView(
fontWeight: FontWeight.w700, padding: EdgeInsets.symmetric(horizontal: 20),
letterSpacing: 3, children: <Widget>[
), Container(
padding: EdgeInsets.only(top: 30),
child: Text(
'Looking for a Label?',
textAlign: TextAlign.left,
style: TextStyle(
color: Colors.black,
fontSize: 5.5 * _deviceBlockSize,
fontWeight: FontWeight.w700,
letterSpacing: 3,
), ),
), ),
LabelScanBox(), ),
SizedBox( LabelScanBox(),
height: 10, SizedBox(
), height: 10,
Form( ),
key: _form, Form(
child: LabelScanInputBox( key: _form,
idCTRL: idCTRL, child: LabelScanInputBox(
deviceBlockSize: _deviceBlockSize,
),
),
SizedBox(
height: 70,
),
FilterScanSaveButton(
form: _form,
idCTRL: idCTRL, idCTRL: idCTRL,
deviceBlockSize: _deviceBlockSize, deviceBlockSize: _deviceBlockSize,
), ),
], ),
) SizedBox(
: ConnectionErrorBox(); height: 70,
}, ),
), FilterScanSaveButton(
form: _form,
idCTRL: idCTRL,
deviceBlockSize: _deviceBlockSize,
),
],
)
: ConnectionErrorBox();
},
), ),
), ),
), ),
@@ -52,58 +52,51 @@ class _MyItemsDetailScreenState extends State<MyItemsDetailScreen> {
final _media = MediaQuery.of(context); final _media = MediaQuery.of(context);
final double _devicewidth = _media.size.width; final double _devicewidth = _media.size.width;
final double _deviceBlockSize = _devicewidth / 100; final double _deviceBlockSize = _devicewidth / 100;
return PopScope( return SafeArea(
canPop: false, child: Scaffold(
onPopInvoked: (didPop) { appBar: AppBar(
if (didPop) return; titleSpacing: -10,
Navigator.of(context).pushNamed(Routes.homePage); title: Text(
}, 'My Items',
child: SafeArea( style: TextStyle(
child: Scaffold( color: Colors.white,
appBar: AppBar(
titleSpacing: -10,
title: Text(
'My Items',
style: TextStyle(
color: Colors.white,
),
),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
), ),
), ),
body: Consumer<ConnectivityProvider>( backgroundColor: Colors.black,
builder: (ct, connection, _) { leading: IconButton(
return connection.conStatus != 'offline' icon: Icon(
? isInit Icons.keyboard_arrow_left,
? Center( color: Colors.white,
child: CircularProgressIndicator( size: 35,
color: Colors.black, ),
), onPressed: () => Navigator.of(context).pop(),
)
: isEmpty
? Center(
child: Text('This Item does\'nt exists!'),
)
: MyItemsDetailsDataBox(
datas: datas!,
deviceBlockSize: _deviceBlockSize,
push: () {
Navigator.pushNamed(
context, Routes.itemsTransferScreen,
arguments: datas);
},
)
: ConnectionErrorBox();
},
), ),
), ),
body: Consumer<ConnectivityProvider>(
builder: (ct, connection, _) {
return connection.conStatus != 'offline'
? isInit
? Center(
child: CircularProgressIndicator(
color: Colors.black,
),
)
: isEmpty
? Center(
child: Text('This Item does\'nt exists!'),
)
: MyItemsDetailsDataBox(
datas: datas!,
deviceBlockSize: _deviceBlockSize,
push: () {
Navigator.pushNamed(
context, Routes.itemsTransferScreen,
arguments: datas);
},
)
: ConnectionErrorBox();
},
),
), ),
); );
} }
+301 -313
View File
@@ -53,323 +53,311 @@ class _MyItemsFilterScreenState extends State<MyItemsFilterScreen> {
final _media = MediaQuery.of(context); final _media = MediaQuery.of(context);
final double _devicewidth = _media.size.width; final double _devicewidth = _media.size.width;
final double _deviceBlockSize = _devicewidth / 100; final double _deviceBlockSize = _devicewidth / 100;
return PopScope( return SafeArea(
canPop: false, child: GestureDetector(
onPopInvoked: (didPop) { onTap: () {
if (didPop) return; FocusManager.instance.primaryFocus?.unfocus();
Navigator.of(context).pushNamed(Routes.homePage); },
// Navigator.pushReplacementNamed( child: Scaffold(
// context, appBar: AppBar(
// Routes.myItemsResultScreen, titleSpacing: -10,
// ); title: Text(
// return true; 'My Items',
}, style: TextStyle(
child: SafeArea( color: Colors.white,
child: GestureDetector(
onTap: () {
FocusManager.instance.primaryFocus?.unfocus();
},
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text(
'My Items',
style: TextStyle(
color: Colors.white,
),
),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context)
.pushReplacementNamed(Routes.myItemsResultScreen),
), ),
), ),
body: Consumer<ConnectivityProvider>( backgroundColor: Colors.black,
builder: (ct, connection, _) { leading: IconButton(
return connection.conStatus != 'offline' icon: Icon(
? isInit Icons.keyboard_arrow_left,
? Center( color: Colors.white,
child: CircularProgressIndicator( size: 35,
color: Colors.black, ),
), onPressed: () => Navigator.of(context)
) .pushReplacementNamed(Routes.myItemsResultScreen),
: Padding(
padding: EdgeInsets.all(20),
child: ListView(
children: <Widget>[
Text(
'Filter My Items',
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
),
SizedBox(
height: 20,
),
Row(
children: [
Flexible(
flex: 8,
child: TextFormField(
controller: idCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Item ID',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2,
horizontal: 3,
),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
keyboardType: TextInputType.number,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(_itemNameFocusNode);
},
),
),
// Spacer(),
Flexible(
flex: 1,
child: InkWell(
onTap: () {
scan().then(
(String result) {
if (result == 'cancel') {
print('cancel');
} else if (result == 'error') {
print('error');
} else if (result == 'access') {
print('access');
} else {
print(result);
idCTRL.text = result;
}
},
);
},
child: Container(
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black,
),
child: Icon(
Icons.qr_code_scanner,
size: 5 * _deviceBlockSize,
color: Colors.white,
),
),
),
),
],
),
SizedBox(
height: 30,
),
TextFormField(
controller: nameCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.alignLeft,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Item Name',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
focusNode: _itemNameFocusNode,
keyboardType: TextInputType.text,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(_itemUdiFocusNode);
},
),
SizedBox(
height: 30,
),
Row(
children: [
Flexible(
flex: 8,
child: TextFormField(
controller: udiCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.alignLeft,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'UDI',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2,
horizontal: 3,
),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
focusNode: _itemUdiFocusNode,
keyboardType: TextInputType.text,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(_itemSizeFocusNode);
},
),
),
Flexible(
flex: 1,
child: InkWell(
onTap: () {
scan().then(
(String result) {
if (result == 'cancel') {
print('cancel');
} else if (result == 'error') {
print('error');
} else if (result == 'access') {
print('access');
} else {
print(result);
idCTRL.text = result;
}
},
);
},
child: Container(
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black,
),
child: Icon(
Icons.qr_code_scanner,
size: 5 * _deviceBlockSize,
color: Colors.white,
),
),
),
),
],
),
SizedBox(
height: 30.0,
),
TextFormField(
controller: sizeCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Size',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
focusNode: _itemSizeFocusNode,
keyboardType: TextInputType.number,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(_itemSpecificFocusNode);
},
),
SizedBox(
height: 30,
),
TextFormField(
controller: specificCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.alignLeft,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Specific',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2,
horizontal: 3,
),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
focusNode: _itemSpecificFocusNode,
keyboardType: TextInputType.visiblePassword,
textInputAction: TextInputAction.next,
),
SizedBox(
height: 90,
),
MyItemFilterSaveButton(
idCTRL: idCTRL,
nameCTRL: nameCTRL,
udiCTRL: udiCTRL,
sizeCTRL: sizeCTRL,
specificCTRL: specificCTRL,
deviceBlockSize: _deviceBlockSize,
firstColor: kDarkBlue,
secondColor: kDarkBlueSub,
push: Routes.myItemsResultScreen,
),
SizedBox(
height: 100,
),
],
),
)
: ConnectionErrorBox();
},
), ),
), ),
body: Consumer<ConnectivityProvider>(
builder: (ct, connection, _) {
return connection.conStatus != 'offline'
? isInit
? Center(
child: CircularProgressIndicator(
color: Colors.black,
),
)
: Padding(
padding: EdgeInsets.all(20),
child: ListView(
children: <Widget>[
Text(
'Filter My Items',
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
),
SizedBox(
height: 20,
),
Row(
children: [
Flexible(
flex: 8,
child: TextFormField(
controller: idCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Item ID',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2,
horizontal: 3,
),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
keyboardType: TextInputType.number,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(_itemNameFocusNode);
},
),
),
// Spacer(),
Flexible(
flex: 1,
child: InkWell(
onTap: () {
scan().then(
(String result) {
if (result == 'cancel') {
print('cancel');
} else if (result == 'error') {
print('error');
} else if (result == 'access') {
print('access');
} else {
print(result);
idCTRL.text = result;
}
},
);
},
child: Container(
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black,
),
child: Icon(
Icons.qr_code_scanner,
size: 5 * _deviceBlockSize,
color: Colors.white,
),
),
),
),
],
),
SizedBox(
height: 30,
),
TextFormField(
controller: nameCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.alignLeft,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Item Name',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
focusNode: _itemNameFocusNode,
keyboardType: TextInputType.text,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(_itemUdiFocusNode);
},
),
SizedBox(
height: 30,
),
Row(
children: [
Flexible(
flex: 8,
child: TextFormField(
controller: udiCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.alignLeft,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'UDI',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2,
horizontal: 3,
),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
focusNode: _itemUdiFocusNode,
keyboardType: TextInputType.text,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(_itemSizeFocusNode);
},
),
),
Flexible(
flex: 1,
child: InkWell(
onTap: () {
scan().then(
(String result) {
if (result == 'cancel') {
print('cancel');
} else if (result == 'error') {
print('error');
} else if (result == 'access') {
print('access');
} else {
print(result);
idCTRL.text = result;
}
},
);
},
child: Container(
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black,
),
child: Icon(
Icons.qr_code_scanner,
size: 5 * _deviceBlockSize,
color: Colors.white,
),
),
),
),
],
),
SizedBox(
height: 30.0,
),
TextFormField(
controller: sizeCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Size',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
focusNode: _itemSizeFocusNode,
keyboardType: TextInputType.number,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(_itemSpecificFocusNode);
},
),
SizedBox(
height: 30,
),
TextFormField(
controller: specificCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.alignLeft,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Specific',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2,
horizontal: 3,
),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
focusNode: _itemSpecificFocusNode,
keyboardType: TextInputType.visiblePassword,
textInputAction: TextInputAction.next,
),
SizedBox(
height: 90,
),
MyItemFilterSaveButton(
idCTRL: idCTRL,
nameCTRL: nameCTRL,
udiCTRL: udiCTRL,
sizeCTRL: sizeCTRL,
specificCTRL: specificCTRL,
deviceBlockSize: _deviceBlockSize,
firstColor: kDarkBlue,
secondColor: kDarkBlueSub,
push: Routes.myItemsResultScreen,
),
SizedBox(
height: 100,
),
],
),
)
: ConnectionErrorBox();
},
),
), ),
), ),
); );
+150 -157
View File
@@ -26,181 +26,174 @@ class _MyItemsScanScreenState extends State<MyItemsScanScreen> {
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5); // final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
final double _deviceWidth = _media.size.width; final double _deviceWidth = _media.size.width;
final double _deviceBlockSize = _deviceWidth / 100; final double _deviceBlockSize = _deviceWidth / 100;
return PopScope( return SafeArea(
canPop: false, child: GestureDetector(
onPopInvoked: (didPop) { onTap: () {
if (didPop) return; FocusManager.instance.primaryFocus?.unfocus();
Navigator.of(context).pushNamed(Routes.homePage); },
}, child: Scaffold(
child: SafeArea( appBar: AppBar(
child: GestureDetector( titleSpacing: -10,
onTap: () { title: Text(
FocusManager.instance.primaryFocus?.unfocus(); 'My Items',
}, style: TextStyle(
child: Scaffold( color: Colors.white,
appBar: AppBar(
titleSpacing: -10,
title: Text(
'My Items',
style: TextStyle(
color: Colors.white,
),
),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
), ),
), ),
body: Consumer<ConnectivityProvider>( backgroundColor: Colors.black,
builder: (ct, connection, _) { leading: IconButton(
return connection.conStatus != 'offline' icon: Icon(
? ListView( Icons.keyboard_arrow_left,
padding: EdgeInsets.symmetric(horizontal: 20), color: Colors.white,
children: <Widget>[ size: 35,
Container( ),
padding: EdgeInsets.only(top: 30), onPressed: () => Navigator.of(context).pop(),
child: Text( ),
'Looking for an Item?', ),
textAlign: TextAlign.left, body: Consumer<ConnectivityProvider>(
style: TextStyle( builder: (ct, connection, _) {
color: Colors.black, return connection.conStatus != 'offline'
fontSize: 5.5 * _deviceBlockSize, ? ListView(
fontWeight: FontWeight.w700, padding: EdgeInsets.symmetric(horizontal: 20),
letterSpacing: 3, children: <Widget>[
), Container(
padding: EdgeInsets.only(top: 30),
child: Text(
'Looking for an Item?',
textAlign: TextAlign.left,
style: TextStyle(
color: Colors.black,
fontSize: 5.5 * _deviceBlockSize,
fontWeight: FontWeight.w700,
letterSpacing: 3,
), ),
), ),
GestureDetector( ),
child: Container( GestureDetector(
margin: EdgeInsets.symmetric(vertical: 10), child: Container(
height: 200, margin: EdgeInsets.symmetric(vertical: 10),
decoration: BoxDecoration(border: Border.all()), height: 200,
child: Center( decoration: BoxDecoration(border: Border.all()),
child: Text( child: Center(
'Please Scan The Item Barcode', child: Text(
style: TextStyle( 'Please Scan The Item Barcode',
color: Colors.black, style: TextStyle(
fontSize: 5 * _deviceBlockSize, color: Colors.black,
fontWeight: FontWeight.w100, fontSize: 5 * _deviceBlockSize,
letterSpacing: 3,
),
textAlign: TextAlign.center,
),
),
),
onTap: () {
scan().then(
(String result) {
if (result == 'cancel') {
print('cancel');
} else if (result == 'error') {
print('error');
} else if (result == 'access') {
print('access');
} else {
launch(
'https://cssd-doc.com/Show/Item/$result',
);
// Navigator.of(context).pushNamed(
// Routes.cycleDetailScreen,
// arguments: result,
// );
}
},
);
},
),
SizedBox(
height: 10.0,
),
Form(
key: _form,
child: TextFormField(
validator: (val) {
if (val!.isEmpty) {
return 'Id required!!';
}
return null;
},
controller: idCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100, fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize, letterSpacing: 3,
),
isDense: true,
labelText: 'Or enter an Item ID',
contentPadding: EdgeInsets.symmetric(
vertical: 2,
horizontal: 3,
),
focusedBorder: UnderlineInputBorder(
// borderRadius: BorderRadius.only(Radius.circular(4)),
borderSide: BorderSide(
color: Colors.grey,
),
), ),
textAlign: TextAlign.center,
), ),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
keyboardType: TextInputType.number,
), ),
), ),
SizedBox( onTap: () {
height: 70, scan().then(
), (String result) {
InkWell( if (result == 'cancel') {
onTap: () { print('cancel');
if (!_form.currentState!.validate()) { } else if (result == 'error') {
return; print('error');
} else if (result == 'access') {
print('access');
} else {
launch(
'https://cssd-doc.com/Show/Item/$result',
);
// Navigator.of(context).pushNamed(
// Routes.cycleDetailScreen,
// arguments: result,
// );
}
},
);
},
),
SizedBox(
height: 10.0,
),
Form(
key: _form,
child: TextFormField(
validator: (val) {
if (val!.isEmpty) {
return 'Id required!!';
} }
launch( return null;
'https://cssd-doc.com/Show/Item/${idCTRL.text}',
);
// Navigator.of(context).pushNamed(
// Routes.cycleDetailScreen,
// arguments: idCTRL.text,
// );
}, },
child: Container( controller: idCTRL,
padding: EdgeInsets.symmetric( decoration: InputDecoration(
horizontal: 5 * _deviceBlockSize, icon: Icon(
vertical: 10, FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
), ),
decoration: BoxDecoration( labelStyle: TextStyle(
gradient: LinearGradient( fontWeight: FontWeight.w100,
colors: [kDarkBlue, kDarkBlueSub], fontSize: 4 * _deviceBlockSize,
),
isDense: true,
labelText: 'Or enter an Item ID',
contentPadding: EdgeInsets.symmetric(
vertical: 2,
horizontal: 3,
),
focusedBorder: UnderlineInputBorder(
// borderRadius: BorderRadius.only(Radius.circular(4)),
borderSide: BorderSide(
color: Colors.grey,
), ),
borderRadius: BorderRadius.circular(7),
), ),
child: Align( ),
alignment: Alignment.center, style: TextStyle(
child: Text( fontWeight: FontWeight.w700,
'Search', fontSize: 5 * _deviceBlockSize,
style: TextStyle( ),
color: Colors.white, keyboardType: TextInputType.number,
fontSize: 5 * _deviceBlockSize, ),
), ),
SizedBox(
height: 70,
),
InkWell(
onTap: () {
if (!_form.currentState!.validate()) {
return;
}
launch(
'https://cssd-doc.com/Show/Item/${idCTRL.text}',
);
// Navigator.of(context).pushNamed(
// Routes.cycleDetailScreen,
// arguments: idCTRL.text,
// );
},
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 5 * _deviceBlockSize,
vertical: 10,
),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [kDarkBlue, kDarkBlueSub],
),
borderRadius: BorderRadius.circular(7),
),
child: Align(
alignment: Alignment.center,
child: Text(
'Search',
style: TextStyle(
color: Colors.white,
fontSize: 5 * _deviceBlockSize,
), ),
), ),
), ),
), ),
], ),
) ],
: ConnectionErrorBox(); )
}, : ConnectionErrorBox();
), },
), ),
), ),
), ),
@@ -79,250 +79,240 @@ class _ItemsTransferScreenState extends State<ItemsTransferScreen> {
final _media = MediaQuery.of(context); final _media = MediaQuery.of(context);
final double _deviceWidth = _media.size.width; final double _deviceWidth = _media.size.width;
final double _deviceBlockSize = _deviceWidth / 100; final double _deviceBlockSize = _deviceWidth / 100;
return PopScope( return SafeArea(
canPop: false, child: GestureDetector(
onPopInvoked: (didPop) { onTap: () {
if (didPop) return; FocusManager.instance.primaryFocus?.unfocus();
Navigator.of(context).pushNamed(Routes.homePage); },
}, child: Scaffold(
child: SafeArea( appBar: AppBar(
child: GestureDetector( titleSpacing: -10,
onTap: () { title: Text(
FocusManager.instance.primaryFocus?.unfocus(); 'Item Details',
}, style: TextStyle(
child: Scaffold( color: Colors.white,
appBar: AppBar(
titleSpacing: -10,
title: Text(
'Item Details',
style: TextStyle(
color: Colors.white,
),
),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
), ),
), ),
body: Consumer<ConnectivityProvider>( backgroundColor: Colors.black,
builder: (ct, connection, _) { leading: IconButton(
return connection.conStatus != 'offline' icon: Icon(
? Padding( Icons.keyboard_arrow_left,
padding: EdgeInsets.only( color: Colors.white,
top: 20, size: 35,
right: 20, ),
bottom: 40, onPressed: () => Navigator.of(context).pop(),
left: 20, ),
), ),
child: Column( body: Consumer<ConnectivityProvider>(
crossAxisAlignment: CrossAxisAlignment.start, builder: (ct, connection, _) {
children: <Widget>[ return connection.conStatus != 'offline'
ResultBanner( ? Padding(
deviceBlockSize: _deviceBlockSize, padding: EdgeInsets.only(
text: 'Transfer to', top: 20,
hasFilterObject: false, right: 20,
push: Routes.myItemsFilterScreen, bottom: 40,
), left: 20,
SizedBox( ),
height: 20.0, child: Column(
), crossAxisAlignment: CrossAxisAlignment.start,
ResultSearchBox( children: <Widget>[
searchCTRL: searchCTRL, ResultBanner(
text: 'user', deviceBlockSize: _deviceBlockSize,
text2: 'name or ID', text: 'Transfer to',
deviceBlockSize: _deviceBlockSize, hasFilterObject: false,
textInputType: TextInputType.visiblePassword, push: Routes.myItemsFilterScreen,
onChanged: (value) { ),
Provider.of<UsersProvider>(context, SizedBox(
listen: false) height: 20.0,
.searchUsers(value); ),
}, ResultSearchBox(
), searchCTRL: searchCTRL,
SizedBox( text: 'user',
height: 20, text2: 'name or ID',
), deviceBlockSize: _deviceBlockSize,
Expanded( textInputType: TextInputType.visiblePassword,
child: Consumer<UsersProvider>( onChanged: (value) {
builder: (context, userResults, _) { Provider.of<UsersProvider>(context, listen: false)
return userResults.isLoading .searchUsers(value);
? Center( },
child: CircularProgressIndicator( ),
color: Colors.black, SizedBox(
), height: 20,
) ),
: userResults.usersBox?.length != null Expanded(
? ListView.builder( child: Consumer<UsersProvider>(
controller: sc, builder: (context, userResults, _) {
itemBuilder: (context, index) { return userResults.isLoading
return TransferDataBox( ? Center(
deviceBlockSize: child: CircularProgressIndicator(
_deviceBlockSize, color: Colors.black,
user: userResults
.usersBox?[index],
clickColor: kDarkBlue,
isClicked: userResults
.selectedUserIndex ==
index,
onTap: (userId) {
Provider.of<UsersProvider>(
context,
listen: false,
).selectUser(index);
print(userId);
Provider.of<UsersProvider>(
context,
listen: false)
.saveUserId = userId;
Provider.of<UsersProvider>(
context,
listen: false)
.selectedUserForItems =
userResults
.usersBox?[index];
},
);
},
itemCount:
userResults.usersBox?.length,
shrinkWrap: true,
)
: Container(
child: Center(
child: Text(
"There is no user to show."),
),
);
},
),
),
TransferDestroyButton(
deviceBlockSize: _deviceBlockSize,
firstColor: kDarkBlue,
secondColor: kDarkBlueSub,
onTap: () {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
title: Text(
'Are you sure to transfer this Item?',
style: TextStyle(
fontSize: 4 * _deviceBlockSize,
), ),
), )
content: SizedBox( : userResults.usersBox?.length != null
width: _deviceBlockSize, ? ListView.builder(
height: 320, controller: sc,
child: Column( itemBuilder: (context, index) {
children: [ return TransferDataBox(
Text( deviceBlockSize:
'By approving, your item will be transferred the specified user. It can be undone unless the user reject the transfer.', _deviceBlockSize,
style: TextStyle( user: userResults
fontSize: 3 * _deviceBlockSize, .usersBox?[index],
), clickColor: kDarkBlue,
), isClicked: userResults
SizedBox( .selectedUserIndex ==
height: 10.0, index,
), onTap: (userId) {
ItemCard( Provider.of<UsersProvider>(
_deviceBlockSize, itemData!), context,
SizedBox( listen: false,
height: 5.0, ).selectUser(index);
), print(userId);
Row( Provider.of<UsersProvider>(
children: [ context,
Spacer(), listen: false)
Text('To'), .saveUserId = userId;
SizedBox( Provider.of<UsersProvider>(
width: 5.0,
),
TransferDataBox(
deviceBlockSize:
_deviceBlockSize,
user: Provider.of<
UsersProvider>(
context)
.selectedUserForItems,
)
],
),
SizedBox(
height: 20.0,
),
Consumer<MyItemProvider>(
builder:
(context, myItemProvider, _) {
return TransferDestroyButton(
deviceBlockSize:
_deviceBlockSize,
firstColor: kDarkBlue,
secondColor: kDarkBlueSub,
onTap: () async {
myItemProvider
.setLoadingButton();
await Provider.of<
MyItemProvider>(
context,
listen: false,
).transferItems(
itemData!.id,
await Provider.of<
UsersProvider>(
context, context,
listen: false) listen: false)
.saveUserId!, .selectedUserForItems =
); userResults
Navigator.of(context).pop(); .usersBox?[index];
Navigator.of(context).pop(); },
Navigator.of(context).pop(); );
myItemProvider },
.resetLoadingButton(); itemCount:
Fluttertoast.showToast( userResults.usersBox?.length,
msg: shrinkWrap: true,
"The item is transferred.", )
toastLength: : Container(
Toast.LENGTH_SHORT, child: Center(
gravity: child: Text(
ToastGravity.BOTTOM, "There is no user to show."),
);
},
text: 'Transfer',
isLoadingButton:
myItemProvider
.isloadingButton,
);
},
), ),
SizedBox( );
height: 5.0,
),
CancelTransferButton(
deviceBlockSize: _deviceBlockSize,
color: kPink,
onTap: () {
Navigator.pop(context);
},
),
],
),
),
);
},
);
}, },
text: 'Transfer',
), ),
], ),
), TransferDestroyButton(
) deviceBlockSize: _deviceBlockSize,
: ConnectionErrorBox(); firstColor: kDarkBlue,
}, secondColor: kDarkBlueSub,
), onTap: () {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
title: Text(
'Are you sure to transfer this Item?',
style: TextStyle(
fontSize: 4 * _deviceBlockSize,
),
),
content: SizedBox(
width: _deviceBlockSize,
height: 320,
child: Column(
children: [
Text(
'By approving, your item will be transferred the specified user. It can be undone unless the user reject the transfer.',
style: TextStyle(
fontSize: 3 * _deviceBlockSize,
),
),
SizedBox(
height: 10.0,
),
ItemCard(_deviceBlockSize, itemData!),
SizedBox(
height: 5.0,
),
Row(
children: [
Spacer(),
Text('To'),
SizedBox(
width: 5.0,
),
TransferDataBox(
deviceBlockSize:
_deviceBlockSize,
user:
Provider.of<UsersProvider>(
context)
.selectedUserForItems,
)
],
),
SizedBox(
height: 20.0,
),
Consumer<MyItemProvider>(
builder:
(context, myItemProvider, _) {
return TransferDestroyButton(
deviceBlockSize:
_deviceBlockSize,
firstColor: kDarkBlue,
secondColor: kDarkBlueSub,
onTap: () async {
myItemProvider
.setLoadingButton();
await Provider.of<
MyItemProvider>(
context,
listen: false,
).transferItems(
itemData!.id,
await Provider.of<
UsersProvider>(
context,
listen: false)
.saveUserId!,
);
Navigator.of(context).pop();
Navigator.of(context).pop();
Navigator.of(context).pop();
myItemProvider
.resetLoadingButton();
Fluttertoast.showToast(
msg:
"The item is transferred.",
toastLength:
Toast.LENGTH_SHORT,
gravity:
ToastGravity.BOTTOM,
);
},
text: 'Transfer',
isLoadingButton: myItemProvider
.isloadingButton,
);
},
),
SizedBox(
height: 5.0,
),
CancelTransferButton(
deviceBlockSize: _deviceBlockSize,
color: kPink,
onTap: () {
Navigator.pop(context);
},
),
],
),
),
);
},
);
},
text: 'Transfer',
),
],
),
)
: ConnectionErrorBox();
},
), ),
), ),
), ),
@@ -52,58 +52,51 @@ class _MyPackagesDetailScreenState extends State<MyPackagesDetailScreen> {
final _media = MediaQuery.of(context); final _media = MediaQuery.of(context);
final double _deviceWidth = _media.size.width; final double _deviceWidth = _media.size.width;
final double _deviceBlockSize = _deviceWidth / 100; final double _deviceBlockSize = _deviceWidth / 100;
return PopScope( return SafeArea(
canPop: false, child: Scaffold(
onPopInvoked: (didPop) { appBar: AppBar(
if (didPop) return; titleSpacing: -10,
Navigator.of(context).pushNamed(Routes.homePage); title: Text(
}, 'My Packages',
child: SafeArea( style: TextStyle(
child: Scaffold( color: Colors.white,
appBar: AppBar(
titleSpacing: -10,
title: Text(
'My Packages',
style: TextStyle(
color: Colors.white,
),
),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
), ),
), ),
body: Consumer<ConnectivityProvider>( backgroundColor: Colors.black,
builder: (ct, connection, _) { leading: IconButton(
return connection.conStatus != 'offline' icon: Icon(
? isInit Icons.keyboard_arrow_left,
? Center( color: Colors.white,
child: CircularProgressIndicator( size: 35,
color: Colors.black, ),
), onPressed: () => Navigator.of(context).pop(),
)
: isEmpty
? Center(
child: Text('This Package does\'nt exists!'),
)
: MyPackageDetailsDataBox(
datas: datas!,
deviceBlockSize: _deviceBlockSize,
push: () {
Navigator.pushNamed(
context, Routes.packagesTransferScreen,
arguments: datas);
},
)
: ConnectionErrorBox();
},
), ),
), ),
body: Consumer<ConnectivityProvider>(
builder: (ct, connection, _) {
return connection.conStatus != 'offline'
? isInit
? Center(
child: CircularProgressIndicator(
color: Colors.black,
),
)
: isEmpty
? Center(
child: Text('This Package does\'nt exists!'),
)
: MyPackageDetailsDataBox(
datas: datas!,
deviceBlockSize: _deviceBlockSize,
push: () {
Navigator.pushNamed(
context, Routes.packagesTransferScreen,
arguments: datas);
},
)
: ConnectionErrorBox();
},
),
), ),
); );
} }
@@ -51,260 +51,248 @@ class _MyPackageFilterScreenState extends State<MyPackageFilterScreen> {
final _media = MediaQuery.of(context); final _media = MediaQuery.of(context);
final double _devicewidth = _media.size.width; final double _devicewidth = _media.size.width;
final double _deviceBlockSize = _devicewidth / 100; final double _deviceBlockSize = _devicewidth / 100;
return PopScope( return SafeArea(
canPop: false, child: GestureDetector(
onPopInvoked: (didPop) { onTap: () {
if (didPop) return; FocusManager.instance.primaryFocus?.unfocus();
Navigator.of(context).pushNamed(Routes.homePage); },
// Navigator.pushReplacementNamed( child: Scaffold(
// context, appBar: AppBar(
// Routes.myPackagesResultScreen, titleSpacing: -10,
// ); title: Text(
// return true; 'My Packages',
}, style: TextStyle(
child: SafeArea( color: Colors.white,
child: GestureDetector(
onTap: () {
FocusManager.instance.primaryFocus?.unfocus();
},
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text(
'My Packages',
style: TextStyle(
color: Colors.white,
),
),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context)
.pushReplacementNamed(Routes.myPackagesResultScreen),
), ),
), ),
body: Consumer<ConnectivityProvider>( backgroundColor: Colors.black,
builder: (ct, connection, _) { leading: IconButton(
return connection.conStatus != 'offline' icon: Icon(
? isInit Icons.keyboard_arrow_left,
? Center( color: Colors.white,
child: CircularProgressIndicator( size: 35,
color: Colors.black, ),
), onPressed: () => Navigator.of(context)
) .pushReplacementNamed(Routes.myPackagesResultScreen),
: Padding(
padding: EdgeInsets.all(20),
child: ListView(
// crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
'Filter My Packages',
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
),
SizedBox(
height: 20,
),
Row(
children: [
Flexible(
flex: 8,
child: TextFormField(
controller: idCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Package ID',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2,
horizontal: 3,
),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
keyboardType: TextInputType.number,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(_nameFocusNode);
},
),
),
// Spacer(),
Flexible(
flex: 1,
child: InkWell(
onTap: () {
scan().then(
(String result) {
if (result == 'cancel') {
print('cancel');
} else if (result == 'error') {
print('error');
} else if (result == 'access') {
print('access');
} else {
print(result);
idCTRL.text = result;
}
},
);
},
child: Container(
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black,
),
child: Icon(
Icons.qr_code_scanner,
size: 5 * _deviceBlockSize,
color: Colors.white,
),
),
),
)
],
),
SizedBox(
height: 30,
),
TextFormField(
controller: nameCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.alignLeft,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Package Name',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2,
horizontal: 3,
),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
focusNode: _nameFocusNode,
keyboardType: TextInputType.text,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(_udiFocusNode);
},
),
// SizedBox(
// height: 30,
// ),
// Row(
// children: [
// Flexible(
// flex: 8,
// child: TextFormField(
// controller: udiCTRL,
// decoration: InputDecoration(
// icon: Icon(
// FontAwesomeIcons.alignLeft,
// size: 6 * _deviceBlockSize,
// ),
// labelStyle: TextStyle(
// fontWeight: FontWeight.w100,
// fontSize: 4 * _deviceBlockSize,
// ),
// labelText: 'UDI',
// isDense: true,
// contentPadding: EdgeInsets.symmetric(
// vertical: 2,
// horizontal: 3,
// ),
// ),
// style: TextStyle(
// fontWeight: FontWeight.w700,
// fontSize: 5 * _deviceBlockSize,
// ),
// focusNode: _udiFocusNode,
// keyboardType: TextInputType.text,
// textInputAction: TextInputAction.next,
// ),
// ),
// Flexible(
// flex: 1,
// child: InkWell(
// onTap: () {
// scan().then(
// (String result) {
// if (result == 'cancel') {
// print('cancel');
// } else if (result == 'error') {
// print('error');
// } else if (result == 'access') {
// print('access');
// } else {
// print(result);
// idCTRL.text = result;
// }
// },
// );
// },
// child: Container(
// padding: EdgeInsets.all(8),
// decoration: BoxDecoration(
// shape: BoxShape.circle,
// color: Colors.black,
// ),
// child: Icon(
// Icons.qr_code_scanner,
// size: 5 * _deviceBlockSize,
// color: Colors.white,
// ),
// ),
// ),
// )
// ],
// ),
SizedBox(
height: 90,
),
MyPackagesFilterSaveButton(
idCTRL: idCTRL,
nameCTRL: nameCTRL,
// udiCTRL: udiCTRL,
deviceBlockSize: _deviceBlockSize,
firstColor: kDarkPurple,
secondColor: kDarkPurpleSub,
push: Routes.myPackagesResultScreen,
),
SizedBox(
height: 100,
),
],
),
)
: ConnectionErrorBox();
},
), ),
), ),
body: Consumer<ConnectivityProvider>(
builder: (ct, connection, _) {
return connection.conStatus != 'offline'
? isInit
? Center(
child: CircularProgressIndicator(
color: Colors.black,
),
)
: Padding(
padding: EdgeInsets.all(20),
child: ListView(
// crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
'Filter My Packages',
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
),
SizedBox(
height: 20,
),
Row(
children: [
Flexible(
flex: 8,
child: TextFormField(
controller: idCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Package ID',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2,
horizontal: 3,
),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
keyboardType: TextInputType.number,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(_nameFocusNode);
},
),
),
// Spacer(),
Flexible(
flex: 1,
child: InkWell(
onTap: () {
scan().then(
(String result) {
if (result == 'cancel') {
print('cancel');
} else if (result == 'error') {
print('error');
} else if (result == 'access') {
print('access');
} else {
print(result);
idCTRL.text = result;
}
},
);
},
child: Container(
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black,
),
child: Icon(
Icons.qr_code_scanner,
size: 5 * _deviceBlockSize,
color: Colors.white,
),
),
),
)
],
),
SizedBox(
height: 30,
),
TextFormField(
controller: nameCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.alignLeft,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Package Name',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2,
horizontal: 3,
),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
focusNode: _nameFocusNode,
keyboardType: TextInputType.text,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(_udiFocusNode);
},
),
// SizedBox(
// height: 30,
// ),
// Row(
// children: [
// Flexible(
// flex: 8,
// child: TextFormField(
// controller: udiCTRL,
// decoration: InputDecoration(
// icon: Icon(
// FontAwesomeIcons.alignLeft,
// size: 6 * _deviceBlockSize,
// ),
// labelStyle: TextStyle(
// fontWeight: FontWeight.w100,
// fontSize: 4 * _deviceBlockSize,
// ),
// labelText: 'UDI',
// isDense: true,
// contentPadding: EdgeInsets.symmetric(
// vertical: 2,
// horizontal: 3,
// ),
// ),
// style: TextStyle(
// fontWeight: FontWeight.w700,
// fontSize: 5 * _deviceBlockSize,
// ),
// focusNode: _udiFocusNode,
// keyboardType: TextInputType.text,
// textInputAction: TextInputAction.next,
// ),
// ),
// Flexible(
// flex: 1,
// child: InkWell(
// onTap: () {
// scan().then(
// (String result) {
// if (result == 'cancel') {
// print('cancel');
// } else if (result == 'error') {
// print('error');
// } else if (result == 'access') {
// print('access');
// } else {
// print(result);
// idCTRL.text = result;
// }
// },
// );
// },
// child: Container(
// padding: EdgeInsets.all(8),
// decoration: BoxDecoration(
// shape: BoxShape.circle,
// color: Colors.black,
// ),
// child: Icon(
// Icons.qr_code_scanner,
// size: 5 * _deviceBlockSize,
// color: Colors.white,
// ),
// ),
// ),
// )
// ],
// ),
SizedBox(
height: 90,
),
MyPackagesFilterSaveButton(
idCTRL: idCTRL,
nameCTRL: nameCTRL,
// udiCTRL: udiCTRL,
deviceBlockSize: _deviceBlockSize,
firstColor: kDarkPurple,
secondColor: kDarkPurpleSub,
push: Routes.myPackagesResultScreen,
),
SizedBox(
height: 100,
),
],
),
)
: ConnectionErrorBox();
},
),
), ),
), ),
); );
@@ -26,181 +26,174 @@ class _MyPackagesScanScreenState extends State<MyPackagesScanScreen> {
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5); // final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
final double _deviceWidth = _media.size.width; final double _deviceWidth = _media.size.width;
final double _deviceBlockSize = _deviceWidth / 100; final double _deviceBlockSize = _deviceWidth / 100;
return PopScope( return SafeArea(
canPop: false, child: GestureDetector(
onPopInvoked: (didPop) { onTap: () {
if (didPop) return; FocusManager.instance.primaryFocus?.unfocus();
Navigator.of(context).pushNamed(Routes.homePage); },
}, child: Scaffold(
child: SafeArea( appBar: AppBar(
child: GestureDetector( titleSpacing: -10,
onTap: () { title: Text(
FocusManager.instance.primaryFocus?.unfocus(); 'My Packages',
}, style: TextStyle(
child: Scaffold( color: Colors.white,
appBar: AppBar(
titleSpacing: -10,
title: Text(
'My Packages',
style: TextStyle(
color: Colors.white,
),
),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
), ),
), ),
body: Consumer<ConnectivityProvider>( backgroundColor: Colors.black,
builder: (ct, connection, _) { leading: IconButton(
return connection.conStatus != 'offline' icon: Icon(
? ListView( Icons.keyboard_arrow_left,
padding: EdgeInsets.symmetric(horizontal: 20), color: Colors.white,
children: <Widget>[ size: 35,
Container( ),
padding: EdgeInsets.only(top: 30), onPressed: () => Navigator.of(context).pop(),
child: Text( ),
'Looking for a Package?', ),
textAlign: TextAlign.left, body: Consumer<ConnectivityProvider>(
style: TextStyle( builder: (ct, connection, _) {
color: Colors.black, return connection.conStatus != 'offline'
fontSize: 5.5 * _deviceBlockSize, ? ListView(
fontWeight: FontWeight.w700, padding: EdgeInsets.symmetric(horizontal: 20),
letterSpacing: 3, children: <Widget>[
), Container(
padding: EdgeInsets.only(top: 30),
child: Text(
'Looking for a Package?',
textAlign: TextAlign.left,
style: TextStyle(
color: Colors.black,
fontSize: 5.5 * _deviceBlockSize,
fontWeight: FontWeight.w700,
letterSpacing: 3,
), ),
), ),
GestureDetector( ),
child: Container( GestureDetector(
margin: EdgeInsets.symmetric(vertical: 10), child: Container(
height: 200, margin: EdgeInsets.symmetric(vertical: 10),
decoration: BoxDecoration(border: Border.all()), height: 200,
child: Center( decoration: BoxDecoration(border: Border.all()),
child: Text( child: Center(
'Please Scan The Package Barcode', child: Text(
style: TextStyle( 'Please Scan The Package Barcode',
color: Colors.black, style: TextStyle(
fontSize: 5 * _deviceBlockSize, color: Colors.black,
fontWeight: FontWeight.w100, fontSize: 5 * _deviceBlockSize,
letterSpacing: 3,
),
textAlign: TextAlign.center,
),
),
),
onTap: () {
scan().then(
(String result) {
if (result == 'cancel') {
print('cancel');
} else if (result == 'error') {
print('error');
} else if (result == 'access') {
print('access');
} else {
launch(
'https://cssd-doc.com/Show/Package/$result',
);
// Navigator.of(context).pushNamed(
// Routes.cycleDetailScreen,
// arguments: result,
// );
}
},
);
},
),
SizedBox(
height: 10.0,
),
Form(
key: _form,
child: TextFormField(
validator: (val) {
if (val!.isEmpty) {
return 'Id required!!';
}
return null;
},
controller: idCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100, fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize, letterSpacing: 3,
),
isDense: true,
labelText: 'Or enter a Package ID',
contentPadding: EdgeInsets.symmetric(
vertical: 2,
horizontal: 3,
),
focusedBorder: UnderlineInputBorder(
// borderRadius: BorderRadius.only(Radius.circular(4)),
borderSide: BorderSide(
color: Colors.grey,
),
), ),
textAlign: TextAlign.center,
), ),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
keyboardType: TextInputType.number,
), ),
), ),
SizedBox( onTap: () {
height: 70, scan().then(
), (String result) {
InkWell( if (result == 'cancel') {
onTap: () { print('cancel');
if (!_form.currentState!.validate()) { } else if (result == 'error') {
return; print('error');
} else if (result == 'access') {
print('access');
} else {
launch(
'https://cssd-doc.com/Show/Package/$result',
);
// Navigator.of(context).pushNamed(
// Routes.cycleDetailScreen,
// arguments: result,
// );
}
},
);
},
),
SizedBox(
height: 10.0,
),
Form(
key: _form,
child: TextFormField(
validator: (val) {
if (val!.isEmpty) {
return 'Id required!!';
} }
launch( return null;
'https://cssd-doc.com/Show/Package/${idCTRL.text}',
);
// Navigator.of(context).pushNamed(
// Routes.cycleDetailScreen,
// arguments: idCTRL.text,
// );
}, },
child: Container( controller: idCTRL,
padding: EdgeInsets.symmetric( decoration: InputDecoration(
horizontal: 5 * _deviceBlockSize, icon: Icon(
vertical: 10, FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
), ),
decoration: BoxDecoration( labelStyle: TextStyle(
gradient: LinearGradient( fontWeight: FontWeight.w100,
colors: [kDarkPurple, kDarkPurpleSub], fontSize: 4 * _deviceBlockSize,
),
isDense: true,
labelText: 'Or enter a Package ID',
contentPadding: EdgeInsets.symmetric(
vertical: 2,
horizontal: 3,
),
focusedBorder: UnderlineInputBorder(
// borderRadius: BorderRadius.only(Radius.circular(4)),
borderSide: BorderSide(
color: Colors.grey,
), ),
borderRadius: BorderRadius.circular(7),
), ),
child: Align( ),
alignment: Alignment.center, style: TextStyle(
child: Text( fontWeight: FontWeight.w700,
'Search', fontSize: 5 * _deviceBlockSize,
style: TextStyle( ),
color: Colors.white, keyboardType: TextInputType.number,
fontSize: 5 * _deviceBlockSize, ),
), ),
SizedBox(
height: 70,
),
InkWell(
onTap: () {
if (!_form.currentState!.validate()) {
return;
}
launch(
'https://cssd-doc.com/Show/Package/${idCTRL.text}',
);
// Navigator.of(context).pushNamed(
// Routes.cycleDetailScreen,
// arguments: idCTRL.text,
// );
},
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 5 * _deviceBlockSize,
vertical: 10,
),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [kDarkPurple, kDarkPurpleSub],
),
borderRadius: BorderRadius.circular(7),
),
child: Align(
alignment: Alignment.center,
child: Text(
'Search',
style: TextStyle(
color: Colors.white,
fontSize: 5 * _deviceBlockSize,
), ),
), ),
), ),
), ),
], ),
) ],
: ConnectionErrorBox(); )
}, : ConnectionErrorBox();
), },
), ),
), ),
), ),
@@ -74,220 +74,208 @@ class _PackageTransferScreenState extends State<PackageTransferScreen> {
final _media = MediaQuery.of(context); final _media = MediaQuery.of(context);
final double _deviceWidth = _media.size.width; final double _deviceWidth = _media.size.width;
final double _deviceBlockSize = _deviceWidth / 100; final double _deviceBlockSize = _deviceWidth / 100;
return PopScope( return SafeArea(
canPop: false, child: GestureDetector(
onPopInvoked: (didPop) { onTap: () {
if (didPop) return; FocusManager.instance.primaryFocus?.unfocus();
Navigator.of(context).pushNamed(Routes.homePage); },
}, child: Scaffold(
child: SafeArea( appBar: AppBar(
child: GestureDetector( titleSpacing: -10,
onTap: () { title: Text(
FocusManager.instance.primaryFocus?.unfocus(); 'Package Details',
}, style: TextStyle(
child: Scaffold( color: Colors.white,
appBar: AppBar(
titleSpacing: -10,
title: Text(
'Package Details',
style: TextStyle(
color: Colors.white,
),
),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
), ),
), ),
body: Consumer<ConnectivityProvider>( backgroundColor: Colors.black,
builder: (ct, connection, _) { leading: IconButton(
return connection.conStatus != 'offline' icon: Icon(
? Padding( Icons.keyboard_arrow_left,
padding: EdgeInsets.only( color: Colors.white,
top: 20, size: 35,
right: 20, ),
bottom: 40, onPressed: () => Navigator.of(context).pop(),
left: 20, ),
), ),
child: Column( body: Consumer<ConnectivityProvider>(
crossAxisAlignment: CrossAxisAlignment.start, builder: (ct, connection, _) {
children: <Widget>[ return connection.conStatus != 'offline'
ResultBanner( ? Padding(
deviceBlockSize: _deviceBlockSize, padding: EdgeInsets.only(
text: 'Transfer to', top: 20,
hasFilterObject: false, right: 20,
push: Routes.myItemsFilterScreen, bottom: 40,
), left: 20,
SizedBox( ),
height: 20.0, child: Column(
), crossAxisAlignment: CrossAxisAlignment.start,
ResultSearchBox( children: <Widget>[
searchCTRL: searchCTRL, ResultBanner(
text: 'user', deviceBlockSize: _deviceBlockSize,
text2: 'name or ID', text: 'Transfer to',
deviceBlockSize: _deviceBlockSize, hasFilterObject: false,
textInputType: TextInputType.visiblePassword, push: Routes.myItemsFilterScreen,
onChanged: (value) { ),
Provider.of<UsersProvider>(context, SizedBox(
listen: false) height: 20.0,
.searchUsers(value); ),
ResultSearchBox(
searchCTRL: searchCTRL,
text: 'user',
text2: 'name or ID',
deviceBlockSize: _deviceBlockSize,
textInputType: TextInputType.visiblePassword,
onChanged: (value) {
Provider.of<UsersProvider>(context, listen: false)
.searchUsers(value);
},
),
SizedBox(
height: 20,
),
Expanded(
child: Consumer<UsersProvider>(
builder: (context, userResults, _) {
return userResults.isLoading
? Center(
child: CircularProgressIndicator(
color: Colors.black,
),
)
: ListView.builder(
controller: sc,
itemBuilder: (context, index) {
return TransferDataBox(
deviceBlockSize: _deviceBlockSize,
user: userResults.usersBox?[index],
clickColor: kDarkPurple,
isClicked:
userResults.selectedUserIndex ==
index,
onTap: (userId) {
Provider.of<UsersProvider>(
context,
listen: false,
).selectUser(index);
print(userId);
Provider.of<UsersProvider>(
context,
listen: false)
.saveUserId = userId;
Provider.of<UsersProvider>(
context,
listen: false)
.selectedUserForPackages =
userResults.usersBox?[index];
},
);
},
itemCount: userResults.usersBox?.length,
shrinkWrap: true,
);
}, },
), ),
SizedBox( ),
height: 20, TransferDestroyButton(
), deviceBlockSize: _deviceBlockSize,
Expanded( firstColor: kDarkPurple,
child: Consumer<UsersProvider>( secondColor: kDarkPurpleSub,
builder: (context, userResults, _) { onTap: () {
return userResults.isLoading showDialog(
? Center( context: context,
child: CircularProgressIndicator( builder: (context) {
color: Colors.black, return AlertDialog(
title: Text(
'Are you sure to transfer this Package?',
style: TextStyle(
fontSize: 4 * _deviceBlockSize,
),
),
content: SizedBox(
width: _deviceBlockSize,
height: 300,
child: Column(
children: [
Text(
'By approving, all items in your package will be transferred the specified user. it can be undone unless the user reject the transfer.',
style: TextStyle(
fontSize: 3 * _deviceBlockSize,
),
), ),
) SizedBox(
: ListView.builder( height: 10.0,
controller: sc, ),
itemBuilder: (context, index) { PackageCard(
return TransferDataBox( _deviceBlockSize, packageData!),
deviceBlockSize: _deviceBlockSize, SizedBox(
user: height: 5.0,
userResults.usersBox?[index], ),
clickColor: kDarkPurple, Row(
isClicked: userResults children: [
.selectedUserIndex == Spacer(),
index, Text('To'),
onTap: (userId) { SizedBox(
Provider.of<UsersProvider>( width: 5.0,
context, ),
listen: false, TransferDataBox(
).selectUser(index); deviceBlockSize:
print(userId); _deviceBlockSize,
user: Provider.of<
UsersProvider>(context)
.selectedUserForPackages,
)
],
),
SizedBox(
height: 20.0,
),
TransferDestroyButton(
deviceBlockSize: _deviceBlockSize,
firstColor: kDarkPurple,
secondColor: kDarkPurpleSub,
onTap: () {
Provider.of<MyPackageProvider>(
context,
listen: false,
).transferPackage(
packageData!.id,
Provider.of<UsersProvider>( Provider.of<UsersProvider>(
context, context,
listen: false) listen: false)
.saveUserId = userId; .saveUserId!,
Provider.of<UsersProvider>( );
context, Navigator.of(context).pop();
listen: false) Navigator.of(context)
.selectedUserForPackages = .popAndPushNamed(Routes
userResults .myPackagesResultScreen);
.usersBox?[index]; },
}, text: 'Transfer',
); ),
}, SizedBox(
itemCount: height: 5.0,
userResults.usersBox?.length, ),
shrinkWrap: true, CancelTransferButton(
); deviceBlockSize: _deviceBlockSize,
color: kPink,
onTap: () {
Navigator.pop(context);
},
),
],
),
),
);
}, },
), );
), },
TransferDestroyButton( text: 'Transfer',
deviceBlockSize: _deviceBlockSize, ),
firstColor: kDarkPurple, ],
secondColor: kDarkPurpleSub, ),
onTap: () { )
showDialog( : ConnectionErrorBox();
context: context, },
builder: (context) {
return AlertDialog(
title: Text(
'Are you sure to transfer this Package?',
style: TextStyle(
fontSize: 4 * _deviceBlockSize,
),
),
content: SizedBox(
width: _deviceBlockSize,
height: 300,
child: Column(
children: [
Text(
'By approving, all items in your package will be transferred the specified user. it can be undone unless the user reject the transfer.',
style: TextStyle(
fontSize: 3 * _deviceBlockSize,
),
),
SizedBox(
height: 10.0,
),
PackageCard(
_deviceBlockSize, packageData!),
SizedBox(
height: 5.0,
),
Row(
children: [
Spacer(),
Text('To'),
SizedBox(
width: 5.0,
),
TransferDataBox(
deviceBlockSize:
_deviceBlockSize,
user: Provider.of<
UsersProvider>(
context)
.selectedUserForPackages,
)
],
),
SizedBox(
height: 20.0,
),
TransferDestroyButton(
deviceBlockSize: _deviceBlockSize,
firstColor: kDarkPurple,
secondColor: kDarkPurpleSub,
onTap: () {
Provider.of<MyPackageProvider>(
context,
listen: false,
).transferPackage(
packageData!.id,
Provider.of<UsersProvider>(
context,
listen: false)
.saveUserId!,
);
Navigator.of(context).pop();
Navigator.of(context)
.popAndPushNamed(Routes
.myPackagesResultScreen);
},
text: 'Transfer',
),
SizedBox(
height: 5.0,
),
CancelTransferButton(
deviceBlockSize: _deviceBlockSize,
color: kPink,
onTap: () {
Navigator.pop(context);
},
),
],
),
),
);
},
);
},
text: 'Transfer',
),
],
),
)
: ConnectionErrorBox();
},
),
), ),
), ),
), ),
+213 -230
View File
@@ -66,241 +66,224 @@ class _PackageAddScreenState extends State<PackageAddScreen> {
final double _deviceBlockSize = _devicewidth / 100; final double _deviceBlockSize = _devicewidth / 100;
return Consumer<PackageProvider>( return Consumer<PackageProvider>(
builder: (context, packageProvider, _) { builder: (context, packageProvider, _) {
return PopScope( return SafeArea(
canPop: false, child: GestureDetector(
onPopInvoked: (didPop) { onTap: () {
if (didPop) return; FocusManager.instance.primaryFocus?.unfocus();
Navigator.of(context).pushNamed(Routes.homePage); },
// packageProvider.resetLoadingButton(); child: Scaffold(
// Navigator.pushReplacementNamed( appBar: AppBar(
// context, titleSpacing: -10,
// Routes.packageResultScreen, title: Text(
// ); 'Packages',
// return true; style: TextStyle(
}, color: Colors.white,
child: SafeArea(
child: GestureDetector(
onTap: () {
FocusManager.instance.primaryFocus?.unfocus();
},
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text(
'Packages',
style: TextStyle(
color: Colors.white,
),
),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () {
packageProvider.resetLoadingButton();
Navigator.of(context)
.pushReplacementNamed(Routes.packageResultScreen);
},
), ),
), ),
body: Consumer<ConnectivityProvider>( backgroundColor: Colors.black,
builder: (ct, connection, _) { leading: IconButton(
return connection.conStatus != 'offline' icon: Icon(
? isInit Icons.keyboard_arrow_left,
? Center( color: Colors.white,
child: CircularProgressIndicator( size: 35,
color: Colors.black, ),
), onPressed: () {
) packageProvider.resetLoadingButton();
: Form( Navigator.of(context)
key: _form, .pushReplacementNamed(Routes.packageResultScreen);
child: Padding(
padding: EdgeInsets.all(20),
child: ListView(
children: <Widget>[
Text(
'Add a Package',
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 6 * _deviceBlockSize,
letterSpacing: 3,
),
),
SizedBox(
height: 20,
),
TextFormField(
validator: (val) {
if (val!.isEmpty) {
return 'Name required!';
}
return null;
},
controller: nameCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.alignLeft,
size: 7 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
isDense: true,
labelText: 'Package Name',
contentPadding: EdgeInsets.symmetric(
vertical: 2,
horizontal: 3,
),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
keyboardType: TextInputType.text,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context).requestFocus(
_packageUdiFocusNode);
},
),
SizedBox(
height: 30,
),
// TextFormField(
// validator: (val) {
// if (val!.isEmpty) {
// return 'UDI required!';
// }
// return null;
// },
// controller: udiCTRL,
// decoration: InputDecoration(
// icon: Icon(
// FontAwesomeIcons.alignLeft,
// size: 7 * _deviceBlockSize,
// ),
// labelStyle: TextStyle(
// fontWeight: FontWeight.w100,
// fontSize: 4 * _deviceBlockSize,
// ),
// isDense: true,
// labelText: 'UDI',
// contentPadding: EdgeInsets.symmetric(
// vertical: 2, horizontal: 3),
// ),
// style: TextStyle(
// fontWeight: FontWeight.w700,
// fontSize: 5 * _deviceBlockSize,
// ),
// focusNode: _packageUdiFocusNode,
// keyboardType: TextInputType.visiblePassword,
// textInputAction: TextInputAction.next,
// onFieldSubmitted: (_) {
// FocusScope.of(context)
// .requestFocus(_descriptionFocusNode);
// },
// ),
// SizedBox(
// height: 20,
// ),
Container(
margin:
EdgeInsets.symmetric(vertical: 5),
child: Text(
'Items included',
style: TextStyle(
color: kPurple,
letterSpacing: 2,
fontSize: 5 * _deviceBlockSize,
),
),
),
Consumer<PackageProvider>(
builder: (ctx, packageProvider, _) =>
ListView.builder(
physics:
NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemBuilder: (ctx, index) =>
AddItemBox(
text: 'Select Items Included',
iconColor: kPurpleSub,
deviceBlockSize: _deviceBlockSize,
values: packageProvider
.itemValues[index],
vals: packageProvider.itemVals,
initialItemValue: packageProvider
.initialItemValue,
index: index,
hasRemoveButton: packageProvider
.itemValues.length >
1
? true
: false,
),
itemCount:
packageProvider.itemValues.length,
),
),
SizedBox(
height: 30,
),
TextFormField(
controller: descriptionCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.alignLeft,
size: 7 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
isDense: true,
labelText: 'Description',
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
keyboardType: TextInputType.multiline,
focusNode: _descriptionFocusNode,
minLines: 1,
maxLines: 5,
),
SizedBox(
height: 70,
),
PackageAddSaveButton(
form: _form,
itemValues:
Provider.of<PackageProvider>(
context,
listen: false,
).itemValues,
nameCTRL: nameCTRL,
// udiCTRL: udiCTRL,
dateValue: dateCTRL.text,
descriptionCTRL: descriptionCTRL,
deviceBlockSize: _deviceBlockSize,
),
SizedBox(
height: 100,
),
],
),
),
)
: ConnectionErrorBox();
}, },
), ),
), ),
body: Consumer<ConnectivityProvider>(
builder: (ct, connection, _) {
return connection.conStatus != 'offline'
? isInit
? Center(
child: CircularProgressIndicator(
color: Colors.black,
),
)
: Form(
key: _form,
child: Padding(
padding: EdgeInsets.all(20),
child: ListView(
children: <Widget>[
Text(
'Add a Package',
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 6 * _deviceBlockSize,
letterSpacing: 3,
),
),
SizedBox(
height: 20,
),
TextFormField(
validator: (val) {
if (val!.isEmpty) {
return 'Name required!';
}
return null;
},
controller: nameCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.alignLeft,
size: 7 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
isDense: true,
labelText: 'Package Name',
contentPadding: EdgeInsets.symmetric(
vertical: 2,
horizontal: 3,
),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
keyboardType: TextInputType.text,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(_packageUdiFocusNode);
},
),
SizedBox(
height: 30,
),
// TextFormField(
// validator: (val) {
// if (val!.isEmpty) {
// return 'UDI required!';
// }
// return null;
// },
// controller: udiCTRL,
// decoration: InputDecoration(
// icon: Icon(
// FontAwesomeIcons.alignLeft,
// size: 7 * _deviceBlockSize,
// ),
// labelStyle: TextStyle(
// fontWeight: FontWeight.w100,
// fontSize: 4 * _deviceBlockSize,
// ),
// isDense: true,
// labelText: 'UDI',
// contentPadding: EdgeInsets.symmetric(
// vertical: 2, horizontal: 3),
// ),
// style: TextStyle(
// fontWeight: FontWeight.w700,
// fontSize: 5 * _deviceBlockSize,
// ),
// focusNode: _packageUdiFocusNode,
// keyboardType: TextInputType.visiblePassword,
// textInputAction: TextInputAction.next,
// onFieldSubmitted: (_) {
// FocusScope.of(context)
// .requestFocus(_descriptionFocusNode);
// },
// ),
// SizedBox(
// height: 20,
// ),
Container(
margin: EdgeInsets.symmetric(vertical: 5),
child: Text(
'Items included',
style: TextStyle(
color: kPurple,
letterSpacing: 2,
fontSize: 5 * _deviceBlockSize,
),
),
),
Consumer<PackageProvider>(
builder: (ctx, packageProvider, _) =>
ListView.builder(
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemBuilder: (ctx, index) => AddItemBox(
text: 'Select Items Included',
iconColor: kPurpleSub,
deviceBlockSize: _deviceBlockSize,
values:
packageProvider.itemValues[index],
vals: packageProvider.itemVals,
initialItemValue:
packageProvider.initialItemValue,
index: index,
hasRemoveButton: packageProvider
.itemValues.length >
1
? true
: false,
),
itemCount:
packageProvider.itemValues.length,
),
),
SizedBox(
height: 30,
),
TextFormField(
controller: descriptionCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.alignLeft,
size: 7 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
isDense: true,
labelText: 'Description',
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
keyboardType: TextInputType.multiline,
focusNode: _descriptionFocusNode,
minLines: 1,
maxLines: 5,
),
SizedBox(
height: 70,
),
PackageAddSaveButton(
form: _form,
itemValues: Provider.of<PackageProvider>(
context,
listen: false,
).itemValues,
nameCTRL: nameCTRL,
// udiCTRL: udiCTRL,
dateValue: dateCTRL.text,
descriptionCTRL: descriptionCTRL,
deviceBlockSize: _deviceBlockSize,
),
SizedBox(
height: 100,
),
],
),
),
)
: ConnectionErrorBox();
},
),
), ),
), ),
); );
@@ -47,63 +47,56 @@ class _PackageDetailScreenState extends State<PackageDetailScreen> {
final _media = MediaQuery.of(context); final _media = MediaQuery.of(context);
final double _devicewidth = _media.size.width; final double _devicewidth = _media.size.width;
final double _deviceBlockSize = _devicewidth / 100; final double _deviceBlockSize = _devicewidth / 100;
return PopScope( return SafeArea(
canPop: false, child: Scaffold(
onPopInvoked: (didPop) { appBar: AppBar(
if (didPop) return; titleSpacing: -10,
Navigator.of(context).pop(); title: Text(
}, 'Packages',
child: SafeArea( style: TextStyle(
child: Scaffold( color: Colors.white,
appBar: AppBar(
titleSpacing: -10,
title: Text(
'Packages',
style: TextStyle(
color: Colors.white,
),
),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
), ),
), ),
body: Consumer<ConnectivityProvider>( backgroundColor: Colors.black,
builder: (ct, connection, _) { leading: IconButton(
return connection.conStatus != 'offline' icon: Icon(
? isInit Icons.keyboard_arrow_left,
? Center( color: Colors.white,
child: CircularProgressIndicator( size: 35,
color: Colors.black, ),
), onPressed: () => Navigator.of(context).pop(),
)
: isEmpty
? Center(
child: Text('This Package does\'nt exists!'),
)
: PackageDetailsDataBox(
datas: datas!,
deviceBlockSize: _deviceBlockSize,
goToAddLabelPage: () {
Navigator.pushNamed(
context,
Routes.labelAddScreen,
arguments: {
"id": datas!.id,
"name": datas!.name
},
);
},
)
: ConnectionErrorBox();
},
), ),
), ),
body: Consumer<ConnectivityProvider>(
builder: (ct, connection, _) {
return connection.conStatus != 'offline'
? isInit
? Center(
child: CircularProgressIndicator(
color: Colors.black,
),
)
: isEmpty
? Center(
child: Text('This Package does\'nt exists!'),
)
: PackageDetailsDataBox(
datas: datas!,
deviceBlockSize: _deviceBlockSize,
goToAddLabelPage: () {
Navigator.pushNamed(
context,
Routes.labelAddScreen,
arguments: {
"id": datas!.id,
"name": datas!.name
},
);
},
)
: ConnectionErrorBox();
},
),
), ),
); );
} }
+206 -218
View File
@@ -78,228 +78,216 @@ class _PackageFilterScreenState extends State<PackageFilterScreen> {
final _media = MediaQuery.of(context); final _media = MediaQuery.of(context);
final double _devicewidth = _media.size.width; final double _devicewidth = _media.size.width;
final double _deviceBlockSize = _devicewidth / 100; final double _deviceBlockSize = _devicewidth / 100;
return PopScope( return SafeArea(
canPop: false, child: GestureDetector(
onPopInvoked: (didPop) { onTap: () {
if (didPop) return; FocusManager.instance.primaryFocus?.unfocus();
Navigator.of(context).pushNamed(Routes.homePage); },
// Navigator.pushReplacementNamed( child: Scaffold(
// context, appBar: AppBar(
// Routes.packageResultScreen, titleSpacing: -10,
// ); title: Text(
// return true; 'Packages',
}, style: TextStyle(
child: SafeArea( color: Colors.white,
child: GestureDetector(
onTap: () {
FocusManager.instance.primaryFocus?.unfocus();
},
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text(
'Packages',
style: TextStyle(
color: Colors.white,
),
),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context)
.pushReplacementNamed(Routes.packageResultScreen),
), ),
), ),
body: Consumer<ConnectivityProvider>( backgroundColor: Colors.black,
builder: (ct, connection, _) { leading: IconButton(
return connection.conStatus != 'offline' icon: Icon(
? isInit Icons.keyboard_arrow_left,
? Center( color: Colors.white,
child: CircularProgressIndicator( size: 35,
color: Colors.black, ),
), onPressed: () => Navigator.of(context)
) .pushReplacementNamed(Routes.packageResultScreen),
: Padding(
padding: EdgeInsets.all(20),
child: ListView(
// crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
'Filter Packages',
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
),
SizedBox(
height: 20,
),
Row(
children: [
Flexible(
flex: 8,
child: TextFormField(
controller: idCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Package ID',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2,
horizontal: 3,
),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
keyboardType: TextInputType.number,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(_nameFocusNode);
},
),
),
// Spacer(),
Flexible(
flex: 1,
child: InkWell(
onTap: () {
scan().then(
(String result) {
if (result == 'cancel') {
print('cancel');
} else if (result == 'error') {
print('error');
} else if (result == 'access') {
print('access');
} else {
print(result);
idCTRL.text = result;
}
},
);
},
child: Container(
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black,
),
child: Icon(
Icons.qr_code_scanner,
size: 5 * _deviceBlockSize,
color: Colors.white,
),
),
),
)
],
),
SizedBox(
height: 30,
),
TextFormField(
controller: nameCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.alignLeft,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Package Name',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2,
horizontal: 3,
),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
focusNode: _nameFocusNode,
keyboardType: TextInputType.text,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(_udiFocusNode);
},
),
SizedBox(
height: 30,
),
// TextFormField(
// controller: udiCTRL,
// decoration: InputDecoration(
// icon: Icon(
// FontAwesomeIcons.alignLeft,
// size: 6 * _deviceBlockSize,
// ),
// labelStyle: TextStyle(
// fontWeight: FontWeight.w100,
// fontSize: 4 * _deviceBlockSize,
// ),
// labelText: 'UDI',
// isDense: true,
// contentPadding: EdgeInsets.symmetric(
// vertical: 2,
// horizontal: 3,
// ),
// ),
// style: TextStyle(
// fontWeight: FontWeight.w700,
// fontSize: 5 * _deviceBlockSize,
// ),
// focusNode: _udiFocusNode,
// keyboardType: TextInputType.text,
// textInputAction: TextInputAction.next,
// ),
// SizedBox(
// height: 30.0,
// ),
FilterHospitalBox(
deviceBlockSize: _deviceBlockSize,
hospitalCTRL: hospitalCTRL,
hospitalVals: hospitalVals,
label: 'Hospital',
),
SizedBox(
height: 90,
),
PackageFilterSaveButton(
hospitalVals: hospitalVals,
hospitalCTRL: hospitalCTRL,
idCTRL: idCTRL,
nameCTRL: nameCTRL,
// udiCTRL: udiCTRL,
deviceBlockSize: _deviceBlockSize,
),
SizedBox(
height: 100,
),
],
),
)
: ConnectionErrorBox();
},
), ),
), ),
body: Consumer<ConnectivityProvider>(
builder: (ct, connection, _) {
return connection.conStatus != 'offline'
? isInit
? Center(
child: CircularProgressIndicator(
color: Colors.black,
),
)
: Padding(
padding: EdgeInsets.all(20),
child: ListView(
// crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
'Filter Packages',
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
),
SizedBox(
height: 20,
),
Row(
children: [
Flexible(
flex: 8,
child: TextFormField(
controller: idCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Package ID',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2,
horizontal: 3,
),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
keyboardType: TextInputType.number,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(_nameFocusNode);
},
),
),
// Spacer(),
Flexible(
flex: 1,
child: InkWell(
onTap: () {
scan().then(
(String result) {
if (result == 'cancel') {
print('cancel');
} else if (result == 'error') {
print('error');
} else if (result == 'access') {
print('access');
} else {
print(result);
idCTRL.text = result;
}
},
);
},
child: Container(
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black,
),
child: Icon(
Icons.qr_code_scanner,
size: 5 * _deviceBlockSize,
color: Colors.white,
),
),
),
)
],
),
SizedBox(
height: 30,
),
TextFormField(
controller: nameCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.alignLeft,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Package Name',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2,
horizontal: 3,
),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
focusNode: _nameFocusNode,
keyboardType: TextInputType.text,
textInputAction: TextInputAction.next,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(_udiFocusNode);
},
),
SizedBox(
height: 30,
),
// TextFormField(
// controller: udiCTRL,
// decoration: InputDecoration(
// icon: Icon(
// FontAwesomeIcons.alignLeft,
// size: 6 * _deviceBlockSize,
// ),
// labelStyle: TextStyle(
// fontWeight: FontWeight.w100,
// fontSize: 4 * _deviceBlockSize,
// ),
// labelText: 'UDI',
// isDense: true,
// contentPadding: EdgeInsets.symmetric(
// vertical: 2,
// horizontal: 3,
// ),
// ),
// style: TextStyle(
// fontWeight: FontWeight.w700,
// fontSize: 5 * _deviceBlockSize,
// ),
// focusNode: _udiFocusNode,
// keyboardType: TextInputType.text,
// textInputAction: TextInputAction.next,
// ),
// SizedBox(
// height: 30.0,
// ),
FilterHospitalBox(
deviceBlockSize: _deviceBlockSize,
hospitalCTRL: hospitalCTRL,
hospitalVals: hospitalVals,
label: 'Hospital',
),
SizedBox(
height: 90,
),
PackageFilterSaveButton(
hospitalVals: hospitalVals,
hospitalCTRL: hospitalCTRL,
idCTRL: idCTRL,
nameCTRL: nameCTRL,
// udiCTRL: udiCTRL,
deviceBlockSize: _deviceBlockSize,
),
SizedBox(
height: 100,
),
],
),
)
: ConnectionErrorBox();
},
),
), ),
), ),
); );
@@ -327,7 +327,7 @@ class PackageResultFloatingButton extends StatelessWidget {
InkWell( InkWell(
customBorder: CircleBorder(), customBorder: CircleBorder(),
onTap: () { onTap: () {
Navigator.of(context).pushReplacementNamed(Routes.packageAddScreen); Navigator.of(context).pushNamed(Routes.packageAddScreen);
}, },
child: Container( child: Container(
padding: EdgeInsets.all(_deviceBlockSize), padding: EdgeInsets.all(_deviceBlockSize),
+150 -157
View File
@@ -26,181 +26,174 @@ class _PackageScanScreenState extends State<PackageScanScreen> {
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5); // final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
final double _devicewidth = _media.size.width; final double _devicewidth = _media.size.width;
final double _deviceBlockSize = _devicewidth / 100; final double _deviceBlockSize = _devicewidth / 100;
return PopScope( return SafeArea(
canPop: false, child: GestureDetector(
onPopInvoked: (didPop) { onTap: () {
if (didPop) return; FocusManager.instance.primaryFocus?.unfocus();
Navigator.of(context).pushNamed(Routes.homePage); },
}, child: Scaffold(
child: SafeArea( appBar: AppBar(
child: GestureDetector( titleSpacing: -10,
onTap: () { title: Text(
FocusManager.instance.primaryFocus?.unfocus(); 'Packages',
}, style: TextStyle(
child: Scaffold( color: Colors.white,
appBar: AppBar(
titleSpacing: -10,
title: Text(
'Packages',
style: TextStyle(
color: Colors.white,
),
),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
), ),
), ),
body: Consumer<ConnectivityProvider>( backgroundColor: Colors.black,
builder: (ct, connection, _) { leading: IconButton(
return connection.conStatus != 'offline' icon: Icon(
? ListView( Icons.keyboard_arrow_left,
padding: EdgeInsets.symmetric(horizontal: 20), color: Colors.white,
children: <Widget>[ size: 35,
Container( ),
padding: EdgeInsets.only(top: 30), onPressed: () => Navigator.of(context).pop(),
child: Text( ),
'Looking for a Package?', ),
textAlign: TextAlign.left, body: Consumer<ConnectivityProvider>(
style: TextStyle( builder: (ct, connection, _) {
color: Colors.black, return connection.conStatus != 'offline'
fontSize: 5.5 * _deviceBlockSize, ? ListView(
fontWeight: FontWeight.w700, padding: EdgeInsets.symmetric(horizontal: 20),
letterSpacing: 3, children: <Widget>[
), Container(
padding: EdgeInsets.only(top: 30),
child: Text(
'Looking for a Package?',
textAlign: TextAlign.left,
style: TextStyle(
color: Colors.black,
fontSize: 5.5 * _deviceBlockSize,
fontWeight: FontWeight.w700,
letterSpacing: 3,
), ),
), ),
GestureDetector( ),
child: Container( GestureDetector(
margin: EdgeInsets.symmetric(vertical: 10), child: Container(
height: 200, margin: EdgeInsets.symmetric(vertical: 10),
decoration: BoxDecoration(border: Border.all()), height: 200,
child: Center( decoration: BoxDecoration(border: Border.all()),
child: Text( child: Center(
'Please Scan The Package Barcode', child: Text(
style: TextStyle( 'Please Scan The Package Barcode',
color: Colors.black, style: TextStyle(
fontSize: 5 * _deviceBlockSize, color: Colors.black,
fontWeight: FontWeight.w100, fontSize: 5 * _deviceBlockSize,
letterSpacing: 3,
),
textAlign: TextAlign.center,
),
),
),
onTap: () {
scan().then(
(String result) {
if (result == 'cancel') {
print('cancel');
} else if (result == 'error') {
print('error');
} else if (result == 'access') {
print('access');
} else {
launch(
'https://cssd-doc.com/Show/Package/$result',
);
// Navigator.of(context).pushNamed(
// Routes.cycleDetailScreen,
// arguments: result,
// );
}
},
);
},
),
SizedBox(
height: 10.0,
),
Form(
key: _form,
child: TextFormField(
validator: (val) {
if (val!.isEmpty) {
return 'Id required!!';
}
return null;
},
controller: idCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100, fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize, letterSpacing: 3,
),
isDense: true,
labelText: 'Or enter a Package ID',
contentPadding: EdgeInsets.symmetric(
vertical: 2,
horizontal: 3,
),
focusedBorder: UnderlineInputBorder(
// borderRadius: BorderRadius.only(Radius.circular(4)),
borderSide: BorderSide(
color: Colors.grey,
),
), ),
textAlign: TextAlign.center,
), ),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
keyboardType: TextInputType.number,
), ),
), ),
SizedBox( onTap: () {
height: 70, scan().then(
), (String result) {
InkWell( if (result == 'cancel') {
onTap: () { print('cancel');
if (!_form.currentState!.validate()) { } else if (result == 'error') {
return; print('error');
} else if (result == 'access') {
print('access');
} else {
launch(
'https://cssd-doc.com/Show/Package/$result',
);
// Navigator.of(context).pushNamed(
// Routes.cycleDetailScreen,
// arguments: result,
// );
}
},
);
},
),
SizedBox(
height: 10.0,
),
Form(
key: _form,
child: TextFormField(
validator: (val) {
if (val!.isEmpty) {
return 'Id required!!';
} }
launch( return null;
'https://cssd-doc.com/Show/Package/${idCTRL.text}',
);
// Navigator.of(context).pushNamed(
// Routes.cycleDetailScreen,
// arguments: idCTRL.text,
// );
}, },
child: Container( controller: idCTRL,
padding: EdgeInsets.symmetric( decoration: InputDecoration(
horizontal: 5 * _deviceBlockSize, icon: Icon(
vertical: 10, FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
), ),
decoration: BoxDecoration( labelStyle: TextStyle(
gradient: LinearGradient( fontWeight: FontWeight.w100,
colors: [kPurple, kPurpleSub], fontSize: 4 * _deviceBlockSize,
),
isDense: true,
labelText: 'Or enter a Package ID',
contentPadding: EdgeInsets.symmetric(
vertical: 2,
horizontal: 3,
),
focusedBorder: UnderlineInputBorder(
// borderRadius: BorderRadius.only(Radius.circular(4)),
borderSide: BorderSide(
color: Colors.grey,
), ),
borderRadius: BorderRadius.circular(7),
), ),
child: Align( ),
alignment: Alignment.center, style: TextStyle(
child: Text( fontWeight: FontWeight.w700,
'Search', fontSize: 5 * _deviceBlockSize,
style: TextStyle( ),
color: Colors.white, keyboardType: TextInputType.number,
fontSize: 5 * _deviceBlockSize, ),
), ),
SizedBox(
height: 70,
),
InkWell(
onTap: () {
if (!_form.currentState!.validate()) {
return;
}
launch(
'https://cssd-doc.com/Show/Package/${idCTRL.text}',
);
// Navigator.of(context).pushNamed(
// Routes.cycleDetailScreen,
// arguments: idCTRL.text,
// );
},
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 5 * _deviceBlockSize,
vertical: 10,
),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [kPurple, kPurpleSub],
),
borderRadius: BorderRadius.circular(7),
),
child: Align(
alignment: Alignment.center,
child: Text(
'Search',
style: TextStyle(
color: Colors.white,
fontSize: 5 * _deviceBlockSize,
), ),
), ),
), ),
), ),
], ),
) ],
: ConnectionErrorBox(); )
}, : ConnectionErrorBox();
), },
), ),
), ),
), ),
+204 -219
View File
@@ -49,244 +49,229 @@ class _TestResultAddScreenState extends State<TestResultAddScreen> {
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5); // final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
final double _devicewidth = _media.size.width; final double _devicewidth = _media.size.width;
final double _deviceBlockSize = _devicewidth / 100; final double _deviceBlockSize = _devicewidth / 100;
return PopScope( return SafeArea(
canPop: false, child: Scaffold(
onPopInvoked: (didPop) { appBar: AppBar(
if (didPop) return; titleSpacing: -10,
Navigator.of(context).pushNamed(Routes.homePage); title: Text(
// Navigator.pushReplacementNamed( 'Test Results',
// context, style: TextStyle(
// Routes.testResultScreen, color: Colors.white,
// );
// return true;
},
child: SafeArea(
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text(
'Test Results',
style: TextStyle(
color: Colors.white,
),
),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
// padding: EdgeInsets.all(0),
onPressed: () => Navigator.of(context)
.popAndPushNamed(Routes.testResultScreen),
), ),
), ),
body: Consumer<ConnectivityProvider>( backgroundColor: Colors.black,
builder: (ct, connection, _) { leading: IconButton(
return connection.conStatus != 'offline' icon: Icon(
? isInit Icons.keyboard_arrow_left,
? Center( color: Colors.white,
child: CircularProgressIndicator( size: 35,
color: Colors.black, ),
), // padding: EdgeInsets.all(0),
) onPressed: () =>
: ListView( Navigator.of(context).popAndPushNamed(Routes.testResultScreen),
padding: EdgeInsets.symmetric( ),
horizontal: 20, vertical: 20), ),
children: <Widget>[ body: Consumer<ConnectivityProvider>(
Container( builder: (ct, connection, _) {
padding: EdgeInsets.only( return connection.conStatus != 'offline'
top: 10, ? isInit
), ? Center(
child: Text( child: CircularProgressIndicator(
'Add a Test Result', color: Colors.black,
style: TextStyle( ),
color: Colors.black, )
fontSize: 5 * _deviceBlockSize, : ListView(
letterSpacing: 3, padding:
fontWeight: FontWeight.w700, EdgeInsets.symmetric(horizontal: 20, vertical: 20),
), children: <Widget>[
Container(
padding: EdgeInsets.only(
top: 10,
),
child: Text(
'Add a Test Result',
style: TextStyle(
color: Colors.black,
fontSize: 5 * _deviceBlockSize,
letterSpacing: 3,
fontWeight: FontWeight.w700,
), ),
), ),
GestureDetector( ),
child: Container( GestureDetector(
margin: EdgeInsets.only(top: 5, bottom: 30), child: Container(
padding: EdgeInsets.all(10), margin: EdgeInsets.only(top: 5, bottom: 30),
height: 200, padding: EdgeInsets.all(10),
decoration: BoxDecoration(border: Border.all()), height: 200,
child: Center( decoration: BoxDecoration(border: Border.all()),
child: Text( child: Center(
'PLease Scan The Test Barcode', child: Text(
textAlign: TextAlign.center, 'PLease Scan The Test Barcode',
style: TextStyle( textAlign: TextAlign.center,
color: Colors.grey, style: TextStyle(
fontSize: 5 * _deviceBlockSize, color: Colors.grey,
fontWeight: FontWeight.w100, fontSize: 5 * _deviceBlockSize,
letterSpacing: 3, fontWeight: FontWeight.w100,
), letterSpacing: 3,
), ),
), ),
), ),
onTap: () {
scan().then(
(String result) {
if (result == 'cancel') {
print('cancel');
} else if (result == 'error') {
print('error');
} else if (result == 'access') {
print('access');
} else {
Provider.of<TestResultsProvider>(
context,
listen: false,
).testCode = result;
Navigator.pushNamed(
context,
Routes.formTestResultScreen,
arguments: result,
);
}
},
);
},
), ),
Row( onTap: () {
mainAxisAlignment: MainAxisAlignment.center, scan().then(
crossAxisAlignment: CrossAxisAlignment.center, (String result) {
mainAxisSize: MainAxisSize.max, if (result == 'cancel') {
children: <Widget>[ print('cancel');
Column( } else if (result == 'error') {
crossAxisAlignment: CrossAxisAlignment.center, print('error');
children: <Widget>[ } else if (result == 'access') {
Container( print('access');
width: 70 * _deviceBlockSize, } else {
child: TestResultAddSelectorBox( Provider.of<TestResultsProvider>(
deviceBlockSize: _deviceBlockSize, context,
dataCTRL: testTypeCTRL, listen: false,
dataVals: testTypeVals, ).testCode = result;
label: 'Choose a Test Type', Navigator.pushNamed(
), context,
Routes.formTestResultScreen,
arguments: result,
);
}
},
);
},
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Container(
width: 70 * _deviceBlockSize,
child: TestResultAddSelectorBox(
deviceBlockSize: _deviceBlockSize,
dataCTRL: testTypeCTRL,
dataVals: testTypeVals,
label: 'Choose a Test Type',
), ),
Row( ),
crossAxisAlignment: Row(
CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[ children: <Widget>[
Text( Text(
'OR', 'OR',
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontSize: 7 * _deviceBlockSize, fontSize: 7 * _deviceBlockSize,
),
), ),
SizedBox(
width: 8 * _deviceBlockSize,
),
Container(
width: 50 * _deviceBlockSize,
child: TextFormField(
onChanged: (val) {
if (val != '') {
setState(
() {
testTypeCTRL.text = '';
},
);
} else {
setState(
() {
testTypeCTRL.text =
testTypeVals[0];
},
);
}
},
controller: testCodeCTRL,
decoration: InputDecoration(
isDense: true,
icon: Icon(
FontAwesomeIcons
.sortNumericDown,
),
labelText: 'Enter a Test Code',
labelStyle: TextStyle(
fontSize: 3 * _deviceBlockSize,
),
contentPadding: EdgeInsets.only(
bottom: 5,
top: 5,
),
),
keyboardType:
TextInputType.visiblePassword,
),
),
],
),
SizedBox(
height: 40.0,
),
Container(
padding: EdgeInsets.symmetric(
horizontal: 5 * _deviceBlockSize,
vertical: 10,
), ),
width: 50 * _deviceBlockSize, SizedBox(
decoration: BoxDecoration( width: 8 * _deviceBlockSize,
color: Colors.black,
borderRadius: BorderRadius.circular(7),
), ),
child: Align( Container(
alignment: Alignment.center, width: 50 * _deviceBlockSize,
child: TextButton( child: TextFormField(
child: Text( onChanged: (val) {
'Select', if (val != '') {
style: TextStyle( setState(
color: Colors.white, () {
fontSize: 5 * _deviceBlockSize, testTypeCTRL.text = '';
), },
),
onPressed: () {
if (testCodeCTRL.text != '') {
Provider.of<TestResultsProvider>(
context,
listen: false,
).testCode = testCodeCTRL.text;
Navigator.pushNamed(
context,
Routes.formTestResultScreen,
arguments: testCodeCTRL.text,
); );
} else if (testTypeCTRL.text != } else {
'') { setState(
Provider.of<TestResultsProvider>( () {
context, testTypeCTRL.text =
listen: false, testTypeVals[0];
).testType = testTypeCTRL.text; },
Navigator.pushReplacementNamed(
context,
Routes.formTestResultScreen,
arguments: testTypeCTRL.text,
); );
} }
// print(testCode);
}, },
controller: testCodeCTRL,
decoration: InputDecoration(
isDense: true,
icon: Icon(
FontAwesomeIcons.sortNumericDown,
),
labelText: 'Enter a Test Code',
labelStyle: TextStyle(
fontSize: 3 * _deviceBlockSize,
),
contentPadding: EdgeInsets.only(
bottom: 5,
top: 5,
),
),
keyboardType:
TextInputType.visiblePassword,
), ),
), ),
],
),
SizedBox(
height: 40.0,
),
Container(
padding: EdgeInsets.symmetric(
horizontal: 5 * _deviceBlockSize,
vertical: 10,
), ),
], width: 50 * _deviceBlockSize,
), decoration: BoxDecoration(
SizedBox( color: Colors.black,
width: 5 * _deviceBlockSize, borderRadius: BorderRadius.circular(7),
), ),
], child: Align(
), alignment: Alignment.center,
], child: TextButton(
) child: Text(
: ConnectionErrorBox(); 'Select',
}, style: TextStyle(
), color: Colors.white,
fontSize: 5 * _deviceBlockSize,
),
),
onPressed: () {
if (testCodeCTRL.text != '') {
Provider.of<TestResultsProvider>(
context,
listen: false,
).testCode = testCodeCTRL.text;
Navigator.pushNamed(
context,
Routes.formTestResultScreen,
arguments: testCodeCTRL.text,
);
} else if (testTypeCTRL.text != '') {
Provider.of<TestResultsProvider>(
context,
listen: false,
).testType = testTypeCTRL.text;
Navigator.pushReplacementNamed(
context,
Routes.formTestResultScreen,
arguments: testTypeCTRL.text,
);
}
// print(testCode);
},
),
),
),
],
),
SizedBox(
width: 5 * _deviceBlockSize,
),
],
),
],
)
: ConnectionErrorBox();
},
), ),
), ),
); );
+32 -39
View File
@@ -44,49 +44,42 @@ class _TestDetailsScreenState extends State<TestDetailsScreen> {
final double _devicewidth = _media.size.width; final double _devicewidth = _media.size.width;
final double _deviceBlockSize = _devicewidth / 100; final double _deviceBlockSize = _devicewidth / 100;
// print(datas); // print(datas);
return PopScope( return SafeArea(
canPop: false, child: Scaffold(
onPopInvoked: (didPop) { appBar: AppBar(
if (didPop) return; titleSpacing: -10,
Navigator.of(context).pushNamed(Routes.homePage); title: Text(
}, 'Test Results',
child: SafeArea( style: TextStyle(
child: Scaffold( color: Colors.white,
appBar: AppBar(
titleSpacing: -10,
title: Text(
'Test Results',
style: TextStyle(
color: Colors.white,
),
),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
), ),
), ),
body: Consumer<ConnectivityProvider>( backgroundColor: Colors.black,
builder: (ct, connection, _) { leading: IconButton(
return connection.conStatus != 'offline' icon: Icon(
? isInit Icons.keyboard_arrow_left,
? Center( color: Colors.white,
child: CircularProgressIndicator( size: 35,
color: Colors.black, ),
), onPressed: () => Navigator.of(context).pop(),
)
: DatasBox(
datas: datas!,
deviceBlockSize: _deviceBlockSize,
)
: ConnectionErrorBox();
},
), ),
), ),
body: Consumer<ConnectivityProvider>(
builder: (ct, connection, _) {
return connection.conStatus != 'offline'
? isInit
? Center(
child: CircularProgressIndicator(
color: Colors.black,
),
)
: DatasBox(
datas: datas!,
deviceBlockSize: _deviceBlockSize,
)
: ConnectionErrorBox();
},
),
), ),
); );
} }
+266 -278
View File
@@ -128,299 +128,287 @@ class _TestFilterScreenState extends State<TestFilterScreen> {
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5); // final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
final double _devicewidth = _media.size.width; final double _devicewidth = _media.size.width;
final double _deviceBlockSize = _devicewidth / 100; final double _deviceBlockSize = _devicewidth / 100;
return PopScope( return SafeArea(
canPop: false, child: GestureDetector(
onPopInvoked: (didPop) { onTap: () {
if (didPop) return; FocusManager.instance.primaryFocus?.unfocus();
Navigator.of(context).pushNamed(Routes.homePage); },
// Navigator.pushReplacementNamed( child: Scaffold(
// context, appBar: AppBar(
// Routes.testResultScreen, titleSpacing: -10,
// ); title: Text(
// return true; 'Test Results',
}, style: TextStyle(
child: SafeArea( color: Colors.white,
child: GestureDetector(
onTap: () {
FocusManager.instance.primaryFocus?.unfocus();
},
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text(
'Test Results',
style: TextStyle(
color: Colors.white,
),
),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context).popAndPushNamed(
Routes.testResultScreen,
),
), ),
), ),
body: Consumer<ConnectivityProvider>( backgroundColor: Colors.black,
builder: (ct, connection, _) { leading: IconButton(
return connection.conStatus != 'offline' icon: Icon(
? isInit Icons.keyboard_arrow_left,
? Center( color: Colors.white,
child: CircularProgressIndicator( size: 35,
color: Colors.black, ),
), onPressed: () => Navigator.of(context).popAndPushNamed(
) Routes.testResultScreen,
: Padding( ),
padding: EdgeInsets.all(20), ),
child: ListView( ),
children: <Widget>[ body: Consumer<ConnectivityProvider>(
Text( builder: (ct, connection, _) {
'Filter Test Results', return connection.conStatus != 'offline'
style: TextStyle( ? isInit
fontWeight: FontWeight.w700, ? Center(
fontSize: 5 * _deviceBlockSize, child: CircularProgressIndicator(
), color: Colors.black,
),
)
: Padding(
padding: EdgeInsets.all(20),
child: ListView(
children: <Widget>[
Text(
'Filter Test Results',
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
), ),
SizedBox( ),
height: 20, SizedBox(
), height: 20,
Row( ),
children: [ Row(
Flexible( children: [
flex: 8, Flexible(
child: TextFormField( flex: 8,
controller: idCTRL, child: TextFormField(
decoration: InputDecoration( controller: idCTRL,
icon: Icon( decoration: InputDecoration(
FontAwesomeIcons.sortNumericDown, icon: Icon(
size: 6 * _deviceBlockSize, FontAwesomeIcons.sortNumericDown,
), size: 6 * _deviceBlockSize,
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'ID',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
), ),
style: TextStyle( labelStyle: TextStyle(
fontWeight: FontWeight.w700, fontWeight: FontWeight.w100,
fontSize: 5 * _deviceBlockSize, fontSize: 4 * _deviceBlockSize,
), ),
keyboardType: TextInputType.text, labelText: 'ID',
textInputAction: TextInputAction.next, isDense: true,
// onFieldSubmitted: (_) { contentPadding: EdgeInsets.symmetric(
// FocusScope.of(context) vertical: 2, horizontal: 3),
// .requestFocus(_cycleNumberFocusNode);
// },
), ),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
keyboardType: TextInputType.text,
textInputAction: TextInputAction.next,
// onFieldSubmitted: (_) {
// FocusScope.of(context)
// .requestFocus(_cycleNumberFocusNode);
// },
), ),
Flexible( ),
flex: 1, Flexible(
child: InkWell( flex: 1,
onTap: () { child: InkWell(
scan().then( onTap: () {
(String result) { scan().then(
if (result == 'cancel') { (String result) {
print('cancel'); if (result == 'cancel') {
} else if (result == 'error') { print('cancel');
print('error'); } else if (result == 'error') {
} else if (result == 'access') { print('error');
print('access'); } else if (result == 'access') {
} else { print('access');
print(result); } else {
idCTRL.text = result; print(result);
// Navigator.of(context).pushNamed( idCTRL.text = result;
// CycleDetailScreen.route, // Navigator.of(context).pushNamed(
// arguments: result, // CycleDetailScreen.route,
// ); // arguments: result,
} // );
}, }
); },
}, );
child: Container( },
padding: EdgeInsets.all(8), child: Container(
decoration: BoxDecoration( padding: EdgeInsets.all(8),
shape: BoxShape.circle, decoration: BoxDecoration(
color: Colors.black, shape: BoxShape.circle,
), color: Colors.black,
child: Icon(
Icons.qr_code_scanner,
size: 5 * _deviceBlockSize,
color: Colors.white,
),
), ),
), child: Icon(
), Icons.qr_code_scanner,
], size: 5 * _deviceBlockSize,
),
SizedBox(
height: 25,
),
TestResultFilterSelectorBox(
deviceBlockSize: _deviceBlockSize,
dataCTRL: labelIdCTRL,
dataVals: labelIDVals,
label: 'Label ID',
),
SizedBox(
height: 25,
),
TextFormField(
controller: usernameCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Username',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
keyboardType: TextInputType.visiblePassword,
textInputAction: TextInputAction.next,
// onFieldSubmitted: (_) {
// FocusScope.of(context)
// .requestFocus(_cycleNumberFocusNode);
// },
),
SizedBox(
height: 25,
),
TestResultFilterSelectorBox(
deviceBlockSize: _deviceBlockSize,
dataCTRL: testTypeCTRL,
dataVals: testTypeVals,
label: 'Test Type',
),
SizedBox(
height: 25,
),
userData['roles']?.contains('User') ?? false
? Container()
: Column(
children: [
TestResultFilterSelectorBox(
deviceBlockSize: _deviceBlockSize,
dataCTRL: hospitalCTRL,
dataVals: hospitalVals,
label: 'Hospital',
),
SizedBox(
height: 25,
),
],
),
TestResultFilterDatePicker(
dateCTRL: fDateCTRL,
deviceBlockSize: _deviceBlockSize,
label: 'Date From',
),
SizedBox(
height: 25,
),
TestResultFilterDatePicker(
dateCTRL: uDateCTRL,
deviceBlockSize: _deviceBlockSize,
label: 'Date Until',
),
SizedBox(
height: 70,
),
InkWell(
onTap: () {
Provider.of<TestResultsProvider>(context,
listen: false)
.setFilters(
idCTRL.text,
labelIdCTRL.text != ''
? labelIdCTRL.text
: '',
usernameCTRL.text,
testTypeCTRL.text != ''
? testTypes![testTypeCTRL.text]
: '',
hospitalCTRL.text != ''
? hospitals[hospitalCTRL.text]
: '',
fDateCTRL.text,
uDateCTRL.text,
);
// showDialog(
// context: context,
// builder: (ctx) => AlertDialog(
// content: Text('Filters changed.'),
// actions: <Widget>[
// TextButton(
// onPressed: () {
// Navigator.of(ctx).pop();
// // Navigator.of(context).pop();
// },
// child: Text('Ok'),
// )
// ],
// ),
// ).then(
// (_) =>
// Navigator.of(context).popAndPushNamed(
// Routes.testResultScreen,
// ),
// );
Navigator.of(context).popAndPushNamed(
Routes.testResultScreen,
);
},
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 5 * _deviceBlockSize,
vertical: 10,
),
// margin:
// EdgeInsets.symmetric(horizontal: 35, vertical: 15),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Colors.black, Colors.black87],
),
borderRadius: BorderRadius.circular(7),
),
child: Align(
alignment: Alignment.center,
child: Text(
'Filter',
style: TextStyle(
color: Colors.white, color: Colors.white,
fontSize: 5 * _deviceBlockSize,
), ),
), ),
), ),
), ),
],
),
SizedBox(
height: 25,
),
TestResultFilterSelectorBox(
deviceBlockSize: _deviceBlockSize,
dataCTRL: labelIdCTRL,
dataVals: labelIDVals,
label: 'Label ID',
),
SizedBox(
height: 25,
),
TextFormField(
controller: usernameCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Username',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
), ),
SizedBox( style: TextStyle(
height: 70, fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
), ),
// DropDownBox(values: ['Washer ID']), keyboardType: TextInputType.visiblePassword,
], textInputAction: TextInputAction.next,
), // onFieldSubmitted: (_) {
) // FocusScope.of(context)
: ConnectionErrorBox(); // .requestFocus(_cycleNumberFocusNode);
}, // },
), ),
SizedBox(
height: 25,
),
TestResultFilterSelectorBox(
deviceBlockSize: _deviceBlockSize,
dataCTRL: testTypeCTRL,
dataVals: testTypeVals,
label: 'Test Type',
),
SizedBox(
height: 25,
),
userData['roles']?.contains('User') ?? false
? Container()
: Column(
children: [
TestResultFilterSelectorBox(
deviceBlockSize: _deviceBlockSize,
dataCTRL: hospitalCTRL,
dataVals: hospitalVals,
label: 'Hospital',
),
SizedBox(
height: 25,
),
],
),
TestResultFilterDatePicker(
dateCTRL: fDateCTRL,
deviceBlockSize: _deviceBlockSize,
label: 'Date From',
),
SizedBox(
height: 25,
),
TestResultFilterDatePicker(
dateCTRL: uDateCTRL,
deviceBlockSize: _deviceBlockSize,
label: 'Date Until',
),
SizedBox(
height: 70,
),
InkWell(
onTap: () {
Provider.of<TestResultsProvider>(context,
listen: false)
.setFilters(
idCTRL.text,
labelIdCTRL.text != ''
? labelIdCTRL.text
: '',
usernameCTRL.text,
testTypeCTRL.text != ''
? testTypes![testTypeCTRL.text]
: '',
hospitalCTRL.text != ''
? hospitals[hospitalCTRL.text]
: '',
fDateCTRL.text,
uDateCTRL.text,
);
// showDialog(
// context: context,
// builder: (ctx) => AlertDialog(
// content: Text('Filters changed.'),
// actions: <Widget>[
// TextButton(
// onPressed: () {
// Navigator.of(ctx).pop();
// // Navigator.of(context).pop();
// },
// child: Text('Ok'),
// )
// ],
// ),
// ).then(
// (_) =>
// Navigator.of(context).popAndPushNamed(
// Routes.testResultScreen,
// ),
// );
Navigator.of(context).popAndPushNamed(
Routes.testResultScreen,
);
},
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 5 * _deviceBlockSize,
vertical: 10,
),
// margin:
// EdgeInsets.symmetric(horizontal: 35, vertical: 15),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Colors.black, Colors.black87],
),
borderRadius: BorderRadius.circular(7),
),
child: Align(
alignment: Alignment.center,
child: Text(
'Filter',
style: TextStyle(
color: Colors.white,
fontSize: 5 * _deviceBlockSize,
),
),
),
),
),
SizedBox(
height: 70,
),
// DropDownBox(values: ['Washer ID']),
],
),
)
: ConnectionErrorBox();
},
), ),
), ),
), ),
+84 -96
View File
@@ -96,105 +96,93 @@ class _FormPageState extends State<FormPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return PopScope( return SafeArea(
canPop: false, child: Scaffold(
onPopInvoked: (didPop) { appBar: AppBar(
if (didPop) return; centerTitle: true,
Navigator.of(context).pushNamed(Routes.homePage); title: Text(
// Navigator.pushReplacementNamed( 'Add Test Result',
// context, style: TextStyle(
// Routes.testResultAddScreen, color: Colors.white,
// );
// return true;
},
child: SafeArea(
child: Scaffold(
appBar: AppBar(
centerTitle: true,
title: Text(
'Add Test Result',
style: TextStyle(
color: Colors.white,
),
),
backgroundColor: Colors.black,
actions: <Widget>[
_isLoadingButton
? Center(
child: CircularProgressIndicator(
color: Colors.white,
),
)
: IconButton(
icon: Icon(
Icons.save,
color: Colors.white,
),
onPressed: () {
_saveForm();
},
)
],
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () {
Navigator.of(context).popAndPushNamed(Routes.testResultScreen);
},
), ),
), ),
body: SingleChildScrollView( backgroundColor: Colors.black,
child: Column( actions: <Widget>[
children: <Widget>[ _isLoadingButton
_isLoading ? Center(
? Center( child: CircularProgressIndicator(
child: CircularProgressIndicator( color: Colors.white,
color: Colors.black, ),
), )
) : IconButton(
: Form( icon: Icon(
key: _form, Icons.save,
child: Consumer<Inputs>( color: Colors.white,
builder: (context, inputs, _) { ),
formInputs = inputs.inputItems; onPressed: () {
print(formInputs); _saveForm();
return formInputs.length != 0 },
? FormCreator( )
form: formInputs, ],
onChanged: (value) { leading: IconButton(
formInputs = value; icon: Icon(
}, Icons.keyboard_arrow_left,
) color: Colors.white,
: Center( size: 35,
child: Text('Something went wrong!!!'),
);
},
),
),
// https://www.cssd-doc.com/api/GetInfo
// InkWell(
// onTap: () {
// _saveForm();
// },
// child: Container(
// padding: EdgeInsets.symmetric(horizontal: 60, vertical: 15),
// margin: EdgeInsets.symmetric(vertical: 20, horizontal: 50),
// decoration: BoxDecoration(
// gradient: LinearGradient(colors: [Colors.blue, Colors.green]),
// borderRadius: BorderRadius.circular(10),
// ),
// child: Text(
// 'Save',
// style: TextStyle(color: Colors.white, fontSize: 17),
// textAlign: TextAlign.center,
// ),
// ),
// ),
],
), ),
onPressed: () {
Navigator.of(context).popAndPushNamed(Routes.testResultScreen);
},
),
),
body: SingleChildScrollView(
child: Column(
children: <Widget>[
_isLoading
? Center(
child: CircularProgressIndicator(
color: Colors.black,
),
)
: Form(
key: _form,
child: Consumer<Inputs>(
builder: (context, inputs, _) {
formInputs = inputs.inputItems;
print(formInputs);
return formInputs.length != 0
? FormCreator(
form: formInputs,
onChanged: (value) {
formInputs = value;
},
)
: Center(
child: Text('Something went wrong!!!'),
);
},
),
),
// https://www.cssd-doc.com/api/GetInfo
// InkWell(
// onTap: () {
// _saveForm();
// },
// child: Container(
// padding: EdgeInsets.symmetric(horizontal: 60, vertical: 15),
// margin: EdgeInsets.symmetric(vertical: 20, horizontal: 50),
// decoration: BoxDecoration(
// gradient: LinearGradient(colors: [Colors.blue, Colors.green]),
// borderRadius: BorderRadius.circular(10),
// ),
// child: Text(
// 'Save',
// style: TextStyle(color: Colors.white, fontSize: 17),
// textAlign: TextAlign.center,
// ),
// ),
// ),
],
), ),
), ),
), ),
+1 -1
View File
@@ -128,7 +128,7 @@ class _TestResultScreenState extends State<TestResultScreen> {
InkWell( InkWell(
onTap: () { onTap: () {
Navigator.of(context) Navigator.of(context)
.popAndPushNamed(Routes.testFilterScreen); .pushNamed(Routes.testFilterScreen);
}, },
child: Container( child: Container(
padding: EdgeInsets.all(7), padding: EdgeInsets.all(7),
+142 -149
View File
@@ -27,173 +27,166 @@ class _TestScanScreenState extends State<TestScanScreen> {
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5); // final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
final double _devicewidth = _media.size.width; final double _devicewidth = _media.size.width;
final double _deviceBlockSize = _devicewidth / 100; final double _deviceBlockSize = _devicewidth / 100;
return PopScope( return SafeArea(
canPop: false, child: Scaffold(
onPopInvoked: (didPop) { appBar: AppBar(
if (didPop) return; titleSpacing: -10,
Navigator.of(context).pushNamed(Routes.homePage); title: Text(
}, 'Test Results',
child: SafeArea( style: TextStyle(
child: Scaffold( color: Colors.white,
appBar: AppBar(
titleSpacing: -10,
title: Text(
'Test Results',
style: TextStyle(
color: Colors.white,
),
),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
), ),
), ),
body: Consumer<ConnectivityProvider>( backgroundColor: Colors.black,
builder: (ct, connection, _) { leading: IconButton(
return connection.conStatus != 'offline' icon: Icon(
? ListView( Icons.keyboard_arrow_left,
padding: EdgeInsets.symmetric(horizontal: 20), color: Colors.white,
children: <Widget>[ size: 35,
Container( ),
padding: EdgeInsets.only(top: 30), onPressed: () => Navigator.of(context).pop(),
child: Text( ),
'Looking for a Test Result?', ),
textAlign: TextAlign.left, body: Consumer<ConnectivityProvider>(
style: TextStyle( builder: (ct, connection, _) {
color: Colors.black, return connection.conStatus != 'offline'
fontSize: 5.5 * _deviceBlockSize, ? ListView(
fontWeight: FontWeight.w700, padding: EdgeInsets.symmetric(horizontal: 20),
letterSpacing: 3, children: <Widget>[
), Container(
padding: EdgeInsets.only(top: 30),
child: Text(
'Looking for a Test Result?',
textAlign: TextAlign.left,
style: TextStyle(
color: Colors.black,
fontSize: 5.5 * _deviceBlockSize,
fontWeight: FontWeight.w700,
letterSpacing: 3,
), ),
), ),
GestureDetector( ),
child: Container( GestureDetector(
margin: EdgeInsets.symmetric(vertical: 10), child: Container(
height: 200, margin: EdgeInsets.symmetric(vertical: 10),
decoration: BoxDecoration(border: Border.all()), height: 200,
child: Center( decoration: BoxDecoration(border: Border.all()),
child: Text( child: Center(
'Please Scan The Test Result Barcode', child: Text(
style: TextStyle( 'Please Scan The Test Result Barcode',
color: Colors.black, style: TextStyle(
fontSize: 5 * _deviceBlockSize, color: Colors.black,
fontWeight: FontWeight.w100, fontSize: 5 * _deviceBlockSize,
letterSpacing: 3,
),
textAlign: TextAlign.center,
),
),
),
onTap: () {
scan().then(
(String result) {
if (result == 'cancel') {
print('cancel');
} else if (result == 'error') {
print('error');
} else if (result == 'access') {
print('access');
} else {
launch(
'https://cssd-doc.com/Show/TestResult/$result',
);
// Navigator.of(context).pushNamed(
// Routes.cycleDetailScreen,
// arguments: result,
// );
}
},
);
},
),
SizedBox(
height: 10.0,
),
Form(
key: _form,
child: TextFormField(
validator: (val) {
if (val!.isEmpty) {
return 'Id required!!';
}
return null;
},
controller: idCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100, fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize, letterSpacing: 3,
),
isDense: true,
labelText: 'Or enter a Test Result ID',
contentPadding: EdgeInsets.symmetric(
vertical: 2,
horizontal: 3,
),
focusedBorder: UnderlineInputBorder(
// borderRadius: BorderRadius.only(Radius.circular(4)),
borderSide: BorderSide(
color: Colors.grey,
),
), ),
textAlign: TextAlign.center,
), ),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
keyboardType: TextInputType.number,
), ),
), ),
SizedBox( onTap: () {
height: 70, scan().then(
), (String result) {
InkWell( if (result == 'cancel') {
onTap: () { print('cancel');
if (!_form.currentState!.validate()) { } else if (result == 'error') {
return; print('error');
} else if (result == 'access') {
print('access');
} else {
launch(
'https://cssd-doc.com/Show/TestResult/$result',
);
// Navigator.of(context).pushNamed(
// Routes.cycleDetailScreen,
// arguments: result,
// );
}
},
);
},
),
SizedBox(
height: 10.0,
),
Form(
key: _form,
child: TextFormField(
validator: (val) {
if (val!.isEmpty) {
return 'Id required!!';
} }
launch( return null;
'https://cssd-doc.com/Show/TestResult/${idCTRL.text}',
);
}, },
child: Container( controller: idCTRL,
padding: EdgeInsets.symmetric( decoration: InputDecoration(
horizontal: 5 * _deviceBlockSize, icon: Icon(
vertical: 10, FontAwesomeIcons.sortNumericDown,
size: 6 * _deviceBlockSize,
), ),
decoration: BoxDecoration( labelStyle: TextStyle(
gradient: LinearGradient( fontWeight: FontWeight.w100,
colors: [Colors.black, Colors.black87], fontSize: 4 * _deviceBlockSize,
),
isDense: true,
labelText: 'Or enter a Test Result ID',
contentPadding: EdgeInsets.symmetric(
vertical: 2,
horizontal: 3,
),
focusedBorder: UnderlineInputBorder(
// borderRadius: BorderRadius.only(Radius.circular(4)),
borderSide: BorderSide(
color: Colors.grey,
), ),
borderRadius: BorderRadius.circular(7),
), ),
child: Align( ),
alignment: Alignment.center, style: TextStyle(
child: Text( fontWeight: FontWeight.w700,
'Search', fontSize: 5 * _deviceBlockSize,
style: TextStyle( ),
color: Colors.white, keyboardType: TextInputType.number,
fontSize: 5 * _deviceBlockSize, ),
), ),
SizedBox(
height: 70,
),
InkWell(
onTap: () {
if (!_form.currentState!.validate()) {
return;
}
launch(
'https://cssd-doc.com/Show/TestResult/${idCTRL.text}',
);
},
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 5 * _deviceBlockSize,
vertical: 10,
),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Colors.black, Colors.black87],
),
borderRadius: BorderRadius.circular(7),
),
child: Align(
alignment: Alignment.center,
child: Text(
'Search',
style: TextStyle(
color: Colors.white,
fontSize: 5 * _deviceBlockSize,
), ),
), ),
), ),
), ),
], ),
) ],
: ConnectionErrorBox(); )
}, : ConnectionErrorBox();
), },
), ),
), ),
); );
+1 -1
View File
@@ -34,7 +34,7 @@ class ResultBanner extends StatelessWidget {
InkWell( InkWell(
customBorder: CircleBorder(), customBorder: CircleBorder(),
onTap: () { onTap: () {
Navigator.of(context).popAndPushNamed(push); Navigator.of(context).pushNamed(push);
}, },
child: Container( child: Container(
padding: EdgeInsets.all(5), padding: EdgeInsets.all(5),
@@ -41,7 +41,7 @@ class LabelFloatingButtons extends StatelessWidget {
InkWell( InkWell(
customBorder: CircleBorder(), customBorder: CircleBorder(),
onTap: () { onTap: () {
Navigator.of(context).pushReplacementNamed(Routes.labelAddScreen); Navigator.of(context).pushNamed(Routes.labelAddScreen);
}, },
child: Container( child: Container(
padding: EdgeInsets.all(5), padding: EdgeInsets.all(5),
@@ -41,8 +41,7 @@ class TestResultFloatingButton extends StatelessWidget {
InkWell( InkWell(
customBorder: CircleBorder(), customBorder: CircleBorder(),
onTap: () { onTap: () {
Navigator.of(context) Navigator.of(context).pushNamed(Routes.testResultAddScreen);
.pushReplacementNamed(Routes.testResultAddScreen);
}, },
child: Container( child: Container(
padding: EdgeInsets.all(_deviceBlockSize), padding: EdgeInsets.all(_deviceBlockSize),