mirror of
https://git.meshkee.com/applications/cssd.git
synced 2026-10-10 19:19:17 +03:30
179 lines
6.2 KiB
Dart
Executable File
179 lines
6.2 KiB
Dart
Executable File
import 'package:cssd/config/colors.dart';
|
|
import 'package:cssd/models/my_item_model.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
|
|
|
import '../../../config/routes.dart';
|
|
|
|
class MyItemsItemDataBox extends StatelessWidget {
|
|
final MyItemResultObject? items;
|
|
final bool hasHistoryBtn;
|
|
final VoidCallback? push;
|
|
|
|
const MyItemsItemDataBox({
|
|
Key? key,
|
|
required double deviceBlockSize,
|
|
this.push,
|
|
required this.isAdmin,
|
|
this.items,
|
|
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.itemDetailScreen,
|
|
arguments: items!.id,
|
|
),
|
|
child: Card(
|
|
elevation: 1,
|
|
child: Container(
|
|
padding: EdgeInsets.all(8),
|
|
child: Row(
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: <Widget>[
|
|
// if (items!.udi != null)
|
|
// Container(
|
|
// padding: const EdgeInsets.all(6.0),
|
|
// child: Text(
|
|
// items!.udi!,
|
|
// style: TextStyle(
|
|
// fontWeight: FontWeight.w700,
|
|
// fontSize: 3 * _deviceBlockSize,
|
|
// ),
|
|
// ),
|
|
// ),
|
|
// if (items!.udi != null)
|
|
// SizedBox(
|
|
// width: 3 * _deviceBlockSize,
|
|
// ),
|
|
// Spacer(),
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: <Widget>[
|
|
Container(
|
|
width: 40 * _deviceBlockSize,
|
|
child: Text(
|
|
items!.name,
|
|
style: TextStyle(
|
|
fontSize: 3 * _deviceBlockSize,
|
|
fontWeight: FontWeight.w700,
|
|
),
|
|
),
|
|
),
|
|
Container(
|
|
width: 30 * _deviceBlockSize,
|
|
child: Row(
|
|
children: [
|
|
Text(
|
|
'Udi: ',
|
|
overflow: TextOverflow.ellipsis,
|
|
style: TextStyle(
|
|
fontSize: 3 * _deviceBlockSize,
|
|
color: Colors.grey,
|
|
),
|
|
),
|
|
Text(
|
|
items!.udi ?? '',
|
|
overflow: TextOverflow.ellipsis,
|
|
style: TextStyle(
|
|
fontWeight: FontWeight.w700,
|
|
fontSize: 3 * _deviceBlockSize,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
if (isAdmin)
|
|
Container(
|
|
width: 50 * _deviceBlockSize,
|
|
child: Row(
|
|
children: <Widget>[
|
|
Text(
|
|
'Owner: ',
|
|
style: TextStyle(
|
|
color: Colors.grey,
|
|
fontSize: 3 * _deviceBlockSize,
|
|
),
|
|
),
|
|
Text(
|
|
items!.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: kDarkBlue,
|
|
),
|
|
child: Icon(
|
|
FontAwesomeIcons.history,
|
|
size: 4 * _deviceBlockSize,
|
|
color: Colors.white,
|
|
),
|
|
),
|
|
),
|
|
SizedBox(
|
|
width: 5.0,
|
|
),
|
|
// InkWell(
|
|
// customBorder: CircleBorder(),
|
|
// onTap: () {
|
|
// Navigator.of(context).pushNamed(
|
|
// Routes.myItemsDetailScreen,
|
|
// arguments: items!.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,
|
|
// ),
|
|
// ),
|
|
// ),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|