mirror of
https://git.meshkee.com/applications/cssd.git
synced 2026-10-12 17:48:55 +03:30
beta commit
This commit is contained in:
@@ -1,251 +1,212 @@
|
||||
import 'package:barcode_scan2/barcode_scan2.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../../providers/cycles.dart';
|
||||
|
||||
class CycleAddLabelBox extends StatelessWidget {
|
||||
const CycleAddLabelBox({
|
||||
Key key,
|
||||
@required double deviceBlockSize,
|
||||
@required this.labelValues,
|
||||
@required this.labelVals,
|
||||
@required this.initialLabelValue,
|
||||
@required this.index,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final double _deviceBlockSize;
|
||||
final TextEditingController labelValues;
|
||||
final List<String> labelVals;
|
||||
final String initialLabelValue;
|
||||
final int index;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
// color: Colors.blue,
|
||||
height: 150,
|
||||
child: Stack(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: EdgeInsets.only(
|
||||
right: 10,
|
||||
bottom: 30,
|
||||
left: 10,
|
||||
top: 10,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
left: BorderSide(color: Colors.black, width: 2),
|
||||
right: BorderSide(color: Colors.grey),
|
||||
bottom: BorderSide(color: Colors.grey),
|
||||
top: BorderSide(color: Colors.grey),
|
||||
),
|
||||
),
|
||||
height: 120,
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 5),
|
||||
// height: 65,
|
||||
child: Row(
|
||||
// width: double.infinity,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Icon(
|
||||
FontAwesomeIcons.alignLeft,
|
||||
color: Colors.grey,
|
||||
size: 7 * _deviceBlockSize,
|
||||
),
|
||||
SizedBox(
|
||||
width: 4 * _deviceBlockSize,
|
||||
),
|
||||
Expanded(
|
||||
// width: MediaQuery.of(context).size.width - 70,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
width: _deviceBlockSize,
|
||||
),
|
||||
Text(
|
||||
'Select Labels Included',
|
||||
style: TextStyle(
|
||||
fontSize: 3.5 * _deviceBlockSize,
|
||||
color: Colors.grey,
|
||||
fontWeight: FontWeight.w100,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: MediaQuery.of(context).size.width -
|
||||
(40 * _deviceBlockSize),
|
||||
// height: 30,
|
||||
child: DropdownButtonFormField(
|
||||
decoration: InputDecoration(
|
||||
contentPadding: EdgeInsets.only(
|
||||
left: _deviceBlockSize,
|
||||
),
|
||||
border: InputBorder.none,
|
||||
),
|
||||
iconSize: 7 * _deviceBlockSize,
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.angleDown,
|
||||
color: Colors.black,
|
||||
),
|
||||
isExpanded: true,
|
||||
hint: Container(
|
||||
// width: 100,
|
||||
height: 70,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 0),
|
||||
child: TextFormField(
|
||||
controller: labelValues,
|
||||
decoration: InputDecoration(
|
||||
contentPadding: EdgeInsets.only(
|
||||
bottom: 12,
|
||||
),
|
||||
isDense: true,
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Colors.black,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
isDense: true,
|
||||
items: labelVals.map((val) {
|
||||
return new DropdownMenuItem<String>(
|
||||
value: val,
|
||||
child: Container(
|
||||
child: Text(
|
||||
val,
|
||||
style: TextStyle(
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: (val) {
|
||||
Provider.of<CyclesProvider>(context,
|
||||
listen: false)
|
||||
.changeLabelVal(val, index);
|
||||
// setState(() {
|
||||
// labelValues[index]
|
||||
// .text = val;
|
||||
// });
|
||||
},
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
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);
|
||||
Provider.of<CyclesProvider>(context,
|
||||
listen: false)
|
||||
.changeLabelVal(result, index);
|
||||
// Navigator.of(context).pushNamed(
|
||||
// CycleDetailScreen.route,
|
||||
// arguments: result,
|
||||
// );
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.black,
|
||||
),
|
||||
child: Icon(
|
||||
FontAwesomeIcons.barcode,
|
||||
size: 5 * _deviceBlockSize,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
]),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
bottom: 15,
|
||||
right: 0,
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
Provider.of<CyclesProvider>(context).addLabelVal();
|
||||
// setState(
|
||||
// () {
|
||||
// curLabelVal += 1;
|
||||
// TextEditingController lbl =
|
||||
// new TextEditingController();
|
||||
// lbl.text = initialLabelValue;
|
||||
// labelValues.add(lbl);
|
||||
// },
|
||||
// );
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(3),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.deepOrange,
|
||||
),
|
||||
child: Icon(
|
||||
Icons.add,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Future<String> scan() async {
|
||||
try {
|
||||
var barcode = await BarcodeScanner.scan();
|
||||
if (barcode.type.name == 'Cancelled') {
|
||||
return 'cancel';
|
||||
} else if (barcode.type.name == 'Failed') {
|
||||
return 'error';
|
||||
}
|
||||
try {
|
||||
var id = barcode.rawContent.contains('www.cssd-doc.com')
|
||||
? barcode.rawContent.split('/')[5]
|
||||
: barcode.rawContent;
|
||||
|
||||
return id;
|
||||
} catch (_) {
|
||||
return 'null';
|
||||
}
|
||||
} on PlatformException catch (_) {
|
||||
return 'access';
|
||||
} catch (_) {
|
||||
return 'error';
|
||||
}
|
||||
}
|
||||
}
|
||||
import 'package:cssd/utils/scan.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../../providers/cycles.dart';
|
||||
|
||||
class AddLabelBox extends StatelessWidget {
|
||||
const AddLabelBox({
|
||||
Key? key,
|
||||
required double deviceBlockSize,
|
||||
required this.values,
|
||||
required this.vals,
|
||||
required this.initialLabelValue,
|
||||
required this.index,
|
||||
required this.text,
|
||||
this.iconColor,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final double _deviceBlockSize;
|
||||
final TextEditingController values;
|
||||
final List<String> vals;
|
||||
final String initialLabelValue;
|
||||
final int index;
|
||||
final String text;
|
||||
final Color? iconColor;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
height: 150,
|
||||
child: Stack(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: EdgeInsets.only(
|
||||
right: 10,
|
||||
bottom: 25,
|
||||
left: 10,
|
||||
top: 10,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
left: BorderSide(color: Colors.black, width: 2),
|
||||
right: BorderSide(color: Colors.grey),
|
||||
bottom: BorderSide(color: Colors.grey),
|
||||
top: BorderSide(color: Colors.grey),
|
||||
),
|
||||
),
|
||||
height: 120,
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 5),
|
||||
// height: 65,
|
||||
child: Row(
|
||||
// width: double.infinity,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Icon(
|
||||
FontAwesomeIcons.alignLeft,
|
||||
color: Colors.grey,
|
||||
size: 7 * _deviceBlockSize,
|
||||
),
|
||||
SizedBox(
|
||||
width: 4 * _deviceBlockSize,
|
||||
),
|
||||
Expanded(
|
||||
// width: MediaQuery.of(context).size.width - 70,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
width: _deviceBlockSize,
|
||||
),
|
||||
Text(
|
||||
text,
|
||||
style: TextStyle(
|
||||
fontSize: 3.5 * _deviceBlockSize,
|
||||
color: Colors.grey,
|
||||
fontWeight: FontWeight.w100,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: MediaQuery.of(context).size.width -
|
||||
(40 * _deviceBlockSize),
|
||||
// height: 30,
|
||||
child: DropdownButtonFormField(
|
||||
decoration: InputDecoration(
|
||||
contentPadding: EdgeInsets.only(
|
||||
left: _deviceBlockSize,
|
||||
),
|
||||
border: InputBorder.none,
|
||||
),
|
||||
iconSize: 7 * _deviceBlockSize,
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.angleDown,
|
||||
color: Colors.black,
|
||||
),
|
||||
isExpanded: true,
|
||||
hint: Container(
|
||||
// width: 100,
|
||||
height: 70,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 0),
|
||||
child: TextFormField(
|
||||
controller: values,
|
||||
decoration: InputDecoration(
|
||||
contentPadding: EdgeInsets.only(
|
||||
bottom: 12,
|
||||
),
|
||||
isDense: true,
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Colors.black,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
isDense: true,
|
||||
items: vals.map((val) {
|
||||
return new DropdownMenuItem<String>(
|
||||
value: val,
|
||||
child: Container(
|
||||
child: Text(
|
||||
val,
|
||||
style: TextStyle(
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: (val) {
|
||||
Provider.of<CyclesProvider>(context,
|
||||
listen: false)
|
||||
.changeLabelVal(val!, index);
|
||||
},
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
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);
|
||||
Provider.of<CyclesProvider>(context,
|
||||
listen: false)
|
||||
.changeLabelVal(result, index);
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
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,
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
]),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
bottom: 15,
|
||||
right: 0,
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
Provider.of<CyclesProvider>(context).addLabelVal();
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(3),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: iconColor,
|
||||
),
|
||||
child: Icon(
|
||||
Icons.add,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
import 'package:cssd/config/colors.dart';
|
||||
import 'package:cssd/providers/cycles.dart';
|
||||
|
||||
import '../../../config/routes.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class CycleUpdateButton extends StatelessWidget {
|
||||
const CycleUpdateButton({
|
||||
Key? key,
|
||||
required GlobalKey<FormState> form,
|
||||
required this.id,
|
||||
required this.descriptionCTRL,
|
||||
required this.cycleNumberCTRL,
|
||||
required this.dateCTRL,
|
||||
// required this.labelValue,
|
||||
required this.striizerIdCTRL,
|
||||
required double deviceBlockSize,
|
||||
}) : _form = form,
|
||||
_deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final GlobalKey<FormState> _form;
|
||||
final String id;
|
||||
final TextEditingController descriptionCTRL;
|
||||
final TextEditingController cycleNumberCTRL;
|
||||
final TextEditingController dateCTRL;
|
||||
// final TextEditingController labelValue;
|
||||
final TextEditingController striizerIdCTRL;
|
||||
final double _deviceBlockSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
if (!_form.currentState!.validate()) {
|
||||
return;
|
||||
}
|
||||
// List<String> labels = [];
|
||||
// for (TextEditingController label in labelValue) {
|
||||
// labels.add(label.text);
|
||||
// }
|
||||
Provider.of<CyclesProvider>(context, listen: false).updateCycleResult(
|
||||
id,
|
||||
striizerIdCTRL.text,
|
||||
cycleNumberCTRL.text,
|
||||
// labelValue.text,
|
||||
dateCTRL.text,
|
||||
descriptionCTRL.text,
|
||||
);
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
content: Text('Cycle updated.'),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(ctx).pop();
|
||||
},
|
||||
child: Text('Ok'),
|
||||
)
|
||||
],
|
||||
),
|
||||
).then((_) {
|
||||
Navigator.of(context).pushReplacementNamed(Routes.cycleResultScreen);
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 5 * _deviceBlockSize,
|
||||
vertical: 10,
|
||||
),
|
||||
// margin:
|
||||
// EdgeInsets.symmetric(horizontal: 35, vertical: 15),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [kPink, kPinkSub],
|
||||
),
|
||||
borderRadius: BorderRadius.circular(7),
|
||||
),
|
||||
child: Align(
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
'Update',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,77 +1,79 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
class CycleAddDatePicker extends StatefulWidget {
|
||||
const CycleAddDatePicker({
|
||||
Key key,
|
||||
@required this.dateCTRL,
|
||||
@required double deviceBlockSize,
|
||||
}) : _deviceBlockSize = deviceBlockSize, super(key: key);
|
||||
|
||||
final TextEditingController dateCTRL;
|
||||
final double _deviceBlockSize;
|
||||
|
||||
@override
|
||||
_CycleAddDatePickerState createState() => _CycleAddDatePickerState();
|
||||
}
|
||||
|
||||
class _CycleAddDatePickerState extends State<CycleAddDatePicker> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () async {
|
||||
var res = await showDatePicker(
|
||||
context: context,
|
||||
initialDate: DateTime.now(),
|
||||
firstDate: DateTime(2010, 1),
|
||||
lastDate: DateTime(2101),
|
||||
);
|
||||
if (res != null) {
|
||||
// dateTimeFrom = res;
|
||||
setState(
|
||||
() {
|
||||
widget.dateCTRL.text = DateFormat('y-M-d').format(res);
|
||||
// dateValue = DateFormat('y-M-d').format(
|
||||
// dateTimeFrom,
|
||||
// ); // baraye tavize makane gharar giri baraye api
|
||||
},
|
||||
);
|
||||
}
|
||||
},
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: TextField(
|
||||
enabled: false,
|
||||
controller: widget.dateCTRL,
|
||||
decoration: InputDecoration(
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.alignLeft,
|
||||
size: 7 * widget._deviceBlockSize,
|
||||
),
|
||||
labelStyle: TextStyle(
|
||||
fontWeight: FontWeight.w100,
|
||||
fontSize: 4 * widget._deviceBlockSize,
|
||||
),
|
||||
labelText: 'Date',
|
||||
isDense: true,
|
||||
contentPadding: EdgeInsets.only(
|
||||
bottom: 7,
|
||||
right: 3,
|
||||
left: 3,
|
||||
),
|
||||
// border: InputBorder.none,
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * widget._deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
Icon(FontAwesomeIcons.angleDown)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
class CycleAddDatePicker extends StatefulWidget {
|
||||
const CycleAddDatePicker({
|
||||
Key? key,
|
||||
required this.dateCTRL,
|
||||
required double deviceBlockSize,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final TextEditingController dateCTRL;
|
||||
final double _deviceBlockSize;
|
||||
|
||||
@override
|
||||
_CycleAddDatePickerState createState() => _CycleAddDatePickerState();
|
||||
}
|
||||
|
||||
class _CycleAddDatePickerState extends State<CycleAddDatePicker> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () async {
|
||||
var res = await showDatePicker(
|
||||
context: context,
|
||||
initialDate: DateTime.now(),
|
||||
firstDate: DateTime(2010, 1),
|
||||
lastDate: DateTime(2101),
|
||||
);
|
||||
if (res != null) {
|
||||
// dateTimeFrom = res;
|
||||
setState(
|
||||
() {
|
||||
widget.dateCTRL.text = DateFormat('y-M-d').format(res);
|
||||
// dateValue = DateFormat('y-M-d').format(
|
||||
// dateTimeFrom,
|
||||
// ); // baraye tavize makane gharar giri baraye api
|
||||
},
|
||||
);
|
||||
}
|
||||
},
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: TextField(
|
||||
enabled: false,
|
||||
controller: widget.dateCTRL,
|
||||
decoration: InputDecoration(
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.alignLeft,
|
||||
size: 7 * widget._deviceBlockSize,
|
||||
),
|
||||
labelStyle: TextStyle(
|
||||
fontWeight: FontWeight.w100,
|
||||
fontSize: 4 * widget._deviceBlockSize,
|
||||
),
|
||||
labelText: 'Date',
|
||||
isDense: true,
|
||||
contentPadding: EdgeInsets.only(
|
||||
bottom: 7,
|
||||
right: 3,
|
||||
left: 3,
|
||||
),
|
||||
// border: InputBorder.none,
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * widget._deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
Icon(FontAwesomeIcons.angleDown)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,91 +1,92 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../../config/routes.dart';
|
||||
import '../../../providers/cycles.dart';
|
||||
|
||||
class CycleAddSaveButton extends StatelessWidget {
|
||||
const CycleAddSaveButton({
|
||||
Key key,
|
||||
@required GlobalKey<FormState> form,
|
||||
@required this.labelValues,
|
||||
@required this.cycleNumberCTRL,
|
||||
@required this.dateValue,
|
||||
@required this.descriptionCTRL,
|
||||
@required this.striizerIdCTRL,
|
||||
@required double deviceBlockSize,
|
||||
}) : _form = form,
|
||||
_deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final GlobalKey<FormState> _form;
|
||||
final List<TextEditingController> labelValues;
|
||||
final TextEditingController cycleNumberCTRL;
|
||||
final String dateValue;
|
||||
final TextEditingController descriptionCTRL;
|
||||
final TextEditingController striizerIdCTRL;
|
||||
final double _deviceBlockSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
if (!_form.currentState.validate()) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<String> labels = [];
|
||||
for (TextEditingController label in labelValues) {
|
||||
labels.add(label.text);
|
||||
}
|
||||
Provider.of<CyclesProvider>(context).createCycleResult(
|
||||
cycleNumberCTRL.text,
|
||||
dateValue,
|
||||
labels,
|
||||
descriptionCTRL.text,
|
||||
striizerIdCTRL.text,
|
||||
);
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
content: Text('Cycle added.'),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(ctx).pop();
|
||||
},
|
||||
child: Text('Ok'),
|
||||
)
|
||||
],
|
||||
),
|
||||
).then((_) {
|
||||
Navigator.of(context).pushReplacementNamed(Routes.cycleResultScreen);
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 5 * _deviceBlockSize,
|
||||
vertical: 10,
|
||||
),
|
||||
// margin:
|
||||
// EdgeInsets.symmetric(horizontal: 35, vertical: 15),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [Colors.red, Colors.orange],
|
||||
),
|
||||
borderRadius: BorderRadius.circular(7),
|
||||
),
|
||||
child: Align(
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
'SAVE',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
import 'package:cssd/config/colors.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../../config/routes.dart';
|
||||
import '../../../providers/cycles.dart';
|
||||
|
||||
class CycleAddSaveButton extends StatelessWidget {
|
||||
const CycleAddSaveButton({
|
||||
Key? key,
|
||||
required GlobalKey<FormState> form,
|
||||
required this.labelValues,
|
||||
required this.cycleNumberCTRL,
|
||||
required this.dateValue,
|
||||
required this.descriptionCTRL,
|
||||
required this.striizerIdCTRL,
|
||||
required double deviceBlockSize,
|
||||
}) : _form = form,
|
||||
_deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final GlobalKey<FormState> _form;
|
||||
final List<TextEditingController> labelValues;
|
||||
final TextEditingController cycleNumberCTRL;
|
||||
final String dateValue;
|
||||
final TextEditingController descriptionCTRL;
|
||||
final TextEditingController striizerIdCTRL;
|
||||
final double _deviceBlockSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
if (!_form.currentState!.validate()) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<String> labels = [];
|
||||
for (TextEditingController label in labelValues) {
|
||||
labels.add(label.text);
|
||||
}
|
||||
Provider.of<CyclesProvider>(context, listen: false).createCycleResult(
|
||||
cycleNumberCTRL.text,
|
||||
dateValue,
|
||||
labels,
|
||||
descriptionCTRL.text,
|
||||
striizerIdCTRL.text,
|
||||
);
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
content: Text('Cycle added.'),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(ctx).pop();
|
||||
},
|
||||
child: Text('Ok'),
|
||||
)
|
||||
],
|
||||
),
|
||||
).then((_) {
|
||||
Navigator.of(context).pushReplacementNamed(Routes.cycleResultScreen);
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 5 * _deviceBlockSize,
|
||||
vertical: 10,
|
||||
),
|
||||
// margin:
|
||||
// EdgeInsets.symmetric(horizontal: 35, vertical: 15),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [kPink, kPinkSub],
|
||||
),
|
||||
borderRadius: BorderRadius.circular(7),
|
||||
),
|
||||
child: Align(
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
'Save',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,291 +1,296 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
import '../../../models/cycles_models.dart';
|
||||
|
||||
class CycleDetailsDataBox extends StatelessWidget {
|
||||
const CycleDetailsDataBox({
|
||||
Key key,
|
||||
@required this.datas,
|
||||
@required double deviceBlockSize,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final CycleDetailObject datas;
|
||||
final double _deviceBlockSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.all(20),
|
||||
child: ListView(
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Text(
|
||||
'CYCLE DETAILS',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
letterSpacing: 3,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: Color.fromRGBO(235, 235, 235, 1),
|
||||
border: Border(
|
||||
left: BorderSide(
|
||||
color: Colors.black54,
|
||||
width: 2,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
DateFormat.yMMMd().format(
|
||||
DateTime.parse(
|
||||
datas.createDate,
|
||||
),
|
||||
),
|
||||
style: TextStyle(
|
||||
color: Colors.red,
|
||||
),
|
||||
),
|
||||
Divider(),
|
||||
Text(
|
||||
'ID: ${datas.id}',
|
||||
style: TextStyle(
|
||||
color: Colors.red,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 30,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Sterilizer ID',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas.sterileId.toString(),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Cycle Number',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas.cycleNumber.toString(),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Date',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
DateFormat('d-M-y').format(
|
||||
DateTime.parse(
|
||||
datas.date,
|
||||
),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Description',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas.description.toString(),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Hospital Name',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas.hospitalName,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 30,
|
||||
),
|
||||
Text(
|
||||
'LABELS INCLUDED',
|
||||
style: TextStyle(
|
||||
color: Colors.orange,
|
||||
letterSpacing: 3,
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 4.5 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 20),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
border: Border.all(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
child: ListView.separated(
|
||||
shrinkWrap: true,
|
||||
itemBuilder: (ctx, index) => RichText(
|
||||
text: TextSpan(
|
||||
text: 'Label ID ',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
fontFamily: 'montserrat',
|
||||
),
|
||||
// style: DefaultTextStyle.of(context).style,
|
||||
children: <TextSpan>[
|
||||
TextSpan(
|
||||
text: datas.labels[index],
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.orange,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
separatorBuilder: (ctx, index) => Divider(),
|
||||
itemCount: datas.labels.length,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 50,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 20,),
|
||||
InkWell(
|
||||
onTap: () async=> await launch(
|
||||
'https://cssd-doc.com/Show/Cycle/${datas.id.toString()}',
|
||||
// forceSafariVC: true,
|
||||
// forceWebView: true,
|
||||
// headers: <String, String>{'my_header_key': 'my_header_value'},
|
||||
// child: Text('Show Full Details'),
|
||||
),
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 20),
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
color: Color.fromRGBO(230, 230, 230, 1),
|
||||
borderRadius: BorderRadius.circular(25),
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
'Show More Details',
|
||||
style: TextStyle(fontWeight: FontWeight.w700),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 30,)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
import 'package:cssd/config/colors.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
import '../../../models/cycles_models.dart';
|
||||
|
||||
class CycleDetailsDataBox extends StatelessWidget {
|
||||
const CycleDetailsDataBox({
|
||||
Key? key,
|
||||
required this.datas,
|
||||
required double deviceBlockSize,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final CycleDetailObject datas;
|
||||
final double _deviceBlockSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.all(20),
|
||||
child: ListView(
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Text(
|
||||
'Cycle Details',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
letterSpacing: 3,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: Color.fromRGBO(235, 235, 235, 1),
|
||||
border: Border(
|
||||
left: BorderSide(
|
||||
color: kPink,
|
||||
width: 2,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
DateFormat.yMMMd().format(
|
||||
DateTime.parse(
|
||||
datas.createDate,
|
||||
),
|
||||
),
|
||||
style: TextStyle(
|
||||
color: kPink,
|
||||
),
|
||||
),
|
||||
Divider(),
|
||||
Text(
|
||||
'ID: ${datas.id}',
|
||||
style: TextStyle(
|
||||
color: kPink,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 30,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Sterilizer ID',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas.sterileId.toString(),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Cycle Number',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas.cycleNumber.toString(),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Date',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
DateFormat('d-M-y').format(
|
||||
DateTime.parse(
|
||||
datas.date,
|
||||
),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Description',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas.description.toString(),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Hospital Name',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas.hospitalName,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 30,
|
||||
),
|
||||
Text(
|
||||
'Labels included',
|
||||
style: TextStyle(
|
||||
color: kPink,
|
||||
letterSpacing: 3,
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 4.5 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 20),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
border: Border.all(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
child: ListView.separated(
|
||||
shrinkWrap: true,
|
||||
itemBuilder: (ctx, index) => RichText(
|
||||
text: TextSpan(
|
||||
text: 'Label ID ',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
fontFamily: 'montserrat',
|
||||
),
|
||||
// style: DefaultTextStyle.of(context).style,
|
||||
children: <TextSpan>[
|
||||
TextSpan(
|
||||
text: datas.labels[index],
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: kPink,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
separatorBuilder: (ctx, index) => Divider(),
|
||||
itemCount: datas.labels.length,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 50,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
InkWell(
|
||||
onTap: () async => await launch(
|
||||
'https://cssd-doc.com/Show/Cycle/${datas.id.toString()}',
|
||||
// forceSafariVC: true,
|
||||
// forceWebView: true,
|
||||
// headers: <String, String>{'my_header_key': 'my_header_value'},
|
||||
// child: Text('Show Full Details'),
|
||||
),
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 20),
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
color: Color.fromRGBO(230, 230, 230, 1),
|
||||
borderRadius: BorderRadius.circular(25),
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
'Show More Details',
|
||||
style: TextStyle(fontWeight: FontWeight.w700),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 30,
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,85 +1,86 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
class CycleFilterDatePicker extends StatefulWidget {
|
||||
const CycleFilterDatePicker({
|
||||
Key key,
|
||||
@required this.dateCTRL,
|
||||
@required double deviceBlockSize,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final TextEditingController dateCTRL;
|
||||
final double _deviceBlockSize;
|
||||
|
||||
@override
|
||||
_CycleFilterDatePickerState createState() => _CycleFilterDatePickerState();
|
||||
}
|
||||
|
||||
class _CycleFilterDatePickerState extends State<CycleFilterDatePicker> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () async {
|
||||
var res = await showDatePicker(
|
||||
context: context,
|
||||
initialDate: DateTime.now(),
|
||||
firstDate: DateTime(2010, 1),
|
||||
lastDate: DateTime(2101),
|
||||
);
|
||||
if (res != null) {
|
||||
// dateTimeFrom = res;
|
||||
setState(
|
||||
() {
|
||||
widget.dateCTRL.text = DateFormat('y-M-d').format(res);
|
||||
// dateValue = DateFormat('y-M-d').format(
|
||||
// dateTimeFrom,
|
||||
// ); // baraye tavize makane gharar giri baraye api
|
||||
},
|
||||
);
|
||||
}
|
||||
},
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: TextField(
|
||||
enabled: false,
|
||||
controller: widget.dateCTRL,
|
||||
decoration: InputDecoration(
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.calendarAlt,
|
||||
size: 7 * widget._deviceBlockSize,
|
||||
),
|
||||
labelStyle: TextStyle(
|
||||
fontWeight: FontWeight.w100,
|
||||
fontSize: 4 * widget._deviceBlockSize,
|
||||
),
|
||||
labelText: 'Date',
|
||||
isDense: true,
|
||||
contentPadding: EdgeInsets.only(
|
||||
bottom: 5,
|
||||
left: 2,
|
||||
),
|
||||
// border: InputBorder.none,
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * widget._deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
Icon(FontAwesomeIcons.angleDown)
|
||||
],
|
||||
),
|
||||
// Divider(
|
||||
// color: Colors.grey,
|
||||
// )
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
class CycleFilterDatePicker extends StatefulWidget {
|
||||
const CycleFilterDatePicker({
|
||||
Key? key,
|
||||
required this.dateCTRL,
|
||||
required double deviceBlockSize,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final TextEditingController dateCTRL;
|
||||
final double _deviceBlockSize;
|
||||
|
||||
@override
|
||||
_CycleFilterDatePickerState createState() => _CycleFilterDatePickerState();
|
||||
}
|
||||
|
||||
class _CycleFilterDatePickerState extends State<CycleFilterDatePicker> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () async {
|
||||
var res = await showDatePicker(
|
||||
context: context,
|
||||
initialDate: DateTime.now(),
|
||||
firstDate: DateTime(2010, 1),
|
||||
lastDate: DateTime(2101),
|
||||
);
|
||||
if (res != null) {
|
||||
// dateTimeFrom = res;
|
||||
setState(
|
||||
() {
|
||||
widget.dateCTRL.text = DateFormat('y-M-d').format(res);
|
||||
// dateValue = DateFormat('y-M-d').format(
|
||||
// dateTimeFrom,
|
||||
// ); // baraye tavize makane gharar giri baraye api
|
||||
},
|
||||
);
|
||||
}
|
||||
},
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: TextField(
|
||||
enabled: false,
|
||||
controller: widget.dateCTRL,
|
||||
decoration: InputDecoration(
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.calendarAlt,
|
||||
size: 7 * widget._deviceBlockSize,
|
||||
),
|
||||
labelStyle: TextStyle(
|
||||
fontWeight: FontWeight.w100,
|
||||
fontSize: 4 * widget._deviceBlockSize,
|
||||
),
|
||||
labelText: 'Date',
|
||||
isDense: true,
|
||||
contentPadding: EdgeInsets.only(
|
||||
bottom: 5,
|
||||
left: 2,
|
||||
),
|
||||
// border: InputBorder.none,
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * widget._deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
Icon(FontAwesomeIcons.angleDown)
|
||||
],
|
||||
),
|
||||
// Divider(
|
||||
// color: Colors.grey,
|
||||
// )
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,90 +1,89 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../../config/routes.dart';
|
||||
import '../../../providers/cycles.dart';
|
||||
|
||||
class CycleFilterSaveButton extends StatelessWidget {
|
||||
const CycleFilterSaveButton({
|
||||
Key key,
|
||||
@required this.hospitalVals,
|
||||
@required this.hospitalCTRL,
|
||||
@required this.cycleIdCTRL,
|
||||
@required this.cycleNumberCTRL,
|
||||
@required this.striizerIdCTRL,
|
||||
@required this.dateCTRL,
|
||||
@required double deviceBlockSize,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final List<Map<String, String>> hospitalVals;
|
||||
final TextEditingController hospitalCTRL;
|
||||
final TextEditingController cycleIdCTRL;
|
||||
final TextEditingController cycleNumberCTRL;
|
||||
final TextEditingController striizerIdCTRL;
|
||||
final TextEditingController dateCTRL;
|
||||
final double _deviceBlockSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
String hospitalID;
|
||||
hospitalVals.forEach(
|
||||
(hospital) {
|
||||
if (hospital['name'] == hospitalCTRL.text) {
|
||||
hospitalID = hospital['id'];
|
||||
}
|
||||
},
|
||||
);
|
||||
Provider.of<CyclesProvider>(context).setFilters(
|
||||
cycleIdCTRL.text,
|
||||
cycleNumberCTRL.text,
|
||||
striizerIdCTRL.text,
|
||||
hospitalID,
|
||||
dateCTRL.text,
|
||||
);
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
content: Text('Filters changed.'),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(ctx).pop();
|
||||
},
|
||||
child: Text('Ok'),
|
||||
)
|
||||
],
|
||||
),
|
||||
).then((_) {
|
||||
Navigator.of(context).popAndPushNamed(Routes.cycleResultScreen);
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 5 * _deviceBlockSize,
|
||||
vertical: 5,
|
||||
),
|
||||
// margin:
|
||||
// EdgeInsets.symmetric(horizontal: 35, vertical: 15),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [Colors.red, Colors.orange],
|
||||
),
|
||||
borderRadius: BorderRadius.circular(7),
|
||||
),
|
||||
child: Align(
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
'FILTER',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
import 'package:cssd/config/colors.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../../config/routes.dart';
|
||||
import '../../../providers/cycles.dart';
|
||||
|
||||
class CycleFilterSaveButton extends StatelessWidget {
|
||||
const CycleFilterSaveButton({
|
||||
Key? key,
|
||||
required this.hospitalVals,
|
||||
required this.hospitalCTRL,
|
||||
required this.cycleIdCTRL,
|
||||
required this.cycleNumberCTRL,
|
||||
required this.striizerIdCTRL,
|
||||
required this.dateCTRL,
|
||||
required double deviceBlockSize,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final List<Map<String, String>> hospitalVals;
|
||||
final TextEditingController hospitalCTRL;
|
||||
final TextEditingController cycleIdCTRL;
|
||||
final TextEditingController cycleNumberCTRL;
|
||||
final TextEditingController striizerIdCTRL;
|
||||
final TextEditingController dateCTRL;
|
||||
final double _deviceBlockSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
String? hospitalID;
|
||||
hospitalVals.forEach(
|
||||
(hospital) {
|
||||
if (hospital['name'] == hospitalCTRL.text) {
|
||||
hospitalID = hospital['id']!;
|
||||
}
|
||||
},
|
||||
);
|
||||
Provider.of<CyclesProvider>(context, listen: false).setFilters(
|
||||
cycleIdCTRL.text,
|
||||
cycleNumberCTRL.text,
|
||||
striizerIdCTRL.text,
|
||||
hospitalID,
|
||||
dateCTRL.text,
|
||||
);
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
content: Text('Filters changed.'),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(ctx).pop();
|
||||
},
|
||||
child: Text('Ok'),
|
||||
)
|
||||
],
|
||||
),
|
||||
).then((_) {
|
||||
Navigator.of(context).popAndPushNamed(Routes.cycleResultScreen);
|
||||
});
|
||||
},
|
||||
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(
|
||||
'Filter',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,131 +1,126 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
|
||||
class CycleFilterSelectorBox extends StatefulWidget {
|
||||
const CycleFilterSelectorBox(
|
||||
{Key key,
|
||||
@required double deviceBlockSize,
|
||||
@required this.hospitalCTRL,
|
||||
@required this.hospitalVals,
|
||||
@required String label})
|
||||
: _deviceBlockSize = deviceBlockSize,
|
||||
_label = label,
|
||||
super(key: key);
|
||||
|
||||
final double _deviceBlockSize;
|
||||
final TextEditingController hospitalCTRL;
|
||||
final List<Map<String, String>> hospitalVals;
|
||||
final String _label;
|
||||
|
||||
@override
|
||||
_CycleFilterSelectorBoxState createState() => _CycleFilterSelectorBoxState();
|
||||
}
|
||||
|
||||
class _CycleFilterSelectorBoxState extends State<CycleFilterSelectorBox> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 5),
|
||||
// height: 65,
|
||||
child: Row(
|
||||
// width: double.infinity,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Icon(
|
||||
FontAwesomeIcons.alignLeft,
|
||||
color: Colors.grey,
|
||||
size: 7 * widget._deviceBlockSize,
|
||||
),
|
||||
SizedBox(
|
||||
width: 4 * widget._deviceBlockSize,
|
||||
),
|
||||
Expanded(
|
||||
// width: MediaQuery.of(context).size.width - 70,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
width: widget._deviceBlockSize,
|
||||
),
|
||||
Text(
|
||||
widget._label,
|
||||
style: TextStyle(
|
||||
fontSize: 3.5 * widget._deviceBlockSize,
|
||||
color: Colors.grey,
|
||||
fontWeight: FontWeight.w100,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Container(
|
||||
// height: 30,
|
||||
child: DropdownButtonFormField(
|
||||
decoration: InputDecoration(
|
||||
contentPadding: EdgeInsets.only(
|
||||
left: widget._deviceBlockSize,
|
||||
),
|
||||
border: InputBorder.none,
|
||||
),
|
||||
iconSize: 7 * widget._deviceBlockSize,
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.angleDown,
|
||||
color: Colors.black,
|
||||
),
|
||||
isExpanded: true,
|
||||
hint: Container(
|
||||
// width: 100,
|
||||
height: 70,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 0,
|
||||
),
|
||||
child: TextFormField(
|
||||
controller: widget.hospitalCTRL,
|
||||
decoration: InputDecoration(
|
||||
contentPadding: EdgeInsets.only(bottom: 15),
|
||||
isDense: true,
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
),
|
||||
isDense: true,
|
||||
items: widget.hospitalVals.map((val) {
|
||||
return new DropdownMenuItem<String>(
|
||||
value: val['name'],
|
||||
child: Container(
|
||||
child: Text(
|
||||
val['name'],
|
||||
style: TextStyle(
|
||||
// color: _mainFontColor,
|
||||
fontSize: 5 * widget._deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: (val) {
|
||||
setState(() {
|
||||
widget.hospitalCTRL.text = val;
|
||||
// packageValue[1] = val;
|
||||
// packageCTRL.text = val;
|
||||
// packageVals.forEach((package) {
|
||||
// if (package['name'] == val) {
|
||||
// packageValue[0] = package['id'];
|
||||
// }
|
||||
// });
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
]),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
|
||||
class FilterHospitalBox extends StatefulWidget {
|
||||
const FilterHospitalBox(
|
||||
{Key? key,
|
||||
required double deviceBlockSize,
|
||||
required this.hospitalCTRL,
|
||||
required this.hospitalVals,
|
||||
required String label})
|
||||
: _deviceBlockSize = deviceBlockSize,
|
||||
_label = label,
|
||||
super(key: key);
|
||||
|
||||
final double _deviceBlockSize;
|
||||
final TextEditingController hospitalCTRL;
|
||||
final List<Map<String, String>> hospitalVals;
|
||||
final String _label;
|
||||
|
||||
@override
|
||||
_FilterHospitalBoxState createState() => _FilterHospitalBoxState();
|
||||
}
|
||||
|
||||
class _FilterHospitalBoxState extends State<FilterHospitalBox> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 5),
|
||||
// height: 65,
|
||||
child: Row(
|
||||
// width: double.infinity,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Icon(
|
||||
FontAwesomeIcons.alignLeft,
|
||||
color: Colors.grey,
|
||||
size: 7 * widget._deviceBlockSize,
|
||||
),
|
||||
SizedBox(
|
||||
width: 4 * widget._deviceBlockSize,
|
||||
),
|
||||
Expanded(
|
||||
// width: MediaQuery.of(context).size.width - 70,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
width: widget._deviceBlockSize,
|
||||
),
|
||||
Text(
|
||||
widget._label,
|
||||
style: TextStyle(
|
||||
fontSize: 3.5 * widget._deviceBlockSize,
|
||||
color: Colors.grey,
|
||||
fontWeight: FontWeight.w100,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Container(
|
||||
child: DropdownButtonFormField(
|
||||
decoration: InputDecoration(
|
||||
contentPadding: EdgeInsets.only(
|
||||
left: widget._deviceBlockSize,
|
||||
),
|
||||
border: InputBorder.none,
|
||||
),
|
||||
iconSize: 7 * widget._deviceBlockSize,
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.angleDown,
|
||||
color: Colors.black,
|
||||
),
|
||||
isExpanded: true,
|
||||
hint: Container(
|
||||
// width: 100,
|
||||
height: 70,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 0,
|
||||
),
|
||||
child: TextFormField(
|
||||
controller: widget.hospitalCTRL,
|
||||
decoration: InputDecoration(
|
||||
contentPadding: EdgeInsets.only(bottom: 15),
|
||||
isDense: true,
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
),
|
||||
isDense: true,
|
||||
items: widget.hospitalVals.map((val) {
|
||||
return new DropdownMenuItem<String>(
|
||||
value: val['name'],
|
||||
child: Container(
|
||||
child: Text(
|
||||
val['name']!,
|
||||
style: TextStyle(
|
||||
// color: _mainFontColor,
|
||||
fontSize: 5 * widget._deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: (val) {
|
||||
setState(
|
||||
() {
|
||||
widget.hospitalCTRL.text = val!;
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,46 +1,50 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
|
||||
import '../../../config/routes.dart';
|
||||
|
||||
class CycleResultBanner extends StatelessWidget {
|
||||
const CycleResultBanner({
|
||||
Key key,
|
||||
@required double deviceBlockSize,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final double _deviceBlockSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
// crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
'CYCLES',
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 7 * _deviceBlockSize,
|
||||
fontWeight: FontWeight.w700,
|
||||
letterSpacing: 2,
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
InkWell(
|
||||
customBorder: CircleBorder(),
|
||||
onTap: () {
|
||||
Navigator.of(context).popAndPushNamed(Routes.cycleFilterScreen);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(5),
|
||||
child: Icon(
|
||||
FontAwesomeIcons.filter,
|
||||
size: 7 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
|
||||
class ResultBanner extends StatelessWidget {
|
||||
const ResultBanner({
|
||||
Key? key,
|
||||
required double deviceBlockSize,
|
||||
required this.text,
|
||||
required this.push,
|
||||
this.hasFilterObject = true,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final double _deviceBlockSize;
|
||||
final String text;
|
||||
final String push;
|
||||
final bool hasFilterObject;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
children: <Widget>[
|
||||
Text(
|
||||
text,
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 7 * _deviceBlockSize,
|
||||
fontWeight: FontWeight.w700,
|
||||
letterSpacing: 2,
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
if (hasFilterObject)
|
||||
InkWell(
|
||||
customBorder: CircleBorder(),
|
||||
onTap: () {
|
||||
Navigator.of(context).popAndPushNamed(push);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(5),
|
||||
child: Icon(
|
||||
FontAwesomeIcons.filter,
|
||||
size: 7 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,140 +1,205 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
import '../../../config/routes.dart';
|
||||
import '../../../models/cycles_models.dart';
|
||||
|
||||
class CycleItemBox extends StatelessWidget {
|
||||
final CycleResultObject item;
|
||||
final String labels;
|
||||
|
||||
const CycleItemBox({
|
||||
Key key,
|
||||
@required double deviceBlockSize,
|
||||
this.item,
|
||||
this.labels,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final double _deviceBlockSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: () => Navigator.of(context).pushNamed(
|
||||
Routes.cycleDetailScreen,
|
||||
arguments: item.id,
|
||||
),
|
||||
child: Card(
|
||||
elevation: 1,
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(10),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
item.id,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 3 * _deviceBlockSize,
|
||||
),
|
||||
// Spacer(),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 50 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Label Included:',
|
||||
style: TextStyle(
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 50 * _deviceBlockSize,
|
||||
child: Text(
|
||||
labels,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 50 * _deviceBlockSize,
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Text(
|
||||
'Date:',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
DateFormat('y-M-d').format(
|
||||
DateTime.parse(
|
||||
item.createdAt,
|
||||
),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
Spacer(),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
InkWell(
|
||||
customBorder: CircleBorder(),
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed(
|
||||
Routes.cycleDetailScreen,
|
||||
arguments: item.id,
|
||||
);
|
||||
// TestDetail(testResultId: item.id.toString());
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(7),
|
||||
width: 10 * _deviceBlockSize,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.black,
|
||||
),
|
||||
child: Icon(
|
||||
FontAwesomeIcons.fileAlt,
|
||||
size: 6 * _deviceBlockSize,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
import 'package:cssd/providers/auth.dart';
|
||||
import 'package:cssd/providers/cycles.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../../config/routes.dart';
|
||||
import '../../../models/cycles_models.dart';
|
||||
|
||||
class CycleItemBox extends StatelessWidget {
|
||||
final CycleResultObject? item;
|
||||
final String? labels;
|
||||
|
||||
const CycleItemBox({
|
||||
Key? key,
|
||||
required double deviceBlockSize,
|
||||
this.item,
|
||||
this.labels,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final double _deviceBlockSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final userData = Provider.of<Auth>(context, listen: false).user;
|
||||
return GestureDetector(
|
||||
onTap: () => Navigator.of(context).pushNamed(
|
||||
Routes.cycleDetailScreen,
|
||||
arguments: item!.id,
|
||||
),
|
||||
child: Card(
|
||||
elevation: 1,
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(8),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: const EdgeInsets.all(6),
|
||||
child: Text(
|
||||
item!.id,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 3 * _deviceBlockSize,
|
||||
),
|
||||
// Spacer(),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 30 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Label Included:',
|
||||
style: TextStyle(
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 40 * _deviceBlockSize,
|
||||
child: Text(
|
||||
labels!,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 30 * _deviceBlockSize,
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Text(
|
||||
'Date:',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
DateFormat('y-M-d').format(
|
||||
DateTime.parse(
|
||||
item!.createdAt,
|
||||
),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
Spacer(),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
userData['roles']?.contains('User') ?? false
|
||||
? Container()
|
||||
: InkWell(
|
||||
customBorder: CircleBorder(),
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed(
|
||||
Routes.cycleUpdateScreen,
|
||||
arguments: item!.id,
|
||||
);
|
||||
},
|
||||
child: Icon(
|
||||
Icons.edit,
|
||||
size: 5 * _deviceBlockSize,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 5.0,
|
||||
),
|
||||
userData['roles']?.contains('User') ?? false
|
||||
? Container()
|
||||
: InkWell(
|
||||
customBorder: CircleBorder(),
|
||||
onTap: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
title: Text('Delete'),
|
||||
content: Text(
|
||||
'Are you sure you want delete this Cycle?',
|
||||
),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
child: Text('Yes'),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
Provider.of<CyclesProvider>(context,
|
||||
listen: false)
|
||||
.removeCycles(item!.id);
|
||||
},
|
||||
),
|
||||
TextButton(
|
||||
child: Text('No'),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
child: Icon(
|
||||
Icons.delete,
|
||||
size: 5 * _deviceBlockSize,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 5.0,
|
||||
),
|
||||
InkWell(
|
||||
customBorder: CircleBorder(),
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed(
|
||||
Routes.cycleDetailScreen,
|
||||
arguments: item!.id,
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(7),
|
||||
width: 9 * _deviceBlockSize,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.black,
|
||||
),
|
||||
child: Icon(
|
||||
FontAwesomeIcons.fileAlt,
|
||||
size: 5 * _deviceBlockSize,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,115 +1,109 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../../config/routes.dart';
|
||||
import '../../../providers/cycles.dart';
|
||||
|
||||
class CycleFilterBaner extends StatelessWidget {
|
||||
const CycleFilterBaner({
|
||||
Key key,
|
||||
@required double deviceBlockSize,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final double _deviceBlockSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
Navigator.of(context).popAndPushNamed(Routes.cycleFilterScreen);
|
||||
},
|
||||
child: Chip(
|
||||
backgroundColor: Colors.black,
|
||||
label: Text(
|
||||
'Filters',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
deleteIcon: Icon(
|
||||
FontAwesomeIcons.filter,
|
||||
color: Colors.white,
|
||||
size: 4 * _deviceBlockSize,
|
||||
),
|
||||
onDeleted: () {
|
||||
Navigator.of(context).popAndPushNamed(Routes.cycleFilterScreen);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class CycleFilterChip extends StatelessWidget {
|
||||
const CycleFilterChip({
|
||||
Key key,
|
||||
@required double deviceBlockSize,
|
||||
@required String label,
|
||||
@required String id,
|
||||
@required String cycleNumber,
|
||||
@required String sterilizerId,
|
||||
@required String hospital,
|
||||
@required String date,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
_label = label,
|
||||
_id = id,
|
||||
_cycleNumber = cycleNumber,
|
||||
_sterilizerId = sterilizerId,
|
||||
_hospital = hospital,
|
||||
_date = date,
|
||||
super(key: key);
|
||||
|
||||
final double _deviceBlockSize;
|
||||
final String _label;
|
||||
final String _id;
|
||||
final String _cycleNumber;
|
||||
final String _sterilizerId;
|
||||
final String _hospital;
|
||||
final String _date;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(children: <Widget>[
|
||||
SizedBox(
|
||||
width: _deviceBlockSize,
|
||||
),
|
||||
Chip(
|
||||
backgroundColor: Colors.black,
|
||||
label: Text(
|
||||
_label,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
deleteIcon: Icon(
|
||||
Icons.close,
|
||||
color: Colors.white,
|
||||
),
|
||||
onDeleted: () {
|
||||
var cycleProvider = Provider.of<CyclesProvider>(context);
|
||||
cycleProvider.setFilters(
|
||||
_id,
|
||||
_cycleNumber,
|
||||
_sterilizerId,
|
||||
_hospital,
|
||||
_date,
|
||||
);
|
||||
// cycle.resetPageNumber();
|
||||
// cycle.setFilters(
|
||||
// '',
|
||||
// cycle.filters.cycleNumber,
|
||||
// cycle.filters.sterilizerId,
|
||||
// cycle.filters.hospital,
|
||||
// cycle.filters.date,
|
||||
// );
|
||||
cycleProvider.setLoading();
|
||||
cycleProvider.getCycleResults().then((_) {
|
||||
cycleProvider.resetLoading();
|
||||
});
|
||||
// _reloadItems();
|
||||
},
|
||||
),
|
||||
]);
|
||||
}
|
||||
}
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../../providers/cycles.dart';
|
||||
|
||||
class FilterBanner extends StatelessWidget {
|
||||
const FilterBanner({
|
||||
Key? key,
|
||||
required double deviceBlockSize,
|
||||
required this.push,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final double _deviceBlockSize;
|
||||
final String push;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
Navigator.of(context).popAndPushNamed(push);
|
||||
},
|
||||
child: Chip(
|
||||
backgroundColor: Colors.black,
|
||||
label: Text(
|
||||
'Filters',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
deleteIcon: Icon(
|
||||
FontAwesomeIcons.filter,
|
||||
color: Colors.white,
|
||||
size: 4 * _deviceBlockSize,
|
||||
),
|
||||
onDeleted: () {
|
||||
Navigator.of(context).popAndPushNamed(push);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class CycleFilterChip extends StatelessWidget {
|
||||
const CycleFilterChip({
|
||||
Key? key,
|
||||
required double deviceBlockSize,
|
||||
required String label,
|
||||
required String id,
|
||||
required String cycleNumber,
|
||||
required String sterilizerId,
|
||||
required String hospital,
|
||||
required String date,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
_label = label,
|
||||
_id = id,
|
||||
_cycleNumber = cycleNumber,
|
||||
_sterilizerId = sterilizerId,
|
||||
_hospital = hospital,
|
||||
_date = date,
|
||||
super(key: key);
|
||||
|
||||
final double _deviceBlockSize;
|
||||
final String _label;
|
||||
final String _id;
|
||||
final String _cycleNumber;
|
||||
final String _sterilizerId;
|
||||
final String _hospital;
|
||||
final String _date;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(children: <Widget>[
|
||||
SizedBox(
|
||||
width: _deviceBlockSize,
|
||||
),
|
||||
Chip(
|
||||
backgroundColor: Colors.black,
|
||||
label: Text(
|
||||
_label,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
deleteIcon: Icon(
|
||||
Icons.close,
|
||||
color: Colors.white,
|
||||
),
|
||||
onDeleted: () {
|
||||
var cycleProvider =
|
||||
Provider.of<CyclesProvider>(context, listen: false);
|
||||
cycleProvider.setFilters(
|
||||
_id,
|
||||
_cycleNumber,
|
||||
_sterilizerId,
|
||||
_hospital,
|
||||
_date,
|
||||
);
|
||||
cycleProvider.setLoading();
|
||||
cycleProvider.getCycleResults().then((_) {
|
||||
cycleProvider.resetLoading();
|
||||
});
|
||||
// _reloadItems();
|
||||
},
|
||||
),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,47 +1,49 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../../providers/cycles.dart';
|
||||
class CycleResultSearchBox extends StatelessWidget {
|
||||
const CycleResultSearchBox({
|
||||
Key key,
|
||||
@required this.searchCTRL,
|
||||
@required double deviceBlockSize,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final TextEditingController searchCTRL;
|
||||
final double _deviceBlockSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return TextField(
|
||||
onEditingComplete: () {
|
||||
FocusScope.of(context).unfocus();
|
||||
},
|
||||
controller: searchCTRL,
|
||||
onChanged: (value) {
|
||||
Provider.of<CyclesProvider>(context, listen: false).search(value);
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.search,
|
||||
size: 6 * _deviceBlockSize,
|
||||
),
|
||||
labelStyle: TextStyle(
|
||||
fontWeight: FontWeight.w100,
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
),
|
||||
labelText: 'Search by cycle ID',
|
||||
isDense: true,
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 2, horizontal: 3),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
keyboardType: TextInputType.number,
|
||||
);
|
||||
}
|
||||
}
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
|
||||
class ResultSearchBox extends StatelessWidget {
|
||||
const ResultSearchBox({
|
||||
Key? key,
|
||||
required this.searchCTRL,
|
||||
required double deviceBlockSize,
|
||||
required this.text,
|
||||
required this.onChanged,
|
||||
this.text2 = 'ID',
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final TextEditingController searchCTRL;
|
||||
final double _deviceBlockSize;
|
||||
final String text;
|
||||
final String text2;
|
||||
final dynamic onChanged;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return TextField(
|
||||
onEditingComplete: () {
|
||||
FocusScope.of(context).unfocus();
|
||||
},
|
||||
controller: searchCTRL,
|
||||
onChanged: onChanged,
|
||||
decoration: InputDecoration(
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.search,
|
||||
size: 6 * _deviceBlockSize,
|
||||
),
|
||||
labelStyle: TextStyle(
|
||||
fontWeight: FontWeight.w100,
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
),
|
||||
labelText: 'Search by $text $text2',
|
||||
isDense: true,
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 2, horizontal: 3),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
keyboardType: TextInputType.number,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+343
-183
@@ -1,183 +1,343 @@
|
||||
// import 'package:cssd/pages/test_result_screen.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
|
||||
import '../../config/routes.dart';
|
||||
|
||||
class AppDrawer extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SafeArea(
|
||||
child: SizedBox(
|
||||
width: 250,
|
||||
child: Drawer(
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(20),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.black,
|
||||
),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
ListTile(
|
||||
leading: CircleAvatar(
|
||||
backgroundColor: Colors.white,
|
||||
),
|
||||
title: Text(
|
||||
'CSSD',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
Divider(
|
||||
color: Colors.white,
|
||||
),
|
||||
InkWell(
|
||||
onTap: () =>
|
||||
Navigator.of(context).pushNamed(Routes.myInfoScreen),
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 5, horizontal: 15),
|
||||
margin: EdgeInsets.only(top: 10),
|
||||
decoration: BoxDecoration(
|
||||
gradient:
|
||||
LinearGradient(colors: [Colors.blue, Colors.green]),
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Icon(
|
||||
Icons.person_outline,
|
||||
color: Colors.white,
|
||||
),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Text(
|
||||
'My Info',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
onTap: () =>
|
||||
Navigator.of(context).pushNamed(Routes.testResultScreen),
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 5, horizontal: 15),
|
||||
margin: EdgeInsets.only(top: 10),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Icon(
|
||||
Icons.assignment,
|
||||
color: Colors.white,
|
||||
),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Text(
|
||||
'Test Results',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed(Routes.labelResultScreen);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 5, horizontal: 15),
|
||||
margin: EdgeInsets.only(top: 10),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Icon(
|
||||
FontAwesomeIcons.tag,
|
||||
color: Colors.white,
|
||||
),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Text(
|
||||
'Labels',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed(Routes.cycleResultScreen);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 5, horizontal: 15),
|
||||
margin: EdgeInsets.only(top: 10),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Icon(
|
||||
Icons.refresh,
|
||||
color: Colors.white,
|
||||
),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Text(
|
||||
'Circles',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(left: 20),
|
||||
child: ListTile(
|
||||
leading: Icon(Icons.phone_bluetooth_speaker),
|
||||
title: Text('All Test Result'),
|
||||
dense: true,
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(left: 20),
|
||||
child: ListTile(
|
||||
leading: Icon(Icons.settings),
|
||||
title: Text('Manage Users'),
|
||||
dense: true,
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(left: 20),
|
||||
child: ListTile(
|
||||
leading: Icon(Icons.label),
|
||||
title: Text('Manage Medical Center'),
|
||||
dense: true,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
elevation: 0,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
// import 'package:cssd/pages/test_result_screen.dart';
|
||||
import 'package:cssd/config/colors.dart';
|
||||
import 'package:cssd/providers/auth.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../config/routes.dart';
|
||||
|
||||
class AppDrawer extends StatefulWidget {
|
||||
@override
|
||||
State<AppDrawer> createState() => _AppDrawerState();
|
||||
}
|
||||
|
||||
class _AppDrawerState extends State<AppDrawer> {
|
||||
Map<String, dynamic>? user;
|
||||
|
||||
@override
|
||||
void didChangeDependencies() async {
|
||||
var authObj = Provider.of<Auth>(context, listen: false);
|
||||
user = await authObj.getUserData();
|
||||
super.didChangeDependencies();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SafeArea(
|
||||
child: SizedBox(
|
||||
width: 250,
|
||||
child: Drawer(
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(20),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.black,
|
||||
),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
ListTile(
|
||||
leading: CircleAvatar(
|
||||
backgroundColor: kLightBlue,
|
||||
child: Icon(
|
||||
Icons.person,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
title: Text(
|
||||
user?['name'] != null ? user!['name'] : '',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
Divider(
|
||||
color: Colors.white,
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 5, horizontal: 15),
|
||||
margin: EdgeInsets.only(top: 10),
|
||||
decoration: BoxDecoration(
|
||||
color: kLightBlue,
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Icon(
|
||||
Icons.dashboard,
|
||||
color: Colors.white,
|
||||
),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Text(
|
||||
'Dashboard',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
onTap: () =>
|
||||
Navigator.of(context).pushNamed(Routes.myInfoScreen),
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 5, horizontal: 15),
|
||||
margin: EdgeInsets.only(top: 10),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Icon(
|
||||
Icons.person_outline,
|
||||
color: Colors.white,
|
||||
),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Text(
|
||||
'My Info',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
onTap: () =>
|
||||
Navigator.of(context).pushNamed(Routes.testResultScreen),
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 5, horizontal: 15),
|
||||
margin: EdgeInsets.only(top: 10),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Icon(
|
||||
Icons.assignment,
|
||||
color: Colors.white,
|
||||
),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Text(
|
||||
'Test Results',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed(Routes.labelResultScreen);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 5, horizontal: 15),
|
||||
margin: EdgeInsets.only(top: 10),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Icon(
|
||||
FontAwesomeIcons.tag,
|
||||
color: Colors.white,
|
||||
),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Text(
|
||||
'Labels',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed(Routes.cycleResultScreen);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 5, horizontal: 15),
|
||||
margin: EdgeInsets.only(top: 10),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Icon(
|
||||
Icons.refresh,
|
||||
color: Colors.white,
|
||||
),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Text(
|
||||
'Cycles',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed(Routes.packageResultScreen);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 5, horizontal: 15),
|
||||
margin: EdgeInsets.only(top: 10),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Icon(
|
||||
Icons.all_inbox_rounded,
|
||||
color: Colors.white,
|
||||
),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Text(
|
||||
'Packages',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed(Routes.myItemsResultScreen);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 5, horizontal: 15),
|
||||
margin: EdgeInsets.only(top: 10),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Icon(
|
||||
Icons.inbox_rounded,
|
||||
color: Colors.white,
|
||||
),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Text(
|
||||
'My Packages',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed(Routes.itemResultScreen);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 5, horizontal: 15),
|
||||
margin: EdgeInsets.only(top: 10),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Icon(
|
||||
Icons.book,
|
||||
color: Colors.white,
|
||||
),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Text(
|
||||
'Items',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed(Routes.myItemsResultScreen);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 5, horizontal: 15),
|
||||
margin: EdgeInsets.only(top: 10),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Icon(
|
||||
Icons.my_library_books,
|
||||
color: Colors.white,
|
||||
),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Text(
|
||||
'My Items',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
// Container(
|
||||
// margin: EdgeInsets.only(left: 20),
|
||||
// child: ListTile(
|
||||
// leading: Icon(Icons.phone_bluetooth_speaker),
|
||||
// title: Text('All Test Result'),
|
||||
// dense: true,
|
||||
// ),
|
||||
// ),
|
||||
// Container(
|
||||
// margin: EdgeInsets.only(left: 20),
|
||||
// child: ListTile(
|
||||
// leading: Icon(Icons.settings),
|
||||
// title: Text('Manage Users'),
|
||||
// dense: true,
|
||||
// ),
|
||||
// ),
|
||||
// Container(
|
||||
// margin: EdgeInsets.only(left: 20),
|
||||
// child: ListTile(
|
||||
// leading: Icon(Icons.label),
|
||||
// title: Text('Manage Medical Center'),
|
||||
// dense: true,
|
||||
// ),
|
||||
// ),
|
||||
],
|
||||
),
|
||||
),
|
||||
elevation: 0,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,50 +1,51 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class InputBox extends StatelessWidget {
|
||||
const InputBox({
|
||||
Key key,
|
||||
@required double deviceBlockSize,
|
||||
this.lable,
|
||||
this.initialValue,
|
||||
this.ico, this.isPass,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final double _deviceBlockSize;
|
||||
final String lable;
|
||||
final String initialValue;
|
||||
final IconData ico;
|
||||
final bool isPass;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Icon(
|
||||
ico,
|
||||
color: Colors.grey,
|
||||
),
|
||||
SizedBox(
|
||||
width: _deviceBlockSize,
|
||||
),
|
||||
Expanded(
|
||||
child: TextFormField(
|
||||
decoration: InputDecoration(
|
||||
isDense: false,
|
||||
// border: UnderlineInputBorder(),
|
||||
fillColor: Colors.red,
|
||||
labelText: lable,
|
||||
contentPadding: EdgeInsets.all(0),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontSize: 6 * _deviceBlockSize,
|
||||
),
|
||||
initialValue: initialValue,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class InputBox extends StatelessWidget {
|
||||
const InputBox({
|
||||
Key? key,
|
||||
required double deviceBlockSize,
|
||||
this.lable,
|
||||
this.initialValue,
|
||||
this.ico,
|
||||
this.isPass,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final double _deviceBlockSize;
|
||||
final String? lable;
|
||||
final String? initialValue;
|
||||
final IconData? ico;
|
||||
final bool? isPass;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Icon(
|
||||
ico,
|
||||
color: Colors.grey,
|
||||
),
|
||||
SizedBox(
|
||||
width: _deviceBlockSize,
|
||||
),
|
||||
Expanded(
|
||||
child: TextFormField(
|
||||
decoration: InputDecoration(
|
||||
isDense: false,
|
||||
// border: UnderlineInputBorder(),
|
||||
fillColor: Colors.red,
|
||||
labelText: lable,
|
||||
contentPadding: EdgeInsets.all(0),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontSize: 6 * _deviceBlockSize,
|
||||
),
|
||||
initialValue: initialValue,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ConnectionErrorBox extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Center(
|
||||
child: Text('Please connect to the Internet ! !'),
|
||||
);
|
||||
}
|
||||
}
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ConnectionErrorBox extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Center(
|
||||
child: Text('Please connect to the Internet ! !'),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,51 +1,51 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
|
||||
class PageHeader extends StatelessWidget {
|
||||
const PageHeader({
|
||||
Key key,
|
||||
@required double deviceBlockSize,
|
||||
@required String label,
|
||||
@required String route,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
_label = label,
|
||||
_route = route,
|
||||
super(key: key);
|
||||
|
||||
final double _deviceBlockSize;
|
||||
final String _label;
|
||||
final String _route;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
child: Text(
|
||||
_label,
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 7 * _deviceBlockSize,
|
||||
fontWeight: FontWeight.w700,
|
||||
letterSpacing: 2,
|
||||
),
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
InkWell(
|
||||
customBorder: CircleBorder(),
|
||||
onTap: () {
|
||||
Navigator.of(context).popAndPushNamed(_route);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(5),
|
||||
child: Icon(
|
||||
FontAwesomeIcons.filter,
|
||||
size: 7 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
|
||||
class PageHeader extends StatelessWidget {
|
||||
const PageHeader({
|
||||
Key? key,
|
||||
required double deviceBlockSize,
|
||||
required String label,
|
||||
required String route,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
_label = label,
|
||||
_route = route,
|
||||
super(key: key);
|
||||
|
||||
final double _deviceBlockSize;
|
||||
final String _label;
|
||||
final String _route;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
child: Text(
|
||||
_label,
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 7 * _deviceBlockSize,
|
||||
fontWeight: FontWeight.w700,
|
||||
letterSpacing: 2,
|
||||
),
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
InkWell(
|
||||
customBorder: CircleBorder(),
|
||||
onTap: () {
|
||||
Navigator.of(context).popAndPushNamed(_route);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(5),
|
||||
child: Icon(
|
||||
FontAwesomeIcons.filter,
|
||||
size: 7 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,23 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class SplashScreen extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: Center(
|
||||
child: Text('Loading...'),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class SplashScreen extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: Center(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
CircularProgressIndicator(
|
||||
color: Colors.black,
|
||||
),
|
||||
SizedBox(
|
||||
width: 5.0,
|
||||
),
|
||||
Text('Loading...'),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
import 'package:cssd/config/colors.dart';
|
||||
import 'package:cssd/providers/items.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../../config/routes.dart';
|
||||
|
||||
class ItemAddSaveButton extends StatelessWidget {
|
||||
const ItemAddSaveButton({
|
||||
Key? key,
|
||||
required GlobalKey<FormState> form,
|
||||
this.batchId,
|
||||
required this.nameCTRL,
|
||||
required this.descriptionCTRL,
|
||||
required this.udiCTRL,
|
||||
required double deviceBlockSize,
|
||||
required this.sizeCTRL,
|
||||
required this.specificCTRL,
|
||||
required this.dateValue,
|
||||
}) : _form = form,
|
||||
_deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final GlobalKey<FormState> _form;
|
||||
final TextEditingController nameCTRL;
|
||||
final TextEditingController descriptionCTRL;
|
||||
final TextEditingController udiCTRL;
|
||||
final TextEditingController sizeCTRL;
|
||||
final TextEditingController specificCTRL;
|
||||
final String dateValue;
|
||||
final String? batchId;
|
||||
final double _deviceBlockSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
if (!_form.currentState!.validate()) {
|
||||
return;
|
||||
}
|
||||
Provider.of<ItemProvider>(context, listen: false).createItemResult(
|
||||
nameCTRL.text,
|
||||
sizeCTRL.text,
|
||||
specificCTRL.text,
|
||||
udiCTRL.text,
|
||||
descriptionCTRL.text,
|
||||
batchId,
|
||||
);
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
content: Text('Item added.'),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(ctx).pop();
|
||||
},
|
||||
child: Text('Ok'),
|
||||
)
|
||||
],
|
||||
),
|
||||
).then((_) {
|
||||
Navigator.of(context).pushReplacementNamed(Routes.itemResultScreen);
|
||||
});
|
||||
},
|
||||
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(
|
||||
'Save',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
import 'package:cssd/config/colors.dart';
|
||||
import 'package:cssd/providers/items.dart';
|
||||
|
||||
import '../../../config/routes.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class ItemUpdateButton extends StatelessWidget {
|
||||
const ItemUpdateButton({
|
||||
Key? key,
|
||||
required GlobalKey<FormState> form,
|
||||
required this.id,
|
||||
required this.descriptionCTRL,
|
||||
required this.nameCTRL,
|
||||
required this.udiCTRL,
|
||||
required this.sizeCTRL,
|
||||
required this.specificCTRL,
|
||||
required double deviceBlockSize,
|
||||
}) : _form = form,
|
||||
_deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final GlobalKey<FormState> _form;
|
||||
final String id;
|
||||
final TextEditingController descriptionCTRL;
|
||||
final TextEditingController nameCTRL;
|
||||
final TextEditingController udiCTRL;
|
||||
final TextEditingController sizeCTRL;
|
||||
final TextEditingController specificCTRL;
|
||||
final double _deviceBlockSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
if (!_form.currentState!.validate()) {
|
||||
return;
|
||||
}
|
||||
Provider.of<ItemProvider>(context, listen: false).updateItemResult(
|
||||
id,
|
||||
nameCTRL.text,
|
||||
sizeCTRL.text,
|
||||
specificCTRL.text,
|
||||
udiCTRL.text,
|
||||
descriptionCTRL.text,
|
||||
);
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
content: Text('Item updated.'),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(ctx).pop();
|
||||
},
|
||||
child: Text('Ok'),
|
||||
)
|
||||
],
|
||||
),
|
||||
).then((_) {
|
||||
Navigator.of(context).pushReplacementNamed(Routes.itemResultScreen);
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 5 * _deviceBlockSize,
|
||||
vertical: 10,
|
||||
),
|
||||
// margin:
|
||||
// EdgeInsets.symmetric(horizontal: 35, vertical: 15),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [kBlue, kBlueSub],
|
||||
),
|
||||
borderRadius: BorderRadius.circular(7),
|
||||
),
|
||||
child: Align(
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
'Update',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,186 @@
|
||||
import 'package:cssd/providers/items.dart';
|
||||
import 'package:file_picker/file_picker.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class UploaderImage extends StatelessWidget {
|
||||
final double deviceBlockSize;
|
||||
final ItemProvider providerObject;
|
||||
const UploaderImage({
|
||||
super.key,
|
||||
required this.deviceBlockSize,
|
||||
required this.providerObject,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
child: Directionality(
|
||||
textDirection: TextDirection.rtl,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 20),
|
||||
height: providerObject.catchImages.length != 0 ? 60 : 0,
|
||||
child: ImageBox(
|
||||
deviceBlockSize: deviceBlockSize,
|
||||
itemProvider: providerObject,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: providerObject.catchImages.length != 0 ? 10 : 0,
|
||||
),
|
||||
InkWell(
|
||||
onTap: () async {
|
||||
await loadAssets(context);
|
||||
},
|
||||
child: Container(
|
||||
width: MediaQuery.of(context).size.width - 40,
|
||||
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 30),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
color: Colors.black,
|
||||
),
|
||||
child: Text(
|
||||
'+ Add an image or file from device',
|
||||
textDirection: TextDirection.ltr,
|
||||
style: TextStyle(color: Colors.white),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> loadAssets(BuildContext context) async {
|
||||
var providerObject = Provider.of<ItemProvider>(context, listen: false);
|
||||
List<PlatformFile> files = providerObject.catchImages;
|
||||
try {
|
||||
var datas = await FilePicker.platform.pickFiles(
|
||||
type: FileType.custom,
|
||||
allowedExtensions: ['jpg', 'png', 'bmp', 'jpeg', 'pdf', 'docx', 'doc'],
|
||||
withData: true,
|
||||
withReadStream: true,
|
||||
);
|
||||
files += datas!.files;
|
||||
} catch (_) {}
|
||||
|
||||
providerObject.setCatchImages(files);
|
||||
providerObject.setImages();
|
||||
}
|
||||
}
|
||||
|
||||
class ImageBox extends StatelessWidget {
|
||||
const ImageBox({
|
||||
Key? key,
|
||||
required double deviceBlockSize,
|
||||
required ItemProvider itemProvider,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
_providerObject = itemProvider,
|
||||
super(key: key);
|
||||
|
||||
final double _deviceBlockSize;
|
||||
final ItemProvider _providerObject;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListView.separated(
|
||||
shrinkWrap: true,
|
||||
scrollDirection: Axis.horizontal,
|
||||
itemBuilder: (ctx, index) {
|
||||
bool isPdf = _providerObject.catchImages[index].path!.endsWith('pdf');
|
||||
bool isWord =
|
||||
_providerObject.catchImages[index].path!.endsWith('docx') ||
|
||||
_providerObject.catchImages[index].path!.endsWith('doc');
|
||||
|
||||
// print(_providerObject.catchImages[index].path.endsWith('jpg'));
|
||||
// .substring(_providerObject.catchImages[index].path.length - 4));
|
||||
return ClipRRect(
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
child: Container(
|
||||
width: 60,
|
||||
height: 60,
|
||||
child: Stack(
|
||||
children: <Widget>[
|
||||
Positioned(
|
||||
top: 10,
|
||||
left: 0,
|
||||
child: GestureDetector(
|
||||
onTap: () => isPdf
|
||||
? print('pdf')
|
||||
: isWord
|
||||
? print('word')
|
||||
: Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (_) => Container(
|
||||
color: Colors.white,
|
||||
child: Center(
|
||||
child: Image.memory(
|
||||
_providerObject
|
||||
.catchImages[index].bytes!,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
child: isPdf
|
||||
? Image.asset(
|
||||
'assets/Images/pdf.png',
|
||||
width: 60,
|
||||
height: 60,
|
||||
fit: BoxFit.fill,
|
||||
)
|
||||
: isWord
|
||||
? Image.asset(
|
||||
'assets/Images/word.png',
|
||||
width: 60,
|
||||
height: 60,
|
||||
fit: BoxFit.fill,
|
||||
)
|
||||
: Image.memory(
|
||||
_providerObject.catchImages[index].bytes!,
|
||||
// asset: _images[index],
|
||||
width: 60,
|
||||
height: 60,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 0,
|
||||
right: 0,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
// setState(() {
|
||||
_providerObject.removeImage(index);
|
||||
// });
|
||||
},
|
||||
child: CircleAvatar(
|
||||
backgroundColor: Colors.red,
|
||||
radius: 10,
|
||||
child: Icon(
|
||||
Icons.close,
|
||||
size: 12,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
itemCount: _providerObject.catchImages.length,
|
||||
separatorBuilder: (BuildContext context, int index) => SizedBox(
|
||||
width: 3 * _deviceBlockSize,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,351 @@
|
||||
import 'package:cssd/config/colors.dart';
|
||||
import 'package:cssd/models/item_model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class ItemDetailsDataBox extends StatelessWidget {
|
||||
const ItemDetailsDataBox({
|
||||
Key? key,
|
||||
required this.datas,
|
||||
required double deviceBlockSize,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final ItemDetailObject datas;
|
||||
final double _deviceBlockSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
print(datas.status);
|
||||
return Padding(
|
||||
padding: EdgeInsets.all(20),
|
||||
child: ListView(
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Text(
|
||||
'Item Details',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
letterSpacing: 3,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: Color.fromRGBO(235, 235, 235, 1),
|
||||
border: Border(
|
||||
left: BorderSide(
|
||||
color: kBlue,
|
||||
width: 2,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
DateFormat.yMMMd().format(
|
||||
DateTime.parse(
|
||||
datas.createdAt,
|
||||
),
|
||||
),
|
||||
style: TextStyle(
|
||||
color: kBlue,
|
||||
),
|
||||
),
|
||||
Divider(),
|
||||
Text(
|
||||
'ID: ${datas.id}',
|
||||
style: TextStyle(
|
||||
color: kBlue,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 30,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Item Name',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas.name.toString(),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Size',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas.size.toString(),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Specific',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas.specific.toString(),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'User',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas.userName.toString(),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'UDI',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas.udi.toString(),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Date',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
DateFormat('d-M-y').format(
|
||||
DateTime.parse(
|
||||
datas.createdAt,
|
||||
),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Description',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas.description.toString(),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Hospital Name',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas.hospital,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Status',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas.status == 1 ? 'Success' : 'Failure',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
color: datas.status == 1 ? kBlue : kPink,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
InkWell(
|
||||
onTap: () async => await launch(
|
||||
'https://cssd-doc.com/Show/Item/${datas.id.toString()}',
|
||||
),
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 20),
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
color: Color.fromRGBO(230, 230, 230, 1),
|
||||
borderRadius: BorderRadius.circular(25),
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
'Show More Details',
|
||||
style: TextStyle(fontWeight: FontWeight.w700),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 30,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
import 'package:cssd/providers/items.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class ItemFilterSaveButton extends StatelessWidget {
|
||||
const ItemFilterSaveButton({
|
||||
Key? key,
|
||||
this.hospitalVals,
|
||||
this.hospitalCTRL,
|
||||
required this.idCTRL,
|
||||
required this.nameCTRL,
|
||||
required this.udiCTRL,
|
||||
required this.sizeCTRL,
|
||||
required this.specificCTRL,
|
||||
required this.firstColor,
|
||||
required this.secondColor,
|
||||
required this.push,
|
||||
required double deviceBlockSize,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final List<Map<String, String>>? hospitalVals;
|
||||
final TextEditingController? hospitalCTRL;
|
||||
final TextEditingController idCTRL;
|
||||
final TextEditingController nameCTRL;
|
||||
final TextEditingController udiCTRL;
|
||||
final TextEditingController sizeCTRL;
|
||||
final TextEditingController specificCTRL;
|
||||
final Color firstColor;
|
||||
final Color secondColor;
|
||||
final String push;
|
||||
final double _deviceBlockSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
String? hospitalID;
|
||||
hospitalVals!.forEach(
|
||||
(hospital) {
|
||||
if (hospital['name'] == hospitalCTRL!.text) {
|
||||
hospitalID = hospital['id']!;
|
||||
}
|
||||
},
|
||||
);
|
||||
Provider.of<ItemProvider>(context, listen: false).setFilters(
|
||||
idCTRL.text,
|
||||
nameCTRL.text,
|
||||
udiCTRL.text,
|
||||
hospitalID,
|
||||
sizeCTRL.text,
|
||||
specificCTRL.text,
|
||||
);
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
content: Text('Filters changed.'),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(ctx).pop();
|
||||
},
|
||||
child: Text('Ok'),
|
||||
)
|
||||
],
|
||||
),
|
||||
).then((_) {
|
||||
Navigator.of(context).popAndPushNamed(push);
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 5 * _deviceBlockSize,
|
||||
vertical: 10,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
firstColor,
|
||||
secondColor,
|
||||
],
|
||||
),
|
||||
borderRadius: BorderRadius.circular(7),
|
||||
),
|
||||
child: Align(
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
'Filter',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
import 'package:cssd/providers/items.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class ItemFilterChip extends StatelessWidget {
|
||||
const ItemFilterChip({
|
||||
Key? key,
|
||||
required double deviceBlockSize,
|
||||
required String label,
|
||||
required String id,
|
||||
required String name,
|
||||
required String udi,
|
||||
required String hospital,
|
||||
required String size,
|
||||
required String specific,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
_label = label,
|
||||
_id = id,
|
||||
_name = name,
|
||||
_udi = udi,
|
||||
_hospital = hospital,
|
||||
_size = size,
|
||||
_specific = specific,
|
||||
super(key: key);
|
||||
|
||||
final double _deviceBlockSize;
|
||||
final String _label;
|
||||
final String _id;
|
||||
final String _name;
|
||||
final String _udi;
|
||||
final String _hospital;
|
||||
final String _size;
|
||||
final String _specific;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
width: _deviceBlockSize,
|
||||
),
|
||||
Chip(
|
||||
backgroundColor: Colors.black,
|
||||
label: Text(
|
||||
_label,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
deleteIcon: Icon(
|
||||
Icons.close,
|
||||
color: Colors.white,
|
||||
),
|
||||
onDeleted: () {
|
||||
var itemProvider =
|
||||
Provider.of<ItemProvider>(context, listen: false);
|
||||
itemProvider.setFilters(
|
||||
_id,
|
||||
_name,
|
||||
_udi,
|
||||
_hospital,
|
||||
_size,
|
||||
_specific,
|
||||
);
|
||||
itemProvider.setLoading();
|
||||
itemProvider.getItemResults().then(
|
||||
(_) {
|
||||
itemProvider.resetLoading();
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,244 @@
|
||||
import 'package:cssd/config/colors.dart';
|
||||
import 'package:cssd/models/item_model.dart';
|
||||
import 'package:cssd/providers/auth.dart';
|
||||
import 'package:cssd/providers/items.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../../config/routes.dart';
|
||||
|
||||
class ItemItemBox extends StatelessWidget {
|
||||
final ItemResultObject? item;
|
||||
|
||||
const ItemItemBox({
|
||||
Key? key,
|
||||
required double deviceBlockSize,
|
||||
this.item,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final double _deviceBlockSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final userData = Provider.of<Auth>(context, listen: false).user;
|
||||
return GestureDetector(
|
||||
onTap: () => Navigator.of(context).pushNamed(
|
||||
Routes.itemDetailScreen,
|
||||
arguments: item!.id,
|
||||
),
|
||||
child: Card(
|
||||
elevation: 1,
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(8),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: const EdgeInsets.all(6.0),
|
||||
child: Text(
|
||||
item!.id,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 3 * _deviceBlockSize,
|
||||
),
|
||||
// Spacer(),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 40 * _deviceBlockSize,
|
||||
child: Text(
|
||||
item!.name,
|
||||
style: TextStyle(
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 30 * _deviceBlockSize,
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
'Size: ',
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
item!.size,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 30 * _deviceBlockSize,
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Text(
|
||||
'User: ',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
item!.userName,
|
||||
style: TextStyle(
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Spacer(),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
userData['roles']?.contains('User') ?? false
|
||||
? Container()
|
||||
: InkWell(
|
||||
customBorder: CircleBorder(),
|
||||
onTap: () {
|
||||
Provider.of<ItemProvider>(context,
|
||||
listen: false)
|
||||
.changeStatus(item!.id)
|
||||
.then(
|
||||
(value) {
|
||||
if (value) {
|
||||
print('true');
|
||||
}
|
||||
Navigator.of(context).popAndPushNamed(
|
||||
Routes.itemResultScreen);
|
||||
},
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(7),
|
||||
width: 6 * _deviceBlockSize,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: item!.status == 1 ? kPink : kBlue,
|
||||
),
|
||||
child: Icon(
|
||||
item!.status == 1 ? Icons.close : Icons.check,
|
||||
size: 2 * _deviceBlockSize,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 5.0,
|
||||
),
|
||||
userData['roles']?.contains('User') ?? false
|
||||
? Container()
|
||||
: InkWell(
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed(
|
||||
Routes.itemUpdateScreen,
|
||||
arguments: item!.id,
|
||||
);
|
||||
},
|
||||
child: Icon(
|
||||
Icons.edit,
|
||||
size: 5 * _deviceBlockSize,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 5.0,
|
||||
),
|
||||
userData['roles']?.contains('User') ?? false
|
||||
? Container()
|
||||
: InkWell(
|
||||
onTap: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
title: Text('Delete'),
|
||||
content: Text(
|
||||
'Are you sure you want delete this Item?'),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
child: Text('Yes'),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
Provider.of<ItemProvider>(context,
|
||||
listen: false)
|
||||
.removeItems(item!.id);
|
||||
},
|
||||
),
|
||||
TextButton(
|
||||
child: Text('No'),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
child: Icon(
|
||||
Icons.delete,
|
||||
size: 5 * _deviceBlockSize,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 5.0,
|
||||
),
|
||||
InkWell(
|
||||
customBorder: CircleBorder(),
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed(
|
||||
Routes.itemDetailScreen,
|
||||
arguments: item!.id,
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(7),
|
||||
width: 9 * _deviceBlockSize,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.black,
|
||||
),
|
||||
child: Icon(
|
||||
FontAwesomeIcons.fileAlt,
|
||||
size: 5 * _deviceBlockSize,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,212 @@
|
||||
import 'package:cssd/providers/labels.dart';
|
||||
import 'package:cssd/utils/scan.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class AddPackageBox extends StatelessWidget {
|
||||
const AddPackageBox({
|
||||
Key? key,
|
||||
required double deviceBlockSize,
|
||||
required this.values,
|
||||
required this.vals,
|
||||
required this.initialLabelValue,
|
||||
required this.index,
|
||||
required this.text,
|
||||
this.iconColor,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final double _deviceBlockSize;
|
||||
final TextEditingController values;
|
||||
final List<String> vals;
|
||||
final String initialLabelValue;
|
||||
final int index;
|
||||
final String text;
|
||||
final Color? iconColor;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
height: 150,
|
||||
child: Stack(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: EdgeInsets.only(
|
||||
right: 10,
|
||||
bottom: 25,
|
||||
left: 10,
|
||||
top: 10,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
left: BorderSide(color: Colors.black, width: 2),
|
||||
right: BorderSide(color: Colors.grey),
|
||||
bottom: BorderSide(color: Colors.grey),
|
||||
top: BorderSide(color: Colors.grey),
|
||||
),
|
||||
),
|
||||
height: 120,
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 5),
|
||||
// height: 65,
|
||||
child: Row(
|
||||
// width: double.infinity,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Icon(
|
||||
FontAwesomeIcons.alignLeft,
|
||||
color: Colors.grey,
|
||||
size: 7 * _deviceBlockSize,
|
||||
),
|
||||
SizedBox(
|
||||
width: 4 * _deviceBlockSize,
|
||||
),
|
||||
Expanded(
|
||||
// width: MediaQuery.of(context).size.width - 70,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
width: _deviceBlockSize,
|
||||
),
|
||||
Text(
|
||||
text,
|
||||
style: TextStyle(
|
||||
fontSize: 3.5 * _deviceBlockSize,
|
||||
color: Colors.grey,
|
||||
fontWeight: FontWeight.w100,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: MediaQuery.of(context).size.width -
|
||||
(40 * _deviceBlockSize),
|
||||
// height: 30,
|
||||
child: DropdownButtonFormField(
|
||||
decoration: InputDecoration(
|
||||
contentPadding: EdgeInsets.only(
|
||||
left: _deviceBlockSize,
|
||||
),
|
||||
border: InputBorder.none,
|
||||
),
|
||||
iconSize: 7 * _deviceBlockSize,
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.angleDown,
|
||||
color: Colors.black,
|
||||
),
|
||||
isExpanded: true,
|
||||
hint: Container(
|
||||
// width: 100,
|
||||
height: 70,
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 0),
|
||||
child: TextFormField(
|
||||
controller: values,
|
||||
decoration: InputDecoration(
|
||||
contentPadding: EdgeInsets.only(
|
||||
bottom: 12,
|
||||
),
|
||||
isDense: true,
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Colors.black,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
isDense: true,
|
||||
items: vals.map((val) {
|
||||
return new DropdownMenuItem<String>(
|
||||
value: val,
|
||||
child: Container(
|
||||
child: Text(
|
||||
val,
|
||||
style: TextStyle(
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: (val) {
|
||||
Provider.of<LabelsProvider>(context,
|
||||
listen: false)
|
||||
.changePackageVal(val!, index);
|
||||
},
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
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);
|
||||
Provider.of<LabelsProvider>(context,
|
||||
listen: false)
|
||||
.changePackageVal(result, index);
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
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,
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
bottom: 15,
|
||||
right: 0,
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
Provider.of<LabelsProvider>(context).addPackageVal();
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(3),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: iconColor,
|
||||
),
|
||||
child: Icon(
|
||||
Icons.add,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,73 +1,73 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:intl/intl.dart' as DateEditor;
|
||||
|
||||
class LabelAddDatePicker extends StatefulWidget {
|
||||
LabelAddDatePicker({
|
||||
Key key,
|
||||
@required this.dateCTRL,
|
||||
@required double deviceBlockSize,
|
||||
@required String label,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
_label = label,
|
||||
super(key: key);
|
||||
|
||||
final TextEditingController dateCTRL;
|
||||
final double _deviceBlockSize;
|
||||
final String _label;
|
||||
|
||||
@override
|
||||
_LabelAddDatePickerState createState() => _LabelAddDatePickerState();
|
||||
}
|
||||
|
||||
class _LabelAddDatePickerState extends State<LabelAddDatePicker> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () async {
|
||||
var res = await showDatePicker(
|
||||
context: context,
|
||||
initialDate: DateTime.now(),
|
||||
firstDate: DateTime(2010, 1),
|
||||
lastDate: DateTime(2101),
|
||||
);
|
||||
if (res != null) {
|
||||
setState(
|
||||
() {
|
||||
widget.dateCTRL.text = DateEditor.DateFormat('y-M-d').format(res);
|
||||
// sDateValue =
|
||||
// DateEditor.DateFormat('y-M-d').format(
|
||||
// dateTimeS,
|
||||
// ); // baraye tavize makane gharar giri baraye api
|
||||
},
|
||||
);
|
||||
}
|
||||
},
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: TextField(
|
||||
enabled: false,
|
||||
controller: widget.dateCTRL,
|
||||
decoration: InputDecoration(
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.calendarAlt,
|
||||
size: 7 * widget._deviceBlockSize,
|
||||
),
|
||||
labelText: widget._label,
|
||||
isDense: true,
|
||||
contentPadding: EdgeInsets.only(bottom: 7, right: 3, left: 3),
|
||||
// border: InputBorder.none,
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
),
|
||||
Icon(FontAwesomeIcons.angleDown)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:intl/intl.dart' as DateEditor;
|
||||
|
||||
class LabelAddDatePicker extends StatefulWidget {
|
||||
LabelAddDatePicker({
|
||||
Key? key,
|
||||
required this.dateCTRL,
|
||||
required double deviceBlockSize,
|
||||
required String label,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
_label = label,
|
||||
super(key: key);
|
||||
|
||||
final TextEditingController dateCTRL;
|
||||
final double _deviceBlockSize;
|
||||
final String _label;
|
||||
|
||||
@override
|
||||
_LabelAddDatePickerState createState() => _LabelAddDatePickerState();
|
||||
}
|
||||
|
||||
class _LabelAddDatePickerState extends State<LabelAddDatePicker> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () async {
|
||||
var res = await showDatePicker(
|
||||
context: context,
|
||||
initialDate: DateTime.now(),
|
||||
firstDate: DateTime(2010, 1),
|
||||
lastDate: DateTime(2101),
|
||||
);
|
||||
if (res != null) {
|
||||
setState(
|
||||
() {
|
||||
widget.dateCTRL.text = DateEditor.DateFormat('y-M-d').format(res);
|
||||
// sDateValue =
|
||||
// DateEditor.DateFormat('y-M-d').format(
|
||||
// dateTimeS,
|
||||
// ); // baraye tavize makane gharar giri baraye api
|
||||
},
|
||||
);
|
||||
}
|
||||
},
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: TextField(
|
||||
enabled: false,
|
||||
controller: widget.dateCTRL,
|
||||
decoration: InputDecoration(
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.calendarAlt,
|
||||
size: 7 * widget._deviceBlockSize,
|
||||
),
|
||||
labelText: widget._label,
|
||||
isDense: true,
|
||||
contentPadding: EdgeInsets.only(bottom: 7, right: 3, left: 3),
|
||||
// border: InputBorder.none,
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
),
|
||||
Icon(FontAwesomeIcons.angleDown)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,91 +1,92 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../../config/routes.dart';
|
||||
import '../../../providers/labels.dart';
|
||||
|
||||
class LabelAddSaveButton extends StatelessWidget {
|
||||
const LabelAddSaveButton({
|
||||
Key key,
|
||||
@required GlobalKey<FormState> form,
|
||||
@required this.lotNumberCTRL,
|
||||
@required this.cycleNumberCTRL,
|
||||
@required this.sDateCTRL,
|
||||
@required this.packageValue,
|
||||
@required this.eDateCTRL,
|
||||
@required this.striizerIdCTRL,
|
||||
@required double deviceBlockSize,
|
||||
}) : _form = form,
|
||||
_deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final GlobalKey<FormState> _form;
|
||||
final TextEditingController lotNumberCTRL;
|
||||
final TextEditingController cycleNumberCTRL;
|
||||
final TextEditingController sDateCTRL;
|
||||
final List<String> packageValue;
|
||||
final TextEditingController eDateCTRL;
|
||||
final TextEditingController striizerIdCTRL;
|
||||
final double _deviceBlockSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
if (!_form.currentState.validate()) {
|
||||
return;
|
||||
}
|
||||
Provider.of<LabelsProvider>(context).createLabelResult(
|
||||
lotNumberCTRL.text,
|
||||
cycleNumberCTRL.text,
|
||||
sDateCTRL.text,
|
||||
// sDateValue,
|
||||
{'id': packageValue[0], 'name': packageValue[1]},
|
||||
eDateCTRL.text,
|
||||
// eDateValue,
|
||||
striizerIdCTRL.text,
|
||||
);
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
content: Text('Label added.'),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(ctx).pop();
|
||||
},
|
||||
child: Text('Ok'),
|
||||
)
|
||||
],
|
||||
),
|
||||
).then((_) {
|
||||
Navigator.of(context).pushReplacementNamed(Routes.labelResultScreen);
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 5 * _deviceBlockSize,
|
||||
vertical: 10,
|
||||
),
|
||||
// margin:
|
||||
// EdgeInsets.symmetric(horizontal: 35, vertical: 15),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [Colors.blue, Colors.green],
|
||||
),
|
||||
borderRadius: BorderRadius.circular(7),
|
||||
),
|
||||
child: Align(
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
'SAVE',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
import 'package:cssd/config/colors.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../../config/routes.dart';
|
||||
import '../../../providers/labels.dart';
|
||||
|
||||
class LabelAddSaveButton extends StatelessWidget {
|
||||
const LabelAddSaveButton({
|
||||
Key? key,
|
||||
required GlobalKey<FormState> form,
|
||||
required this.lotNumberCTRL,
|
||||
required this.cycleNumberCTRL,
|
||||
required this.sDateCTRL,
|
||||
required this.packageValue,
|
||||
required this.eDateCTRL,
|
||||
required this.striizerIdCTRL,
|
||||
required double deviceBlockSize,
|
||||
}) : _form = form,
|
||||
_deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final GlobalKey<FormState> _form;
|
||||
final TextEditingController lotNumberCTRL;
|
||||
final TextEditingController cycleNumberCTRL;
|
||||
final TextEditingController sDateCTRL;
|
||||
final List<String> packageValue;
|
||||
final TextEditingController eDateCTRL;
|
||||
final TextEditingController striizerIdCTRL;
|
||||
final double _deviceBlockSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
if (!_form.currentState!.validate()) {
|
||||
return;
|
||||
}
|
||||
Provider.of<LabelsProvider>(context, listen: false).createLabelResult(
|
||||
lotNumberCTRL.text,
|
||||
cycleNumberCTRL.text,
|
||||
sDateCTRL.text,
|
||||
// sDateValue,
|
||||
{'id': packageValue[0], 'name': packageValue[1]},
|
||||
eDateCTRL.text,
|
||||
// eDateValue,
|
||||
striizerIdCTRL.text,
|
||||
);
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
content: Text('Label added.'),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(ctx).pop();
|
||||
},
|
||||
child: Text('Ok'),
|
||||
)
|
||||
],
|
||||
),
|
||||
).then((_) {
|
||||
Navigator.of(context).pushReplacementNamed(Routes.labelResultScreen);
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 5 * _deviceBlockSize,
|
||||
vertical: 10,
|
||||
),
|
||||
// margin:
|
||||
// EdgeInsets.symmetric(horizontal: 35, vertical: 15),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [kLightBlue, kLightBlueSub],
|
||||
),
|
||||
borderRadius: BorderRadius.circular(7),
|
||||
),
|
||||
child: Align(
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
'Save',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,144 +1,149 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
|
||||
class LabelAddSelectorBox extends StatefulWidget {
|
||||
const LabelAddSelectorBox({
|
||||
Key key,
|
||||
@required double deviceBlockSize,
|
||||
@required this.packageCTRL,
|
||||
@required this.packageVals,
|
||||
@required this.packageValue,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final double _deviceBlockSize;
|
||||
final TextEditingController packageCTRL;
|
||||
final List<Map<String, String>> packageVals;
|
||||
final List<String> packageValue;
|
||||
|
||||
@override
|
||||
_LabelAddSelectorBoxState createState() => _LabelAddSelectorBoxState();
|
||||
}
|
||||
|
||||
class _LabelAddSelectorBoxState extends State<LabelAddSelectorBox> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 5),
|
||||
// height: 65,
|
||||
child: Row(
|
||||
// width: double.infinity,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Icon(
|
||||
FontAwesomeIcons.alignLeft,
|
||||
color: Colors.grey,
|
||||
size: 7 * widget._deviceBlockSize,
|
||||
),
|
||||
SizedBox(
|
||||
width: 4 * widget._deviceBlockSize,
|
||||
),
|
||||
Expanded(
|
||||
// width: MediaQuery.of(context).size.width - 70,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
width: widget._deviceBlockSize,
|
||||
),
|
||||
Text(
|
||||
'Package',
|
||||
style: TextStyle(
|
||||
fontSize: 3.5 * widget._deviceBlockSize,
|
||||
color: Colors.grey,
|
||||
fontWeight: FontWeight.w700),
|
||||
),
|
||||
],
|
||||
),
|
||||
Container(
|
||||
// height: 30,
|
||||
child: DropdownButtonFormField(
|
||||
decoration: InputDecoration(
|
||||
contentPadding:
|
||||
EdgeInsets.only(left: widget._deviceBlockSize),
|
||||
// border: InputBorder.none,
|
||||
),
|
||||
iconSize: 7 * widget._deviceBlockSize,
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.angleDown,
|
||||
color: Colors.black,
|
||||
),
|
||||
isExpanded: true,
|
||||
hint: Container(
|
||||
// width: 100,
|
||||
height: 70,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 0),
|
||||
child: Text(
|
||||
widget.packageCTRL.text,
|
||||
textDirection: TextDirection.rtl,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Colors.black,
|
||||
fontSize: 5 * widget._deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
// Container(
|
||||
// // width: 100,
|
||||
// height: 70,
|
||||
// padding: const EdgeInsets.symmetric(horizontal: 0),
|
||||
// child: TextFormField(
|
||||
// controller: widget.packageCTRL,
|
||||
// decoration: InputDecoration(
|
||||
// contentPadding: EdgeInsets.only(bottom: 15),
|
||||
// isDense: true,
|
||||
// ),
|
||||
// style: TextStyle(
|
||||
// fontWeight: FontWeight.w700,
|
||||
// color: Colors.black,
|
||||
// fontSize: 5 * widget._deviceBlockSize,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
isDense: true,
|
||||
items: widget.packageVals.map((val) {
|
||||
return new DropdownMenuItem<String>(
|
||||
value: val['name'],
|
||||
child: Container(
|
||||
child: Text(
|
||||
val['name'],
|
||||
textDirection: TextDirection.rtl,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Colors.black,
|
||||
fontSize: 5 * widget._deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: (val) {
|
||||
setState(() {
|
||||
widget.packageValue[1] = val;
|
||||
widget.packageCTRL.text = val;
|
||||
widget.packageVals.forEach((package) {
|
||||
if (package['name'] == val) {
|
||||
widget.packageValue[0] = package['id'];
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
]),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
|
||||
class LabelAddSelectorBox extends StatefulWidget {
|
||||
const LabelAddSelectorBox({
|
||||
Key? key,
|
||||
required double deviceBlockSize,
|
||||
required this.packageCTRL,
|
||||
required this.packageVals,
|
||||
required this.packageValue,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final double _deviceBlockSize;
|
||||
final TextEditingController packageCTRL;
|
||||
final List<Map<String, String>> packageVals;
|
||||
final List<String> packageValue;
|
||||
|
||||
@override
|
||||
_LabelAddSelectorBoxState createState() => _LabelAddSelectorBoxState();
|
||||
}
|
||||
|
||||
class _LabelAddSelectorBoxState extends State<LabelAddSelectorBox> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 5),
|
||||
// height: 65,
|
||||
child: Row(
|
||||
// width: double.infinity,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Icon(
|
||||
FontAwesomeIcons.alignLeft,
|
||||
color: Colors.grey,
|
||||
size: 7 * widget._deviceBlockSize,
|
||||
),
|
||||
SizedBox(
|
||||
width: 4 * widget._deviceBlockSize,
|
||||
),
|
||||
Expanded(
|
||||
// width: MediaQuery.of(context).size.width - 70,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
width: widget._deviceBlockSize,
|
||||
),
|
||||
Text(
|
||||
'Package',
|
||||
style: TextStyle(
|
||||
fontSize: 3.5 * widget._deviceBlockSize,
|
||||
color: Colors.grey,
|
||||
fontWeight: FontWeight.w700),
|
||||
),
|
||||
],
|
||||
),
|
||||
Container(
|
||||
// height: 30,
|
||||
child: DropdownButtonFormField(
|
||||
decoration: InputDecoration(
|
||||
contentPadding:
|
||||
EdgeInsets.only(left: widget._deviceBlockSize),
|
||||
// border: InputBorder.none,
|
||||
),
|
||||
iconSize: 7 * widget._deviceBlockSize,
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.angleDown,
|
||||
color: Colors.black,
|
||||
),
|
||||
isExpanded: true,
|
||||
hint: Container(
|
||||
// width: 100,
|
||||
height: 70,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 0),
|
||||
child: Text(
|
||||
widget.packageCTRL.text,
|
||||
textDirection: TextDirection.rtl,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Colors.black,
|
||||
fontSize: 5 * widget._deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
// Container(
|
||||
// // width: 100,
|
||||
// height: 70,
|
||||
// padding: const EdgeInsets.symmetric(horizontal: 0),
|
||||
// child: TextFormField(
|
||||
// controller: widget.packageCTRL,
|
||||
// decoration: InputDecoration(
|
||||
// contentPadding: EdgeInsets.only(bottom: 15),
|
||||
// isDense: true,
|
||||
// ),
|
||||
// style: TextStyle(
|
||||
// fontWeight: FontWeight.w700,
|
||||
// color: Colors.black,
|
||||
// fontSize: 5 * widget._deviceBlockSize,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
isDense: true,
|
||||
items: widget.packageVals.map((val) {
|
||||
return new DropdownMenuItem<String>(
|
||||
value: val['name'],
|
||||
child: Container(
|
||||
child: Text(
|
||||
val['name'] ?? '',
|
||||
textDirection: TextDirection.rtl,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Colors.black,
|
||||
fontSize: 5 * widget._deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: (val) {
|
||||
setState(
|
||||
() {
|
||||
widget.packageValue[1] = val!;
|
||||
widget.packageCTRL.text = val;
|
||||
widget.packageVals.forEach(
|
||||
(package) {
|
||||
if (package['name'] == val) {
|
||||
widget.packageValue[0] = package['id'] ?? '';
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,93 +1,93 @@
|
||||
import '../../../config/routes.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import '../../../providers/labels.dart';
|
||||
|
||||
class LabelUpdateButton extends StatelessWidget {
|
||||
const LabelUpdateButton({
|
||||
Key key,
|
||||
@required GlobalKey<FormState> form,
|
||||
@required this.id,
|
||||
@required this.lotNumberCTRL,
|
||||
@required this.cycleNumberCTRL,
|
||||
@required this.sDateCTRL,
|
||||
@required this.packageValue,
|
||||
@required this.eDateCTRL,
|
||||
@required this.striizerIdCTRL,
|
||||
@required double deviceBlockSize,
|
||||
}) : _form = form,
|
||||
_deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final GlobalKey<FormState> _form;
|
||||
final String id;
|
||||
final TextEditingController lotNumberCTRL;
|
||||
final TextEditingController cycleNumberCTRL;
|
||||
final TextEditingController sDateCTRL;
|
||||
final List<String> packageValue;
|
||||
final TextEditingController eDateCTRL;
|
||||
final TextEditingController striizerIdCTRL;
|
||||
final double _deviceBlockSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
if (!_form.currentState.validate()) {
|
||||
return;
|
||||
}
|
||||
Provider.of<LabelsProvider>(context).updateLabelResult(
|
||||
id,
|
||||
lotNumberCTRL.text,
|
||||
cycleNumberCTRL.text,
|
||||
sDateCTRL.text,
|
||||
// sDateValue,
|
||||
{'id': packageValue[0], 'name': packageValue[1]},
|
||||
eDateCTRL.text,
|
||||
// eDateValue,
|
||||
striizerIdCTRL.text,
|
||||
);
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
content: Text('Label updated.'),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(ctx).pop();
|
||||
},
|
||||
child: Text('Ok'),
|
||||
)
|
||||
],
|
||||
),
|
||||
).then((_) {
|
||||
Navigator.of(context).pushReplacementNamed(Routes.labelResultScreen);
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 5 * _deviceBlockSize,
|
||||
vertical: 10,
|
||||
),
|
||||
// margin:
|
||||
// EdgeInsets.symmetric(horizontal: 35, vertical: 15),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [Colors.blue, Colors.green],
|
||||
),
|
||||
borderRadius: BorderRadius.circular(7),
|
||||
),
|
||||
child: Align(
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
'UPDATE',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
import 'package:cssd/config/colors.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../../config/routes.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import '../../../providers/labels.dart';
|
||||
|
||||
class LabelUpdateButton extends StatelessWidget {
|
||||
const LabelUpdateButton({
|
||||
Key? key,
|
||||
required GlobalKey<FormState> form,
|
||||
required this.id,
|
||||
required this.lotNumberCTRL,
|
||||
required this.cycleNumberCTRL,
|
||||
required this.sDateCTRL,
|
||||
required this.packageValue,
|
||||
required this.eDateCTRL,
|
||||
required this.striizerIdCTRL,
|
||||
required double deviceBlockSize,
|
||||
}) : _form = form,
|
||||
_deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final GlobalKey<FormState> _form;
|
||||
final String id;
|
||||
final TextEditingController lotNumberCTRL;
|
||||
final TextEditingController cycleNumberCTRL;
|
||||
final TextEditingController sDateCTRL;
|
||||
final List<String> packageValue;
|
||||
final TextEditingController eDateCTRL;
|
||||
final TextEditingController striizerIdCTRL;
|
||||
final double _deviceBlockSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
if (!_form.currentState!.validate()) {
|
||||
return;
|
||||
}
|
||||
Provider.of<LabelsProvider>(context, listen: false).updateLabelResult(
|
||||
id,
|
||||
lotNumberCTRL.text,
|
||||
cycleNumberCTRL.text,
|
||||
sDateCTRL.text,
|
||||
{'id': packageValue[0]},
|
||||
eDateCTRL.text,
|
||||
striizerIdCTRL.text,
|
||||
);
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
content: Text('Label updated.'),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(ctx).pop();
|
||||
},
|
||||
child: Text('Ok'),
|
||||
)
|
||||
],
|
||||
),
|
||||
).then((_) {
|
||||
Navigator.of(context).pushReplacementNamed(Routes.labelResultScreen);
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 5 * _deviceBlockSize,
|
||||
vertical: 10,
|
||||
),
|
||||
// margin:
|
||||
// EdgeInsets.symmetric(horizontal: 35, vertical: 15),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [kLightBlue, kLightBlueSub],
|
||||
),
|
||||
borderRadius: BorderRadius.circular(7),
|
||||
),
|
||||
child: Align(
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
'Update',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,300 +1,302 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
import '../../../models/label_models.dart';
|
||||
|
||||
class LabelDetailsDataBox extends StatelessWidget {
|
||||
const LabelDetailsDataBox({
|
||||
Key key,
|
||||
@required this.datas,
|
||||
@required double deviceBlockSize,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final LabelDetailsObject datas;
|
||||
final double _deviceBlockSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.all(20),
|
||||
child: ListView(
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Text(
|
||||
'LABEL DETAILS',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
letterSpacing: 3,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: Color.fromRGBO(235, 235, 235, 1),
|
||||
border: Border(
|
||||
left: BorderSide(
|
||||
color: Colors.black54,
|
||||
width: 2,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
DateFormat.yMMMd().format(
|
||||
DateTime.parse(
|
||||
datas.createDate,
|
||||
),
|
||||
),
|
||||
style: TextStyle(
|
||||
color: Colors.red,
|
||||
),
|
||||
),
|
||||
Divider(),
|
||||
Text(
|
||||
'ID: ${datas.id}',
|
||||
style: TextStyle(
|
||||
color: Colors.red,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 30,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Sterilizer ID',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas.sterileId.toString(),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Cycle Number',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas.cycleNumber.toString(),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Lot Number',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas.lotNumber.toString(),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Sterile Date',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
DateFormat('y-M-d').format(
|
||||
DateTime.parse(
|
||||
datas.sterileDate,
|
||||
),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Expire Date',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
DateFormat('y-M-d').format(
|
||||
DateTime.parse(
|
||||
datas.expireDate,
|
||||
),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700, color: Colors.red),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Package',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas.package.toString(),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Hospital Name',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas.hospitalName,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
InkWell(
|
||||
onTap: () => launch(
|
||||
'https://cssd-doc.com/Show/Label/${datas.id.toString()}',
|
||||
// forceSafariVC: true,
|
||||
// forceWebView: true,
|
||||
// headers: <String, String>{'my_header_key': 'my_header_value'},
|
||||
// child: Text('Show Full Details'),
|
||||
),
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 20),
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
color: Color.fromRGBO(230, 230, 230, 1),
|
||||
borderRadius: BorderRadius.circular(25),
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
'Show More Details',
|
||||
style: TextStyle(fontWeight: FontWeight.w700),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
import 'package:cssd/config/colors.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
import '../../../models/label_models.dart';
|
||||
|
||||
class LabelDetailsDataBox extends StatelessWidget {
|
||||
const LabelDetailsDataBox({
|
||||
Key? key,
|
||||
required this.datas,
|
||||
required double deviceBlockSize,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final LabelDetailsObject datas;
|
||||
final double _deviceBlockSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.all(20),
|
||||
child: ListView(
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Text(
|
||||
'Label Details',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
letterSpacing: 3,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: Color.fromRGBO(235, 235, 235, 1),
|
||||
border: Border(
|
||||
left: BorderSide(
|
||||
color: kLightBlue,
|
||||
width: 2,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
DateFormat.yMMMd().format(
|
||||
DateTime.parse(
|
||||
datas.createDate,
|
||||
),
|
||||
),
|
||||
style: TextStyle(
|
||||
color: kLightBlue,
|
||||
),
|
||||
),
|
||||
Divider(),
|
||||
Text(
|
||||
'ID: ${datas.id}',
|
||||
style: TextStyle(
|
||||
color: kLightBlue,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 30,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Sterilizer ID',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas.sterileId.toString(),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Cycle Number',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas.cycleNumber.toString(),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Lot Number',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas.lotNumber.toString(),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Sterile Date',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
DateFormat('y-M-d').format(
|
||||
DateTime.parse(
|
||||
datas.sterileDate,
|
||||
),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Expire Date',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
DateFormat('y-M-d').format(
|
||||
DateTime.parse(
|
||||
datas.expireDate,
|
||||
),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
color: kPink,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Package',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas.package.toString(),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Hospital Name',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas.hospitalName,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
InkWell(
|
||||
onTap: () => launch(
|
||||
'https://cssd-doc.com/Show/Label/${datas.id.toString()}',
|
||||
// forceSafariVC: true,
|
||||
// forceWebView: true,
|
||||
// headers: <String, String>{'my_header_key': 'my_header_value'},
|
||||
// child: Text('Show Full Details'),
|
||||
),
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 20),
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
color: Color.fromRGBO(230, 230, 230, 1),
|
||||
borderRadius: BorderRadius.circular(25),
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
'Show More Details',
|
||||
style: TextStyle(fontWeight: FontWeight.w700),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,36 +1,36 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class InfoHeader extends StatelessWidget {
|
||||
const InfoHeader({
|
||||
Key key,
|
||||
@required double deviceBlockSize,
|
||||
@required String label,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
_label = label,
|
||||
super(key: key);
|
||||
|
||||
final double _deviceBlockSize;
|
||||
final String _label;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: EdgeInsets.only(
|
||||
left: 20,
|
||||
top: 20,
|
||||
bottom: 10,
|
||||
right: 20,
|
||||
),
|
||||
child: Text(
|
||||
_label,
|
||||
textAlign: TextAlign.left,
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 7 * _deviceBlockSize,
|
||||
letterSpacing: _deviceBlockSize,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class InfoHeader extends StatelessWidget {
|
||||
const InfoHeader({
|
||||
Key? key,
|
||||
required double deviceBlockSize,
|
||||
required String label,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
_label = label,
|
||||
super(key: key);
|
||||
|
||||
final double _deviceBlockSize;
|
||||
final String _label;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: EdgeInsets.only(
|
||||
left: 20,
|
||||
top: 20,
|
||||
bottom: 10,
|
||||
right: 20,
|
||||
),
|
||||
child: Text(
|
||||
_label,
|
||||
textAlign: TextAlign.left,
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 7 * _deviceBlockSize,
|
||||
letterSpacing: _deviceBlockSize,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,87 +1,88 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../../config/routes.dart';
|
||||
import '../../../providers/labels.dart';
|
||||
|
||||
class LabelFilterSaveButton extends StatelessWidget {
|
||||
const LabelFilterSaveButton({
|
||||
Key key,
|
||||
@required this.hospitalVals,
|
||||
@required this.hospitalCTRL,
|
||||
@required this.labelIdCTRl,
|
||||
@required this.cycleNumberCTRL,
|
||||
@required this.striizerIdCTRL,
|
||||
@required double deviceBlockSize,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final List<Map<String, String>> hospitalVals;
|
||||
final TextEditingController hospitalCTRL;
|
||||
final TextEditingController labelIdCTRl;
|
||||
final TextEditingController cycleNumberCTRL;
|
||||
final TextEditingController striizerIdCTRL;
|
||||
final double _deviceBlockSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
String hospitalID;
|
||||
hospitalVals.forEach(
|
||||
(hospital) {
|
||||
if (hospital['name'] == hospitalCTRL.text) {
|
||||
hospitalID = hospital['id'];
|
||||
}
|
||||
},
|
||||
);
|
||||
Provider.of<LabelsProvider>(context).setFilters(
|
||||
labelIdCTRl.text,
|
||||
cycleNumberCTRL.text,
|
||||
striizerIdCTRL.text,
|
||||
hospitalID,
|
||||
);
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
content: Text('Filters changed.'),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(ctx).pop();
|
||||
},
|
||||
child: Text('Ok'),
|
||||
)
|
||||
],
|
||||
),
|
||||
).then((_) {
|
||||
Navigator.of(context).popAndPushNamed(Routes.labelResultScreen);
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 5 * _deviceBlockSize,
|
||||
vertical: 5,
|
||||
),
|
||||
// margin:
|
||||
// EdgeInsets.symmetric(horizontal: 35, vertical: 15),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [Colors.blue, Colors.green],
|
||||
),
|
||||
borderRadius: BorderRadius.circular(7),
|
||||
),
|
||||
child: Align(
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
'FILTER',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
import 'package:cssd/config/colors.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../../config/routes.dart';
|
||||
import '../../../providers/labels.dart';
|
||||
|
||||
class LabelFilterSaveButton extends StatelessWidget {
|
||||
const LabelFilterSaveButton({
|
||||
Key? key,
|
||||
required this.hospitalVals,
|
||||
required this.hospitalCTRL,
|
||||
required this.labelIdCTRl,
|
||||
required this.cycleNumberCTRL,
|
||||
required this.striizerIdCTRL,
|
||||
required double deviceBlockSize,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final List<Map<String, String>> hospitalVals;
|
||||
final TextEditingController hospitalCTRL;
|
||||
final TextEditingController labelIdCTRl;
|
||||
final TextEditingController cycleNumberCTRL;
|
||||
final TextEditingController striizerIdCTRL;
|
||||
final double _deviceBlockSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
String? hospitalID;
|
||||
hospitalVals.forEach(
|
||||
(hospital) {
|
||||
if (hospital['name'] == hospitalCTRL.text) {
|
||||
hospitalID = hospital['id']!;
|
||||
}
|
||||
},
|
||||
);
|
||||
Provider.of<LabelsProvider>(context, listen: false).setFilters(
|
||||
labelIdCTRl.text,
|
||||
cycleNumberCTRL.text,
|
||||
striizerIdCTRL.text,
|
||||
hospitalID,
|
||||
);
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
content: Text('Filters changed.'),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(ctx).pop();
|
||||
},
|
||||
child: Text('Ok'),
|
||||
)
|
||||
],
|
||||
),
|
||||
).then((_) {
|
||||
Navigator.of(context).popAndPushNamed(Routes.labelResultScreen);
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 5 * _deviceBlockSize,
|
||||
vertical: 10,
|
||||
),
|
||||
// margin:
|
||||
// EdgeInsets.symmetric(horizontal: 35, vertical: 15),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [kLightBlue, kLightBlueSub],
|
||||
),
|
||||
borderRadius: BorderRadius.circular(7),
|
||||
),
|
||||
child: Align(
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
'Filter',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,114 +1,114 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
|
||||
class LabelFilterSelectorBox extends StatefulWidget {
|
||||
const LabelFilterSelectorBox({
|
||||
Key key,
|
||||
@required double deviceBlockSize,
|
||||
@required this.hospitalCTRL,
|
||||
@required this.hospitalVals,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final double _deviceBlockSize;
|
||||
final TextEditingController hospitalCTRL;
|
||||
final List<Map<String, String>> hospitalVals;
|
||||
|
||||
@override
|
||||
_LabelFilterSelectorBoxState createState() => _LabelFilterSelectorBoxState();
|
||||
}
|
||||
|
||||
class _LabelFilterSelectorBoxState extends State<LabelFilterSelectorBox> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 5),
|
||||
// height: 65,
|
||||
child: Row(
|
||||
// width: double.infinity,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Icon(
|
||||
FontAwesomeIcons.alignLeft,
|
||||
color: Colors.grey,
|
||||
size: 7 * widget._deviceBlockSize,
|
||||
),
|
||||
SizedBox(
|
||||
width: 4 * widget._deviceBlockSize,
|
||||
),
|
||||
Expanded(
|
||||
// width: MediaQuery.of(context).size.width - 70,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Text(
|
||||
'Hospital',
|
||||
style: TextStyle(
|
||||
fontSize: 3.5 * widget._deviceBlockSize,
|
||||
color: Colors.grey,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Container(
|
||||
// height: 30,
|
||||
child: DropdownButtonFormField(
|
||||
decoration: InputDecoration(
|
||||
contentPadding: EdgeInsets.only(left: 0),
|
||||
border: InputBorder.none,
|
||||
),
|
||||
iconSize: 7 * widget._deviceBlockSize,
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.angleDown,
|
||||
color: Colors.black,
|
||||
),
|
||||
isExpanded: true,
|
||||
hint: Container(
|
||||
// width: 100,
|
||||
height: 70,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 0),
|
||||
child: TextFormField(
|
||||
controller: widget.hospitalCTRL,
|
||||
decoration: InputDecoration(
|
||||
contentPadding: EdgeInsets.only(bottom: 15),
|
||||
isDense: true,
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
),
|
||||
isDense: true,
|
||||
items: widget.hospitalVals.map((val) {
|
||||
return new DropdownMenuItem<String>(
|
||||
value: val['name'],
|
||||
child: Container(
|
||||
child: Text(
|
||||
val['name'],
|
||||
style: TextStyle(
|
||||
// color: _mainFontColor,
|
||||
fontSize: 4 * widget._deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: (val) {
|
||||
setState(() {
|
||||
widget.hospitalCTRL.text = val;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
]),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
|
||||
class LabelFilterSelectorBox extends StatefulWidget {
|
||||
const LabelFilterSelectorBox({
|
||||
Key? key,
|
||||
required double deviceBlockSize,
|
||||
required this.hospitalCTRL,
|
||||
required this.hospitalVals,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final double _deviceBlockSize;
|
||||
final TextEditingController hospitalCTRL;
|
||||
final List<Map<String, String>> hospitalVals;
|
||||
|
||||
@override
|
||||
_LabelFilterSelectorBoxState createState() => _LabelFilterSelectorBoxState();
|
||||
}
|
||||
|
||||
class _LabelFilterSelectorBoxState extends State<LabelFilterSelectorBox> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 5),
|
||||
// height: 65,
|
||||
child: Row(
|
||||
// width: double.infinity,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Icon(
|
||||
FontAwesomeIcons.alignLeft,
|
||||
color: Colors.grey,
|
||||
size: 7 * widget._deviceBlockSize,
|
||||
),
|
||||
SizedBox(
|
||||
width: 4 * widget._deviceBlockSize,
|
||||
),
|
||||
Expanded(
|
||||
// width: MediaQuery.of(context).size.width - 70,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Text(
|
||||
'Hospital',
|
||||
style: TextStyle(
|
||||
fontSize: 3.5 * widget._deviceBlockSize,
|
||||
color: Colors.grey,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Container(
|
||||
// height: 30,
|
||||
child: DropdownButtonFormField(
|
||||
decoration: InputDecoration(
|
||||
contentPadding: EdgeInsets.only(left: 0),
|
||||
border: InputBorder.none,
|
||||
),
|
||||
iconSize: 7 * widget._deviceBlockSize,
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.angleDown,
|
||||
color: Colors.black,
|
||||
),
|
||||
isExpanded: true,
|
||||
hint: Container(
|
||||
// width: 100,
|
||||
height: 70,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 0),
|
||||
child: TextFormField(
|
||||
controller: widget.hospitalCTRL,
|
||||
decoration: InputDecoration(
|
||||
contentPadding: EdgeInsets.only(bottom: 15),
|
||||
isDense: true,
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
),
|
||||
isDense: true,
|
||||
items: widget.hospitalVals.map((val) {
|
||||
return new DropdownMenuItem<String>(
|
||||
value: val['name'],
|
||||
child: Container(
|
||||
child: Text(
|
||||
val['name']!,
|
||||
style: TextStyle(
|
||||
// color: _mainFontColor,
|
||||
fontSize: 4 * widget._deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: (val) {
|
||||
setState(() {
|
||||
widget.hospitalCTRL.text = val!;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
]),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,150 +1,192 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
|
||||
import '../../../config/routes.dart';
|
||||
import '../../../models/label_models.dart';
|
||||
|
||||
class LabelItemBox extends StatelessWidget {
|
||||
final LabelResultObject item;
|
||||
const LabelItemBox({
|
||||
Key key,
|
||||
@required double deviceBlockSize,
|
||||
this.item,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final double _deviceBlockSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: () => Navigator.of(context).pushNamed(
|
||||
Routes.labelDetailScreen,
|
||||
arguments: item.id,
|
||||
),
|
||||
child: Card(
|
||||
elevation: 1,
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(10),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
item.id,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 3 * _deviceBlockSize,
|
||||
),
|
||||
// Spacer(),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 30 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Package:',
|
||||
style: TextStyle(
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 40 * _deviceBlockSize,
|
||||
child: Text(
|
||||
item.package,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 30 * _deviceBlockSize,
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Text(
|
||||
'Exp:',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
item.expireDate,
|
||||
style: TextStyle(
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
Spacer(),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
InkWell(
|
||||
customBorder: CircleBorder(),
|
||||
onTap: () {
|
||||
Navigator.of(context).pushReplacementNamed(
|
||||
Routes.labelUpdateScreen,
|
||||
arguments: item.id,
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(7),
|
||||
width: 10 * _deviceBlockSize,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.black,
|
||||
),
|
||||
child: Icon(
|
||||
Icons.edit,
|
||||
size: 6 * _deviceBlockSize,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: _deviceBlockSize,),
|
||||
InkWell(
|
||||
customBorder: CircleBorder(),
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed(
|
||||
Routes.labelDetailScreen,
|
||||
arguments: item.id,
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(7),
|
||||
width: 10 * _deviceBlockSize,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.black,
|
||||
),
|
||||
child: Icon(
|
||||
FontAwesomeIcons.fileAlt,
|
||||
size: 6 * _deviceBlockSize,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
import 'package:cssd/providers/auth.dart';
|
||||
import 'package:cssd/providers/labels.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../../config/routes.dart';
|
||||
import '../../../models/label_models.dart';
|
||||
|
||||
class LabelItemBox extends StatelessWidget {
|
||||
final LabelResultObject? item;
|
||||
const LabelItemBox({
|
||||
Key? key,
|
||||
required double deviceBlockSize,
|
||||
this.item,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final double _deviceBlockSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final userData = Provider.of<Auth>(context, listen: false).user;
|
||||
return GestureDetector(
|
||||
onTap: () => Navigator.of(context).pushNamed(
|
||||
Routes.labelDetailScreen,
|
||||
arguments: item!.id,
|
||||
),
|
||||
child: Card(
|
||||
elevation: 1,
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(8),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: const EdgeInsets.all(6),
|
||||
child: Text(
|
||||
item!.id,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 3 * _deviceBlockSize,
|
||||
),
|
||||
// Spacer(),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 30 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Package:',
|
||||
style: TextStyle(
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 40 * _deviceBlockSize,
|
||||
child: Text(
|
||||
item!.package,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 30 * _deviceBlockSize,
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Text(
|
||||
'Exp:',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
item!.expireDate,
|
||||
style: TextStyle(
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
Spacer(),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
userData['roles']?.contains('User') ?? false
|
||||
? Container()
|
||||
: InkWell(
|
||||
customBorder: CircleBorder(),
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed(
|
||||
Routes.labelUpdateScreen,
|
||||
arguments: item!.id,
|
||||
);
|
||||
},
|
||||
child: Icon(
|
||||
Icons.edit,
|
||||
size: 5 * _deviceBlockSize,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 5.0,
|
||||
),
|
||||
userData['roles']?.contains('User') ?? false
|
||||
? Container()
|
||||
: InkWell(
|
||||
customBorder: CircleBorder(),
|
||||
onTap: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
title: Text('Delete'),
|
||||
content: Text(
|
||||
'Are you sure you want delete this Label?'),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
child: Text('Yes'),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
Provider.of<LabelsProvider>(context,
|
||||
listen: false)
|
||||
.removeLabels(item!.id);
|
||||
},
|
||||
),
|
||||
TextButton(
|
||||
child: Text('No'),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
child: Icon(
|
||||
Icons.delete,
|
||||
size: 5 * _deviceBlockSize,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 5.0,
|
||||
),
|
||||
InkWell(
|
||||
customBorder: CircleBorder(),
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed(
|
||||
Routes.labelDetailScreen,
|
||||
arguments: item!.id,
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(7),
|
||||
width: 9 * _deviceBlockSize,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.black,
|
||||
),
|
||||
child: Icon(
|
||||
FontAwesomeIcons.fileAlt,
|
||||
size: 5 * _deviceBlockSize,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,63 +1,65 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../../providers/labels.dart';
|
||||
class LabelFilterChip extends StatelessWidget {
|
||||
const LabelFilterChip({
|
||||
Key key,
|
||||
@required double deviceBlockSize,
|
||||
@required String id,
|
||||
@required String cycleNumber,
|
||||
@required String sterilizerId,
|
||||
@required String hospital,
|
||||
@required String label,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
_id = id,
|
||||
_cycleNumber = cycleNumber,
|
||||
_sterilizerId = sterilizerId,
|
||||
_hispotal = hospital,
|
||||
_label = label,
|
||||
super(key: key);
|
||||
|
||||
final double _deviceBlockSize;
|
||||
final String _id;
|
||||
final String _cycleNumber;
|
||||
final String _sterilizerId;
|
||||
final String _hispotal;
|
||||
final String _label;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(children: <Widget>[
|
||||
SizedBox(
|
||||
width: _deviceBlockSize,
|
||||
),
|
||||
Chip(
|
||||
backgroundColor: Colors.black,
|
||||
label: Text(
|
||||
_label,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
deleteIcon: Icon(
|
||||
Icons.close,
|
||||
color: Colors.white,
|
||||
),
|
||||
onDeleted: () {
|
||||
var labelProviderObject = Provider.of<LabelsProvider>(context);
|
||||
labelProviderObject.setFilters(
|
||||
_id,
|
||||
_cycleNumber,
|
||||
_sterilizerId,
|
||||
_hispotal,
|
||||
);
|
||||
labelProviderObject.setLoading();
|
||||
labelProviderObject.getLabelResults().then((_) {
|
||||
labelProviderObject.resetLoading();
|
||||
});
|
||||
},
|
||||
),
|
||||
]);
|
||||
}
|
||||
}
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../../providers/labels.dart';
|
||||
|
||||
class LabelFilterChip extends StatelessWidget {
|
||||
const LabelFilterChip({
|
||||
Key? key,
|
||||
required double deviceBlockSize,
|
||||
required String id,
|
||||
required String cycleNumber,
|
||||
required String sterilizerId,
|
||||
required String hospital,
|
||||
required String label,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
_id = id,
|
||||
_cycleNumber = cycleNumber,
|
||||
_sterilizerId = sterilizerId,
|
||||
_hispotal = hospital,
|
||||
_label = label,
|
||||
super(key: key);
|
||||
|
||||
final double _deviceBlockSize;
|
||||
final String _id;
|
||||
final String _cycleNumber;
|
||||
final String _sterilizerId;
|
||||
final String _hispotal;
|
||||
final String _label;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(children: <Widget>[
|
||||
SizedBox(
|
||||
width: _deviceBlockSize,
|
||||
),
|
||||
Chip(
|
||||
backgroundColor: Colors.black,
|
||||
label: Text(
|
||||
_label,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
deleteIcon: Icon(
|
||||
Icons.close,
|
||||
color: Colors.white,
|
||||
),
|
||||
onDeleted: () {
|
||||
var labelProviderObject =
|
||||
Provider.of<LabelsProvider>(context, listen: false);
|
||||
labelProviderObject.setFilters(
|
||||
_id,
|
||||
_cycleNumber,
|
||||
_sterilizerId,
|
||||
_hispotal,
|
||||
);
|
||||
labelProviderObject.setLoading();
|
||||
labelProviderObject.getLabelResults().then((_) {
|
||||
labelProviderObject.resetLoading();
|
||||
});
|
||||
},
|
||||
),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,62 +1,62 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
|
||||
import '../../../config/routes.dart';
|
||||
|
||||
class LabelFloatingButtons extends StatelessWidget {
|
||||
const LabelFloatingButtons({
|
||||
Key key,
|
||||
@required double deviceBlockSize,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final double _deviceBlockSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
InkWell(
|
||||
customBorder: CircleBorder(),
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed(Routes.labelScanScreen);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.black,
|
||||
),
|
||||
child: Icon(
|
||||
FontAwesomeIcons.barcode,
|
||||
size: 7.1 * _deviceBlockSize,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 2 * _deviceBlockSize,
|
||||
),
|
||||
InkWell(
|
||||
customBorder: CircleBorder(),
|
||||
onTap: () {
|
||||
Navigator.of(context).pushReplacementNamed(Routes.labelAddScreen);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(5),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.redAccent,
|
||||
),
|
||||
child: Icon(
|
||||
Icons.add,
|
||||
size: 10 * _deviceBlockSize,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
import 'package:cssd/config/colors.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../config/routes.dart';
|
||||
|
||||
class LabelFloatingButtons extends StatelessWidget {
|
||||
const LabelFloatingButtons({
|
||||
Key? key,
|
||||
required double deviceBlockSize,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final double _deviceBlockSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
InkWell(
|
||||
customBorder: CircleBorder(),
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed(Routes.labelScanScreen);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.black,
|
||||
),
|
||||
child: Icon(
|
||||
Icons.qr_code_scanner,
|
||||
size: 7.1 * _deviceBlockSize,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 2 * _deviceBlockSize,
|
||||
),
|
||||
InkWell(
|
||||
customBorder: CircleBorder(),
|
||||
onTap: () {
|
||||
Navigator.of(context).pushReplacementNamed(Routes.labelAddScreen);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(5),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: kLightBlue,
|
||||
),
|
||||
child: Icon(
|
||||
Icons.add,
|
||||
size: 10 * _deviceBlockSize,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,48 +1,48 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../../providers/labels.dart';
|
||||
|
||||
class LabelSearchBox extends StatelessWidget {
|
||||
const LabelSearchBox({
|
||||
Key key,
|
||||
@required this.searchCTRL,
|
||||
@required double deviceBlockSize,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final TextEditingController searchCTRL;
|
||||
final double _deviceBlockSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return TextField(
|
||||
onEditingComplete: () {
|
||||
FocusScope.of(context).unfocus();
|
||||
},
|
||||
onChanged: (value) {
|
||||
Provider.of<LabelsProvider>(context, listen: false).search(value);
|
||||
},
|
||||
controller: searchCTRL,
|
||||
decoration: InputDecoration(
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.search,
|
||||
size: 6 * _deviceBlockSize,
|
||||
),
|
||||
labelStyle: TextStyle(
|
||||
fontWeight: FontWeight.w100,
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
),
|
||||
labelText: 'Search by lable ID',
|
||||
isDense: true,
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 2, horizontal: 3),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
keyboardType: TextInputType.number,
|
||||
);
|
||||
}
|
||||
}
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../../providers/labels.dart';
|
||||
|
||||
class LabelSearchBox extends StatelessWidget {
|
||||
const LabelSearchBox({
|
||||
Key? key,
|
||||
required this.searchCTRL,
|
||||
required double deviceBlockSize,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final TextEditingController searchCTRL;
|
||||
final double _deviceBlockSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return TextField(
|
||||
onEditingComplete: () {
|
||||
FocusScope.of(context).unfocus();
|
||||
},
|
||||
onChanged: (value) {
|
||||
Provider.of<LabelsProvider>(context, listen: false).search(value);
|
||||
},
|
||||
controller: searchCTRL,
|
||||
decoration: InputDecoration(
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.search,
|
||||
size: 6 * _deviceBlockSize,
|
||||
),
|
||||
labelStyle: TextStyle(
|
||||
fontWeight: FontWeight.w100,
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
),
|
||||
labelText: 'Search by label ID',
|
||||
isDense: true,
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 2, horizontal: 3),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
keyboardType: TextInputType.number,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,54 +1,54 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
|
||||
class LabelScanInputBox extends StatelessWidget {
|
||||
const LabelScanInputBox({
|
||||
Key key,
|
||||
@required this.idCTRL,
|
||||
@required double deviceBlockSize,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final TextEditingController idCTRL;
|
||||
final double _deviceBlockSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return 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,
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
),
|
||||
labelText: 'Or enter a label ID',
|
||||
isDense: true,
|
||||
contentPadding: EdgeInsets.symmetric(
|
||||
vertical: 2,
|
||||
horizontal: 3,
|
||||
),
|
||||
focusedBorder: UnderlineInputBorder(
|
||||
// borderRadius: BorderRadius.only(Radius.circular(4)),
|
||||
borderSide: BorderSide(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
keyboardType: TextInputType.number,
|
||||
);
|
||||
}
|
||||
}
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
|
||||
class LabelScanInputBox extends StatelessWidget {
|
||||
const LabelScanInputBox({
|
||||
Key? key,
|
||||
required this.idCTRL,
|
||||
required double deviceBlockSize,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final TextEditingController idCTRL;
|
||||
final double _deviceBlockSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return 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,
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
),
|
||||
labelText: 'Or enter a label ID',
|
||||
isDense: true,
|
||||
contentPadding: EdgeInsets.symmetric(
|
||||
vertical: 2,
|
||||
horizontal: 3,
|
||||
),
|
||||
focusedBorder: UnderlineInputBorder(
|
||||
// borderRadius: BorderRadius.only(Radius.circular(4)),
|
||||
borderSide: BorderSide(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
keyboardType: TextInputType.number,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,58 +1,58 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class FilterScanSaveButton extends StatelessWidget {
|
||||
const FilterScanSaveButton({
|
||||
Key key,
|
||||
@required GlobalKey<FormState> form,
|
||||
@required this.idCTRL,
|
||||
@required double deviceBlockSize,
|
||||
}) : _form = form,
|
||||
_deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final GlobalKey<FormState> _form;
|
||||
final TextEditingController idCTRL;
|
||||
final double _deviceBlockSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
if (!_form.currentState.validate()) {
|
||||
return;
|
||||
}
|
||||
launch(
|
||||
'https://cssd-doc.com/Show/Label/${idCTRL.text}',
|
||||
);
|
||||
// Navigator.of(context).pushNamed(
|
||||
// Routes.labelDetailScreen,
|
||||
// arguments: idCTRL.text,
|
||||
// );
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 5 * _deviceBlockSize,
|
||||
vertical: 10,
|
||||
),
|
||||
margin: EdgeInsets.only(bottom: 50,left: 20,right: 20),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [Colors.blue, Colors.green],
|
||||
),
|
||||
borderRadius: BorderRadius.circular(7),
|
||||
),
|
||||
child: Align(
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
'GO!',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
import 'package:cssd/config/colors.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class FilterScanSaveButton extends StatelessWidget {
|
||||
const FilterScanSaveButton({
|
||||
Key? key,
|
||||
required GlobalKey<FormState> form,
|
||||
required this.idCTRL,
|
||||
required double deviceBlockSize,
|
||||
}) : _form = form,
|
||||
_deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final GlobalKey<FormState> _form;
|
||||
final TextEditingController idCTRL;
|
||||
final double _deviceBlockSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
if (!_form.currentState!.validate()) {
|
||||
return;
|
||||
}
|
||||
launch(
|
||||
'https://cssd-doc.com/Show/Label/${idCTRL.text}',
|
||||
);
|
||||
// Navigator.of(context).pushNamed(
|
||||
// Routes.labelDetailScreen,
|
||||
// arguments: idCTRL.text,
|
||||
// );
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 5 * _deviceBlockSize,
|
||||
vertical: 10,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [kLightBlue, kLightBlueSub],
|
||||
),
|
||||
borderRadius: BorderRadius.circular(7),
|
||||
),
|
||||
child: Align(
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
'Search',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,88 +1,88 @@
|
||||
import 'package:barcode_scan2/barcode_scan2.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class LabelScanBox extends StatelessWidget {
|
||||
const LabelScanBox({
|
||||
Key key,
|
||||
}) : super(key: key);
|
||||
Future<String> scan() async {
|
||||
try {
|
||||
var barcode = await BarcodeScanner.scan();
|
||||
if (barcode.type.name == 'Cancelled') {
|
||||
return 'cancel';
|
||||
} else if (barcode.type.name == 'Failed') {
|
||||
return 'error';
|
||||
} // print(barcode.split('/'));
|
||||
try {
|
||||
var id = barcode.rawContent.contains('www.cssd-doc.com')
|
||||
? barcode.rawContent.split('/')[5]
|
||||
: barcode.rawContent;
|
||||
return id;
|
||||
} catch (_) {
|
||||
return 'null';
|
||||
}
|
||||
} on PlatformException catch (_) {
|
||||
return 'access';
|
||||
} catch (_) {
|
||||
return 'error';
|
||||
}
|
||||
|
||||
// } on FormatException {
|
||||
// setState(() => this.testCode =
|
||||
// 'null (User returned using the "back"-button before scanning anything. Result)');
|
||||
// } catch (e) {
|
||||
// setState(() => this.testCode = 'Unknown error: $e');
|
||||
// }
|
||||
// return null;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final _media = MediaQuery.of(context);
|
||||
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
|
||||
final double _devicewidth = _media.size.width;
|
||||
final double _deviceBlockSize = _devicewidth / 100;
|
||||
return GestureDetector(
|
||||
child: Container(
|
||||
margin: EdgeInsets.symmetric(vertical: 10),
|
||||
height: 200,
|
||||
decoration: BoxDecoration(border: Border.all()),
|
||||
child: Center(
|
||||
child: Text(
|
||||
'Please Scan The Label Barcode',
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
fontWeight: FontWeight.w100,
|
||||
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/Label/$result',
|
||||
);
|
||||
// Navigator.of(context).pushNamed(
|
||||
// Routes.labelDetailScreen,
|
||||
// arguments: result,
|
||||
// );
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
import 'package:barcode_scan2/barcode_scan2.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class LabelScanBox extends StatelessWidget {
|
||||
const LabelScanBox({
|
||||
Key? key,
|
||||
}) : super(key: key);
|
||||
Future<String> scan() async {
|
||||
try {
|
||||
var barcode = await BarcodeScanner.scan();
|
||||
if (barcode.type.name == 'Cancelled') {
|
||||
return 'cancel';
|
||||
} else if (barcode.type.name == 'Failed') {
|
||||
return 'error';
|
||||
} // print(barcode.split('/'));
|
||||
try {
|
||||
var id = barcode.rawContent.contains('www.cssd-doc.com')
|
||||
? barcode.rawContent.split('/')[5]
|
||||
: barcode.rawContent;
|
||||
return id;
|
||||
} catch (_) {
|
||||
return 'null';
|
||||
}
|
||||
} on PlatformException catch (_) {
|
||||
return 'access';
|
||||
} catch (_) {
|
||||
return 'error';
|
||||
}
|
||||
|
||||
// } on FormatException {
|
||||
// setState(() => this.testCode =
|
||||
// 'null (User returned using the "back"-button before scanning anything. Result)');
|
||||
// } catch (e) {
|
||||
// setState(() => this.testCode = 'Unknown error: $e');
|
||||
// }
|
||||
// return null;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final _media = MediaQuery.of(context);
|
||||
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
|
||||
final double _devicewidth = _media.size.width;
|
||||
final double _deviceBlockSize = _devicewidth / 100;
|
||||
return GestureDetector(
|
||||
child: Container(
|
||||
margin: EdgeInsets.symmetric(vertical: 10),
|
||||
height: 200,
|
||||
decoration: BoxDecoration(border: Border.all()),
|
||||
child: Center(
|
||||
child: Text(
|
||||
'Please Scan The Label Barcode',
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
fontWeight: FontWeight.w100,
|
||||
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/Label/$result',
|
||||
);
|
||||
// Navigator.of(context).pushNamed(
|
||||
// Routes.labelDetailScreen,
|
||||
// arguments: result,
|
||||
// );
|
||||
}
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,48 +1,48 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class InfoInputBox extends StatelessWidget {
|
||||
const InfoInputBox({
|
||||
Key key,
|
||||
@required this.controller,
|
||||
@required double deviceBlockSize,
|
||||
@required String label,
|
||||
@required IconData icon,
|
||||
@required TextInputType inputType,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
_label = label,
|
||||
_icon = icon,
|
||||
_inputType = inputType,
|
||||
super(key: key);
|
||||
|
||||
final TextEditingController controller;
|
||||
final double _deviceBlockSize;
|
||||
final String _label;
|
||||
final IconData _icon;
|
||||
final TextInputType _inputType;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return TextFormField(
|
||||
controller: controller,
|
||||
decoration: InputDecoration(
|
||||
icon: Icon(
|
||||
_icon,
|
||||
size: 6 * _deviceBlockSize,
|
||||
),
|
||||
labelStyle: TextStyle(
|
||||
fontWeight: FontWeight.w100,
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
),
|
||||
labelText: _label,
|
||||
isDense: true,
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 2, horizontal: 3),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
keyboardType: _inputType,
|
||||
textInputAction: TextInputAction.next,
|
||||
);
|
||||
}
|
||||
}
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class InfoInputBox extends StatelessWidget {
|
||||
const InfoInputBox({
|
||||
Key? key,
|
||||
required this.controller,
|
||||
required double deviceBlockSize,
|
||||
required String label,
|
||||
required IconData icon,
|
||||
required TextInputType inputType,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
_label = label,
|
||||
_icon = icon,
|
||||
_inputType = inputType,
|
||||
super(key: key);
|
||||
|
||||
final TextEditingController controller;
|
||||
final double _deviceBlockSize;
|
||||
final String _label;
|
||||
final IconData _icon;
|
||||
final TextInputType _inputType;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return TextFormField(
|
||||
controller: controller,
|
||||
decoration: InputDecoration(
|
||||
icon: Icon(
|
||||
_icon,
|
||||
size: 6 * _deviceBlockSize,
|
||||
),
|
||||
labelStyle: TextStyle(
|
||||
fontWeight: FontWeight.w100,
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
),
|
||||
labelText: _label,
|
||||
isDense: true,
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 2, horizontal: 3),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
keyboardType: _inputType,
|
||||
textInputAction: TextInputAction.next,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class CancelTransferButton extends StatelessWidget {
|
||||
const CancelTransferButton(
|
||||
{Key? key,
|
||||
required double deviceBlockSize,
|
||||
required this.color,
|
||||
required this.onTap})
|
||||
: _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final Color color;
|
||||
final VoidCallback onTap;
|
||||
final double _deviceBlockSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 5 * _deviceBlockSize,
|
||||
vertical: 10,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(7),
|
||||
),
|
||||
child: Align(
|
||||
alignment: Alignment.center,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.close,
|
||||
color: color,
|
||||
),
|
||||
SizedBox(
|
||||
width: 5.0,
|
||||
),
|
||||
Text(
|
||||
'Let me think again',
|
||||
style: TextStyle(
|
||||
color: color,
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,536 @@
|
||||
import 'package:cssd/config/colors.dart';
|
||||
import 'package:cssd/config/routes.dart';
|
||||
import 'package:cssd/models/item_model.dart';
|
||||
import 'package:cssd/providers/auth.dart';
|
||||
import 'package:cssd/providers/items.dart';
|
||||
import 'package:cssd/widgets/MyItemsScreens/Detail/cancel_transfer_button.dart';
|
||||
import 'package:cssd/widgets/MyItemsScreens/Detail/transfer_destroy_button.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class MyItemsDetailsDataBox extends StatelessWidget {
|
||||
const MyItemsDetailsDataBox({
|
||||
Key? key,
|
||||
required this.datas,
|
||||
required double deviceBlockSize,
|
||||
required this.push,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final ItemDetailObject datas;
|
||||
final double _deviceBlockSize;
|
||||
final VoidCallback push;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final userData = Provider.of<Auth>(context, listen: false).user;
|
||||
print(datas.status);
|
||||
return Padding(
|
||||
padding: EdgeInsets.all(20),
|
||||
child: ListView(
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Text(
|
||||
'Item Details',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
letterSpacing: 3,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: Color.fromRGBO(235, 235, 235, 1),
|
||||
border: Border(
|
||||
left: BorderSide(
|
||||
color: kDarkBlue,
|
||||
width: 2,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
DateFormat.yMMMd().format(
|
||||
DateTime.parse(
|
||||
datas.createdAt,
|
||||
),
|
||||
),
|
||||
style: TextStyle(
|
||||
color: kDarkBlue,
|
||||
),
|
||||
),
|
||||
Divider(),
|
||||
Text(
|
||||
'ID: ${datas.id}',
|
||||
style: TextStyle(
|
||||
color: kDarkBlue,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 30,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Item Name',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas.name.toString(),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Size',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas.size.toString(),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Specific',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas.specific.toString(),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'User',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas.userName.toString(),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'UDI',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas.udi.toString(),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Date',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
DateFormat('d-M-y').format(
|
||||
DateTime.parse(
|
||||
datas.createdAt,
|
||||
),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Description',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas.description.toString(),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Hospital Name',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas.hospital,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Status',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas.status == 1 ? 'Success' : 'Failure',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
color: datas.status == 1 ? kDarkBlue : kPink,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
TransferDestroyButton(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
firstColor: kDarkBlue,
|
||||
secondColor: kDarkBlueSub,
|
||||
text: 'Transfer',
|
||||
onTap: () {
|
||||
push();
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
height: 10.0,
|
||||
),
|
||||
userData['roles']?.contains('User') ?? false
|
||||
? Container()
|
||||
: TransferDestroyButton(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
firstColor: kPink,
|
||||
secondColor: kPinkSub,
|
||||
text: 'Destroy',
|
||||
onTap: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
title: Text(
|
||||
'Are you sure to destroy this Item?',
|
||||
style: TextStyle(
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
content: SizedBox(
|
||||
width: _deviceBlockSize,
|
||||
height: 220,
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
'By approving, your item will be removed and it can not be used any more.',
|
||||
style: TextStyle(
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10.0,
|
||||
),
|
||||
ItemCard(_deviceBlockSize),
|
||||
SizedBox(
|
||||
height: 20.0,
|
||||
),
|
||||
TransferDestroyButton(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
firstColor: kPink,
|
||||
secondColor: kPinkSub,
|
||||
onTap: () {
|
||||
Provider.of<ItemProvider>(context,
|
||||
listen: false)
|
||||
.removeItems(datas.id)
|
||||
.then(
|
||||
(value) {
|
||||
Navigator.of(context).pop();
|
||||
Navigator.pushReplacementNamed(
|
||||
context,
|
||||
Routes.myItemsResultScreen,
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
text: 'Destroy',
|
||||
),
|
||||
SizedBox(
|
||||
height: 5.0,
|
||||
),
|
||||
CancelTransferButton(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
color: kDarkBlue,
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
height: 20.0,
|
||||
),
|
||||
InkWell(
|
||||
onTap: () async => await launch(
|
||||
'https://cssd-doc.com/Show/Item/${datas.id.toString()}',
|
||||
),
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 20),
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
color: Color.fromRGBO(230, 230, 230, 1),
|
||||
borderRadius: BorderRadius.circular(25),
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
'Show More Details',
|
||||
style: TextStyle(fontWeight: FontWeight.w700),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 30,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Container ItemCard(double _deviceBlockSize) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: Colors.grey),
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: const EdgeInsets.all(6.0),
|
||||
child: Text(
|
||||
datas.id,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 3 * _deviceBlockSize,
|
||||
),
|
||||
// Spacer(),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 40 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas.name,
|
||||
style: TextStyle(
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 30 * _deviceBlockSize,
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
'Size:',
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
datas.size,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 30 * _deviceBlockSize,
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Text(
|
||||
'User:',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
datas.userName,
|
||||
style: TextStyle(
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
import 'package:cssd/config/colors.dart';
|
||||
import 'package:cssd/models/users_model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class TransferDataBox extends StatelessWidget {
|
||||
final Users? user;
|
||||
final Function(String)? onTap;
|
||||
final bool isClicked;
|
||||
|
||||
const TransferDataBox({
|
||||
Key? key,
|
||||
required double deviceBlockSize,
|
||||
this.user,
|
||||
this.onTap,
|
||||
this.isClicked = false,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final double _deviceBlockSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
onTap!(user!.id);
|
||||
},
|
||||
child: Card(
|
||||
elevation: 1,
|
||||
child: Container(
|
||||
decoration: isClicked
|
||||
? BoxDecoration(
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(10),
|
||||
),
|
||||
border: Border.all(color: kDarkBlue, width: 2.0),
|
||||
)
|
||||
: BoxDecoration(),
|
||||
padding: EdgeInsets.all(8),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: const EdgeInsets.all(6.0),
|
||||
child: Text(
|
||||
user!.id.toString(),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 3 * _deviceBlockSize,
|
||||
),
|
||||
// Spacer(),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 30 * _deviceBlockSize,
|
||||
child: Text(
|
||||
user!.userName,
|
||||
style: TextStyle(
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 30 * _deviceBlockSize,
|
||||
child: Text(
|
||||
user!.phoneNumber,
|
||||
style: TextStyle(
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class TransferDestroyButton extends StatelessWidget {
|
||||
const TransferDestroyButton({
|
||||
Key? key,
|
||||
required double deviceBlockSize,
|
||||
required this.firstColor,
|
||||
required this.secondColor,
|
||||
required this.onTap,
|
||||
required this.text,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
final double _deviceBlockSize;
|
||||
final Color firstColor;
|
||||
final Color secondColor;
|
||||
final String text;
|
||||
final VoidCallback onTap;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 5 * _deviceBlockSize,
|
||||
vertical: 10,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [firstColor, secondColor],
|
||||
),
|
||||
borderRadius: BorderRadius.circular(7),
|
||||
),
|
||||
child: Align(
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
text,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
import 'package:cssd/providers/my_items.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class MyItemFilterChip extends StatelessWidget {
|
||||
const MyItemFilterChip({
|
||||
Key? key,
|
||||
required double deviceBlockSize,
|
||||
required String label,
|
||||
required String id,
|
||||
required String name,
|
||||
required String udi,
|
||||
required String size,
|
||||
required String specific,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
_label = label,
|
||||
_id = id,
|
||||
_name = name,
|
||||
_udi = udi,
|
||||
_size = size,
|
||||
_specific = specific,
|
||||
super(key: key);
|
||||
|
||||
final double _deviceBlockSize;
|
||||
final String _label;
|
||||
final String _id;
|
||||
final String _name;
|
||||
final String _udi;
|
||||
final String _size;
|
||||
final String _specific;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
width: _deviceBlockSize,
|
||||
),
|
||||
Chip(
|
||||
backgroundColor: Colors.black,
|
||||
label: Text(
|
||||
_label,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
deleteIcon: Icon(
|
||||
Icons.close,
|
||||
color: Colors.white,
|
||||
),
|
||||
onDeleted: () {
|
||||
var itemProvider =
|
||||
Provider.of<MyItemProvider>(context, listen: false);
|
||||
itemProvider.setFilters(
|
||||
_id,
|
||||
_name,
|
||||
_udi,
|
||||
_size,
|
||||
_specific,
|
||||
);
|
||||
itemProvider.setLoading();
|
||||
itemProvider.getMyItems().then(
|
||||
(_) {
|
||||
itemProvider.resetLoading();
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
import 'package:cssd/providers/my_items.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class MyItemFilterSaveButton extends StatelessWidget {
|
||||
const MyItemFilterSaveButton({
|
||||
Key? key,
|
||||
required this.idCTRL,
|
||||
required this.nameCTRL,
|
||||
required this.udiCTRL,
|
||||
required this.sizeCTRL,
|
||||
required this.specificCTRL,
|
||||
required this.firstColor,
|
||||
required this.secondColor,
|
||||
required this.push,
|
||||
required double deviceBlockSize,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final TextEditingController idCTRL;
|
||||
final TextEditingController nameCTRL;
|
||||
final TextEditingController udiCTRL;
|
||||
final TextEditingController sizeCTRL;
|
||||
final TextEditingController specificCTRL;
|
||||
final Color firstColor;
|
||||
final Color secondColor;
|
||||
final String push;
|
||||
final double _deviceBlockSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
Provider.of<MyItemProvider>(context, listen: false).setFilters(
|
||||
idCTRL.text,
|
||||
nameCTRL.text,
|
||||
udiCTRL.text,
|
||||
sizeCTRL.text,
|
||||
specificCTRL.text,
|
||||
);
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
content: Text('Filters changed.'),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(ctx).pop();
|
||||
},
|
||||
child: Text('Ok'),
|
||||
)
|
||||
],
|
||||
),
|
||||
).then((_) {
|
||||
Navigator.of(context).popAndPushNamed(push);
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 5 * _deviceBlockSize,
|
||||
vertical: 10,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
firstColor,
|
||||
secondColor,
|
||||
],
|
||||
),
|
||||
borderRadius: BorderRadius.circular(7),
|
||||
),
|
||||
child: Align(
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
'Filter',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
import 'package:cssd/models/my_item_model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ItemHistoryDate extends StatelessWidget {
|
||||
const ItemHistoryDate({
|
||||
super.key,
|
||||
required double deviceBlockSize,
|
||||
required this.items,
|
||||
}) : _deviceBlockSize = deviceBlockSize;
|
||||
|
||||
final double _deviceBlockSize;
|
||||
final MyItemResultObject items;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
children: [
|
||||
Text(
|
||||
'From',
|
||||
style: TextStyle(
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 6.0,
|
||||
),
|
||||
Text(
|
||||
items.fromDate!.toString(),
|
||||
style: TextStyle(
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
Icon(
|
||||
Icons.keyboard_arrow_right,
|
||||
color: Colors.grey,
|
||||
),
|
||||
Spacer(),
|
||||
Text(
|
||||
'To',
|
||||
style: TextStyle(
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 6.0,
|
||||
),
|
||||
Text(
|
||||
items.toDate!.toString(),
|
||||
style: TextStyle(
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,236 @@
|
||||
import 'package:cssd/config/colors.dart';
|
||||
import 'package:cssd/models/my_item_model.dart';
|
||||
import 'package:cssd/providers/my_items.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../../config/routes.dart';
|
||||
|
||||
class RequestsDataBox extends StatelessWidget {
|
||||
final MyItemResultObject? item;
|
||||
|
||||
const RequestsDataBox({
|
||||
Key? key,
|
||||
required double deviceBlockSize,
|
||||
required this.isAdmin,
|
||||
this.item,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final double _deviceBlockSize;
|
||||
final bool isAdmin;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: () => Navigator.of(context).pushNamed(
|
||||
Routes.myItemsDetailScreen,
|
||||
arguments: item!.id,
|
||||
),
|
||||
child: Card(
|
||||
elevation: 1,
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(8),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: const EdgeInsets.all(6.0),
|
||||
child: Text(
|
||||
item!.id,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 3 * _deviceBlockSize,
|
||||
),
|
||||
// Spacer(),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 40 * _deviceBlockSize,
|
||||
child: Text(
|
||||
item!.name,
|
||||
style: TextStyle(
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 30 * _deviceBlockSize,
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
'Size: ',
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
item!.size,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (isAdmin)
|
||||
Container(
|
||||
width: 30 * _deviceBlockSize,
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Text(
|
||||
'User: ',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
item!.userName.toString(),
|
||||
style: TextStyle(
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Spacer(),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
InkWell(
|
||||
onTap: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
title: Text('Accept'),
|
||||
content: Text(
|
||||
'Are you sure for approve this item?',
|
||||
),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
Provider.of<MyItemProvider>(context,
|
||||
listen: false)
|
||||
.verifyItemRequests(
|
||||
item!.id, 'approved')
|
||||
.then((result) {
|
||||
if (result) {
|
||||
print('true');
|
||||
}
|
||||
Navigator.of(ctx).pop();
|
||||
Navigator.of(context).popAndPushNamed(
|
||||
Routes.myItemsResultScreen);
|
||||
});
|
||||
},
|
||||
child: Text('Yes'),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(ctx).pop();
|
||||
},
|
||||
child: Text('No'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(7),
|
||||
width: 8 * _deviceBlockSize,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: kDarkBlue,
|
||||
),
|
||||
child: Icon(
|
||||
Icons.check,
|
||||
size: 4 * _deviceBlockSize,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 3,
|
||||
),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
title: Text('Reject'),
|
||||
content: Text(
|
||||
'Are you sure for reject this item?',
|
||||
),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
Provider.of<MyItemProvider>(context,
|
||||
listen: false)
|
||||
.verifyItemRequests(
|
||||
item!.id, 'rejected')
|
||||
.then((result) {
|
||||
if (result) {
|
||||
print('false');
|
||||
}
|
||||
Navigator.of(ctx).pop();
|
||||
Navigator.of(context).popAndPushNamed(
|
||||
Routes.myItemsResultScreen);
|
||||
});
|
||||
},
|
||||
child: Text('Yes'),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(ctx).pop();
|
||||
},
|
||||
child: Text('No'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(7),
|
||||
width: 8 * _deviceBlockSize,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: kPink,
|
||||
),
|
||||
child: Icon(
|
||||
Icons.close,
|
||||
size: 4 * _deviceBlockSize,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: _deviceBlockSize,
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,176 @@
|
||||
import 'package:cssd/config/colors.dart';
|
||||
import 'package:cssd/models/my_item_model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
|
||||
import '../../../config/routes.dart';
|
||||
|
||||
class MyItemsItemDataBox extends StatelessWidget {
|
||||
final MyItemResultObject? items;
|
||||
final bool hasHistoryBtn;
|
||||
final VoidCallback? push;
|
||||
|
||||
const MyItemsItemDataBox({
|
||||
Key? key,
|
||||
required double deviceBlockSize,
|
||||
this.push,
|
||||
required this.isAdmin,
|
||||
this.items,
|
||||
this.hasHistoryBtn = true,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final double _deviceBlockSize;
|
||||
final bool isAdmin;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: () => Navigator.of(context).pushNamed(
|
||||
Routes.myItemsDetailScreen,
|
||||
arguments: items!.id,
|
||||
),
|
||||
child: Card(
|
||||
elevation: 1,
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(8),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: const EdgeInsets.all(6.0),
|
||||
child: Text(
|
||||
items!.id,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 3 * _deviceBlockSize,
|
||||
),
|
||||
// Spacer(),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 40 * _deviceBlockSize,
|
||||
child: Text(
|
||||
items!.name,
|
||||
style: TextStyle(
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 30 * _deviceBlockSize,
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
'Size: ',
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
items!.size,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (isAdmin)
|
||||
Container(
|
||||
width: 30 * _deviceBlockSize,
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Text(
|
||||
'User: ',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
items!.userName.toString(),
|
||||
style: TextStyle(
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Spacer(),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
if (hasHistoryBtn)
|
||||
InkWell(
|
||||
customBorder: CircleBorder(),
|
||||
onTap: () {
|
||||
push!();
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(7),
|
||||
width: 9 * _deviceBlockSize,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: kDarkBlue,
|
||||
),
|
||||
child: Icon(
|
||||
FontAwesomeIcons.history,
|
||||
size: 4 * _deviceBlockSize,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 5.0,
|
||||
),
|
||||
InkWell(
|
||||
customBorder: CircleBorder(),
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed(
|
||||
Routes.myItemsDetailScreen,
|
||||
arguments: items!.id,
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(7),
|
||||
width: 9 * _deviceBlockSize,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.black,
|
||||
),
|
||||
child: Icon(
|
||||
FontAwesomeIcons.fileAlt,
|
||||
size: 5 * _deviceBlockSize,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,449 @@
|
||||
import 'package:cssd/config/colors.dart';
|
||||
import 'package:cssd/config/routes.dart';
|
||||
import 'package:cssd/models/package_model.dart';
|
||||
import 'package:cssd/providers/auth.dart';
|
||||
import 'package:cssd/providers/packages.dart';
|
||||
import 'package:cssd/widgets/MyItemsScreens/Detail/cancel_transfer_button.dart';
|
||||
import 'package:cssd/widgets/MyItemsScreens/Detail/transfer_destroy_button.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class MyPackageDetailsDataBox extends StatelessWidget {
|
||||
const MyPackageDetailsDataBox({
|
||||
Key? key,
|
||||
required this.datas,
|
||||
required double deviceBlockSize,
|
||||
required this.push,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final PackageDetailObject datas;
|
||||
final double _deviceBlockSize;
|
||||
final VoidCallback push;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final userData = Provider.of<Auth>(context, listen: false).user;
|
||||
return Padding(
|
||||
padding: EdgeInsets.all(20),
|
||||
child: ListView(
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Text(
|
||||
'Package Details',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
letterSpacing: 3,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: Color.fromRGBO(235, 235, 235, 1),
|
||||
border: Border(
|
||||
left: BorderSide(
|
||||
color: kDarkPurple,
|
||||
width: 2,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
DateFormat.yMMMd().format(
|
||||
DateTime.parse(
|
||||
datas.createDate,
|
||||
),
|
||||
),
|
||||
style: TextStyle(
|
||||
color: kDarkPurple,
|
||||
),
|
||||
),
|
||||
Divider(),
|
||||
Text(
|
||||
'ID: ${datas.id}',
|
||||
style: TextStyle(
|
||||
color: kDarkPurple,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 30,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Package Name',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas.name.toString(),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Date',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
DateFormat('d-M-y').format(
|
||||
DateTime.parse(
|
||||
datas.createDate,
|
||||
),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'UDI',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas.udi.toString(),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Description',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas.description.toString(),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Hospital Name',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas.hospitalName,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 30,
|
||||
),
|
||||
Text(
|
||||
'Items included',
|
||||
style: TextStyle(
|
||||
color: kPurple,
|
||||
letterSpacing: 3,
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 4.5 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 20),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
border: Border.all(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
child: ListView.separated(
|
||||
shrinkWrap: true,
|
||||
itemBuilder: (ctx, index) => RichText(
|
||||
text: TextSpan(
|
||||
text: 'Item ID ',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
fontFamily: 'montserrat',
|
||||
),
|
||||
children: <TextSpan>[
|
||||
TextSpan(
|
||||
text: datas.items[index],
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: kDarkPurple,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
separatorBuilder: (ctx, index) => Divider(),
|
||||
itemCount: datas.items.length,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
TransferDestroyButton(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
firstColor: kDarkPurple,
|
||||
secondColor: kDarkPurpleSub,
|
||||
text: 'Transfer',
|
||||
onTap: () {
|
||||
push();
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
height: 10.0,
|
||||
),
|
||||
userData['roles']?.contains('User') ?? false
|
||||
? Container()
|
||||
: TransferDestroyButton(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
firstColor: kPink,
|
||||
secondColor: kPinkSub,
|
||||
text: 'Destroy',
|
||||
onTap: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
title: Text(
|
||||
'Are you sure to destroy this Package?',
|
||||
style: TextStyle(
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
content: SizedBox(
|
||||
width: _deviceBlockSize,
|
||||
height: 220,
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
'By approving, your package will be removed and it can not be used any more.',
|
||||
style: TextStyle(
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10.0,
|
||||
),
|
||||
PackageCard(_deviceBlockSize),
|
||||
SizedBox(
|
||||
height: 20.0,
|
||||
),
|
||||
TransferDestroyButton(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
firstColor: kPink,
|
||||
secondColor: kPinkSub,
|
||||
onTap: () {
|
||||
Provider.of<PackageProvider>(context,
|
||||
listen: false)
|
||||
.removePackages(datas.id)
|
||||
.then(
|
||||
(value) {
|
||||
Navigator.of(context).pop();
|
||||
Navigator.pushReplacementNamed(
|
||||
context,
|
||||
Routes.myPackagesResultScreen,
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
text: 'Destroy',
|
||||
),
|
||||
SizedBox(
|
||||
height: 5.0,
|
||||
),
|
||||
CancelTransferButton(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
color: kDarkPurple,
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
InkWell(
|
||||
onTap: () async => await launch(
|
||||
'https://cssd-doc.com/Show/Package/${datas.id.toString()}',
|
||||
),
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 20),
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
color: Color.fromRGBO(230, 230, 230, 1),
|
||||
borderRadius: BorderRadius.circular(25),
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
'Show More Details',
|
||||
style: TextStyle(fontWeight: FontWeight.w700),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 30,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Container PackageCard(double _deviceBlockSize) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: Colors.grey),
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: const EdgeInsets.all(6.0),
|
||||
child: Text(
|
||||
datas.id,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 3 * _deviceBlockSize,
|
||||
),
|
||||
// Spacer(),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 40 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas.name,
|
||||
style: TextStyle(
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
),
|
||||
// Container(
|
||||
// width: 30 * _deviceBlockSize,
|
||||
// child: Row(
|
||||
// children: <Widget>[
|
||||
// Text(
|
||||
// 'User:',
|
||||
// style: TextStyle(
|
||||
// color: Colors.grey,
|
||||
// fontSize: 3 * _deviceBlockSize,
|
||||
// ),
|
||||
// ),
|
||||
// Text(
|
||||
// datas.userName,
|
||||
// style: TextStyle(
|
||||
// fontSize: 3 * _deviceBlockSize,
|
||||
// fontWeight: FontWeight.w700,
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
import 'package:cssd/providers/my_packages.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class MyPackageFilterChip extends StatelessWidget {
|
||||
const MyPackageFilterChip({
|
||||
Key? key,
|
||||
required double deviceBlockSize,
|
||||
required String label,
|
||||
required String id,
|
||||
required String name,
|
||||
required String udi,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
_label = label,
|
||||
_id = id,
|
||||
_name = name,
|
||||
_udi = udi,
|
||||
super(key: key);
|
||||
|
||||
final double _deviceBlockSize;
|
||||
final String _label;
|
||||
final String _id;
|
||||
final String _name;
|
||||
final String _udi;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
width: _deviceBlockSize,
|
||||
),
|
||||
Chip(
|
||||
backgroundColor: Colors.black,
|
||||
label: Text(
|
||||
_label,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
deleteIcon: Icon(
|
||||
Icons.close,
|
||||
color: Colors.white,
|
||||
),
|
||||
onDeleted: () {
|
||||
var packageProvider =
|
||||
Provider.of<MyPackageProvider>(context, listen: false);
|
||||
packageProvider.setFilters(
|
||||
_id,
|
||||
_name,
|
||||
_udi,
|
||||
);
|
||||
packageProvider.setLoading();
|
||||
packageProvider.getMyPackages().then(
|
||||
(_) {
|
||||
packageProvider.resetLoading();
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
import 'package:cssd/providers/my_packages.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class MyPackagesFilterSaveButton extends StatelessWidget {
|
||||
const MyPackagesFilterSaveButton({
|
||||
Key? key,
|
||||
required this.idCTRL,
|
||||
required this.nameCTRL,
|
||||
required this.udiCTRL,
|
||||
required this.firstColor,
|
||||
required this.secondColor,
|
||||
required this.push,
|
||||
required double deviceBlockSize,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final TextEditingController idCTRL;
|
||||
final TextEditingController nameCTRL;
|
||||
final TextEditingController udiCTRL;
|
||||
final Color firstColor;
|
||||
final Color secondColor;
|
||||
final String push;
|
||||
final double _deviceBlockSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
Provider.of<MyPackageProvider>(context, listen: false).setFilters(
|
||||
idCTRL.text,
|
||||
nameCTRL.text,
|
||||
udiCTRL.text,
|
||||
);
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
content: Text('Filters changed.'),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(ctx).pop();
|
||||
},
|
||||
child: Text('Ok'),
|
||||
)
|
||||
],
|
||||
),
|
||||
).then((_) {
|
||||
Navigator.of(context).popAndPushNamed(push);
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 5 * _deviceBlockSize,
|
||||
vertical: 10,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
firstColor,
|
||||
secondColor,
|
||||
],
|
||||
),
|
||||
borderRadius: BorderRadius.circular(7),
|
||||
),
|
||||
child: Align(
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
'Filter',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
import 'package:cssd/models/my_package_model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class PackageHistoryDate extends StatelessWidget {
|
||||
const PackageHistoryDate({
|
||||
super.key,
|
||||
required double deviceBlockSize,
|
||||
required this.packages,
|
||||
}) : _deviceBlockSize = deviceBlockSize;
|
||||
|
||||
final double _deviceBlockSize;
|
||||
final MyPackageResultObject packages;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
children: [
|
||||
Text(
|
||||
'From',
|
||||
style: TextStyle(
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 6.0,
|
||||
),
|
||||
Text(
|
||||
packages.fromDate!,
|
||||
style: TextStyle(
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
Icon(
|
||||
Icons.keyboard_arrow_right,
|
||||
color: Colors.grey,
|
||||
),
|
||||
Spacer(),
|
||||
Text(
|
||||
'To',
|
||||
style: TextStyle(
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 6.0,
|
||||
),
|
||||
Text(
|
||||
packages.toDate!,
|
||||
style: TextStyle(
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
import 'package:cssd/config/colors.dart';
|
||||
import 'package:cssd/models/my_package_model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
|
||||
import '../../../../config/routes.dart';
|
||||
|
||||
class MyPackagesItemDataBox extends StatelessWidget {
|
||||
final MyPackageResultObject? packages;
|
||||
final bool hasHistoryBtn;
|
||||
final VoidCallback? push;
|
||||
|
||||
const MyPackagesItemDataBox({
|
||||
Key? key,
|
||||
required double deviceBlockSize,
|
||||
this.push,
|
||||
required this.isAdmin,
|
||||
this.packages,
|
||||
this.hasHistoryBtn = true,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final double _deviceBlockSize;
|
||||
final bool isAdmin;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: () => Navigator.of(context).pushNamed(
|
||||
Routes.myPackagesDetailScreen,
|
||||
arguments: packages!.id,
|
||||
),
|
||||
child: Card(
|
||||
elevation: 1,
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(8),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: const EdgeInsets.all(6.0),
|
||||
child: Text(
|
||||
packages!.id,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 3 * _deviceBlockSize,
|
||||
),
|
||||
// Spacer(),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 40 * _deviceBlockSize,
|
||||
child: Text(
|
||||
packages!.name,
|
||||
style: TextStyle(
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (isAdmin)
|
||||
Container(
|
||||
width: 30 * _deviceBlockSize,
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Text(
|
||||
'User: ',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
packages!.userName.toString(),
|
||||
style: TextStyle(
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Spacer(),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
if (hasHistoryBtn)
|
||||
InkWell(
|
||||
customBorder: CircleBorder(),
|
||||
onTap: () {
|
||||
push!();
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(7),
|
||||
width: 9 * _deviceBlockSize,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: kDarkBlue,
|
||||
),
|
||||
child: Icon(
|
||||
FontAwesomeIcons.history,
|
||||
size: 4 * _deviceBlockSize,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 5.0,
|
||||
),
|
||||
InkWell(
|
||||
customBorder: CircleBorder(),
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed(
|
||||
Routes.myPackagesDetailScreen,
|
||||
arguments: packages!.id,
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(7),
|
||||
width: 9 * _deviceBlockSize,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.black,
|
||||
),
|
||||
child: Icon(
|
||||
FontAwesomeIcons.fileAlt,
|
||||
size: 5 * _deviceBlockSize,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,213 @@
|
||||
import 'package:cssd/config/colors.dart';
|
||||
import 'package:cssd/models/my_package_model.dart';
|
||||
import 'package:cssd/providers/my_items.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../../config/routes.dart';
|
||||
|
||||
class PackageRequestsDataBox extends StatelessWidget {
|
||||
final MyPackageResultObject? package;
|
||||
|
||||
const PackageRequestsDataBox({
|
||||
Key? key,
|
||||
required double deviceBlockSize,
|
||||
required this.isAdmin,
|
||||
this.package,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final double _deviceBlockSize;
|
||||
final bool isAdmin;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: () => Navigator.of(context).pushNamed(
|
||||
Routes.myPackagesDetailScreen,
|
||||
arguments: package!.id,
|
||||
),
|
||||
child: Card(
|
||||
elevation: 1,
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(8),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: const EdgeInsets.all(6.0),
|
||||
child: Text(
|
||||
package!.id,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 3 * _deviceBlockSize,
|
||||
),
|
||||
// Spacer(),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 40 * _deviceBlockSize,
|
||||
child: Text(
|
||||
package!.name,
|
||||
style: TextStyle(
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (isAdmin)
|
||||
Container(
|
||||
width: 30 * _deviceBlockSize,
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Text(
|
||||
'User: ',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
package!.userName.toString(),
|
||||
style: TextStyle(
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Spacer(),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
InkWell(
|
||||
onTap: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
title: Text('Accept'),
|
||||
content: Text(
|
||||
'Are you sure for approve this item?',
|
||||
),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
Provider.of<MyItemProvider>(context,
|
||||
listen: false)
|
||||
.verifyItemRequests(
|
||||
package!.id, 'approved')
|
||||
.then((result) {
|
||||
if (result) {
|
||||
print('true');
|
||||
}
|
||||
Navigator.of(ctx).pop();
|
||||
Navigator.of(context).popAndPushNamed(
|
||||
Routes.myItemsResultScreen);
|
||||
});
|
||||
},
|
||||
child: Text('Yes'),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(ctx).pop();
|
||||
},
|
||||
child: Text('No'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(7),
|
||||
width: 8 * _deviceBlockSize,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: kDarkBlue,
|
||||
),
|
||||
child: Icon(
|
||||
Icons.check,
|
||||
size: 4 * _deviceBlockSize,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 3,
|
||||
),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
title: Text('Reject'),
|
||||
content: Text(
|
||||
'Are you sure for reject this item?',
|
||||
),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
Provider.of<MyItemProvider>(context,
|
||||
listen: false)
|
||||
.verifyItemRequests(
|
||||
package!.id, 'rejected')
|
||||
.then((result) {
|
||||
if (result) {
|
||||
print('false');
|
||||
}
|
||||
Navigator.of(ctx).pop();
|
||||
Navigator.of(context).popAndPushNamed(
|
||||
Routes.myItemsResultScreen);
|
||||
});
|
||||
},
|
||||
child: Text('Yes'),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(ctx).pop();
|
||||
},
|
||||
child: Text('No'),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(7),
|
||||
width: 8 * _deviceBlockSize,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: kPink,
|
||||
),
|
||||
child: Icon(
|
||||
Icons.close,
|
||||
size: 4 * _deviceBlockSize,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: _deviceBlockSize,
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
import 'package:cssd/config/colors.dart';
|
||||
import 'package:cssd/providers/packages.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../../config/routes.dart';
|
||||
|
||||
class PackageAddSaveButton extends StatelessWidget {
|
||||
const PackageAddSaveButton({
|
||||
Key? key,
|
||||
required GlobalKey<FormState> form,
|
||||
required this.itemValues,
|
||||
required this.nameCTRL,
|
||||
required this.descriptionCTRL,
|
||||
required this.udiCTRL,
|
||||
required this.dateValue,
|
||||
required double deviceBlockSize,
|
||||
}) : _form = form,
|
||||
_deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final GlobalKey<FormState> _form;
|
||||
final List<TextEditingController> itemValues;
|
||||
final TextEditingController nameCTRL;
|
||||
final TextEditingController descriptionCTRL;
|
||||
final TextEditingController udiCTRL;
|
||||
final String dateValue;
|
||||
final double _deviceBlockSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
if (!_form.currentState!.validate()) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<String> items = [];
|
||||
for (TextEditingController item in itemValues) {
|
||||
items.add(item.text);
|
||||
}
|
||||
Provider.of<PackageProvider>(context, listen: false)
|
||||
.createPackageResult(
|
||||
nameCTRL.text,
|
||||
udiCTRL.text,
|
||||
items,
|
||||
descriptionCTRL.text,
|
||||
);
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
content: Text('Package added.'),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(ctx).pop();
|
||||
},
|
||||
child: Text('Ok'),
|
||||
)
|
||||
],
|
||||
),
|
||||
).then((_) {
|
||||
Navigator.of(context)
|
||||
.pushReplacementNamed(Routes.packageResultScreen);
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 5 * _deviceBlockSize,
|
||||
vertical: 10,
|
||||
),
|
||||
// margin:
|
||||
// EdgeInsets.symmetric(horizontal: 35, vertical: 15),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [kPurple, kPurpleSub],
|
||||
),
|
||||
borderRadius: BorderRadius.circular(7),
|
||||
),
|
||||
child: Align(
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
'Save',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
import 'package:cssd/config/colors.dart';
|
||||
import 'package:cssd/providers/packages.dart';
|
||||
|
||||
import '../../../config/routes.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class PackageUpdateButton extends StatelessWidget {
|
||||
const PackageUpdateButton({
|
||||
Key? key,
|
||||
required GlobalKey<FormState> form,
|
||||
required this.id,
|
||||
required this.descriptionCTRL,
|
||||
required this.nameCTRL,
|
||||
required this.udiCTRL,
|
||||
required this.itemCTRL,
|
||||
required double deviceBlockSize,
|
||||
}) : _form = form,
|
||||
_deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final GlobalKey<FormState> _form;
|
||||
final String id;
|
||||
final TextEditingController descriptionCTRL;
|
||||
final TextEditingController nameCTRL;
|
||||
final TextEditingController udiCTRL;
|
||||
final TextEditingController itemCTRL;
|
||||
final double _deviceBlockSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
if (!_form.currentState!.validate()) {
|
||||
return;
|
||||
}
|
||||
Provider.of<PackageProvider>(context, listen: false)
|
||||
.updatePackageResult(
|
||||
id,
|
||||
nameCTRL.text,
|
||||
udiCTRL.text,
|
||||
descriptionCTRL.text,
|
||||
int.parse(itemCTRL.text),
|
||||
);
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
content: Text('Package updated.'),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(ctx).pop();
|
||||
},
|
||||
child: Text('Ok'),
|
||||
)
|
||||
],
|
||||
),
|
||||
).then((_) {
|
||||
Navigator.of(context)
|
||||
.pushReplacementNamed(Routes.packageResultScreen);
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 5 * _deviceBlockSize,
|
||||
vertical: 10,
|
||||
),
|
||||
// margin:
|
||||
// EdgeInsets.symmetric(horizontal: 35, vertical: 15),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [kPurple, kPurpleSub],
|
||||
),
|
||||
borderRadius: BorderRadius.circular(7),
|
||||
),
|
||||
child: Align(
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
'Update',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,290 @@
|
||||
import 'package:cssd/config/colors.dart';
|
||||
import 'package:cssd/models/package_model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class PackageDetailsDataBox extends StatelessWidget {
|
||||
const PackageDetailsDataBox({
|
||||
Key? key,
|
||||
required this.datas,
|
||||
required double deviceBlockSize,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final PackageDetailObject datas;
|
||||
final double _deviceBlockSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.all(20),
|
||||
child: ListView(
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Text(
|
||||
'Package Details',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
letterSpacing: 3,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: Color.fromRGBO(235, 235, 235, 1),
|
||||
border: Border(
|
||||
left: BorderSide(
|
||||
color: kPurple,
|
||||
width: 2,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
DateFormat.yMMMd().format(
|
||||
DateTime.parse(
|
||||
datas.createDate,
|
||||
),
|
||||
),
|
||||
style: TextStyle(
|
||||
color: kPurple,
|
||||
),
|
||||
),
|
||||
Divider(),
|
||||
Text(
|
||||
'ID: ${datas.id}',
|
||||
style: TextStyle(
|
||||
color: kPurple,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 30,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Package Name',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas.name.toString(),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Date',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
DateFormat('d-M-y').format(
|
||||
DateTime.parse(
|
||||
datas.createDate,
|
||||
),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'UDI',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas.udi.toString(),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Description',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas.description.toString(),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Hospital Name',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas.hospitalName,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 30,
|
||||
),
|
||||
Text(
|
||||
'Items included',
|
||||
style: TextStyle(
|
||||
color: kPurple,
|
||||
letterSpacing: 3,
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 4.5 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 20),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
border: Border.all(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
child: ListView.separated(
|
||||
shrinkWrap: true,
|
||||
itemBuilder: (ctx, index) => RichText(
|
||||
text: TextSpan(
|
||||
text: 'Item ID ',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
fontFamily: 'montserrat',
|
||||
),
|
||||
children: <TextSpan>[
|
||||
TextSpan(
|
||||
text: datas.items[index],
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: kPurple,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
separatorBuilder: (ctx, index) => Divider(),
|
||||
itemCount: datas.items.length,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 50,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
InkWell(
|
||||
onTap: () async => await launch(
|
||||
'https://cssd-doc.com/Show/Package/${datas.id.toString()}',
|
||||
),
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 20),
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
color: Color.fromRGBO(230, 230, 230, 1),
|
||||
borderRadius: BorderRadius.circular(25),
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
'Show More Details',
|
||||
style: TextStyle(fontWeight: FontWeight.w700),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 30,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
import 'package:cssd/config/colors.dart';
|
||||
import 'package:cssd/providers/packages.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../../config/routes.dart';
|
||||
|
||||
class PackageFilterSaveButton extends StatelessWidget {
|
||||
const PackageFilterSaveButton({
|
||||
Key? key,
|
||||
required this.hospitalVals,
|
||||
required this.hospitalCTRL,
|
||||
required this.idCTRL,
|
||||
required this.nameCTRL,
|
||||
required this.udiCTRL,
|
||||
required double deviceBlockSize,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final List<Map<String, String>> hospitalVals;
|
||||
final TextEditingController hospitalCTRL;
|
||||
final TextEditingController idCTRL;
|
||||
final TextEditingController nameCTRL;
|
||||
final TextEditingController udiCTRL;
|
||||
final double _deviceBlockSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
String? hospitalID;
|
||||
hospitalVals.forEach(
|
||||
(hospital) {
|
||||
if (hospital['name'] == hospitalCTRL.text) {
|
||||
hospitalID = hospital['id']!;
|
||||
}
|
||||
},
|
||||
);
|
||||
Provider.of<PackageProvider>(context, listen: false).setFilters(
|
||||
idCTRL.text,
|
||||
nameCTRL.text,
|
||||
hospitalID,
|
||||
udiCTRL.text,
|
||||
);
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
content: Text('Filters changed.'),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.of(ctx).pop();
|
||||
},
|
||||
child: Text('Ok'),
|
||||
)
|
||||
],
|
||||
),
|
||||
).then((_) {
|
||||
Navigator.of(context).popAndPushNamed(Routes.packageResultScreen);
|
||||
});
|
||||
},
|
||||
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(
|
||||
'Filter',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
import 'package:cssd/providers/packages.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class PackageFilterChip extends StatelessWidget {
|
||||
const PackageFilterChip({
|
||||
Key? key,
|
||||
required double deviceBlockSize,
|
||||
required String label,
|
||||
required String id,
|
||||
required String name,
|
||||
required String hospital,
|
||||
required String udi,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
_label = label,
|
||||
_id = id,
|
||||
_name = name,
|
||||
_hospital = hospital,
|
||||
_udi = udi,
|
||||
super(key: key);
|
||||
|
||||
final double _deviceBlockSize;
|
||||
final String _label;
|
||||
final String _id;
|
||||
final String _name;
|
||||
final String _hospital;
|
||||
final String _udi;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
width: _deviceBlockSize,
|
||||
),
|
||||
Chip(
|
||||
backgroundColor: Colors.black,
|
||||
label: Text(
|
||||
_label,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
deleteIcon: Icon(
|
||||
Icons.close,
|
||||
color: Colors.white,
|
||||
),
|
||||
onDeleted: () {
|
||||
var packageProvider =
|
||||
Provider.of<PackageProvider>(context, listen: false);
|
||||
packageProvider.setFilters(
|
||||
_id,
|
||||
_name,
|
||||
_hospital,
|
||||
_udi,
|
||||
);
|
||||
packageProvider.setLoading();
|
||||
packageProvider.getPackageResults().then(
|
||||
(_) {
|
||||
packageProvider.resetLoading();
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,204 @@
|
||||
import 'package:cssd/models/package_model.dart';
|
||||
import 'package:cssd/providers/auth.dart';
|
||||
import 'package:cssd/providers/packages.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../../config/routes.dart';
|
||||
|
||||
class PackageItemBox extends StatelessWidget {
|
||||
final PackageResultObject? item;
|
||||
|
||||
const PackageItemBox({
|
||||
Key? key,
|
||||
required double deviceBlockSize,
|
||||
this.item,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final double _deviceBlockSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final userData = Provider.of<Auth>(context, listen: false).user;
|
||||
return GestureDetector(
|
||||
onTap: () => Navigator.of(context).pushNamed(
|
||||
Routes.packageDetailScreen,
|
||||
arguments: item!.id,
|
||||
),
|
||||
child: Card(
|
||||
elevation: 1,
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(8),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: const EdgeInsets.all(6.0),
|
||||
child: Text(
|
||||
item!.id,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 3 * _deviceBlockSize,
|
||||
),
|
||||
// Spacer(),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 30 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Package Name:',
|
||||
style: TextStyle(
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 40 * _deviceBlockSize,
|
||||
child: Text(
|
||||
item!.name,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 30 * _deviceBlockSize,
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Text(
|
||||
'Date:',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
DateFormat('y-M-d').format(
|
||||
DateTime.parse(
|
||||
item!.createdAt,
|
||||
),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
Spacer(),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
userData['roles']?.contains('User') ?? false
|
||||
? Container()
|
||||
: InkWell(
|
||||
customBorder: CircleBorder(),
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed(
|
||||
Routes.packageUpdateScreen,
|
||||
arguments: item!.id,
|
||||
);
|
||||
},
|
||||
child: Icon(
|
||||
Icons.edit,
|
||||
size: 5 * _deviceBlockSize,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 5.0,
|
||||
),
|
||||
userData['roles']?.contains('User') ?? false
|
||||
? Container()
|
||||
: InkWell(
|
||||
customBorder: CircleBorder(),
|
||||
onTap: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
title: Text('Delete'),
|
||||
content: Text(
|
||||
'Are you sure you want delete this Package?',
|
||||
),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
child: Text('Yes'),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
Provider.of<PackageProvider>(
|
||||
context,
|
||||
listen: false)
|
||||
.removePackages(item!.id);
|
||||
},
|
||||
),
|
||||
TextButton(
|
||||
child: Text('No'),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
child: Icon(
|
||||
Icons.delete,
|
||||
size: 5 * _deviceBlockSize,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 5.0,
|
||||
),
|
||||
InkWell(
|
||||
customBorder: CircleBorder(),
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed(
|
||||
Routes.packageDetailScreen,
|
||||
arguments: item!.id,
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(7),
|
||||
width: 9 * _deviceBlockSize,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.black,
|
||||
),
|
||||
child: Icon(
|
||||
FontAwesomeIcons.fileAlt,
|
||||
size: 5 * _deviceBlockSize,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,320 +1,328 @@
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:camera/camera.dart';
|
||||
import 'package:file_picker/file_picker.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../../providers/test_results.dart';
|
||||
|
||||
class CaptureImage extends StatefulWidget {
|
||||
@override
|
||||
_CaptureImageState createState() {
|
||||
return _CaptureImageState();
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns a suitable camera icon for [direction].
|
||||
IconData getCameraLensIcon(CameraLensDirection direction) {
|
||||
switch (direction) {
|
||||
case CameraLensDirection.back:
|
||||
return Icons.camera_rear;
|
||||
case CameraLensDirection.front:
|
||||
return Icons.camera_front;
|
||||
case CameraLensDirection.external:
|
||||
return Icons.camera;
|
||||
}
|
||||
throw ArgumentError('Unknown lens direction');
|
||||
}
|
||||
|
||||
void logError(String code, String message) =>
|
||||
print('Error: $code\nError Message: $message');
|
||||
|
||||
class _CaptureImageState extends State<CaptureImage>
|
||||
with WidgetsBindingObserver {
|
||||
CameraController controller;
|
||||
String imagePath;
|
||||
// String videoPath;
|
||||
VoidCallback videoPlayerListener;
|
||||
bool isInit = true;
|
||||
int curCamera = 0;
|
||||
var cameras;
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
WidgetsBinding.instance.addObserver(this);
|
||||
}
|
||||
|
||||
@override
|
||||
void didChangeDependencies() async {
|
||||
if (isInit) {
|
||||
cameras = await availableCameras();
|
||||
onNewCameraSelected(cameras[curCamera]);
|
||||
setState(() {
|
||||
isInit = false;
|
||||
});
|
||||
}
|
||||
super.didChangeDependencies();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
WidgetsBinding.instance.removeObserver(this);
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
void didChangeAppLifecycleState(AppLifecycleState state) {
|
||||
// App state changed before we got the chance to initialize.
|
||||
if (controller == null || !controller.value.isInitialized) {
|
||||
return;
|
||||
}
|
||||
if (state == AppLifecycleState.inactive) {
|
||||
controller?.dispose();
|
||||
} else if (state == AppLifecycleState.resumed) {
|
||||
if (controller != null) {
|
||||
onNewCameraSelected(controller.description);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SafeArea(
|
||||
child: Scaffold(
|
||||
key: _scaffoldKey,
|
||||
// appBar: AppBar(
|
||||
// title: const Text('Take Picture'),
|
||||
// ),
|
||||
body: isInit
|
||||
? Center(
|
||||
child: CircularProgressIndicator(),
|
||||
)
|
||||
: Stack(children: <Widget>[
|
||||
_cameraPreviewWidget(),
|
||||
Positioned(
|
||||
bottom: 100, left: 100, child: _captureControlRowWidget()),
|
||||
Positioned(
|
||||
bottom: 100,
|
||||
right: 100,
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
if (curCamera == 0) {
|
||||
try {
|
||||
onNewCameraSelected(cameras[1]);
|
||||
setState(() {
|
||||
curCamera = 1;
|
||||
});
|
||||
} catch (e) {}
|
||||
} else {
|
||||
onNewCameraSelected(cameras[0]);
|
||||
setState(() {
|
||||
curCamera = 0;
|
||||
});
|
||||
}
|
||||
},
|
||||
child: Icon(
|
||||
curCamera == 0 ? Icons.camera_rear : Icons.camera_front,
|
||||
size: 40,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
// _cameraTogglesRowWidget(cameras),
|
||||
]),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Display the preview from the camera (or a message if the preview is not available).
|
||||
Widget _cameraPreviewWidget() {
|
||||
if (controller == null || !controller.value.isInitialized) {
|
||||
return const Text(
|
||||
'Tap a camera',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 24.0,
|
||||
fontWeight: FontWeight.w900,
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
child: CameraPreview(controller),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Toggle recording audio
|
||||
|
||||
/// Display the control bar with buttons to take pictures and record videos.
|
||||
Widget _captureControlRowWidget() {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
||||
IconButton(
|
||||
icon: const Icon(
|
||||
Icons.camera_alt,
|
||||
size: 40,
|
||||
color: Colors.white,
|
||||
),
|
||||
// color: Colors.blue,
|
||||
onPressed: controller != null &&
|
||||
controller.value.isInitialized &&
|
||||
!controller.value.isRecordingVideo
|
||||
? onTakePictureButtonPressed
|
||||
: null,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
getCameras() async {
|
||||
return await availableCameras();
|
||||
}
|
||||
|
||||
/// Display a row of toggle to select the camera (or a message if no camera is available).
|
||||
// Widget _cameraTogglesRowWidget(var cameras) {
|
||||
// final List<Widget> toggles = <Widget>[];
|
||||
|
||||
// if (cameras.isEmpty) {
|
||||
// return const Text('No camera found');
|
||||
// } else {
|
||||
// for (CameraDescription cameraDescription in cameras) {
|
||||
// print("${cameraDescription.name}");
|
||||
// toggles.add(
|
||||
// SizedBox(
|
||||
// width: 90.0,
|
||||
// child: RadioListTile<CameraDescription>(
|
||||
// title: Icon(getCameraLensIcon(cameraDescription.lensDirection)),
|
||||
// groupValue: controller?.description,
|
||||
// value: cameraDescription,
|
||||
// onChanged: controller != null && controller.value.isRecordingVideo
|
||||
// ? null
|
||||
// : onNewCameraSelected,
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
// return Row(children: toggles);
|
||||
// }
|
||||
|
||||
String timestamp() => DateTime.now().millisecondsSinceEpoch.toString();
|
||||
|
||||
void showInSnackBar(String message) {
|
||||
_scaffoldKey.currentState.showSnackBar(SnackBar(content: Text(message)));
|
||||
}
|
||||
|
||||
void onNewCameraSelected(CameraDescription cameraDescription) async {
|
||||
print(cameraDescription.lensDirection.toString());
|
||||
if (controller != null) {
|
||||
await controller.dispose();
|
||||
}
|
||||
controller = CameraController(
|
||||
cameraDescription,
|
||||
ResolutionPreset.medium,
|
||||
// enableAudio: enableAudio,
|
||||
);
|
||||
|
||||
// If the controller is updated then update the UI.
|
||||
controller.addListener(() {
|
||||
if (mounted) setState(() {});
|
||||
if (controller.value.hasError) {
|
||||
showInSnackBar('Camera error ${controller.value.errorDescription}');
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
await controller.initialize();
|
||||
} on CameraException catch (e) {
|
||||
_showCameraException(e);
|
||||
}
|
||||
|
||||
if (mounted) {
|
||||
setState(() {});
|
||||
}
|
||||
}
|
||||
|
||||
void onTakePictureButtonPressed() {
|
||||
takePicture().then((String filePath) {
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
imagePath = filePath;
|
||||
var profileProviderObject =
|
||||
Provider.of<TestResultsProvider>(context, listen: false);
|
||||
List<PlatformFile> files = profileProviderObject.catchImages;
|
||||
print(imagePath);
|
||||
files.add(PlatformFile(
|
||||
name: 'test',
|
||||
size: 0,
|
||||
path: imagePath,
|
||||
bytes: File(imagePath).readAsBytesSync()));
|
||||
profileProviderObject.setCatchImages(files);
|
||||
profileProviderObject.setImages();
|
||||
print(imagePath);
|
||||
});
|
||||
if (filePath != null) {
|
||||
Navigator.of(context).pop();
|
||||
// showInSnackBar('Picture saved to $filePath');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Future<String> takePicture() async {
|
||||
if (!controller.value.isInitialized) {
|
||||
showInSnackBar('Error: select a camera first.');
|
||||
return null;
|
||||
}
|
||||
final Directory extDir = await getApplicationDocumentsDirectory();
|
||||
final String dirPath = '${extDir.path}/Pictures/flutter_test';
|
||||
await Directory(dirPath).create(recursive: true);
|
||||
final String filePath = '$dirPath/${timestamp()}.jpg';
|
||||
|
||||
if (controller.value.isTakingPicture) {
|
||||
// A capture is already pending, do nothing.
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
await controller.takePicture(filePath);
|
||||
} on CameraException catch (e) {
|
||||
_showCameraException(e);
|
||||
return null;
|
||||
}
|
||||
return filePath;
|
||||
}
|
||||
|
||||
void _showCameraException(CameraException e) {
|
||||
logError(e.code, e.description);
|
||||
showInSnackBar('Error: ${e.code}\n${e.description}');
|
||||
}
|
||||
}
|
||||
|
||||
// class CameraApp extends StatelessWidget {
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// return MaterialApp(
|
||||
// home: CaptureImage(),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
// List<CameraDescription> cameras = [];
|
||||
|
||||
// Future<void> main() async {
|
||||
// // Fetch the available cameras before initializing the app.
|
||||
// try {
|
||||
// WidgetsFlutterBinding.ensureInitialized();
|
||||
// } on CameraException catch (e) {
|
||||
// logError(e.code, e.description);
|
||||
// }
|
||||
// runApp(CameraApp());
|
||||
// }
|
||||
// ignore_for_file: dead_code
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:camera/camera.dart';
|
||||
import 'package:file_picker/file_picker.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../../providers/test_results.dart';
|
||||
|
||||
class CaptureImage extends StatefulWidget {
|
||||
@override
|
||||
_CaptureImageState createState() {
|
||||
return _CaptureImageState();
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns a suitable camera icon for [direction].
|
||||
IconData getCameraLensIcon(CameraLensDirection direction) {
|
||||
switch (direction) {
|
||||
case CameraLensDirection.back:
|
||||
return Icons.camera_rear;
|
||||
case CameraLensDirection.front:
|
||||
return Icons.camera_front;
|
||||
case CameraLensDirection.external:
|
||||
return Icons.camera;
|
||||
}
|
||||
throw ArgumentError('Unknown lens direction');
|
||||
}
|
||||
|
||||
void logError(String code, String message) =>
|
||||
print('Error: $code\nError Message: $message');
|
||||
|
||||
class _CaptureImageState extends State<CaptureImage>
|
||||
with WidgetsBindingObserver {
|
||||
CameraController? controller;
|
||||
String? imagePath;
|
||||
// String videoPath;
|
||||
VoidCallback? videoPlayerListener;
|
||||
bool isInit = true;
|
||||
int curCamera = 0;
|
||||
var cameras;
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
WidgetsBinding.instance.addObserver(this);
|
||||
}
|
||||
|
||||
@override
|
||||
void didChangeDependencies() async {
|
||||
if (isInit) {
|
||||
cameras = await availableCameras();
|
||||
onNewCameraSelected(cameras[curCamera]);
|
||||
setState(() {
|
||||
isInit = false;
|
||||
});
|
||||
}
|
||||
super.didChangeDependencies();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
WidgetsBinding.instance.removeObserver(this);
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
void didChangeAppLifecycleState(AppLifecycleState state) {
|
||||
// App state changed before we got the chance to initialize.
|
||||
if (controller == null || !controller!.value.isInitialized) {
|
||||
return;
|
||||
}
|
||||
if (state == AppLifecycleState.inactive) {
|
||||
controller?.dispose();
|
||||
} else if (state == AppLifecycleState.resumed) {
|
||||
if (controller != null) {
|
||||
onNewCameraSelected(controller!.description);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SafeArea(
|
||||
child: Scaffold(
|
||||
key: _scaffoldKey,
|
||||
// appBar: AppBar(
|
||||
// title: const Text('Take Picture'),
|
||||
// ),
|
||||
body: isInit
|
||||
? Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: Colors.black,
|
||||
),
|
||||
)
|
||||
: Stack(children: <Widget>[
|
||||
_cameraPreviewWidget(),
|
||||
Positioned(
|
||||
bottom: 100, left: 100, child: _captureControlRowWidget()),
|
||||
Positioned(
|
||||
bottom: 100,
|
||||
right: 100,
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
if (curCamera == 0) {
|
||||
try {
|
||||
onNewCameraSelected(cameras[1]);
|
||||
setState(() {
|
||||
curCamera = 1;
|
||||
});
|
||||
} catch (e) {}
|
||||
} else {
|
||||
onNewCameraSelected(cameras[0]);
|
||||
setState(() {
|
||||
curCamera = 0;
|
||||
});
|
||||
}
|
||||
},
|
||||
child: Icon(
|
||||
curCamera == 0 ? Icons.camera_rear : Icons.camera_front,
|
||||
size: 40,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
// _cameraTogglesRowWidget(cameras),
|
||||
]),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Display the preview from the camera (or a message if the preview is not available).
|
||||
Widget _cameraPreviewWidget() {
|
||||
if (controller == null || !controller!.value.isInitialized) {
|
||||
return const Text(
|
||||
'Tap a camera',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 24.0,
|
||||
fontWeight: FontWeight.w900,
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
child: CameraPreview(controller!),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Toggle recording audio
|
||||
|
||||
/// Display the control bar with buttons to take pictures and record videos.
|
||||
Widget _captureControlRowWidget() {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
||||
IconButton(
|
||||
icon: const Icon(
|
||||
Icons.camera_alt,
|
||||
size: 40,
|
||||
color: Colors.white,
|
||||
),
|
||||
// color: Colors.blue,
|
||||
onPressed: controller != null &&
|
||||
controller!.value.isInitialized &&
|
||||
!controller!.value.isRecordingVideo
|
||||
? onTakePictureButtonPressed
|
||||
: null,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
getCameras() async {
|
||||
return await availableCameras();
|
||||
}
|
||||
|
||||
/// Display a row of toggle to select the camera (or a message if no camera is available).
|
||||
// Widget _cameraTogglesRowWidget(var cameras) {
|
||||
// final List<Widget> toggles = <Widget>[];
|
||||
|
||||
// if (cameras.isEmpty) {
|
||||
// return const Text('No camera found');
|
||||
// } else {
|
||||
// for (CameraDescription cameraDescription in cameras) {
|
||||
// print("${cameraDescription.name}");
|
||||
// toggles.add(
|
||||
// SizedBox(
|
||||
// width: 90.0,
|
||||
// child: RadioListTile<CameraDescription>(
|
||||
// title: Icon(getCameraLensIcon(cameraDescription.lensDirection)),
|
||||
// groupValue: controller?.description,
|
||||
// value: cameraDescription,
|
||||
// onChanged: controller != null && controller.value.isRecordingVideo
|
||||
// ? null
|
||||
// : onNewCameraSelected,
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
// return Row(children: toggles);
|
||||
// }
|
||||
|
||||
String timestamp() => DateTime.now().millisecondsSinceEpoch.toString();
|
||||
|
||||
void showInSnackBar(String message) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(message),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void onNewCameraSelected(CameraDescription cameraDescription) async {
|
||||
print(cameraDescription.lensDirection.toString());
|
||||
if (controller != null) {
|
||||
await controller!.dispose();
|
||||
}
|
||||
controller = CameraController(
|
||||
cameraDescription,
|
||||
ResolutionPreset.medium,
|
||||
// enableAudio: enableAudio,
|
||||
);
|
||||
|
||||
// If the controller is updated then update the UI.
|
||||
controller!.addListener(() {
|
||||
if (mounted) setState(() {});
|
||||
if (controller!.value.hasError) {
|
||||
showInSnackBar('Camera error ${controller!.value.errorDescription}');
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
await controller!.initialize();
|
||||
} on CameraException catch (e) {
|
||||
_showCameraException(e);
|
||||
}
|
||||
|
||||
if (mounted) {
|
||||
setState(() {});
|
||||
}
|
||||
}
|
||||
|
||||
void onTakePictureButtonPressed() {
|
||||
takePicture().then((String? filePath) {
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
imagePath = filePath;
|
||||
var profileProviderObject =
|
||||
Provider.of<TestResultsProvider>(context, listen: false);
|
||||
List<PlatformFile> files = profileProviderObject.catchImages;
|
||||
print(imagePath);
|
||||
files.add(PlatformFile(
|
||||
name: 'test',
|
||||
size: 0,
|
||||
path: imagePath,
|
||||
bytes: File(imagePath!).readAsBytesSync()));
|
||||
profileProviderObject.setCatchImages(files);
|
||||
profileProviderObject.setImages();
|
||||
print(imagePath);
|
||||
});
|
||||
if (filePath != null) {
|
||||
Navigator.of(context).pop();
|
||||
// showInSnackBar('Picture saved to $filePath');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Future<String?> takePicture() async {
|
||||
if (!controller!.value.isInitialized) {
|
||||
showInSnackBar('Error: select a camera first.');
|
||||
return null;
|
||||
}
|
||||
final Directory extDir = await getApplicationDocumentsDirectory();
|
||||
final String dirPath = '${extDir.path}/Pictures/flutter_test';
|
||||
await Directory(dirPath).create(recursive: true);
|
||||
final String filePath = '$dirPath/${timestamp()}.jpg';
|
||||
|
||||
if (controller!.value.isTakingPicture) {
|
||||
// A capture is already pending, do nothing.
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
await controller!.takePicture();
|
||||
} on CameraException catch (e) {
|
||||
_showCameraException(e);
|
||||
return null;
|
||||
}
|
||||
return filePath;
|
||||
}
|
||||
|
||||
void _showCameraException(CameraException e) {
|
||||
logError(e.code, e.description!);
|
||||
showInSnackBar('Error: ${e.code}\n${e.description}');
|
||||
}
|
||||
}
|
||||
|
||||
// class CameraApp extends StatelessWidget {
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// return MaterialApp(
|
||||
// home: CaptureImage(),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
// List<CameraDescription> cameras = [];
|
||||
|
||||
// Future<void> main() async {
|
||||
// // Fetch the available cameras before initializing the app.
|
||||
// try {
|
||||
// WidgetsFlutterBinding.ensureInitialized();
|
||||
// } on CameraException catch (e) {
|
||||
// logError(e.code, e.description);
|
||||
// }
|
||||
// runApp(CameraApp());
|
||||
// }
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,57 +1,57 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../config/routes.dart';
|
||||
|
||||
class TestResultAddSaveButton extends StatelessWidget {
|
||||
const TestResultAddSaveButton({
|
||||
Key key,
|
||||
// @required GlobalKey<FormState> form,
|
||||
// @required this.idCTRL,
|
||||
@required double deviceBlockSize,
|
||||
}) :
|
||||
// _form = form,
|
||||
_deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
// final GlobalKey<FormState> _form;
|
||||
// final TextEditingController idCTRL;
|
||||
final double _deviceBlockSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
// if (! _form.currentState.validate()) {
|
||||
// return;
|
||||
// }
|
||||
Navigator.of(context).pushNamed(
|
||||
Routes.labelDetailScreen,
|
||||
// arguments: idCTRL.text,
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 5 * _deviceBlockSize,
|
||||
vertical: 10,
|
||||
),
|
||||
margin: EdgeInsets.symmetric(horizontal: 20),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [Colors.blue, Colors.green],
|
||||
),
|
||||
borderRadius: BorderRadius.circular(7),
|
||||
),
|
||||
child: Align(
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
'GO!',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
// import 'package:flutter/material.dart';
|
||||
|
||||
// import '../../../config/routes.dart';
|
||||
|
||||
// class TestResultAddSaveButton extends StatelessWidget {
|
||||
// const TestResultAddSaveButton({
|
||||
// Key? key,
|
||||
// // @required GlobalKey<FormState> form,
|
||||
// // @required this.idCTRL,
|
||||
// required double deviceBlockSize,
|
||||
// }) :
|
||||
// // _form = form,
|
||||
// _deviceBlockSize = deviceBlockSize,
|
||||
// super(key: key);
|
||||
|
||||
// // final GlobalKey<FormState> _form;
|
||||
// // final TextEditingController idCTRL;
|
||||
// final double _deviceBlockSize;
|
||||
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// return InkWell(
|
||||
// onTap: () {
|
||||
// // if (! _form.currentState.validate()) {
|
||||
// // return;
|
||||
// // }
|
||||
// Navigator.of(context).pushNamed(
|
||||
// Routes.labelDetailScreen,
|
||||
// // arguments: idCTRL.text,
|
||||
// );
|
||||
// },
|
||||
// child: Container(
|
||||
// padding: EdgeInsets.symmetric(
|
||||
// horizontal: 5 * _deviceBlockSize,
|
||||
// vertical: 10,
|
||||
// ),
|
||||
// margin: EdgeInsets.symmetric(horizontal: 20),
|
||||
// decoration: BoxDecoration(
|
||||
// gradient: LinearGradient(
|
||||
// colors: [Colors.blue, Colors.green],
|
||||
// ),
|
||||
// borderRadius: BorderRadius.circular(7),
|
||||
// ),
|
||||
// child: Align(
|
||||
// alignment: Alignment.center,
|
||||
// child: Text(
|
||||
// 'GO!',
|
||||
// style: TextStyle(
|
||||
// color: Colors.white,
|
||||
// fontSize: 5 * _deviceBlockSize,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -1,132 +1,137 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
|
||||
class TestResultAddSelectorBox extends StatefulWidget {
|
||||
const TestResultAddSelectorBox({
|
||||
Key key,
|
||||
@required double deviceBlockSize,
|
||||
@required this.dataCTRL,
|
||||
@required this.dataVals,
|
||||
@required String label,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
_label = label,
|
||||
super(key: key);
|
||||
|
||||
final double _deviceBlockSize;
|
||||
final TextEditingController dataCTRL;
|
||||
final List<String> dataVals;
|
||||
final String _label;
|
||||
|
||||
@override
|
||||
_TestResultAddSelectorBoxState createState() =>
|
||||
_TestResultAddSelectorBoxState();
|
||||
}
|
||||
|
||||
class _TestResultAddSelectorBoxState extends State<TestResultAddSelectorBox> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 5),
|
||||
// height: 65,
|
||||
child: Row(
|
||||
// width: double.infinity,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Icon(
|
||||
FontAwesomeIcons.alignLeft,
|
||||
color: Colors.grey,
|
||||
size: 6 * widget._deviceBlockSize,
|
||||
),
|
||||
SizedBox(
|
||||
width: 4 * widget._deviceBlockSize,
|
||||
),
|
||||
Expanded(
|
||||
// width: MediaQuery.of(context).size.width - 70,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Text(
|
||||
widget._label,
|
||||
style: TextStyle(
|
||||
fontSize: 3 * widget._deviceBlockSize,
|
||||
color: Colors.grey,
|
||||
fontWeight: FontWeight.w100,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Container(
|
||||
height: 40,
|
||||
child: DropdownButtonFormField(
|
||||
decoration: InputDecoration(
|
||||
contentPadding: EdgeInsets.only(left: 0),
|
||||
// border: InputBorder.none,
|
||||
),
|
||||
iconSize: 7 * widget._deviceBlockSize,
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.angleDown,
|
||||
color: Colors.black,
|
||||
),
|
||||
isExpanded: true,
|
||||
hint: Container(
|
||||
// width: 100,
|
||||
height: 70,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 0),
|
||||
child: Text(
|
||||
widget.dataCTRL.text,
|
||||
// textDirection: TextDirection.rtl,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Colors.black,
|
||||
fontSize: 3 * widget._deviceBlockSize,
|
||||
),
|
||||
),
|
||||
// TextFormField(
|
||||
// controller: widget.dataCTRL,
|
||||
// decoration: InputDecoration(
|
||||
// contentPadding: EdgeInsets.only(bottom: 15),
|
||||
// isDense: true,
|
||||
// ),
|
||||
// style: TextStyle(
|
||||
// fontWeight: FontWeight.w700,
|
||||
// color: Colors.black,
|
||||
// ),
|
||||
// // minLines: 1,
|
||||
// // maxLines: 3,
|
||||
// ),
|
||||
),
|
||||
isDense: true,
|
||||
items: widget.dataVals.map((val) {
|
||||
return new DropdownMenuItem<String>(
|
||||
value: val,
|
||||
child: Container(
|
||||
child: Text(
|
||||
val,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Colors.black,
|
||||
fontSize: 3 * widget._deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: (val) {
|
||||
setState(() {
|
||||
widget.dataCTRL.text = val;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
]),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
|
||||
class TestResultAddSelectorBox extends StatefulWidget {
|
||||
const TestResultAddSelectorBox({
|
||||
Key? key,
|
||||
required double deviceBlockSize,
|
||||
required this.dataCTRL,
|
||||
required this.dataVals,
|
||||
required String label,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
_label = label,
|
||||
super(key: key);
|
||||
|
||||
final double _deviceBlockSize;
|
||||
final TextEditingController dataCTRL;
|
||||
final List<String> dataVals;
|
||||
final String _label;
|
||||
|
||||
@override
|
||||
_TestResultAddSelectorBoxState createState() =>
|
||||
_TestResultAddSelectorBoxState();
|
||||
}
|
||||
|
||||
class _TestResultAddSelectorBoxState extends State<TestResultAddSelectorBox> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 5),
|
||||
// height: 65,
|
||||
child: Row(
|
||||
// width: double.infinity,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Icon(
|
||||
FontAwesomeIcons.alignLeft,
|
||||
color: Colors.grey,
|
||||
size: 6 * widget._deviceBlockSize,
|
||||
),
|
||||
SizedBox(
|
||||
width: 4 * widget._deviceBlockSize,
|
||||
),
|
||||
Expanded(
|
||||
// width: MediaQuery.of(context).size.width - 70,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Text(
|
||||
widget._label,
|
||||
style: TextStyle(
|
||||
fontSize: 3 * widget._deviceBlockSize,
|
||||
color: Colors.grey,
|
||||
fontWeight: FontWeight.w100,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Container(
|
||||
height: 40,
|
||||
child: DropdownButtonFormField(
|
||||
decoration: InputDecoration(
|
||||
contentPadding: EdgeInsets.only(left: 0),
|
||||
// border: InputBorder.none,
|
||||
),
|
||||
iconSize: 7 * widget._deviceBlockSize,
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.angleDown,
|
||||
color: Colors.black,
|
||||
),
|
||||
isExpanded: true,
|
||||
hint: Container(
|
||||
// width: 100,
|
||||
height: 70,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 0),
|
||||
child: Text(
|
||||
widget.dataCTRL.text,
|
||||
// textDirection: TextDirection.rtl,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Colors.black,
|
||||
fontSize: 3 * widget._deviceBlockSize,
|
||||
),
|
||||
),
|
||||
// TextFormField(
|
||||
// controller: widget.dataCTRL,
|
||||
// decoration: InputDecoration(
|
||||
// contentPadding: EdgeInsets.only(bottom: 15),
|
||||
// isDense: true,
|
||||
// ),
|
||||
// style: TextStyle(
|
||||
// fontWeight: FontWeight.w700,
|
||||
// color: Colors.black,
|
||||
// ),
|
||||
// // minLines: 1,
|
||||
// // maxLines: 3,
|
||||
// ),
|
||||
),
|
||||
isDense: true,
|
||||
items: widget.dataVals.map(
|
||||
(val) {
|
||||
return new DropdownMenuItem<String>(
|
||||
value: val,
|
||||
child: Container(
|
||||
child: Text(
|
||||
val,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Colors.black,
|
||||
fontSize: 3 * widget._deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
).toList(),
|
||||
onChanged: (val) {
|
||||
setState(
|
||||
() {
|
||||
widget.dataCTRL.text = val!;
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,259 +1,276 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class DatasBox extends StatelessWidget {
|
||||
const DatasBox({
|
||||
Key key,
|
||||
@required this.datas,
|
||||
@required double deviceBlockSize,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final Map<String, Object> datas;
|
||||
final double _deviceBlockSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.all(20),
|
||||
child: ListView(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: Color.fromRGBO(230, 230, 230, 1),
|
||||
border: Border(
|
||||
left: BorderSide(
|
||||
color: Colors.pink,
|
||||
width: 2,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
DateFormat.yMMMd().format(
|
||||
DateTime.parse(
|
||||
datas['date'],
|
||||
),
|
||||
),
|
||||
style: TextStyle(
|
||||
color: Colors.red,
|
||||
),
|
||||
),
|
||||
Divider(),
|
||||
Text(
|
||||
datas['test_type_name'],
|
||||
style: TextStyle(
|
||||
color: Colors.red,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 30,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Test Register ID',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas['id'].toString(),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Autoclave ID',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas['auto_cleave_id'].toString(),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Hospital',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas['hospital'].toString(),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Date',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
DateFormat('d-M-y').format(
|
||||
DateTime.parse(
|
||||
datas['date'],
|
||||
),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Status',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas['accepted'] == 'Accepted'
|
||||
? 'Accepted'
|
||||
: 'Rejected',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
color: datas['accepted'] == 'Accepted'
|
||||
? Colors.green
|
||||
: Colors.red,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Description',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas['description'].toString(),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 20,),
|
||||
InkWell(
|
||||
onTap: () async=> await launch(
|
||||
'https://cssd-doc.com/Show/TestResult/${datas['id'].toString()}',
|
||||
// 'https://cssd-doc.com/api/TestResults/${datas['id'].toString()}',
|
||||
|
||||
// forceSafariVC: true,
|
||||
// forceWebView: true,
|
||||
// headers: <String, String>{'my_header_key': 'my_header_value'},
|
||||
// child: Text('Show Full Details'),
|
||||
),
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 20),
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
color: Color.fromRGBO(230, 230, 230, 1),
|
||||
borderRadius: BorderRadius.circular(25),
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
'Show More Details',
|
||||
style: TextStyle(fontWeight: FontWeight.w700),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
import 'package:cssd/config/colors.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class DatasBox extends StatelessWidget {
|
||||
const DatasBox({
|
||||
Key? key,
|
||||
required this.datas,
|
||||
required double deviceBlockSize,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final Map<String, dynamic> datas;
|
||||
final double _deviceBlockSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.all(20),
|
||||
child: ListView(
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Text(
|
||||
'Test Result Details',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
letterSpacing: 3,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: Color.fromRGBO(230, 230, 230, 1),
|
||||
border: Border(
|
||||
left: BorderSide(
|
||||
color: datas['accepted'] == 'Accepted' ? kLightBlue : kPink,
|
||||
width: 2,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
DateFormat.yMMMd().format(
|
||||
DateTime.parse(
|
||||
datas['date'],
|
||||
),
|
||||
),
|
||||
style: TextStyle(
|
||||
color: datas['accepted'] == 'Accepted' ? kLightBlue : kPink,
|
||||
),
|
||||
),
|
||||
Divider(),
|
||||
Text(
|
||||
datas['test_type_name'],
|
||||
style: TextStyle(
|
||||
color: datas['accepted'] == 'Accepted' ? kLightBlue : kPink,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 30,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Test Register ID',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas['id'].toString(),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Autoclave ID',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas['auto_cleave_id'].toString(),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Hospital',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas['hospital'].toString(),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Date',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
DateFormat('d-M-y').format(
|
||||
DateTime.parse(
|
||||
datas['date'],
|
||||
),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Status',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas['accepted'] == 'Accepted' ||
|
||||
datas['verified'] == 'Verified'
|
||||
? 'Accepted'
|
||||
: 'Rejected',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
color: datas['accepted'] == 'Accepted'
|
||||
? kLightBlue
|
||||
: kPink,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Description',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas['description'].toString(),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
InkWell(
|
||||
onTap: () async => await launch(
|
||||
'https://cssd-doc.com/Show/TestResult/${datas['id'].toString()}',
|
||||
// 'https://cssd-doc.com/api/TestResults/${datas['id'].toString()}',
|
||||
|
||||
// forceSafariVC: true,
|
||||
// forceWebView: true,
|
||||
// headers: <String, String>{'my_header_key': 'my_header_value'},
|
||||
// child: Text('Show Full Details'),
|
||||
),
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 20),
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
color: Color.fromRGBO(230, 230, 230, 1),
|
||||
borderRadius: BorderRadius.circular(25),
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
'Show More Details',
|
||||
style: TextStyle(fontWeight: FontWeight.w700),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,74 +1,76 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:intl/intl.dart' as DateEditor;
|
||||
|
||||
class TestResultFilterDatePicker extends StatefulWidget {
|
||||
TestResultFilterDatePicker({
|
||||
Key key,
|
||||
@required this.dateCTRL,
|
||||
@required double deviceBlockSize,
|
||||
@required String label,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
_label = label,
|
||||
super(key: key);
|
||||
|
||||
final TextEditingController dateCTRL;
|
||||
final double _deviceBlockSize;
|
||||
final String _label;
|
||||
|
||||
@override
|
||||
_TestResultFilterDatePickerState createState() => _TestResultFilterDatePickerState();
|
||||
}
|
||||
|
||||
class _TestResultFilterDatePickerState extends State<TestResultFilterDatePicker> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () async {
|
||||
var res = await showDatePicker(
|
||||
context: context,
|
||||
initialDate: DateTime.now(),
|
||||
firstDate: DateTime(2010, 1),
|
||||
lastDate: DateTime(2101),
|
||||
);
|
||||
if (res != null) {
|
||||
setState(
|
||||
() {
|
||||
widget.dateCTRL.text = DateEditor.DateFormat('y-M-d').format(res);
|
||||
// sDateValue =
|
||||
// DateEditor.DateFormat('y-M-d').format(
|
||||
// dateTimeS,
|
||||
// ); // baraye tavize makane gharar giri baraye api
|
||||
},
|
||||
);
|
||||
}
|
||||
},
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: TextField(
|
||||
enabled: false,
|
||||
controller: widget.dateCTRL,
|
||||
decoration: InputDecoration(
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.calendarAlt,
|
||||
size: 7 * widget._deviceBlockSize,
|
||||
),
|
||||
labelText: widget._label,
|
||||
isDense: true,
|
||||
contentPadding: EdgeInsets.only(bottom: 12, right: 3, left: 3),
|
||||
// border: InputBorder.none,
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * widget._deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
Icon(FontAwesomeIcons.angleDown)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:intl/intl.dart' as DateEditor;
|
||||
|
||||
class TestResultFilterDatePicker extends StatefulWidget {
|
||||
TestResultFilterDatePicker({
|
||||
Key? key,
|
||||
required this.dateCTRL,
|
||||
required double deviceBlockSize,
|
||||
required String label,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
_label = label,
|
||||
super(key: key);
|
||||
|
||||
final TextEditingController dateCTRL;
|
||||
final double _deviceBlockSize;
|
||||
final String _label;
|
||||
|
||||
@override
|
||||
_TestResultFilterDatePickerState createState() =>
|
||||
_TestResultFilterDatePickerState();
|
||||
}
|
||||
|
||||
class _TestResultFilterDatePickerState
|
||||
extends State<TestResultFilterDatePicker> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () async {
|
||||
var res = await showDatePicker(
|
||||
context: context,
|
||||
initialDate: DateTime.now(),
|
||||
firstDate: DateTime(2010, 1),
|
||||
lastDate: DateTime(2101),
|
||||
);
|
||||
if (res != null) {
|
||||
setState(
|
||||
() {
|
||||
widget.dateCTRL.text = DateEditor.DateFormat('y-M-d').format(res);
|
||||
// sDateValue =
|
||||
// DateEditor.DateFormat('y-M-d').format(
|
||||
// dateTimeS,
|
||||
// ); // baraye tavize makane gharar giri baraye api
|
||||
},
|
||||
);
|
||||
}
|
||||
},
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: TextField(
|
||||
enabled: false,
|
||||
controller: widget.dateCTRL,
|
||||
decoration: InputDecoration(
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.calendarAlt,
|
||||
size: 7 * widget._deviceBlockSize,
|
||||
),
|
||||
labelText: widget._label,
|
||||
isDense: true,
|
||||
contentPadding: EdgeInsets.only(bottom: 12, right: 3, left: 3),
|
||||
// border: InputBorder.none,
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * widget._deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
Icon(FontAwesomeIcons.angleDown)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,88 +1,87 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
|
||||
class DropDownBox extends StatefulWidget {
|
||||
|
||||
DropDownBox({
|
||||
Key key,
|
||||
@required this.values,
|
||||
}) : super(key: key);
|
||||
|
||||
final List<String> values;
|
||||
|
||||
@override
|
||||
_DropDownBoxState createState() => _DropDownBoxState();
|
||||
}
|
||||
|
||||
class _DropDownBoxState extends State<DropDownBox> {
|
||||
String _curValue;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_curValue = widget.values[0];
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// _curValue = widget.values[0];
|
||||
// final ThemeData _theme = Theme.of(context);
|
||||
// final Color _mainFontColor = _theme.textSelectionColor;
|
||||
final _media = MediaQuery.of(context);
|
||||
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
|
||||
final double _devicewidth = _media.size.width;
|
||||
final double _deviceBlockSize = _devicewidth / 100;
|
||||
return Row(
|
||||
// width: double.infinity,
|
||||
children: <Widget>[
|
||||
Icon(
|
||||
FontAwesomeIcons.sortNumericDown,
|
||||
color: Colors.grey,
|
||||
size: 4 * _deviceBlockSize,
|
||||
),
|
||||
SizedBox(
|
||||
width: _deviceBlockSize,
|
||||
),
|
||||
Expanded(
|
||||
// width: MediaQuery.of(context).size.width - 70,
|
||||
child: DropdownButton(
|
||||
focusColor: Colors.red,
|
||||
icon: Icon(FontAwesomeIcons.angleDown),
|
||||
isExpanded: true,
|
||||
hint: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4),
|
||||
child: Text(
|
||||
_curValue,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Colors.black,
|
||||
// color: _mainFontColor,
|
||||
fontSize: 3.5 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
isDense: true,
|
||||
items: widget.values.map((String value) {
|
||||
return new DropdownMenuItem<String>(
|
||||
value: value,
|
||||
child: Container(
|
||||
child: Text(
|
||||
value,
|
||||
style: TextStyle(
|
||||
// color: _mainFontColor,
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: (val) {
|
||||
setState(() {
|
||||
_curValue = val;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
]);
|
||||
}
|
||||
}
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
|
||||
class DropDownBox extends StatefulWidget {
|
||||
DropDownBox({
|
||||
Key? key,
|
||||
required this.values,
|
||||
}) : super(key: key);
|
||||
|
||||
final List<String> values;
|
||||
|
||||
@override
|
||||
_DropDownBoxState createState() => _DropDownBoxState();
|
||||
}
|
||||
|
||||
class _DropDownBoxState extends State<DropDownBox> {
|
||||
String? _curValue;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_curValue = widget.values[0];
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// _curValue = widget.values[0];
|
||||
// final ThemeData _theme = Theme.of(context);
|
||||
// final Color _mainFontColor = _theme.textSelectionColor;
|
||||
final _media = MediaQuery.of(context);
|
||||
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
|
||||
final double _devicewidth = _media.size.width;
|
||||
final double _deviceBlockSize = _devicewidth / 100;
|
||||
return Row(
|
||||
// width: double.infinity,
|
||||
children: <Widget>[
|
||||
Icon(
|
||||
FontAwesomeIcons.sortNumericDown,
|
||||
color: Colors.grey,
|
||||
size: 4 * _deviceBlockSize,
|
||||
),
|
||||
SizedBox(
|
||||
width: _deviceBlockSize,
|
||||
),
|
||||
Expanded(
|
||||
// width: MediaQuery.of(context).size.width - 70,
|
||||
child: DropdownButton(
|
||||
focusColor: Colors.red,
|
||||
icon: Icon(FontAwesomeIcons.angleDown),
|
||||
isExpanded: true,
|
||||
hint: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4),
|
||||
child: Text(
|
||||
_curValue!,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Colors.black,
|
||||
// color: _mainFontColor,
|
||||
fontSize: 3.5 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
isDense: true,
|
||||
items: widget.values.map((String value) {
|
||||
return new DropdownMenuItem<String>(
|
||||
value: value,
|
||||
child: Container(
|
||||
child: Text(
|
||||
value,
|
||||
style: TextStyle(
|
||||
// color: _mainFontColor,
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: (val) {
|
||||
setState(() {
|
||||
_curValue = val;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,130 +1,130 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
|
||||
class TestResultFilterSelectorBox extends StatefulWidget {
|
||||
const TestResultFilterSelectorBox({
|
||||
Key key,
|
||||
@required double deviceBlockSize,
|
||||
@required this.dataCTRL,
|
||||
@required this.dataVals,
|
||||
@required String label,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
_label = label,
|
||||
super(key: key);
|
||||
|
||||
final double _deviceBlockSize;
|
||||
final TextEditingController dataCTRL;
|
||||
final List<String> dataVals;
|
||||
final String _label;
|
||||
|
||||
@override
|
||||
_TestResultFilterSelectorBoxState createState() =>
|
||||
_TestResultFilterSelectorBoxState();
|
||||
}
|
||||
|
||||
class _TestResultFilterSelectorBoxState
|
||||
extends State<TestResultFilterSelectorBox> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 5),
|
||||
// height: 65,
|
||||
child: Row(
|
||||
// width: double.infinity,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Icon(
|
||||
FontAwesomeIcons.alignLeft,
|
||||
color: Colors.grey,
|
||||
size: 7 * widget._deviceBlockSize,
|
||||
),
|
||||
SizedBox(
|
||||
width: 4 * widget._deviceBlockSize,
|
||||
),
|
||||
Expanded(
|
||||
// width: MediaQuery.of(context).size.width - 70,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Text(
|
||||
widget._label,
|
||||
style: TextStyle(
|
||||
fontSize: 3.5 * widget._deviceBlockSize,
|
||||
color: Colors.grey,
|
||||
fontWeight: FontWeight.w100,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Container(
|
||||
// height: 30,
|
||||
child: DropdownButtonFormField(
|
||||
decoration: InputDecoration(
|
||||
contentPadding: EdgeInsets.only(left: 0),
|
||||
// border: InputBorder.none,
|
||||
),
|
||||
iconSize: 7 * widget._deviceBlockSize,
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.angleDown,
|
||||
color: Colors.black,
|
||||
),
|
||||
isExpanded: true,
|
||||
hint: Container(
|
||||
// width: 100,
|
||||
height: 70,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 0),
|
||||
child: Text(
|
||||
widget.dataCTRL.text,
|
||||
// textDirection: TextDirection.rtl,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Colors.black,
|
||||
fontSize: 5 * widget._deviceBlockSize),
|
||||
),
|
||||
// TextFormField(
|
||||
// controller: widget.dataCTRL,
|
||||
// decoration: InputDecoration(
|
||||
// contentPadding: EdgeInsets.only(bottom: 15),
|
||||
// isDense: true,
|
||||
// ),
|
||||
// style: TextStyle(
|
||||
// fontWeight: FontWeight.w700,
|
||||
// color: Colors.black,
|
||||
// ),
|
||||
// // minLines: 1,
|
||||
// // maxLines: 3,
|
||||
// ),
|
||||
),
|
||||
isDense: true,
|
||||
items: widget.dataVals.map((val) {
|
||||
return new DropdownMenuItem<String>(
|
||||
value: val,
|
||||
child: Container(
|
||||
child: Text(
|
||||
val,
|
||||
style: TextStyle(
|
||||
// color: _mainFontColor,
|
||||
fontSize: 4 * widget._deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: (val) {
|
||||
setState(() {
|
||||
widget.dataCTRL.text = val;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
]),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
|
||||
class TestResultFilterSelectorBox extends StatefulWidget {
|
||||
const TestResultFilterSelectorBox({
|
||||
Key? key,
|
||||
required double deviceBlockSize,
|
||||
required this.dataCTRL,
|
||||
required this.dataVals,
|
||||
required String label,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
_label = label,
|
||||
super(key: key);
|
||||
|
||||
final double _deviceBlockSize;
|
||||
final TextEditingController dataCTRL;
|
||||
final List<String> dataVals;
|
||||
final String _label;
|
||||
|
||||
@override
|
||||
_TestResultFilterSelectorBoxState createState() =>
|
||||
_TestResultFilterSelectorBoxState();
|
||||
}
|
||||
|
||||
class _TestResultFilterSelectorBoxState
|
||||
extends State<TestResultFilterSelectorBox> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 5),
|
||||
// height: 65,
|
||||
child: Row(
|
||||
// width: double.infinity,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Icon(
|
||||
FontAwesomeIcons.alignLeft,
|
||||
color: Colors.grey,
|
||||
size: 7 * widget._deviceBlockSize,
|
||||
),
|
||||
SizedBox(
|
||||
width: 4 * widget._deviceBlockSize,
|
||||
),
|
||||
Expanded(
|
||||
// width: MediaQuery.of(context).size.width - 70,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Text(
|
||||
widget._label,
|
||||
style: TextStyle(
|
||||
fontSize: 3.5 * widget._deviceBlockSize,
|
||||
color: Colors.grey,
|
||||
fontWeight: FontWeight.w100,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Container(
|
||||
// height: 30,
|
||||
child: DropdownButtonFormField(
|
||||
decoration: InputDecoration(
|
||||
contentPadding: EdgeInsets.only(left: 0),
|
||||
// border: InputBorder.none,
|
||||
),
|
||||
iconSize: 7 * widget._deviceBlockSize,
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.angleDown,
|
||||
color: Colors.black,
|
||||
),
|
||||
isExpanded: true,
|
||||
hint: Container(
|
||||
// width: 100,
|
||||
height: 70,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 0),
|
||||
child: Text(
|
||||
widget.dataCTRL.text,
|
||||
// textDirection: TextDirection.rtl,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Colors.black,
|
||||
fontSize: 5 * widget._deviceBlockSize),
|
||||
),
|
||||
// TextFormField(
|
||||
// controller: widget.dataCTRL,
|
||||
// decoration: InputDecoration(
|
||||
// contentPadding: EdgeInsets.only(bottom: 15),
|
||||
// isDense: true,
|
||||
// ),
|
||||
// style: TextStyle(
|
||||
// fontWeight: FontWeight.w700,
|
||||
// color: Colors.black,
|
||||
// ),
|
||||
// // minLines: 1,
|
||||
// // maxLines: 3,
|
||||
// ),
|
||||
),
|
||||
isDense: true,
|
||||
items: widget.dataVals.map((val) {
|
||||
return new DropdownMenuItem<String>(
|
||||
value: val,
|
||||
child: Container(
|
||||
child: Text(
|
||||
val,
|
||||
style: TextStyle(
|
||||
// color: _mainFontColor,
|
||||
fontSize: 4 * widget._deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: (val) {
|
||||
setState(() {
|
||||
widget.dataCTRL.text = val!;
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
]),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,35 +1,35 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../config/routes.dart';
|
||||
|
||||
class TestResultAddButton extends StatelessWidget {
|
||||
const TestResultAddButton({
|
||||
Key key,
|
||||
@required double deviceBlockSize,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final double _deviceBlockSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
customBorder: CircleBorder(),
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed(Routes.testResultAddScreen);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(5),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.redAccent,
|
||||
),
|
||||
child: Icon(
|
||||
Icons.add,
|
||||
size: 10 * _deviceBlockSize,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../config/routes.dart';
|
||||
|
||||
class TestResultAddButton extends StatelessWidget {
|
||||
const TestResultAddButton({
|
||||
Key? key,
|
||||
required double deviceBlockSize,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final double _deviceBlockSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
customBorder: CircleBorder(),
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed(Routes.testResultAddScreen);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(5),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.redAccent,
|
||||
),
|
||||
child: Icon(
|
||||
Icons.add,
|
||||
size: 10 * _deviceBlockSize,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,76 +1,77 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../../providers/test_results.dart';
|
||||
|
||||
class TestResultChip extends StatelessWidget {
|
||||
const TestResultChip({
|
||||
Key key,
|
||||
@required double deviceBlockSize,
|
||||
@required String label,
|
||||
@required String id,
|
||||
@required String labelID,
|
||||
@required String testType,
|
||||
@required String hospital,
|
||||
@required String username,
|
||||
@required String fDate,
|
||||
@required String uDate,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
_id = id,
|
||||
_labelID = labelID,
|
||||
_testType = testType,
|
||||
_hispotal = hospital,
|
||||
_label = label,
|
||||
_username = username,
|
||||
_fDate = fDate,
|
||||
_uDate = uDate,
|
||||
super(key: key);
|
||||
|
||||
final double _deviceBlockSize;
|
||||
final String _id;
|
||||
final String _labelID;
|
||||
final String _testType;
|
||||
final String _hispotal;
|
||||
final String _label;
|
||||
final String _username;
|
||||
final String _fDate;
|
||||
final String _uDate;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(children: <Widget>[
|
||||
SizedBox(
|
||||
width: _deviceBlockSize,
|
||||
),
|
||||
Chip(
|
||||
backgroundColor: Colors.black,
|
||||
label: Text(
|
||||
_label,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
deleteIcon: Icon(
|
||||
Icons.close,
|
||||
color: Colors.white,
|
||||
),
|
||||
onDeleted: () {
|
||||
var labelProviderObject = Provider.of<TestResultsProvider>(context);
|
||||
labelProviderObject.setFilters(
|
||||
_id,
|
||||
_labelID,
|
||||
_username,
|
||||
_testType,
|
||||
_hispotal,
|
||||
_fDate,
|
||||
_uDate,
|
||||
);
|
||||
labelProviderObject.setLoading();
|
||||
labelProviderObject.getTestResults().then((_) {
|
||||
labelProviderObject.resetLoading();
|
||||
});
|
||||
},
|
||||
),
|
||||
]);
|
||||
}
|
||||
}
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../../providers/test_results.dart';
|
||||
|
||||
class TestResultChip extends StatelessWidget {
|
||||
const TestResultChip({
|
||||
Key? key,
|
||||
required double deviceBlockSize,
|
||||
required String label,
|
||||
required String id,
|
||||
required String labelID,
|
||||
required String testType,
|
||||
required String hospital,
|
||||
required String username,
|
||||
required String fDate,
|
||||
required String uDate,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
_id = id,
|
||||
_labelID = labelID,
|
||||
_testType = testType,
|
||||
_hispotal = hospital,
|
||||
_label = label,
|
||||
_username = username,
|
||||
_fDate = fDate,
|
||||
_uDate = uDate,
|
||||
super(key: key);
|
||||
|
||||
final double _deviceBlockSize;
|
||||
final String _id;
|
||||
final String _labelID;
|
||||
final String _testType;
|
||||
final String _hispotal;
|
||||
final String _label;
|
||||
final String _username;
|
||||
final String _fDate;
|
||||
final String _uDate;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(children: <Widget>[
|
||||
SizedBox(
|
||||
width: _deviceBlockSize,
|
||||
),
|
||||
Chip(
|
||||
backgroundColor: Colors.black,
|
||||
label: Text(
|
||||
_label,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
deleteIcon: Icon(
|
||||
Icons.close,
|
||||
color: Colors.white,
|
||||
),
|
||||
onDeleted: () {
|
||||
var labelProviderObject =
|
||||
Provider.of<TestResultsProvider>(context, listen: false);
|
||||
labelProviderObject.setFilters(
|
||||
_id,
|
||||
_labelID,
|
||||
_username,
|
||||
_testType,
|
||||
_hispotal,
|
||||
_fDate,
|
||||
_uDate,
|
||||
);
|
||||
labelProviderObject.setLoading();
|
||||
labelProviderObject.getTestResults().then((_) {
|
||||
labelProviderObject.resetLoading();
|
||||
});
|
||||
},
|
||||
),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,93 +1,63 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
|
||||
import '../../../config/routes.dart';
|
||||
|
||||
// class TestResultFloatingButton extends StatelessWidget {
|
||||
// const TestResultFloatingButton({
|
||||
// Key key,
|
||||
// @required double deviceBlockSize,
|
||||
// }) : _deviceBlockSize = deviceBlockSize,
|
||||
// super(key: key);
|
||||
|
||||
// final double _deviceBlockSize;
|
||||
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// return InkWell(
|
||||
// onTap: () {
|
||||
// Navigator.of(context).popAndPushNamed(Routes.testResultAddScreen);
|
||||
// },
|
||||
// child: Container(
|
||||
// padding: EdgeInsets.all(5),
|
||||
// decoration: BoxDecoration(
|
||||
// shape: BoxShape.circle,
|
||||
// color: Color.fromRGBO(0, 190, 190, 1),
|
||||
// ),
|
||||
// child: Icon(
|
||||
// Icons.add,
|
||||
// size: 10 * _deviceBlockSize,
|
||||
// color: Colors.white,
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
class TestResultFloatingButton extends StatelessWidget {
|
||||
const TestResultFloatingButton({
|
||||
Key key,
|
||||
@required double deviceBlockSize,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final double _deviceBlockSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
InkWell(
|
||||
customBorder: CircleBorder(),
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed(Routes.testScanScreen);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(2.5 * _deviceBlockSize),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.black,
|
||||
),
|
||||
child: Icon(
|
||||
FontAwesomeIcons.barcode,
|
||||
size: 7.1 * _deviceBlockSize,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 2 * _deviceBlockSize,
|
||||
),
|
||||
InkWell(
|
||||
customBorder: CircleBorder(),
|
||||
onTap: () {
|
||||
Navigator.of(context).pushReplacementNamed(Routes.testResultAddScreen);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(_deviceBlockSize),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Color.fromRGBO(0, 190, 190, 1),
|
||||
),
|
||||
child: Icon(
|
||||
Icons.add,
|
||||
size: 10 * _deviceBlockSize,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
import 'package:cssd/config/colors.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../config/routes.dart';
|
||||
|
||||
class TestResultFloatingButton extends StatelessWidget {
|
||||
const TestResultFloatingButton({
|
||||
Key? key,
|
||||
required double deviceBlockSize,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final double _deviceBlockSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
InkWell(
|
||||
customBorder: CircleBorder(),
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed(Routes.testScanScreen);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(2.5 * _deviceBlockSize),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.black,
|
||||
),
|
||||
child: Icon(
|
||||
Icons.qr_code_scanner,
|
||||
size: 7.1 * _deviceBlockSize,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 2 * _deviceBlockSize,
|
||||
),
|
||||
InkWell(
|
||||
customBorder: CircleBorder(),
|
||||
onTap: () {
|
||||
Navigator.of(context)
|
||||
.pushReplacementNamed(Routes.testResultAddScreen);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(_deviceBlockSize),
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: kLightBlue,
|
||||
),
|
||||
child: Icon(
|
||||
Icons.add,
|
||||
size: 10 * _deviceBlockSize,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,48 +1,48 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../../providers/test_results.dart';
|
||||
|
||||
class TestResultSearchBox extends StatelessWidget {
|
||||
const TestResultSearchBox({
|
||||
Key key,
|
||||
@required this.searchCTRL,
|
||||
@required double deviceBlockSize,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final TextEditingController searchCTRL;
|
||||
final double _deviceBlockSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return TextField(
|
||||
onEditingComplete: () {
|
||||
FocusScope.of(context).unfocus();
|
||||
},
|
||||
onChanged: (value) {
|
||||
Provider.of<TestResultsProvider>(context, listen: false).search(value);
|
||||
},
|
||||
controller: searchCTRL,
|
||||
decoration: InputDecoration(
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.search,
|
||||
size: 6 * _deviceBlockSize,
|
||||
),
|
||||
labelStyle: TextStyle(
|
||||
fontWeight: FontWeight.w100,
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
),
|
||||
labelText: 'Search by test name',
|
||||
isDense: true,
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 2, horizontal: 3),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
keyboardType: TextInputType.visiblePassword,
|
||||
);
|
||||
}
|
||||
}
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../../providers/test_results.dart';
|
||||
|
||||
class TestResultSearchBox extends StatelessWidget {
|
||||
const TestResultSearchBox({
|
||||
Key? key,
|
||||
required this.searchCTRL,
|
||||
required double deviceBlockSize,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final TextEditingController searchCTRL;
|
||||
final double _deviceBlockSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return TextField(
|
||||
onEditingComplete: () {
|
||||
FocusScope.of(context).unfocus();
|
||||
},
|
||||
onChanged: (value) {
|
||||
Provider.of<TestResultsProvider>(context, listen: false).search(value);
|
||||
},
|
||||
controller: searchCTRL,
|
||||
decoration: InputDecoration(
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.search,
|
||||
size: 6 * _deviceBlockSize,
|
||||
),
|
||||
labelStyle: TextStyle(
|
||||
fontWeight: FontWeight.w100,
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
),
|
||||
labelText: 'Search by test name',
|
||||
isDense: true,
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 2, horizontal: 3),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
keyboardType: TextInputType.visiblePassword,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user