mirror of
https://git.meshkee.com/applications/cssd.git
synced 2026-10-13 03:18:57 +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,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user