Files
cssd/lib/widgets/TestResultScreens/Details/datas_box.dart
T
2023-11-22 14:53:35 +04:30

277 lines
9.2 KiB
Dart
Executable File

import 'package:cssd/config/colors.dart';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:url_launcher/url_launcher.dart';
class DatasBox extends StatelessWidget {
const DatasBox({
Key? key,
required this.datas,
required double deviceBlockSize,
}) : _deviceBlockSize = deviceBlockSize,
super(key: key);
final Map<String, dynamic> datas;
final double _deviceBlockSize;
@override
Widget build(BuildContext context) {
return Padding(
padding: EdgeInsets.all(20),
child: ListView(
children: <Widget>[
SizedBox(
height: 10,
),
Text(
'Test Result Details',
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
letterSpacing: 3,
),
),
SizedBox(
height: 10,
),
Container(
padding: EdgeInsets.all(10),
decoration: BoxDecoration(
color: Color.fromRGBO(230, 230, 230, 1),
border: Border(
left: BorderSide(
color: datas['accepted'] == 'Accepted' ? kLightBlue : kPink,
width: 2,
),
),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text(
DateFormat.yMMMd().format(
DateTime.parse(
datas['date'],
),
),
style: TextStyle(
color: datas['accepted'] == 'Accepted' ? kLightBlue : kPink,
),
),
Divider(),
Text(
datas['test_type_name'],
style: TextStyle(
color: datas['accepted'] == 'Accepted' ? kLightBlue : kPink,
fontWeight: FontWeight.w700,
),
),
SizedBox(
height: 30,
),
Row(
children: <Widget>[
Container(
width: 35 * _deviceBlockSize,
child: Text(
'Test Register ID',
style: TextStyle(
color: Colors.grey,
),
),
),
Container(
width: 45 * _deviceBlockSize,
child: Text(
datas['id'].toString(),
style: TextStyle(
fontWeight: FontWeight.w700,
),
overflow: TextOverflow.clip,
),
),
],
),
Divider(),
SizedBox(
height: 5,
),
Row(
children: <Widget>[
Container(
width: 35 * _deviceBlockSize,
child: Text(
'Autoclave ID',
style: TextStyle(
color: Colors.grey,
),
),
),
Container(
width: 45 * _deviceBlockSize,
child: Text(
datas['auto_cleave_id'].toString(),
style: TextStyle(
fontWeight: FontWeight.w700,
),
overflow: TextOverflow.clip,
),
),
],
),
Divider(),
SizedBox(
height: 5,
),
Row(
children: <Widget>[
Container(
width: 35 * _deviceBlockSize,
child: Text(
'Hospital',
style: TextStyle(
color: Colors.grey,
),
),
),
Container(
width: 45 * _deviceBlockSize,
child: Text(
datas['hospital'].toString(),
style: TextStyle(
fontWeight: FontWeight.w700,
),
overflow: TextOverflow.clip,
),
),
],
),
Divider(),
SizedBox(
height: 5,
),
Row(
children: <Widget>[
Container(
width: 35 * _deviceBlockSize,
child: Text(
'Date',
style: TextStyle(
color: Colors.grey,
),
),
),
Container(
width: 45 * _deviceBlockSize,
child: Text(
DateFormat('d-M-y').format(
DateTime.parse(
datas['date'],
),
),
style: TextStyle(
fontWeight: FontWeight.w700,
),
overflow: TextOverflow.clip,
),
),
],
),
Divider(),
SizedBox(
height: 5,
),
Row(
children: <Widget>[
Container(
width: 35 * _deviceBlockSize,
child: Text(
'Status',
style: TextStyle(
color: Colors.grey,
),
),
),
Container(
width: 45 * _deviceBlockSize,
child: Text(
datas['accepted'] == 'Accepted' ||
datas['verified'] == 'Verified'
? 'Accepted'
: 'Rejected',
style: TextStyle(
fontWeight: FontWeight.w700,
color: datas['accepted'] == 'Accepted'
? kLightBlue
: kPink,
),
overflow: TextOverflow.clip,
),
),
],
),
Divider(),
SizedBox(
height: 5,
),
Row(
children: <Widget>[
Container(
width: 35 * _deviceBlockSize,
child: Text(
'Description',
style: TextStyle(
color: Colors.grey,
),
),
),
Container(
width: 45 * _deviceBlockSize,
child: Text(
datas['description'].toString(),
style: TextStyle(
fontWeight: FontWeight.w700,
),
overflow: TextOverflow.clip,
),
),
],
),
],
),
),
SizedBox(
height: 20,
),
InkWell(
onTap: () async => await launch(
'https://cssd-doc.com/Show/TestResult/${datas['id'].toString()}',
// 'https://cssd-doc.com/api/TestResults/${datas['id'].toString()}',
// forceSafariVC: true,
// forceWebView: true,
// headers: <String, String>{'my_header_key': 'my_header_value'},
// child: Text('Show Full Details'),
),
child: Container(
padding: EdgeInsets.symmetric(vertical: 20),
width: double.infinity,
decoration: BoxDecoration(
color: Color.fromRGBO(230, 230, 230, 1),
borderRadius: BorderRadius.circular(25),
),
child: Center(
child: Text(
'Show More Details',
style: TextStyle(fontWeight: FontWeight.w700),
),
),
),
)
],
),
);
}
}