mirror of
https://git.meshkee.com/applications/cssd.git
synced 2026-10-13 00:58:56 +03:30
3.2.2
This commit is contained in:
@@ -168,7 +168,7 @@ class MyItemsDetailsDataBox extends StatelessWidget {
|
||||
Container(
|
||||
width: 35 * _deviceBlockSize,
|
||||
child: Text(
|
||||
'User',
|
||||
'Owner',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
@@ -190,6 +190,33 @@ class MyItemsDetailsDataBox extends StatelessWidget {
|
||||
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(
|
||||
@@ -332,21 +359,32 @@ class MyItemsDetailsDataBox extends StatelessWidget {
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
TransferDestroyButton(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
firstColor: kDarkBlue,
|
||||
secondColor: kDarkBlueSub,
|
||||
text: 'Transfer',
|
||||
onTap: () {
|
||||
push();
|
||||
},
|
||||
),
|
||||
userData['roles']?.contains('Admin') ?? false
|
||||
? 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(),
|
||||
SizedBox(
|
||||
height: 10.0,
|
||||
),
|
||||
userData['roles']?.contains('User') ?? false
|
||||
? Container()
|
||||
: TransferDestroyButton(
|
||||
userData['roles']?.contains('Admin') ?? false
|
||||
? TransferDestroyButton(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
firstColor: kPink,
|
||||
secondColor: kPinkSub,
|
||||
@@ -417,13 +455,88 @@ class MyItemsDetailsDataBox extends StatelessWidget {
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
)
|
||||
: userData['roles'].contains('Supervisor')
|
||||
? datas.packageId != null
|
||||
? 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 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: kPink,
|
||||
secondColor: kPinkSub,
|
||||
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(),
|
||||
SizedBox(
|
||||
height: 10.0,
|
||||
),
|
||||
userData['roles']?.contains('User') ?? false
|
||||
? Container()
|
||||
: TransferDestroyButton(
|
||||
userData['roles']?.contains('Admin') ?? false
|
||||
? TransferDestroyButton(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
firstColor: Colors.black,
|
||||
secondColor: Colors.black87,
|
||||
@@ -494,7 +607,84 @@ class MyItemsDetailsDataBox extends StatelessWidget {
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
)
|
||||
: userData['roles'].contains('Supervisor')
|
||||
? datas.packageId != null
|
||||
? TransferDestroyButton(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
firstColor: Colors.black,
|
||||
secondColor: Colors.black87,
|
||||
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: Colors.black,
|
||||
secondColor: Colors.black87,
|
||||
onTap: () {
|
||||
Provider.of<MyItemProvider>(context,
|
||||
listen: false)
|
||||
.repairItems(
|
||||
datas.id, 'approved')
|
||||
.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: 20.0,
|
||||
),
|
||||
|
||||
@@ -8,6 +8,7 @@ class TransferDestroyButton extends StatelessWidget {
|
||||
required this.secondColor,
|
||||
required this.onTap,
|
||||
required this.text,
|
||||
this.fontSize = 5.0,
|
||||
}) : _deviceBlockSize = deviceBlockSize,
|
||||
super(key: key);
|
||||
final double _deviceBlockSize;
|
||||
@@ -15,6 +16,7 @@ class TransferDestroyButton extends StatelessWidget {
|
||||
final Color secondColor;
|
||||
final String text;
|
||||
final VoidCallback onTap;
|
||||
final double fontSize;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -37,7 +39,7 @@ class TransferDestroyButton extends StatelessWidget {
|
||||
text,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 5 * _deviceBlockSize,
|
||||
fontSize: fontSize * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user