From 22d0390e904f44b6ed7880d3b948beec8d98234e Mon Sep 17 00:00:00 2001 From: HooDie Date: Sun, 12 Nov 2023 17:41:02 +0330 Subject: [PATCH] 2.1.1 --- .../my_packages_transfer_screen.dart | 2 +- lib/pages/home_screen.dart | 79 ++++++------ lib/providers/labels.dart | 10 +- lib/widgets/Global/drawer.dart | 121 ++++++++++-------- lib/widgets/LabelScreens/Add/save_button.dart | 2 +- .../Detail/my_items_detail_box_widget.dart | 2 +- 6 files changed, 116 insertions(+), 100 deletions(-) diff --git a/lib/pages/MyPackagesPages/my_packages_transfer_screen.dart b/lib/pages/MyPackagesPages/my_packages_transfer_screen.dart index 553629e..de8af4e 100644 --- a/lib/pages/MyPackagesPages/my_packages_transfer_screen.dart +++ b/lib/pages/MyPackagesPages/my_packages_transfer_screen.dart @@ -185,7 +185,7 @@ class _PackageTransferScreenState extends State { ), content: SizedBox( width: _deviceBlockSize, - height: 280, + height: 300, child: Column( children: [ Text( diff --git a/lib/pages/home_screen.dart b/lib/pages/home_screen.dart index d538108..66574fd 100644 --- a/lib/pages/home_screen.dart +++ b/lib/pages/home_screen.dart @@ -159,6 +159,9 @@ class HomePage extends StatelessWidget { ), ), ), + Divider( + height: 2, + ), SelectionItem( firstLine: 'CYCLES', secondLine: 'List, Details & Add a one', @@ -180,24 +183,26 @@ class HomePage extends StatelessWidget { Divider( height: 2, ), - SelectionItem( - firstLine: 'PACKAGES', - secondLine: 'List, Details & Add a one', - firstLineColor: kPurple, - secondLineColor: kPurpleSub, - onTap: () => Navigator.push( - context, - MaterialPageRoute( - builder: (context) { - return Consumer( - builder: (ctx, auth, _) { - return PackageResultScreen(); - }, - ); - }, - ), - ), - ), + userData['roles']?.contains('User') ?? false + ? Container() + : SelectionItem( + firstLine: 'PACKAGES', + secondLine: 'List, Details & Add a one', + firstLineColor: kPurple, + secondLineColor: kPurpleSub, + onTap: () => Navigator.push( + context, + MaterialPageRoute( + builder: (context) { + return Consumer( + builder: (ctx, auth, _) { + return PackageResultScreen(); + }, + ); + }, + ), + ), + ), SelectionItem( firstLine: 'MY PACKAGES', secondLine: 'The Package that i possess', @@ -219,24 +224,26 @@ class HomePage extends StatelessWidget { Divider( height: 2, ), - SelectionItem( - firstLine: 'ITEMS', - secondLine: 'List, Details & Add a one', - firstLineColor: kBlue, - secondLineColor: kBlueSub, - onTap: () => Navigator.push( - context, - MaterialPageRoute( - builder: (context) { - return Consumer( - builder: (ctx, auth, _) { - return ItemResultScreen(); - }, - ); - }, - ), - ), - ), + userData['roles']?.contains('User') ?? false + ? Container() + : SelectionItem( + firstLine: 'ITEMS', + secondLine: 'List, Details & Add a one', + firstLineColor: kBlue, + secondLineColor: kBlueSub, + onTap: () => Navigator.push( + context, + MaterialPageRoute( + builder: (context) { + return Consumer( + builder: (ctx, auth, _) { + return ItemResultScreen(); + }, + ); + }, + ), + ), + ), SelectionItem( firstLine: 'MY ITEMS', secondLine: 'The Items that i possess', diff --git a/lib/providers/labels.dart b/lib/providers/labels.dart index dea719d..bdbe1d1 100644 --- a/lib/providers/labels.dart +++ b/lib/providers/labels.dart @@ -101,10 +101,10 @@ class LabelsProvider extends ChangeNotifier { Future createLabelResult(lotNumber, cycleNumber, sterileDate, packages, expireDate, sterilizerId) async { - List> pkgs = []; - for (var package in packages) { - pkgs.add({'name': '', 'id': package}); - } + // List> pkgs = []; + // for (var package in packages) { + // pkgs.add({'name': '', 'id': package}); + // } var response = await http.post(Uri.parse(Url.createLabelResult), body: json.encode( { @@ -113,7 +113,7 @@ class LabelsProvider extends ChangeNotifier { 'sterilizer_id': sterilizerId, 'cycle_number': cycleNumber, 'lot_number': lotNumber, - 'package_id': pkgs, + 'package_id': packages, }, ), headers: { diff --git a/lib/widgets/Global/drawer.dart b/lib/widgets/Global/drawer.dart index 0fedd62..be83272 100644 --- a/lib/widgets/Global/drawer.dart +++ b/lib/widgets/Global/drawer.dart @@ -24,6 +24,7 @@ class _AppDrawerState extends State { @override Widget build(BuildContext context) { + final userData = Provider.of(context, listen: false).user; return SafeArea( child: SizedBox( width: 250, @@ -192,35 +193,39 @@ class _AppDrawerState extends State { ), ), ), - InkWell( - onTap: () { - Navigator.of(context).pushNamed(Routes.packageResultScreen); - }, - child: Container( - padding: EdgeInsets.symmetric(vertical: 5, horizontal: 15), - margin: EdgeInsets.only(top: 10), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(5), - ), - child: Row( - children: [ - Icon( - Icons.all_inbox_rounded, - color: Colors.white, - ), - SizedBox( - width: 10, - ), - Text( - 'Packages', - style: TextStyle( - color: Colors.white, + userData['roles']?.contains('User') ?? false + ? Container() + : InkWell( + onTap: () { + Navigator.of(context) + .pushNamed(Routes.packageResultScreen); + }, + child: Container( + padding: + EdgeInsets.symmetric(vertical: 5, horizontal: 15), + margin: EdgeInsets.only(top: 10), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5), ), - ) - ], - ), - ), - ), + child: Row( + children: [ + Icon( + Icons.all_inbox_rounded, + color: Colors.white, + ), + SizedBox( + width: 10, + ), + Text( + 'Packages', + style: TextStyle( + color: Colors.white, + ), + ) + ], + ), + ), + ), InkWell( onTap: () { Navigator.of(context) @@ -251,35 +256,39 @@ class _AppDrawerState extends State { ), ), ), - InkWell( - onTap: () { - Navigator.of(context).pushNamed(Routes.itemResultScreen); - }, - child: Container( - padding: EdgeInsets.symmetric(vertical: 5, horizontal: 15), - margin: EdgeInsets.only(top: 10), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(5), - ), - child: Row( - children: [ - Icon( - Icons.book, - color: Colors.white, - ), - SizedBox( - width: 10, - ), - Text( - 'Items', - style: TextStyle( - color: Colors.white, + userData['roles']?.contains('User') ?? false + ? Container() + : InkWell( + onTap: () { + Navigator.of(context) + .pushNamed(Routes.itemResultScreen); + }, + child: Container( + padding: + EdgeInsets.symmetric(vertical: 5, horizontal: 15), + margin: EdgeInsets.only(top: 10), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5), ), - ) - ], - ), - ), - ), + child: Row( + children: [ + Icon( + Icons.book, + color: Colors.white, + ), + SizedBox( + width: 10, + ), + Text( + 'Items', + style: TextStyle( + color: Colors.white, + ), + ) + ], + ), + ), + ), InkWell( onTap: () { Navigator.of(context).pushNamed(Routes.myItemsResultScreen); diff --git a/lib/widgets/LabelScreens/Add/save_button.dart b/lib/widgets/LabelScreens/Add/save_button.dart index 16e4e67..4623dbc 100644 --- a/lib/widgets/LabelScreens/Add/save_button.dart +++ b/lib/widgets/LabelScreens/Add/save_button.dart @@ -46,7 +46,7 @@ class LabelAddSaveButton extends StatelessWidget { sDateCTRL.text, // sDateValue, // {'id': packageValue[0], 'name': packageValue[1]}, - packages, + packages[0], eDateCTRL.text, // eDateValue, striizerIdCTRL.text, diff --git a/lib/widgets/MyItemsScreens/Detail/my_items_detail_box_widget.dart b/lib/widgets/MyItemsScreens/Detail/my_items_detail_box_widget.dart index 1d7a45f..8209ad8 100644 --- a/lib/widgets/MyItemsScreens/Detail/my_items_detail_box_widget.dart +++ b/lib/widgets/MyItemsScreens/Detail/my_items_detail_box_widget.dart @@ -364,7 +364,7 @@ class MyItemsDetailsDataBox extends StatelessWidget { ), content: SizedBox( width: _deviceBlockSize, - height: 220, + height: 250, child: Column( children: [ Text(