mirror of
https://git.meshkee.com/applications/cssd.git
synced 2026-10-12 08:58:54 +03:30
commit
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import 'package:cssd/models/cycles_models.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({
|
||||
@@ -17,215 +19,273 @@ class CycleDetailsDataBox extends StatelessWidget {
|
||||
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,
|
||||
child: ListView(
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
),
|
||||
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,
|
||||
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),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
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: 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: 30,)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,21 @@
|
||||
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,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
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();
|
||||
@@ -47,7 +51,7 @@ class _CycleFilterSelectorBoxState extends State<CycleFilterSelectorBox> {
|
||||
width: widget._deviceBlockSize,
|
||||
),
|
||||
Text(
|
||||
'Package',
|
||||
widget._label,
|
||||
style: TextStyle(
|
||||
fontSize: 3.5 * widget._deviceBlockSize,
|
||||
color: Colors.grey,
|
||||
|
||||
@@ -72,8 +72,7 @@ class _LabelAddSelectorBoxState extends State<LabelAddSelectorBox> {
|
||||
color: Colors.black,
|
||||
),
|
||||
isExpanded: true,
|
||||
hint:
|
||||
Container(
|
||||
hint: Container(
|
||||
// width: 100,
|
||||
height: 70,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 0),
|
||||
@@ -84,9 +83,10 @@ class _LabelAddSelectorBoxState extends State<LabelAddSelectorBox> {
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Colors.black,
|
||||
fontSize: 5 * widget._deviceBlockSize
|
||||
fontSize: 5 * widget._deviceBlockSize,
|
||||
),
|
||||
),),
|
||||
),
|
||||
),
|
||||
// Container(
|
||||
// // width: 100,
|
||||
// height: 70,
|
||||
@@ -111,9 +111,12 @@ class _LabelAddSelectorBoxState extends State<LabelAddSelectorBox> {
|
||||
child: Container(
|
||||
child: Text(
|
||||
val['name'],
|
||||
textDirection: TextDirection.rtl,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
// color: _mainFontColor,
|
||||
fontSize: 4 * widget._deviceBlockSize,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Colors.black,
|
||||
fontSize: 5 * widget._deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
import 'package:cssd/config/routes.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:cssd/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>[
|
||||
FlatButton(
|
||||
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,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
import 'package:cssd/models/label_models.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({
|
||||
@@ -17,227 +19,282 @@ class LabelDetailsDataBox extends StatelessWidget {
|
||||
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,
|
||||
child: ListView(
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
),
|
||||
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,
|
||||
),
|
||||
Text(
|
||||
'LABEL DETAILS',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
letterSpacing: 3,
|
||||
),
|
||||
),
|
||||
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: 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),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ class LabelItemBox extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 50 * _deviceBlockSize,
|
||||
width: 30 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Package:',
|
||||
style: TextStyle(
|
||||
@@ -56,14 +56,14 @@ class LabelItemBox extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 50 * _deviceBlockSize,
|
||||
width: 40 * _deviceBlockSize,
|
||||
child: Text(
|
||||
item.package,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 50 * _deviceBlockSize,
|
||||
width: 30 * _deviceBlockSize,
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Text(
|
||||
@@ -91,6 +91,29 @@ class LabelItemBox extends StatelessWidget {
|
||||
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: () {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import 'package:cssd/config/routes.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class FilterScanSaveButton extends StatelessWidget {
|
||||
const FilterScanSaveButton({
|
||||
@@ -7,7 +7,9 @@ class FilterScanSaveButton extends StatelessWidget {
|
||||
@required GlobalKey<FormState> form,
|
||||
@required this.idCTRL,
|
||||
@required double deviceBlockSize,
|
||||
}) : _form = form, _deviceBlockSize = deviceBlockSize, super(key: key);
|
||||
}) : _form = form,
|
||||
_deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
|
||||
final GlobalKey<FormState> _form;
|
||||
final TextEditingController idCTRL;
|
||||
@@ -17,20 +19,23 @@ class FilterScanSaveButton extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
if (! _form.currentState.validate()) {
|
||||
if (!_form.currentState.validate()) {
|
||||
return;
|
||||
}
|
||||
Navigator.of(context).pushNamed(
|
||||
Routes.labelDetailScreen,
|
||||
arguments: idCTRL.text,
|
||||
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.symmetric(horizontal: 20),
|
||||
margin: EdgeInsets.only(bottom: 50,left: 20,right: 20),
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [Colors.blue, Colors.green],
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'package:barcode_scan/barcode_scan.dart';
|
||||
import 'package:cssd/config/routes.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class LabelScanBox extends StatelessWidget {
|
||||
const LabelScanBox({
|
||||
@@ -24,9 +24,8 @@ class LabelScanBox extends StatelessWidget {
|
||||
return 'null';
|
||||
}
|
||||
} on PlatformException catch (_) {
|
||||
return 'access';
|
||||
}
|
||||
catch (_){
|
||||
return 'access';
|
||||
} catch (_) {
|
||||
return 'error';
|
||||
}
|
||||
|
||||
@@ -70,15 +69,16 @@ class LabelScanBox extends StatelessWidget {
|
||||
print('cancel');
|
||||
} else if (result == 'error') {
|
||||
print('error');
|
||||
}
|
||||
else if(result == 'access'){
|
||||
} else if (result == 'access') {
|
||||
print('access');
|
||||
}
|
||||
else {
|
||||
Navigator.of(context).pushNamed(
|
||||
Routes.labelDetailScreen,
|
||||
arguments: result,
|
||||
} else {
|
||||
launch(
|
||||
'https://cssd-doc.com/Show/Label/$result',
|
||||
);
|
||||
// Navigator.of(context).pushNamed(
|
||||
// Routes.labelDetailScreen,
|
||||
// arguments: result,
|
||||
// );
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
@@ -7,15 +7,18 @@ class InfoInputBox extends StatelessWidget {
|
||||
@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) {
|
||||
@@ -38,7 +41,7 @@ class InfoInputBox extends StatelessWidget {
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
),
|
||||
keyboardType: TextInputType.number,
|
||||
keyboardType: _inputType,
|
||||
textInputAction: TextInputAction.next,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,313 @@
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:camera/camera.dart';
|
||||
import 'package:cssd/providers/test_results.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:provider/provider.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<File> files = profileProviderObject.catchImages;
|
||||
files.add(File(imagePath));
|
||||
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());
|
||||
// }
|
||||
@@ -1,8 +1,16 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:cssd/config/routes.dart';
|
||||
import 'package:file_picker/file_picker.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:image_picker_gallery_camera/image_picker_gallery_camera.dart';
|
||||
import 'package:meta/meta.dart';
|
||||
import 'package:multiselect_formfield/multiselect_formfield.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../../providers/test_results.dart';
|
||||
|
||||
class FormCreator extends StatefulWidget {
|
||||
const FormCreator({
|
||||
@@ -60,7 +68,82 @@ class _FormCreatorState extends State<FormCreator> {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
if (item['type'] == 'Image') {
|
||||
final testProviderObject = Provider.of<TestResultsProvider>(context);
|
||||
final mediaData = MediaQuery.of(context);
|
||||
final deviceWidth = mediaData.size.width;
|
||||
final _deviceBlockSize = deviceWidth / 100;
|
||||
listWidgets.insert(
|
||||
3,
|
||||
Container(
|
||||
// height: 70,
|
||||
child: Directionality(
|
||||
textDirection: TextDirection.rtl,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 20),
|
||||
height: testProviderObject.catchImages.length != 0 ? 60 : 0,
|
||||
child: ImageBox(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
testProvider: testProviderObject,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: testProviderObject.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,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
InkWell(
|
||||
onTap: () async {
|
||||
await Navigator.of(context).pushNamed(Routes.captureImageScreen);
|
||||
// await captureImage(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 from camera',
|
||||
textDirection: TextDirection.ltr,
|
||||
style: TextStyle(color: Colors.white),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
if (item['type'] == "Label") {
|
||||
listWidgets.add(
|
||||
Container(
|
||||
@@ -113,26 +196,39 @@ class _FormCreatorState extends State<FormCreator> {
|
||||
}
|
||||
|
||||
formItems[count]['value'] = formItems[count]['value'] ?? startValue;
|
||||
int divisions = (endValue - startValue).round();
|
||||
// int divisions = (endValue - startValue).round();
|
||||
listWidgets.add(
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 35),
|
||||
child: Slider(
|
||||
min: startValue,
|
||||
max: endValue,
|
||||
value: formItems[count]['value'],
|
||||
label: '${formItems[count]['value'].round()}',
|
||||
divisions: divisions,
|
||||
onChanged: (double value) {
|
||||
setState(() {
|
||||
formItems[count]['value'] = value;
|
||||
});
|
||||
},
|
||||
semanticFormatterCallback: (double newValue) {
|
||||
return '${newValue.round()}';
|
||||
},
|
||||
),
|
||||
),
|
||||
padding: EdgeInsets.only(top: 35, left: 10, right: 10),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
Text(item['type']),
|
||||
Text(formItems[count]['value'].toString()),
|
||||
],
|
||||
),
|
||||
Slider(
|
||||
min: startValue,
|
||||
max: endValue,
|
||||
value: formItems[count]['value'],
|
||||
// label: '${formItems[count]['value'].round()}',
|
||||
// divisions: divisions,
|
||||
onChanged: (double value) {
|
||||
setState(() {
|
||||
formItems[count]['value'] =
|
||||
double.parse(value.toStringAsFixed(2));
|
||||
});
|
||||
// print(formItems[count]['value']);
|
||||
},
|
||||
// semanticFormatterCallback: (double newValue) {
|
||||
// return '${newValue.round()}';
|
||||
// },
|
||||
),
|
||||
],
|
||||
)),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -353,9 +449,51 @@ class _FormCreatorState extends State<FormCreator> {
|
||||
// ),
|
||||
// );
|
||||
}
|
||||
|
||||
return listWidgets;
|
||||
}
|
||||
|
||||
Future captureImage(BuildContext context) async {
|
||||
var profileProviderObject =
|
||||
Provider.of<TestResultsProvider>(context, listen: false);
|
||||
List<File> files = profileProviderObject.catchImages;
|
||||
try {
|
||||
files.add(
|
||||
await ImagePickerGC.pickImage(
|
||||
context: context,
|
||||
source: ImgSource.Camera,
|
||||
cameraIcon: Icon(
|
||||
Icons.camera_alt,
|
||||
color: Colors.red,
|
||||
), //cameraIcon and galleryIcon can change. If no icon provided default icon will be present
|
||||
cameraText: Text(
|
||||
"From Camera",
|
||||
style: TextStyle(color: Colors.red),
|
||||
),
|
||||
),
|
||||
);
|
||||
} catch (e) {}
|
||||
profileProviderObject.setCatchImages(files);
|
||||
profileProviderObject.setImages();
|
||||
}
|
||||
|
||||
Future<void> loadAssets(BuildContext context) async {
|
||||
var profileProviderObject =
|
||||
Provider.of<TestResultsProvider>(context, listen: false);
|
||||
List<File> files = profileProviderObject.catchImages;
|
||||
try {
|
||||
files += await FilePicker.getMultiFile(
|
||||
type: FileType.custom,
|
||||
allowedExtensions: ['jpg', 'png', 'bmp', 'jpeg', 'pdf', 'docx', 'doc'],
|
||||
);
|
||||
// print(files);
|
||||
} catch (_) {}
|
||||
|
||||
profileProviderObject.setCatchImages(files);
|
||||
profileProviderObject.setImages();
|
||||
// profileProviderObject.addImage();
|
||||
}
|
||||
|
||||
_FormCreatorState(this.formItems);
|
||||
|
||||
void _handleChanged() {
|
||||
@@ -377,3 +515,110 @@ class _FormCreatorState extends State<FormCreator> {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class ImageBox extends StatelessWidget {
|
||||
const ImageBox({
|
||||
Key key,
|
||||
@required double deviceBlockSize,
|
||||
@required TestResultsProvider testProvider,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
_testProvider = testProvider,
|
||||
super(key: key);
|
||||
|
||||
final double _deviceBlockSize;
|
||||
final TestResultsProvider _testProvider;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListView.separated(
|
||||
shrinkWrap: true,
|
||||
scrollDirection: Axis.horizontal,
|
||||
itemBuilder: (ctx, index) {
|
||||
bool isPdf = _testProvider.catchImages[index].path.endsWith('pdf');
|
||||
bool isWord = _testProvider.catchImages[index].path.endsWith('docx') ||
|
||||
_testProvider.catchImages[index].path.endsWith('doc');
|
||||
|
||||
// print(_testProvider.catchImages[index].path.endsWith('jpg'));
|
||||
// .substring(_testProvider.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.file(
|
||||
_testProvider.catchImages[index],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
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.file(
|
||||
_testProvider.catchImages[index],
|
||||
// asset: _images[index],
|
||||
width: 60,
|
||||
height: 60,
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 0,
|
||||
right: 0,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
// setState(() {
|
||||
_testProvider.removeImage(index);
|
||||
// });
|
||||
},
|
||||
child: CircleAvatar(
|
||||
backgroundColor: Colors.red,
|
||||
radius: 10,
|
||||
child: Icon(
|
||||
Icons.close,
|
||||
size: 12,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
itemCount: _testProvider.catchImages.length,
|
||||
separatorBuilder: (BuildContext context, int index) => SizedBox(
|
||||
width: 3 * _deviceBlockSize,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ class _TestResultAddSelectorBoxState extends State<TestResultAddSelectorBox> {
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Colors.black,
|
||||
fontSize: 4 * widget._deviceBlockSize,
|
||||
fontSize: 3 * widget._deviceBlockSize,
|
||||
),
|
||||
),
|
||||
// TextFormField(
|
||||
@@ -106,9 +106,11 @@ class _TestResultAddSelectorBoxState extends State<TestResultAddSelectorBox> {
|
||||
child: Container(
|
||||
child: Text(
|
||||
val,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
// color: _mainFontColor,
|
||||
fontSize: 4 * widget._deviceBlockSize,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Colors.black,
|
||||
fontSize: 3 * widget._deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class DatasBox extends StatelessWidget {
|
||||
const DatasBox({
|
||||
@@ -16,212 +17,240 @@ class DatasBox extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.all(20),
|
||||
child: 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'],
|
||||
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,
|
||||
),
|
||||
),
|
||||
style: TextStyle(
|
||||
color: Colors.red,
|
||||
),
|
||||
),
|
||||
Divider(),
|
||||
Text(
|
||||
datas['test_type_name'],
|
||||
style: TextStyle(
|
||||
color: Colors.red,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 30,
|
||||
),
|
||||
Row(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'CSSD ID',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
Text(
|
||||
DateFormat.yMMMd().format(
|
||||
DateTime.parse(
|
||||
datas['date'],
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas['id'].toString(),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
style: TextStyle(
|
||||
color: Colors.red,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Autocleave ID',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
Divider(),
|
||||
Text(
|
||||
datas['test_type_name'],
|
||||
style: TextStyle(
|
||||
color: Colors.red,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas['auto_cleave_id'].toString(),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
SizedBox(
|
||||
height: 30,
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Test Code',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas['test_code'].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'],
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Test Register ID',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas['id'].toString(),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
),
|
||||
),
|
||||
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(),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
SizedBox(height: 20,),
|
||||
InkWell(
|
||||
onTap: () async=> await launch(
|
||||
'https://cssd-doc.com/Show/TestResult/${datas['id'].toString()}',
|
||||
// forceSafariVC: true,
|
||||
// forceWebView: true,
|
||||
// headers: <String, String>{'my_header_key': 'my_header_value'},
|
||||
// child: Text('Show Full Details'),
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'Status',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
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),
|
||||
),
|
||||
Container(
|
||||
width: 45 * _deviceBlockSize,
|
||||
child: Text(
|
||||
datas['verified'] == 'NotVerified'
|
||||
? 'Rejected'
|
||||
: 'Verified',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
color: datas['verified'] == 'NotVerified'
|
||||
? Colors.red
|
||||
: Colors.blueAccent,
|
||||
),
|
||||
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(),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,37 @@
|
||||
import 'package:cssd/config/routes.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.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({
|
||||
@@ -12,22 +44,49 @@ class TestResultFloatingButton extends StatelessWidget {
|
||||
|
||||
@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),
|
||||
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,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: Icon(
|
||||
Icons.add,
|
||||
size: 10 * _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,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user