mirror of
https://git.meshkee.com/applications/cssd.git
synced 2026-10-12 16:48:55 +03:30
3.2.2
This commit is contained in:
@@ -1,8 +1,13 @@
|
||||
import 'package:cssd/config/colors.dart';
|
||||
import 'package:cssd/config/routes.dart';
|
||||
import 'package:cssd/models/package_model.dart';
|
||||
import 'package:cssd/providers/auth.dart';
|
||||
import 'package:cssd/providers/packages.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:intl/intl.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class MyPackageDetailsDataBox extends StatelessWidget {
|
||||
@@ -20,7 +25,7 @@ class MyPackageDetailsDataBox extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// final userData = Provider.of<Auth>(context, listen: false).user;
|
||||
final userData = Provider.of<Auth>(context, listen: false).user;
|
||||
return Padding(
|
||||
padding: EdgeInsets.all(20),
|
||||
child: ListView(
|
||||
@@ -129,6 +134,64 @@ class MyPackageDetailsDataBox extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
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,
|
||||
),
|
||||
// Divider(),
|
||||
// SizedBox(
|
||||
// height: 5,
|
||||
@@ -271,83 +334,83 @@ class MyPackageDetailsDataBox extends StatelessWidget {
|
||||
push();
|
||||
},
|
||||
),
|
||||
// SizedBox(
|
||||
// height: 10.0,
|
||||
// ),
|
||||
// userData['roles']?.contains('User') ?? false
|
||||
// ? Container()
|
||||
// : 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 Package?',
|
||||
// style: TextStyle(
|
||||
// fontSize: 4 * _deviceBlockSize,
|
||||
// ),
|
||||
// ),
|
||||
// content: SizedBox(
|
||||
// width: _deviceBlockSize,
|
||||
// height: 220,
|
||||
// child: Column(
|
||||
// children: [
|
||||
// Text(
|
||||
// 'By approving, your package will be removed and it can not be used any more.',
|
||||
// style: TextStyle(
|
||||
// fontSize: 3 * _deviceBlockSize,
|
||||
// ),
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 10.0,
|
||||
// ),
|
||||
// PackageCard(_deviceBlockSize),
|
||||
// SizedBox(
|
||||
// height: 20.0,
|
||||
// ),
|
||||
// TransferDestroyButton(
|
||||
// deviceBlockSize: _deviceBlockSize,
|
||||
// firstColor: kPink,
|
||||
// secondColor: kPinkSub,
|
||||
// onTap: () {
|
||||
// Provider.of<PackageProvider>(context,
|
||||
// listen: false)
|
||||
// .removePackages(datas.id)
|
||||
// .then(
|
||||
// (value) {
|
||||
// Navigator.of(context).pop();
|
||||
// Navigator.pushReplacementNamed(
|
||||
// context,
|
||||
// Routes.myPackagesResultScreen,
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
// },
|
||||
// text: 'Destroy',
|
||||
// ),
|
||||
// SizedBox(
|
||||
// height: 5.0,
|
||||
// ),
|
||||
// CancelTransferButton(
|
||||
// deviceBlockSize: _deviceBlockSize,
|
||||
// color: kDarkPurple,
|
||||
// onTap: () {
|
||||
// Navigator.pop(context);
|
||||
// },
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
// },
|
||||
// ),
|
||||
SizedBox(
|
||||
height: 10.0,
|
||||
),
|
||||
userData['roles']?.contains('User') ?? false
|
||||
? Container()
|
||||
: TransferDestroyButton(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
firstColor: kPink,
|
||||
secondColor: kPinkSub,
|
||||
text: 'Back Items to Item List',
|
||||
onTap: () {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
title: Text(
|
||||
'Are you sure to destroy this Package?',
|
||||
style: TextStyle(
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
content: SizedBox(
|
||||
width: _deviceBlockSize,
|
||||
height: 220,
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
'By approving, your package will be removed and it can not be used any more.',
|
||||
style: TextStyle(
|
||||
fontSize: 3 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10.0,
|
||||
),
|
||||
PackageCard(_deviceBlockSize),
|
||||
SizedBox(
|
||||
height: 20.0,
|
||||
),
|
||||
TransferDestroyButton(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
firstColor: kPink,
|
||||
secondColor: kPinkSub,
|
||||
onTap: () {
|
||||
Provider.of<PackageProvider>(context,
|
||||
listen: false)
|
||||
.removePackages(datas.id)
|
||||
.then(
|
||||
(value) {
|
||||
Navigator.of(context).pop();
|
||||
Navigator.pushReplacementNamed(
|
||||
context,
|
||||
Routes.myPackagesResultScreen,
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
text: 'Destroy',
|
||||
),
|
||||
SizedBox(
|
||||
height: 5.0,
|
||||
),
|
||||
CancelTransferButton(
|
||||
deviceBlockSize: _deviceBlockSize,
|
||||
color: kDarkPurple,
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import 'package:cssd/providers/auth.dart';
|
||||
import 'package:cssd/providers/my_packages.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
@@ -26,7 +25,6 @@ class MyPackageFilterChip extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final userData = Provider.of<Auth>(context, listen: false).user;
|
||||
return Row(
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
@@ -53,19 +51,11 @@ class MyPackageFilterChip extends StatelessWidget {
|
||||
// _udi,
|
||||
);
|
||||
packageProvider.setLoading();
|
||||
if (userData['roles']?.contains('User')) {
|
||||
packageProvider.getMyPackages().then(
|
||||
packageProvider.getMyPackages().then(
|
||||
(_) {
|
||||
packageProvider.resetLoading();
|
||||
},
|
||||
);
|
||||
} else {
|
||||
packageProvider.getHospitalPackages().then(
|
||||
(_) {
|
||||
packageProvider.resetLoading();
|
||||
},
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user