mirror of
https://git.meshkee.com/applications/cssd.git
synced 2026-10-14 00:48:55 +03:30
445 lines
15 KiB
Dart
445 lines
15 KiB
Dart
import 'package:cssd/config/colors.dart';
|
|
import 'package:cssd/models/package_model.dart';
|
|
import 'package:cssd/widgets/MyItemsScreens/Detail/transfer_destroy_button.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:intl/intl.dart';
|
|
import 'package:url_launcher/url_launcher.dart';
|
|
|
|
class MyPackageDetailsDataBox extends StatelessWidget {
|
|
const MyPackageDetailsDataBox({
|
|
Key? key,
|
|
required this.datas,
|
|
required double deviceBlockSize,
|
|
required this.push,
|
|
}) : _deviceBlockSize = deviceBlockSize,
|
|
super(key: key);
|
|
|
|
final PackageDetailObject datas;
|
|
final double _deviceBlockSize;
|
|
final VoidCallback push;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
// final userData = Provider.of<Auth>(context, listen: false).user;
|
|
return Padding(
|
|
padding: EdgeInsets.all(20),
|
|
child: ListView(
|
|
children: <Widget>[
|
|
SizedBox(
|
|
height: 10,
|
|
),
|
|
Text(
|
|
'Package Details',
|
|
style: TextStyle(
|
|
fontWeight: FontWeight.w700,
|
|
fontSize: 5 * _deviceBlockSize,
|
|
letterSpacing: 3,
|
|
),
|
|
),
|
|
SizedBox(
|
|
height: 10,
|
|
),
|
|
Container(
|
|
padding: EdgeInsets.all(10),
|
|
decoration: BoxDecoration(
|
|
color: Color.fromRGBO(235, 235, 235, 1),
|
|
border: Border(
|
|
left: BorderSide(
|
|
color: kDarkPurple,
|
|
width: 2,
|
|
),
|
|
),
|
|
),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: <Widget>[
|
|
Text(
|
|
DateFormat.yMMMd().format(
|
|
DateTime.parse(
|
|
datas.createDate,
|
|
),
|
|
),
|
|
style: TextStyle(
|
|
color: kDarkPurple,
|
|
),
|
|
),
|
|
Divider(),
|
|
Text(
|
|
'ID: ${datas.id}',
|
|
style: TextStyle(
|
|
color: kDarkPurple,
|
|
fontWeight: FontWeight.w700,
|
|
),
|
|
),
|
|
SizedBox(
|
|
height: 30,
|
|
),
|
|
Row(
|
|
children: <Widget>[
|
|
Container(
|
|
width: 35 * _deviceBlockSize,
|
|
child: Text(
|
|
'Package Name',
|
|
style: TextStyle(
|
|
color: Colors.grey,
|
|
),
|
|
),
|
|
),
|
|
Container(
|
|
width: 45 * _deviceBlockSize,
|
|
child: Text(
|
|
datas.name.toString(),
|
|
style: TextStyle(
|
|
fontWeight: FontWeight.w700,
|
|
),
|
|
overflow: TextOverflow.clip,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
Divider(),
|
|
SizedBox(
|
|
height: 5,
|
|
),
|
|
Row(
|
|
children: <Widget>[
|
|
Container(
|
|
width: 35 * _deviceBlockSize,
|
|
child: Text(
|
|
'Date',
|
|
style: TextStyle(
|
|
color: Colors.grey,
|
|
),
|
|
),
|
|
),
|
|
Container(
|
|
width: 45 * _deviceBlockSize,
|
|
child: Text(
|
|
DateFormat('d-M-y').format(
|
|
DateTime.parse(
|
|
datas.createDate,
|
|
),
|
|
),
|
|
style: TextStyle(
|
|
fontWeight: FontWeight.w700,
|
|
),
|
|
overflow: TextOverflow.clip,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
// Divider(),
|
|
// SizedBox(
|
|
// height: 5,
|
|
// ),
|
|
// Row(
|
|
// children: <Widget>[
|
|
// Container(
|
|
// width: 35 * _deviceBlockSize,
|
|
// child: Text(
|
|
// 'UDI',
|
|
// style: TextStyle(
|
|
// color: Colors.grey,
|
|
// ),
|
|
// ),
|
|
// ),
|
|
// Container(
|
|
// width: 45 * _deviceBlockSize,
|
|
// child: Text(
|
|
// datas.udi.toString(),
|
|
// style: TextStyle(
|
|
// fontWeight: FontWeight.w700,
|
|
// ),
|
|
// overflow: TextOverflow.clip,
|
|
// ),
|
|
// ),
|
|
// ],
|
|
// ),
|
|
Divider(),
|
|
SizedBox(
|
|
height: 5,
|
|
),
|
|
Row(
|
|
children: <Widget>[
|
|
Container(
|
|
width: 35 * _deviceBlockSize,
|
|
child: Text(
|
|
'Description',
|
|
style: TextStyle(
|
|
color: Colors.grey,
|
|
),
|
|
),
|
|
),
|
|
Container(
|
|
width: 45 * _deviceBlockSize,
|
|
child: Text(
|
|
datas.description.toString(),
|
|
style: TextStyle(
|
|
fontWeight: FontWeight.w700,
|
|
),
|
|
overflow: TextOverflow.clip,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
Divider(),
|
|
SizedBox(
|
|
height: 5,
|
|
),
|
|
Row(
|
|
children: <Widget>[
|
|
Container(
|
|
width: 35 * _deviceBlockSize,
|
|
child: Text(
|
|
'Hospital Name',
|
|
style: TextStyle(
|
|
color: Colors.grey,
|
|
),
|
|
),
|
|
),
|
|
Container(
|
|
width: 45 * _deviceBlockSize,
|
|
child: Text(
|
|
datas.hospitalName,
|
|
style: TextStyle(
|
|
fontWeight: FontWeight.w700,
|
|
),
|
|
overflow: TextOverflow.clip,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
Divider(),
|
|
SizedBox(
|
|
height: 30,
|
|
),
|
|
Text(
|
|
'Items included',
|
|
style: TextStyle(
|
|
color: kPurple,
|
|
letterSpacing: 3,
|
|
fontWeight: FontWeight.w700,
|
|
fontSize: 4.5 * _deviceBlockSize,
|
|
),
|
|
),
|
|
Container(
|
|
width: double.infinity,
|
|
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 20),
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(5),
|
|
border: Border.all(
|
|
color: Colors.grey,
|
|
),
|
|
),
|
|
child: ListView.separated(
|
|
shrinkWrap: true,
|
|
itemBuilder: (ctx, index) => RichText(
|
|
text: TextSpan(
|
|
text: 'Item ID ',
|
|
style: TextStyle(
|
|
color: Colors.grey,
|
|
fontFamily: 'montserrat',
|
|
),
|
|
children: <TextSpan>[
|
|
TextSpan(
|
|
text: datas.items[index],
|
|
style: TextStyle(
|
|
fontWeight: FontWeight.bold,
|
|
color: kDarkPurple,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
separatorBuilder: (ctx, index) => Divider(),
|
|
itemCount: datas.items.length,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
SizedBox(
|
|
height: 20,
|
|
),
|
|
TransferDestroyButton(
|
|
deviceBlockSize: _deviceBlockSize,
|
|
firstColor: kDarkPurple,
|
|
secondColor: kDarkPurpleSub,
|
|
text: 'Transfer',
|
|
onTap: () {
|
|
push();
|
|
},
|
|
),
|
|
// SizedBox(
|
|
// height: 10.0,
|
|
// ),
|
|
// userData['roles']?.contains('User') ?? false
|
|
// ? Container()
|
|
// : TransferDestroyButton(
|
|
// deviceBlockSize: _deviceBlockSize,
|
|
// firstColor: kPink,
|
|
// secondColor: kPinkSub,
|
|
// text: 'Destroy',
|
|
// onTap: () {
|
|
// showDialog(
|
|
// context: context,
|
|
// builder: (context) {
|
|
// return AlertDialog(
|
|
// title: Text(
|
|
// 'Are you sure to destroy this Package?',
|
|
// style: TextStyle(
|
|
// fontSize: 4 * _deviceBlockSize,
|
|
// ),
|
|
// ),
|
|
// content: SizedBox(
|
|
// width: _deviceBlockSize,
|
|
// height: 220,
|
|
// child: Column(
|
|
// children: [
|
|
// Text(
|
|
// 'By approving, your package will be removed and it can not be used any more.',
|
|
// style: TextStyle(
|
|
// fontSize: 3 * _deviceBlockSize,
|
|
// ),
|
|
// ),
|
|
// SizedBox(
|
|
// height: 10.0,
|
|
// ),
|
|
// PackageCard(_deviceBlockSize),
|
|
// SizedBox(
|
|
// height: 20.0,
|
|
// ),
|
|
// TransferDestroyButton(
|
|
// deviceBlockSize: _deviceBlockSize,
|
|
// firstColor: kPink,
|
|
// secondColor: kPinkSub,
|
|
// onTap: () {
|
|
// Provider.of<PackageProvider>(context,
|
|
// listen: false)
|
|
// .removePackages(datas.id)
|
|
// .then(
|
|
// (value) {
|
|
// Navigator.of(context).pop();
|
|
// Navigator.pushReplacementNamed(
|
|
// context,
|
|
// Routes.myPackagesResultScreen,
|
|
// );
|
|
// },
|
|
// );
|
|
// },
|
|
// text: 'Destroy',
|
|
// ),
|
|
// SizedBox(
|
|
// height: 5.0,
|
|
// ),
|
|
// CancelTransferButton(
|
|
// deviceBlockSize: _deviceBlockSize,
|
|
// color: kDarkPurple,
|
|
// onTap: () {
|
|
// Navigator.pop(context);
|
|
// },
|
|
// ),
|
|
// ],
|
|
// ),
|
|
// ),
|
|
// );
|
|
// },
|
|
// );
|
|
// },
|
|
// ),
|
|
SizedBox(
|
|
height: 20,
|
|
),
|
|
InkWell(
|
|
onTap: () async => await launch(
|
|
'https://cssd-doc.com/Show/Package/${datas.id.toString()}',
|
|
),
|
|
child: Container(
|
|
padding: EdgeInsets.symmetric(vertical: 20),
|
|
width: double.infinity,
|
|
decoration: BoxDecoration(
|
|
color: Color.fromRGBO(230, 230, 230, 1),
|
|
borderRadius: BorderRadius.circular(25),
|
|
),
|
|
child: Center(
|
|
child: Text(
|
|
'Show More Details',
|
|
style: TextStyle(fontWeight: FontWeight.w700),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
SizedBox(
|
|
height: 30,
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
Container PackageCard(double _deviceBlockSize) {
|
|
return Container(
|
|
decoration: BoxDecoration(
|
|
border: Border.all(color: Colors.grey),
|
|
borderRadius: BorderRadius.circular(5),
|
|
),
|
|
child: Row(
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: <Widget>[
|
|
Container(
|
|
padding: const EdgeInsets.all(6.0),
|
|
child: Text(
|
|
datas.id,
|
|
style: TextStyle(
|
|
fontWeight: FontWeight.w700,
|
|
fontSize: 5 * _deviceBlockSize,
|
|
),
|
|
),
|
|
),
|
|
SizedBox(
|
|
width: 3 * _deviceBlockSize,
|
|
),
|
|
// Spacer(),
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: <Widget>[
|
|
Container(
|
|
width: 40 * _deviceBlockSize,
|
|
child: Text(
|
|
datas.name,
|
|
style: TextStyle(
|
|
fontSize: 3 * _deviceBlockSize,
|
|
fontWeight: FontWeight.w700,
|
|
),
|
|
),
|
|
),
|
|
// Container(
|
|
// width: 30 * _deviceBlockSize,
|
|
// child: Row(
|
|
// children: <Widget>[
|
|
// Text(
|
|
// 'User:',
|
|
// style: TextStyle(
|
|
// color: Colors.grey,
|
|
// fontSize: 3 * _deviceBlockSize,
|
|
// ),
|
|
// ),
|
|
// Text(
|
|
// datas.userName,
|
|
// style: TextStyle(
|
|
// fontSize: 3 * _deviceBlockSize,
|
|
// fontWeight: FontWeight.w700,
|
|
// ),
|
|
// ),
|
|
// ],
|
|
// ),
|
|
// ),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|