mirror of
https://git.meshkee.com/applications/cssd.git
synced 2026-10-10 19:19:17 +03:30
179 lines
6.1 KiB
Dart
Executable File
179 lines
6.1 KiB
Dart
Executable File
import 'package:cssd/config/colors.dart';
|
|
import 'package:cssd/models/my_package_model.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
|
import 'package:intl/intl.dart';
|
|
|
|
import '../../../../config/routes.dart';
|
|
|
|
class MyPackagesItemDataBox extends StatelessWidget {
|
|
final MyPackageResultObject? packages;
|
|
final bool hasHistoryBtn;
|
|
final VoidCallback? push;
|
|
|
|
const MyPackagesItemDataBox({
|
|
Key? key,
|
|
required double deviceBlockSize,
|
|
this.push,
|
|
required this.isAdmin,
|
|
this.packages,
|
|
this.hasHistoryBtn = true,
|
|
}) : _deviceBlockSize = deviceBlockSize,
|
|
super(key: key);
|
|
|
|
final double _deviceBlockSize;
|
|
final bool isAdmin;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return GestureDetector(
|
|
onTap: () => Navigator.of(context).pushNamed(
|
|
Routes.myPackagesDetailScreen,
|
|
arguments: packages!.id,
|
|
),
|
|
child: Card(
|
|
elevation: 1,
|
|
child: Container(
|
|
padding: EdgeInsets.all(8),
|
|
child: Row(
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: <Widget>[
|
|
// Container(
|
|
// padding: const EdgeInsets.all(6.0),
|
|
// child: Text(
|
|
// packages!.id,
|
|
// style: TextStyle(
|
|
// fontWeight: FontWeight.w700,
|
|
// fontSize: 5 * _deviceBlockSize,
|
|
// ),
|
|
// ),
|
|
// ),
|
|
// SizedBox(
|
|
// width: 3 * _deviceBlockSize,
|
|
// ),
|
|
// Spacer(),
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: <Widget>[
|
|
Container(
|
|
width: 40 * _deviceBlockSize,
|
|
child: Text(
|
|
packages!.name,
|
|
style: TextStyle(
|
|
fontSize: 3 * _deviceBlockSize,
|
|
fontWeight: FontWeight.w700,
|
|
),
|
|
),
|
|
),
|
|
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(
|
|
packages!.createdAt,
|
|
),
|
|
),
|
|
style: TextStyle(
|
|
fontSize: 3 * _deviceBlockSize,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
if (isAdmin)
|
|
Container(
|
|
width: 30 * _deviceBlockSize,
|
|
child: Row(
|
|
children: <Widget>[
|
|
Text(
|
|
'User: ',
|
|
style: TextStyle(
|
|
color: Colors.grey,
|
|
fontSize: 3 * _deviceBlockSize,
|
|
),
|
|
),
|
|
Text(
|
|
packages!.userName.toString(),
|
|
style: TextStyle(
|
|
fontSize: 3 * _deviceBlockSize,
|
|
fontWeight: FontWeight.w700,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
Spacer(),
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
children: <Widget>[
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
children: <Widget>[
|
|
if (hasHistoryBtn)
|
|
InkWell(
|
|
customBorder: CircleBorder(),
|
|
onTap: () {
|
|
push!();
|
|
},
|
|
child: Container(
|
|
padding: EdgeInsets.all(7),
|
|
width: 9 * _deviceBlockSize,
|
|
decoration: BoxDecoration(
|
|
shape: BoxShape.circle,
|
|
color: kDarkPurple,
|
|
),
|
|
child: Icon(
|
|
FontAwesomeIcons.history,
|
|
size: 4 * _deviceBlockSize,
|
|
color: Colors.white,
|
|
),
|
|
),
|
|
),
|
|
SizedBox(
|
|
width: 5.0,
|
|
),
|
|
InkWell(
|
|
customBorder: CircleBorder(),
|
|
onTap: () {
|
|
Navigator.of(context).pushNamed(
|
|
Routes.myPackagesDetailScreen,
|
|
arguments: packages!.id,
|
|
);
|
|
},
|
|
child: Container(
|
|
padding: EdgeInsets.all(7),
|
|
width: 9 * _deviceBlockSize,
|
|
decoration: BoxDecoration(
|
|
shape: BoxShape.circle,
|
|
color: Colors.black,
|
|
),
|
|
child: Icon(
|
|
FontAwesomeIcons.fileAlt,
|
|
size: 5 * _deviceBlockSize,
|
|
color: Colors.white,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|