mirror of
https://git.meshkee.com/applications/cssd.git
synced 2026-10-13 20:58:55 +03:30
improve item data box ui
This commit is contained in:
@@ -141,94 +141,6 @@ class ItemItemBox extends StatelessWidget {
|
|||||||
// ),
|
// ),
|
||||||
userData['roles']?.contains('Admin') ?? false
|
userData['roles']?.contains('Admin') ?? false
|
||||||
? InkWell(
|
? InkWell(
|
||||||
onTap: () {
|
|
||||||
showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (context) {
|
|
||||||
return AlertDialog(
|
|
||||||
title: Text('Delete'),
|
|
||||||
content: Text(
|
|
||||||
'Are you sure you want delete this Item?',
|
|
||||||
),
|
|
||||||
actions: <Widget>[
|
|
||||||
TextButton(
|
|
||||||
child: Text('Yes'),
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
Provider.of<ItemProvider>(context,
|
|
||||||
listen: false)
|
|
||||||
.removeItems(item!.id);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
TextButton(
|
|
||||||
child: Text('No'),
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
child: Icon(
|
|
||||||
Icons.delete,
|
|
||||||
size: 5 * _deviceBlockSize,
|
|
||||||
color: Colors.black,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: userData['roles']?.contains('Supervisor')
|
|
||||||
? item!.packageId != null
|
|
||||||
? InkWell(
|
|
||||||
onTap: () {
|
|
||||||
showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (context) {
|
|
||||||
return AlertDialog(
|
|
||||||
title: Text('Delete'),
|
|
||||||
content: Text(
|
|
||||||
'Are you sure you want delete this Item?',
|
|
||||||
),
|
|
||||||
actions: <Widget>[
|
|
||||||
TextButton(
|
|
||||||
child: Text('Yes'),
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
Provider.of<ItemProvider>(
|
|
||||||
context,
|
|
||||||
listen: false)
|
|
||||||
.removeItems(item!.id);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
TextButton(
|
|
||||||
child: Text('No'),
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
child: Icon(
|
|
||||||
Icons.delete,
|
|
||||||
size: 5 * _deviceBlockSize,
|
|
||||||
color: Colors.black,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: Container()
|
|
||||||
: Container(),
|
|
||||||
SizedBox(
|
|
||||||
width: 5.0,
|
|
||||||
),
|
|
||||||
(userData['roles']?.contains('User') ?? false)
|
|
||||||
? Container()
|
|
||||||
: item?.status == "suspended"
|
|
||||||
? Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
|
||||||
children: <Widget>[
|
|
||||||
InkWell(
|
|
||||||
customBorder: CircleBorder(),
|
customBorder: CircleBorder(),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
showDialog(
|
showDialog(
|
||||||
@@ -236,52 +148,41 @@ class ItemItemBox extends StatelessWidget {
|
|||||||
builder: (context) {
|
builder: (context) {
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
title: Text(
|
title: Text(
|
||||||
'Are you Reject this item?'),
|
'Are you Confirm this item?',
|
||||||
|
),
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
Consumer<ItemProvider>(
|
Consumer<ItemProvider>(builder:
|
||||||
builder: (context,
|
(context, itemProvider, _) {
|
||||||
itemProvider, _) {
|
return itemProvider.isloadingButton
|
||||||
return itemProvider
|
|
||||||
.isloadingButton
|
|
||||||
? CircularProgressIndicator(
|
? CircularProgressIndicator(
|
||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
)
|
)
|
||||||
: TextButton(
|
: TextButton(
|
||||||
onPressed:
|
onPressed: () async {
|
||||||
() async {
|
|
||||||
itemProvider
|
itemProvider
|
||||||
.setLoadingButton();
|
.setLoadingButton();
|
||||||
await Provider.of<
|
await Provider.of<
|
||||||
ItemProvider>(
|
ItemProvider>(
|
||||||
context,
|
context,
|
||||||
listen:
|
listen: false)
|
||||||
false)
|
.changeStatus(item!.id,
|
||||||
.changeStatus(
|
"approved")
|
||||||
item!.id,
|
|
||||||
"rejected")
|
|
||||||
.then(
|
.then(
|
||||||
(value) {
|
(value) {
|
||||||
if (value) {
|
if (value) {
|
||||||
print(
|
print('true');
|
||||||
'true');
|
|
||||||
}
|
}
|
||||||
Navigator.of(
|
Navigator.of(context)
|
||||||
context)
|
|
||||||
.pop();
|
.pop();
|
||||||
Navigator.of(
|
Navigator.of(context)
|
||||||
context)
|
.popAndPushNamed(Routes
|
||||||
.popAndPushNamed(
|
|
||||||
Routes
|
|
||||||
.itemResultScreen);
|
.itemResultScreen);
|
||||||
Fluttertoast
|
Fluttertoast.showToast(
|
||||||
.showToast(
|
|
||||||
msg:
|
msg:
|
||||||
"Item is rejected.",
|
"Item is Confirmed.",
|
||||||
toastLength:
|
toastLength: Toast
|
||||||
Toast
|
|
||||||
.LENGTH_SHORT,
|
.LENGTH_SHORT,
|
||||||
gravity:
|
gravity: ToastGravity
|
||||||
ToastGravity
|
|
||||||
.BOTTOM,
|
.BOTTOM,
|
||||||
);
|
);
|
||||||
itemProvider
|
itemProvider
|
||||||
@@ -291,8 +192,7 @@ class ItemItemBox extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
child: Text('Yes'),
|
child: Text('Yes'),
|
||||||
);
|
);
|
||||||
},
|
}),
|
||||||
),
|
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
@@ -309,18 +209,18 @@ class ItemItemBox extends StatelessWidget {
|
|||||||
width: 8 * _deviceBlockSize,
|
width: 8 * _deviceBlockSize,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
shape: BoxShape.circle,
|
shape: BoxShape.circle,
|
||||||
color: kPink),
|
color: kLightBlue,
|
||||||
|
),
|
||||||
child: Icon(
|
child: Icon(
|
||||||
Icons.close,
|
Icons.check,
|
||||||
size: 4 * _deviceBlockSize,
|
size: 4 * _deviceBlockSize,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
)
|
||||||
SizedBox(
|
: userData['roles']?.contains('Supervisor')
|
||||||
width: 5,
|
? item!.packageId != null
|
||||||
),
|
? InkWell(
|
||||||
InkWell(
|
|
||||||
customBorder: CircleBorder(),
|
customBorder: CircleBorder(),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
showDialog(
|
showDialog(
|
||||||
@@ -397,7 +297,7 @@ class ItemItemBox extends StatelessWidget {
|
|||||||
width: 8 * _deviceBlockSize,
|
width: 8 * _deviceBlockSize,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
shape: BoxShape.circle,
|
shape: BoxShape.circle,
|
||||||
color: kBlue,
|
color: kLightBlue,
|
||||||
),
|
),
|
||||||
child: Icon(
|
child: Icon(
|
||||||
Icons.check,
|
Icons.check,
|
||||||
@@ -405,35 +305,321 @@ class ItemItemBox extends StatelessWidget {
|
|||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
],
|
|
||||||
)
|
)
|
||||||
|
: Container()
|
||||||
: Container(),
|
: Container(),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 5.0,
|
width: 5.0,
|
||||||
),
|
),
|
||||||
InkWell(
|
userData['roles']?.contains('Admin') ?? false
|
||||||
customBorder: CircleBorder(),
|
? InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.of(context).pushNamed(
|
showDialog(
|
||||||
Routes.itemDetailScreen,
|
context: context,
|
||||||
arguments: item!.id,
|
builder: (context) {
|
||||||
|
return AlertDialog(
|
||||||
|
title: Text('Delete'),
|
||||||
|
content: Text(
|
||||||
|
'Are you sure you want delete this Item?',
|
||||||
|
),
|
||||||
|
actions: <Widget>[
|
||||||
|
TextButton(
|
||||||
|
child: Text('Yes'),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
Provider.of<ItemProvider>(context,
|
||||||
|
listen: false)
|
||||||
|
.removeItems(item!.id);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
child: Text('No'),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: EdgeInsets.all(7),
|
padding: EdgeInsets.all(7),
|
||||||
width: 9 * _deviceBlockSize,
|
width: 8 * _deviceBlockSize,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
shape: BoxShape.circle,
|
shape: BoxShape.circle,
|
||||||
color: Colors.black,
|
color: kPink,
|
||||||
),
|
),
|
||||||
child: Icon(
|
child: Icon(
|
||||||
FontAwesomeIcons.fileAlt,
|
Icons.delete_outlined,
|
||||||
size: 5 * _deviceBlockSize,
|
size: 4 * _deviceBlockSize,
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
)
|
||||||
|
: userData['roles']?.contains('Supervisor')
|
||||||
|
? item!.packageId != null
|
||||||
|
? InkWell(
|
||||||
|
onTap: () {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return AlertDialog(
|
||||||
|
title: Text('Delete'),
|
||||||
|
content: Text(
|
||||||
|
'Are you sure you want delete this Item?',
|
||||||
),
|
),
|
||||||
|
actions: <Widget>[
|
||||||
|
TextButton(
|
||||||
|
child: Text('Yes'),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
Provider.of<ItemProvider>(
|
||||||
|
context,
|
||||||
|
listen: false)
|
||||||
|
.removeItems(item!.id);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
child: Text('No'),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.all(7),
|
||||||
|
width: 8 * _deviceBlockSize,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
color: kPink,
|
||||||
|
),
|
||||||
|
child: Icon(
|
||||||
|
Icons.delete_outlined,
|
||||||
|
size: 4 * _deviceBlockSize,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: Container()
|
||||||
|
: Container(),
|
||||||
|
|
||||||
|
// (userData['roles']?.contains('User') ?? false)
|
||||||
|
// ? Container()
|
||||||
|
// : item?.status == "suspended"
|
||||||
|
// ? Row(
|
||||||
|
// mainAxisAlignment: MainAxisAlignment.end,
|
||||||
|
// children: <Widget>[
|
||||||
|
// InkWell(
|
||||||
|
// customBorder: CircleBorder(),
|
||||||
|
// onTap: () {
|
||||||
|
// showDialog(
|
||||||
|
// context: context,
|
||||||
|
// builder: (context) {
|
||||||
|
// return AlertDialog(
|
||||||
|
// title: Text(
|
||||||
|
// 'Are you Reject this item?'),
|
||||||
|
// actions: <Widget>[
|
||||||
|
// Consumer<ItemProvider>(
|
||||||
|
// builder: (context,
|
||||||
|
// itemProvider, _) {
|
||||||
|
// return itemProvider
|
||||||
|
// .isloadingButton
|
||||||
|
// ? CircularProgressIndicator(
|
||||||
|
// color: Colors.black,
|
||||||
|
// )
|
||||||
|
// : TextButton(
|
||||||
|
// onPressed:
|
||||||
|
// () async {
|
||||||
|
// itemProvider
|
||||||
|
// .setLoadingButton();
|
||||||
|
// await Provider.of<
|
||||||
|
// ItemProvider>(
|
||||||
|
// context,
|
||||||
|
// listen:
|
||||||
|
// false)
|
||||||
|
// .changeStatus(
|
||||||
|
// item!.id,
|
||||||
|
// "rejected")
|
||||||
|
// .then(
|
||||||
|
// (value) {
|
||||||
|
// if (value) {
|
||||||
|
// print(
|
||||||
|
// 'true');
|
||||||
|
// }
|
||||||
|
// Navigator.of(
|
||||||
|
// context)
|
||||||
|
// .pop();
|
||||||
|
// Navigator.of(
|
||||||
|
// context)
|
||||||
|
// .popAndPushNamed(
|
||||||
|
// Routes
|
||||||
|
// .itemResultScreen);
|
||||||
|
// Fluttertoast
|
||||||
|
// .showToast(
|
||||||
|
// msg:
|
||||||
|
// "Item is rejected.",
|
||||||
|
// toastLength:
|
||||||
|
// Toast
|
||||||
|
// .LENGTH_SHORT,
|
||||||
|
// gravity:
|
||||||
|
// ToastGravity
|
||||||
|
// .BOTTOM,
|
||||||
|
// );
|
||||||
|
// itemProvider
|
||||||
|
// .resetLoadingButton();
|
||||||
|
// },
|
||||||
|
// );
|
||||||
|
// },
|
||||||
|
// child: Text('Yes'),
|
||||||
|
// );
|
||||||
|
// },
|
||||||
|
// ),
|
||||||
|
// TextButton(
|
||||||
|
// onPressed: () {
|
||||||
|
// Navigator.of(context).pop();
|
||||||
|
// },
|
||||||
|
// child: Text('No'),
|
||||||
|
// ),
|
||||||
|
// ],
|
||||||
|
// );
|
||||||
|
// },
|
||||||
|
// );
|
||||||
|
// },
|
||||||
|
// child: Container(
|
||||||
|
// padding: EdgeInsets.all(7),
|
||||||
|
// width: 8 * _deviceBlockSize,
|
||||||
|
// decoration: BoxDecoration(
|
||||||
|
// shape: BoxShape.circle,
|
||||||
|
// color: kPink),
|
||||||
|
// child: Icon(
|
||||||
|
// Icons.close,
|
||||||
|
// size: 4 * _deviceBlockSize,
|
||||||
|
// color: Colors.white,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// SizedBox(
|
||||||
|
// width: 5,
|
||||||
|
// ),
|
||||||
|
// InkWell(
|
||||||
|
// customBorder: CircleBorder(),
|
||||||
|
// onTap: () {
|
||||||
|
// showDialog(
|
||||||
|
// context: context,
|
||||||
|
// builder: (context) {
|
||||||
|
// return AlertDialog(
|
||||||
|
// title: Text(
|
||||||
|
// 'Are you Confirm this item?',
|
||||||
|
// ),
|
||||||
|
// actions: <Widget>[
|
||||||
|
// Consumer<ItemProvider>(builder:
|
||||||
|
// (context, itemProvider, _) {
|
||||||
|
// return itemProvider
|
||||||
|
// .isloadingButton
|
||||||
|
// ? CircularProgressIndicator(
|
||||||
|
// color: Colors.black,
|
||||||
|
// )
|
||||||
|
// : TextButton(
|
||||||
|
// onPressed: () async {
|
||||||
|
// itemProvider
|
||||||
|
// .setLoadingButton();
|
||||||
|
// await Provider.of<
|
||||||
|
// ItemProvider>(
|
||||||
|
// context,
|
||||||
|
// listen:
|
||||||
|
// false)
|
||||||
|
// .changeStatus(
|
||||||
|
// item!.id,
|
||||||
|
// "approved")
|
||||||
|
// .then(
|
||||||
|
// (value) {
|
||||||
|
// if (value) {
|
||||||
|
// print('true');
|
||||||
|
// }
|
||||||
|
// Navigator.of(
|
||||||
|
// context)
|
||||||
|
// .pop();
|
||||||
|
// Navigator.of(
|
||||||
|
// context)
|
||||||
|
// .popAndPushNamed(
|
||||||
|
// Routes
|
||||||
|
// .itemResultScreen);
|
||||||
|
// Fluttertoast
|
||||||
|
// .showToast(
|
||||||
|
// msg:
|
||||||
|
// "Item is Confirmed.",
|
||||||
|
// toastLength: Toast
|
||||||
|
// .LENGTH_SHORT,
|
||||||
|
// gravity:
|
||||||
|
// ToastGravity
|
||||||
|
// .BOTTOM,
|
||||||
|
// );
|
||||||
|
// itemProvider
|
||||||
|
// .resetLoadingButton();
|
||||||
|
// },
|
||||||
|
// );
|
||||||
|
// },
|
||||||
|
// child: Text('Yes'),
|
||||||
|
// );
|
||||||
|
// }),
|
||||||
|
// TextButton(
|
||||||
|
// onPressed: () {
|
||||||
|
// Navigator.of(context).pop();
|
||||||
|
// },
|
||||||
|
// child: Text('No'),
|
||||||
|
// ),
|
||||||
|
// ],
|
||||||
|
// );
|
||||||
|
// },
|
||||||
|
// );
|
||||||
|
// },
|
||||||
|
// child: Container(
|
||||||
|
// padding: EdgeInsets.all(7),
|
||||||
|
// width: 8 * _deviceBlockSize,
|
||||||
|
// decoration: BoxDecoration(
|
||||||
|
// shape: BoxShape.circle,
|
||||||
|
// color: kLightBlue,
|
||||||
|
// ),
|
||||||
|
// child: Icon(
|
||||||
|
// Icons.check,
|
||||||
|
// size: 4 * _deviceBlockSize,
|
||||||
|
// color: Colors.white,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ],
|
||||||
|
// )
|
||||||
|
// : Container(),
|
||||||
|
SizedBox(
|
||||||
|
width: 5.0,
|
||||||
|
),
|
||||||
|
// InkWell(
|
||||||
|
// customBorder: CircleBorder(),
|
||||||
|
// onTap: () {
|
||||||
|
// Navigator.of(context).pushNamed(
|
||||||
|
// Routes.itemDetailScreen,
|
||||||
|
// arguments: item!.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,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user