mirror of
https://git.meshkee.com/applications/cssd.git
synced 2026-10-10 19:28:56 +03:30
945 lines
39 KiB
Dart
Executable File
945 lines
39 KiB
Dart
Executable File
import 'package:carousel_slider/carousel_slider.dart';
|
|
import 'package:cssd/config/colors.dart';
|
|
import 'package:cssd/config/routes.dart';
|
|
import 'package:cssd/models/item_model.dart';
|
|
import 'package:cssd/providers/auth.dart';
|
|
import 'package:cssd/providers/items.dart';
|
|
import 'package:cssd/providers/my_items.dart';
|
|
import 'package:cssd/widgets/MyItemsScreens/Detail/cancel_transfer_button.dart';
|
|
import 'package:cssd/widgets/MyItemsScreens/Detail/transfer_destroy_button.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:fluttertoast/fluttertoast.dart';
|
|
import 'package:intl/intl.dart';
|
|
import 'package:pinch_zoom/pinch_zoom.dart';
|
|
import 'package:provider/provider.dart';
|
|
import 'package:url_launcher/url_launcher.dart';
|
|
|
|
class ItemDetailsDataBox extends StatelessWidget {
|
|
const ItemDetailsDataBox({
|
|
Key? key,
|
|
required this.datas,
|
|
required double deviceBlockSize,
|
|
required this.push,
|
|
}) : _deviceBlockSize = deviceBlockSize,
|
|
super(key: key);
|
|
|
|
final ItemDetailObject datas;
|
|
final double _deviceBlockSize;
|
|
final VoidCallback push;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final userData = Provider.of<Auth>(context, listen: false).user;
|
|
print(datas.status);
|
|
return Padding(
|
|
padding: EdgeInsets.all(20),
|
|
child: ListView(
|
|
children: <Widget>[
|
|
SizedBox(
|
|
height: 10,
|
|
),
|
|
Text(
|
|
'Item 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: datas.repair == 1
|
|
? kPink
|
|
: datas.status == 'approved'
|
|
? kDarkBlue
|
|
: datas.status == 'rejected'
|
|
? kPink
|
|
: Colors.grey,
|
|
width: 2,
|
|
),
|
|
),
|
|
),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: <Widget>[
|
|
Text(
|
|
DateFormat.yMMMd().format(
|
|
DateTime.parse(
|
|
datas.createdAt,
|
|
),
|
|
),
|
|
style: TextStyle(
|
|
color: datas.repair == 1
|
|
? kPink
|
|
: datas.status == 'approved'
|
|
? kDarkBlue
|
|
: datas.status == 'rejected'
|
|
? kPink
|
|
: Colors.grey,
|
|
),
|
|
),
|
|
Divider(),
|
|
Text(
|
|
'ID: ${datas.id}',
|
|
style: TextStyle(
|
|
color: datas.repair == 1
|
|
? kPink
|
|
: datas.status == 'approved'
|
|
? kDarkBlue
|
|
: datas.status == 'rejected'
|
|
? kPink
|
|
: Colors.grey,
|
|
fontWeight: FontWeight.w700,
|
|
),
|
|
),
|
|
SizedBox(
|
|
height: 30,
|
|
),
|
|
Row(
|
|
children: <Widget>[
|
|
Container(
|
|
width: 35 * _deviceBlockSize,
|
|
child: Text(
|
|
'Item 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(
|
|
'Size',
|
|
style: TextStyle(
|
|
color: Colors.grey,
|
|
),
|
|
),
|
|
),
|
|
Container(
|
|
width: 45 * _deviceBlockSize,
|
|
child: Text(
|
|
datas.size.toString(),
|
|
style: TextStyle(
|
|
fontWeight: FontWeight.w700,
|
|
),
|
|
overflow: TextOverflow.clip,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
Divider(),
|
|
SizedBox(
|
|
height: 5,
|
|
),
|
|
Row(
|
|
children: <Widget>[
|
|
Container(
|
|
width: 35 * _deviceBlockSize,
|
|
child: Text(
|
|
'Specific',
|
|
style: TextStyle(
|
|
color: Colors.grey,
|
|
),
|
|
),
|
|
),
|
|
Container(
|
|
width: 45 * _deviceBlockSize,
|
|
child: Text(
|
|
datas.specific.toString(),
|
|
style: TextStyle(
|
|
fontWeight: FontWeight.w700,
|
|
),
|
|
overflow: TextOverflow.clip,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
Divider(),
|
|
SizedBox(
|
|
height: 5,
|
|
),
|
|
Row(
|
|
children: <Widget>[
|
|
Container(
|
|
width: 35 * _deviceBlockSize,
|
|
child: Text(
|
|
'Owner',
|
|
style: TextStyle(
|
|
color: Colors.grey,
|
|
),
|
|
),
|
|
),
|
|
Container(
|
|
width: 45 * _deviceBlockSize,
|
|
child: Text(
|
|
datas.userName.toString(),
|
|
style: TextStyle(
|
|
fontWeight: FontWeight.w700,
|
|
),
|
|
overflow: TextOverflow.clip,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
Divider(),
|
|
SizedBox(
|
|
height: 5,
|
|
),
|
|
Row(
|
|
children: <Widget>[
|
|
Container(
|
|
width: 35 * _deviceBlockSize,
|
|
child: Text(
|
|
'Creator',
|
|
style: TextStyle(
|
|
color: Colors.grey,
|
|
),
|
|
),
|
|
),
|
|
Container(
|
|
width: 45 * _deviceBlockSize,
|
|
child: Text(
|
|
datas.userCreator.toString(),
|
|
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(
|
|
'Date',
|
|
style: TextStyle(
|
|
color: Colors.grey,
|
|
),
|
|
),
|
|
),
|
|
Container(
|
|
width: 45 * _deviceBlockSize,
|
|
child: Text(
|
|
DateFormat('d-M-y').format(
|
|
DateTime.parse(
|
|
datas.createdAt,
|
|
),
|
|
),
|
|
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.hospital,
|
|
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.repair == 1
|
|
? 'Pending...'
|
|
: datas.status == 'approved'
|
|
? 'Success'
|
|
: datas.status == 'rejected'
|
|
? 'Failure'
|
|
: 'Pending...',
|
|
style: TextStyle(
|
|
fontWeight: FontWeight.w700,
|
|
color: datas.repair == 1
|
|
? kPink
|
|
: datas.status == 'approved'
|
|
? kDarkBlue
|
|
: datas.status == 'rejected'
|
|
? kPink
|
|
: Colors.grey,
|
|
),
|
|
overflow: TextOverflow.clip,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
if (datas.filePath!.isNotEmpty) Divider(),
|
|
if (datas.filePath!.isNotEmpty)
|
|
SizedBox(
|
|
height: 10,
|
|
),
|
|
if (datas.filePath!.isNotEmpty)
|
|
Container(
|
|
width: double.infinity,
|
|
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 20),
|
|
child: CarouselSlider.builder(
|
|
disableGesture: true,
|
|
itemBuilder: (ctx, index, realIndex) {
|
|
return InkWell(
|
|
child: Image(
|
|
image: NetworkImage(datas.filePath![index])),
|
|
onTap: () {
|
|
showDialog(
|
|
context: context,
|
|
builder: (BuildContext context) => PinchZoom(
|
|
child: Image.network(datas.filePath![index])),
|
|
);
|
|
},
|
|
);
|
|
},
|
|
itemCount: datas.filePath!.length,
|
|
options: CarouselOptions(
|
|
enlargeCenterPage: true,
|
|
aspectRatio: 16 / 8,
|
|
viewportFraction: datas.filePath?.length == 1 ? 1 : 0.6,
|
|
padEnds: false,
|
|
pauseAutoPlayOnTouch: true,
|
|
disableCenter: false,
|
|
autoPlay: false,
|
|
enlargeFactor: 0.5,
|
|
enableInfiniteScroll:
|
|
datas.filePath?.length == 1 ? false : true,
|
|
),
|
|
),
|
|
),
|
|
SizedBox(
|
|
height: 10,
|
|
),
|
|
InkWell(
|
|
onTap: () async => await launch(
|
|
'https://cssd-doc.com/Show/Item/${datas.id.toString()}',
|
|
),
|
|
child: Container(
|
|
padding: EdgeInsets.symmetric(vertical: 10),
|
|
width: double.infinity * 2 / 3,
|
|
decoration: BoxDecoration(
|
|
color: Colors.black,
|
|
borderRadius: BorderRadius.circular(5),
|
|
),
|
|
child: Center(
|
|
child: Text(
|
|
'Show More Details',
|
|
style: TextStyle(
|
|
fontSize: 5.0 * _deviceBlockSize,
|
|
color: Colors.white,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
SizedBox(
|
|
height: 20,
|
|
),
|
|
// if (datas.packageId == "null")
|
|
// if (datas.repair == 0)
|
|
// (userData['roles']?.contains('Supervisor') &&
|
|
// datas.hospital.contains(userData['medical_center']) ||
|
|
// (userData['roles']?.contains('User')))
|
|
// ?
|
|
if (userData['roles']?.contains('Admin') ||
|
|
userData['roles']?.contains('Supervisor') ||
|
|
(userData['roles']?.contains('User') &&
|
|
(userData['name']?.contains(datas.userName.toString()))))
|
|
if (datas.status == 'approved' && datas.packageId == "")
|
|
TransferDestroyButton(
|
|
deviceBlockSize: _deviceBlockSize,
|
|
firstColor: kDarkBlue,
|
|
secondColor: kDarkBlueSub,
|
|
text: 'Transfer',
|
|
onTap: () {
|
|
push();
|
|
},
|
|
),
|
|
// : datas.packageId != "null"
|
|
// ? TransferDestroyButton(
|
|
// deviceBlockSize: _deviceBlockSize,
|
|
// firstColor: kDarkBlue,
|
|
// secondColor: kDarkBlueSub,
|
|
// text: 'Transfer',
|
|
// onTap: () {
|
|
// push();
|
|
// },
|
|
// )
|
|
// : Container(),
|
|
// if (userData['roles']?.contains('Admin') ||
|
|
// userData['roles']?.contains('Supervisor'))
|
|
// if (datas.repair == 0)
|
|
// if (datas.packageId == "null")
|
|
if (userData['roles']?.contains('Admin') ||
|
|
userData['roles']?.contains('Supervisor') ||
|
|
(userData['roles']?.contains('User') &&
|
|
(userData['name']?.contains(datas.userName.toString()))))
|
|
if (datas.status == 'approved' && datas.packageId == "")
|
|
SizedBox(
|
|
height: 10.0,
|
|
),
|
|
if (datas.repair == 0)
|
|
(userData['roles']?.contains('Admin') ||
|
|
(userData['roles']?.contains('Supervisor') &&
|
|
datas.status != 1))
|
|
? TransferDestroyButton(
|
|
deviceBlockSize: _deviceBlockSize,
|
|
firstColor: Colors.black,
|
|
secondColor: Colors.black87,
|
|
text: 'Destroy',
|
|
onTap: () {
|
|
showDialog(
|
|
context: context,
|
|
builder: (context) {
|
|
return AlertDialog(
|
|
title: Text(
|
|
'Are you sure to destroy this Item?',
|
|
style: TextStyle(
|
|
fontSize: 4 * _deviceBlockSize,
|
|
),
|
|
),
|
|
content: SizedBox(
|
|
width: _deviceBlockSize,
|
|
height: 220,
|
|
child: Column(
|
|
children: [
|
|
Text(
|
|
'By approving, your item will be removed and it can not be used any more.',
|
|
style: TextStyle(
|
|
fontSize: 3 * _deviceBlockSize,
|
|
),
|
|
),
|
|
SizedBox(
|
|
height: 10.0,
|
|
),
|
|
ItemCard(_deviceBlockSize),
|
|
SizedBox(
|
|
height: 20.0,
|
|
),
|
|
Consumer<ItemProvider>(
|
|
builder: (context, itemProvider, child) {
|
|
return TransferDestroyButton(
|
|
deviceBlockSize: _deviceBlockSize,
|
|
firstColor: Colors.black,
|
|
secondColor: Colors.black87,
|
|
isLoadingButton:
|
|
itemProvider.isloadingButton,
|
|
onTap: () async {
|
|
itemProvider.setLoadingButton();
|
|
await Provider.of<ItemProvider>(
|
|
context,
|
|
listen: false)
|
|
.removeItems(datas.id)
|
|
.then(
|
|
(value) {
|
|
Navigator.of(context).pop();
|
|
Navigator.of(context).pop();
|
|
Navigator.pushReplacementNamed(
|
|
context,
|
|
Routes.myItemsResultScreen,
|
|
);
|
|
itemProvider.resetLoadingButton();
|
|
Fluttertoast.showToast(
|
|
msg: "The item is destroyed.",
|
|
toastLength: Toast.LENGTH_SHORT,
|
|
gravity: ToastGravity.BOTTOM,
|
|
);
|
|
},
|
|
);
|
|
},
|
|
text: 'Destroy',
|
|
);
|
|
},
|
|
),
|
|
SizedBox(
|
|
height: 5.0,
|
|
),
|
|
CancelTransferButton(
|
|
deviceBlockSize: _deviceBlockSize,
|
|
color: kDarkBlue,
|
|
onTap: () {
|
|
Navigator.pop(context);
|
|
},
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
},
|
|
);
|
|
},
|
|
)
|
|
: userData['roles'].contains('Supervisor')
|
|
? datas.packageId != null
|
|
? TransferDestroyButton(
|
|
deviceBlockSize: _deviceBlockSize,
|
|
firstColor: Colors.black,
|
|
secondColor: Colors.black87,
|
|
text: 'Destroy',
|
|
onTap: () {
|
|
showDialog(
|
|
context: context,
|
|
builder: (context) {
|
|
return AlertDialog(
|
|
title: Text(
|
|
'Are you sure to destroy this Item?',
|
|
style: TextStyle(
|
|
fontSize: 4 * _deviceBlockSize,
|
|
),
|
|
),
|
|
content: SizedBox(
|
|
width: _deviceBlockSize,
|
|
height: 220,
|
|
child: Column(
|
|
children: [
|
|
Text(
|
|
'By approving, your item will be removed and it can not be used any more.',
|
|
style: TextStyle(
|
|
fontSize: 3 * _deviceBlockSize,
|
|
),
|
|
),
|
|
SizedBox(
|
|
height: 10.0,
|
|
),
|
|
ItemCard(_deviceBlockSize),
|
|
SizedBox(
|
|
height: 20.0,
|
|
),
|
|
TransferDestroyButton(
|
|
deviceBlockSize: _deviceBlockSize,
|
|
firstColor: Colors.black,
|
|
secondColor: Colors.black87,
|
|
onTap: () {
|
|
Provider.of<ItemProvider>(context,
|
|
listen: false)
|
|
.removeItems(datas.id)
|
|
.then(
|
|
(value) {
|
|
Navigator.of(context).pop();
|
|
Navigator
|
|
.pushReplacementNamed(
|
|
context,
|
|
Routes.myItemsResultScreen,
|
|
);
|
|
},
|
|
);
|
|
},
|
|
text: 'Destroy',
|
|
),
|
|
SizedBox(
|
|
height: 5.0,
|
|
),
|
|
CancelTransferButton(
|
|
deviceBlockSize: _deviceBlockSize,
|
|
color: kDarkBlue,
|
|
onTap: () {
|
|
Navigator.pop(context);
|
|
},
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
},
|
|
);
|
|
},
|
|
)
|
|
: Container()
|
|
: Container(),
|
|
if (datas.repair == 0)
|
|
SizedBox(
|
|
height: 10.0,
|
|
),
|
|
(userData['roles']?.contains('Admin') ||
|
|
userData['roles']?.contains('Supervisor'))
|
|
? TransferDestroyButton(
|
|
deviceBlockSize: _deviceBlockSize,
|
|
firstColor: datas.repair == 1 ? kPink : Colors.green,
|
|
secondColor: datas.repair == 1 ? kPinkSub : Colors.lightGreen,
|
|
text: datas.repair == 1 ? 'Exit repair mode' : 'Repair',
|
|
onTap: () {
|
|
showDialog(
|
|
context: context,
|
|
builder: (context) {
|
|
return AlertDialog(
|
|
title: Text(
|
|
datas.repair == 1
|
|
? 'Are you sure you want to exit repair mode for this item?'
|
|
: 'Are you sure to repair this Item?',
|
|
style: TextStyle(
|
|
fontSize: 4 * _deviceBlockSize,
|
|
),
|
|
),
|
|
content: SizedBox(
|
|
width: _deviceBlockSize,
|
|
height: 240,
|
|
child: Column(
|
|
children: [
|
|
Text(
|
|
datas.repair == 1
|
|
? 'By approving, your item will come out of repair mode and will be usable again unless you enable repair mode.'
|
|
: 'By approving, your item will be set in repair mode and it can be use anymore unless you disable repair mode.',
|
|
style: TextStyle(
|
|
fontSize: 3 * _deviceBlockSize,
|
|
),
|
|
),
|
|
SizedBox(
|
|
height: 10.0,
|
|
),
|
|
ItemCard(_deviceBlockSize),
|
|
SizedBox(
|
|
height: 20.0,
|
|
),
|
|
Consumer<ItemProvider>(
|
|
builder: (context, itemProvider, child) {
|
|
return TransferDestroyButton(
|
|
deviceBlockSize: _deviceBlockSize,
|
|
firstColor: datas.repair == 1
|
|
? kPink
|
|
: Colors.green,
|
|
secondColor: datas.repair == 1
|
|
? kPinkSub
|
|
: Colors.lightGreen,
|
|
isLoadingButton:
|
|
itemProvider.isloadingButton,
|
|
onTap: () async {
|
|
itemProvider.setLoadingButton();
|
|
await Provider.of<MyItemProvider>(
|
|
context,
|
|
listen: false)
|
|
.repairItems(datas.id)
|
|
.then(
|
|
(value) {
|
|
Navigator.of(context).pop();
|
|
Navigator.of(context).pop();
|
|
itemProvider.resetLoadingButton();
|
|
Fluttertoast.showToast(
|
|
msg: "The item is repaired.",
|
|
toastLength: Toast.LENGTH_SHORT,
|
|
gravity: ToastGravity.BOTTOM,
|
|
);
|
|
},
|
|
);
|
|
},
|
|
text: datas.repair == 1
|
|
? 'Exit repair mode'
|
|
: 'Repair',
|
|
);
|
|
},
|
|
),
|
|
SizedBox(
|
|
height: 5.0,
|
|
),
|
|
CancelTransferButton(
|
|
deviceBlockSize: _deviceBlockSize,
|
|
color: kDarkBlue,
|
|
onTap: () {
|
|
Navigator.pop(context);
|
|
},
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
},
|
|
);
|
|
},
|
|
)
|
|
: userData['roles'].contains('Supervisor')
|
|
? datas.packageId != null
|
|
? TransferDestroyButton(
|
|
deviceBlockSize: _deviceBlockSize,
|
|
firstColor: datas.repair == 1 ? kPink : Colors.green,
|
|
secondColor:
|
|
datas.repair == 1 ? kPinkSub : Colors.lightGreen,
|
|
text: 'Repair',
|
|
onTap: () {
|
|
showDialog(
|
|
context: context,
|
|
builder: (context) {
|
|
return AlertDialog(
|
|
title: Text(
|
|
'Are you sure to repair this Item?',
|
|
style: TextStyle(
|
|
fontSize: 4 * _deviceBlockSize,
|
|
),
|
|
),
|
|
content: SizedBox(
|
|
width: _deviceBlockSize,
|
|
height: 220,
|
|
child: Column(
|
|
children: [
|
|
Text(
|
|
'By approving, your item will be set in repair mode and it can be use anymore unless you disable repair mode.',
|
|
style: TextStyle(
|
|
fontSize: 3 * _deviceBlockSize,
|
|
),
|
|
),
|
|
SizedBox(
|
|
height: 10.0,
|
|
),
|
|
ItemCard(_deviceBlockSize),
|
|
SizedBox(
|
|
height: 20.0,
|
|
),
|
|
TransferDestroyButton(
|
|
deviceBlockSize: _deviceBlockSize,
|
|
firstColor: datas.repair == 1
|
|
? kPink
|
|
: Colors.green,
|
|
secondColor: datas.repair == 1
|
|
? kPinkSub
|
|
: Colors.lightGreen,
|
|
onTap: () {
|
|
Provider.of<MyItemProvider>(context,
|
|
listen: false)
|
|
.repairItems(datas.id)
|
|
.then(
|
|
(value) {
|
|
Navigator.of(context).pop();
|
|
Navigator.pushReplacementNamed(
|
|
context,
|
|
Routes.myItemsResultScreen,
|
|
);
|
|
},
|
|
);
|
|
},
|
|
text: 'Repair',
|
|
),
|
|
SizedBox(
|
|
height: 5.0,
|
|
),
|
|
CancelTransferButton(
|
|
deviceBlockSize: _deviceBlockSize,
|
|
color: kDarkBlue,
|
|
onTap: () {
|
|
Navigator.pop(context);
|
|
},
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
},
|
|
);
|
|
},
|
|
)
|
|
: Container()
|
|
: Container(),
|
|
SizedBox(
|
|
height: 30,
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
Container ItemCard(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: [
|
|
Text(
|
|
'Size:',
|
|
overflow: TextOverflow.ellipsis,
|
|
style: TextStyle(
|
|
fontSize: 3 * _deviceBlockSize,
|
|
color: Colors.grey,
|
|
),
|
|
),
|
|
Text(
|
|
datas.size,
|
|
overflow: TextOverflow.ellipsis,
|
|
style: TextStyle(
|
|
fontWeight: FontWeight.w700,
|
|
fontSize: 3 * _deviceBlockSize,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Container(
|
|
width: 40 * _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,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|