This commit is contained in:
Odein
2023-11-22 14:53:35 +04:30
parent 22d0390e90
commit cd3b1080f5
298 changed files with 800 additions and 413 deletions
+128 -103
View File
@@ -15,6 +15,7 @@ class AddLabelBox extends StatelessWidget {
required this.index,
required this.text,
this.iconColor,
required this.hasRemoveButton,
}) : _deviceBlockSize = deviceBlockSize,
super(key: key);
@@ -25,6 +26,7 @@ class AddLabelBox extends StatelessWidget {
final int index;
final String text;
final Color? iconColor;
final bool hasRemoveButton;
@override
Widget build(BuildContext context) {
@@ -67,119 +69,120 @@ class AddLabelBox extends StatelessWidget {
Expanded(
// width: MediaQuery.of(context).size.width - 70,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
children: <Widget>[
SizedBox(
width: _deviceBlockSize,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
children: <Widget>[
SizedBox(
width: _deviceBlockSize,
),
Text(
text,
style: TextStyle(
fontSize: 3.5 * _deviceBlockSize,
color: Colors.grey,
fontWeight: FontWeight.w100,
),
Text(
text,
style: TextStyle(
fontSize: 3.5 * _deviceBlockSize,
color: Colors.grey,
fontWeight: FontWeight.w100,
),
],
),
Row(
children: <Widget>[
Container(
width: MediaQuery.of(context).size.width -
(40 * _deviceBlockSize),
// height: 30,
child: DropdownButtonFormField(
decoration: InputDecoration(
contentPadding: EdgeInsets.only(
left: _deviceBlockSize,
),
border: InputBorder.none,
),
),
],
),
Row(
children: <Widget>[
Container(
width: MediaQuery.of(context).size.width -
(40 * _deviceBlockSize),
// height: 30,
child: DropdownButtonFormField(
decoration: InputDecoration(
contentPadding: EdgeInsets.only(
left: _deviceBlockSize,
iconSize: 7 * _deviceBlockSize,
icon: Icon(
FontAwesomeIcons.angleDown,
color: Colors.black,
),
isExpanded: true,
hint: Container(
// width: 100,
height: 70,
padding:
const EdgeInsets.symmetric(horizontal: 0),
child: TextFormField(
controller: values,
decoration: InputDecoration(
contentPadding: EdgeInsets.only(
bottom: 12,
),
isDense: true,
),
border: InputBorder.none,
),
iconSize: 7 * _deviceBlockSize,
icon: Icon(
FontAwesomeIcons.angleDown,
color: Colors.black,
),
isExpanded: true,
hint: Container(
// width: 100,
height: 70,
padding: const EdgeInsets.symmetric(
horizontal: 0),
child: TextFormField(
controller: values,
decoration: InputDecoration(
contentPadding: EdgeInsets.only(
bottom: 12,
),
isDense: true,
),
style: TextStyle(
fontWeight: FontWeight.w700,
color: Colors.black,
fontSize: 5 * _deviceBlockSize,
),
style: TextStyle(
fontWeight: FontWeight.w700,
color: Colors.black,
fontSize: 5 * _deviceBlockSize,
),
),
isDense: true,
items: vals.map((val) {
return new DropdownMenuItem<String>(
value: val,
child: Container(
child: Text(
val,
style: TextStyle(
fontSize: 4 * _deviceBlockSize,
),
),
isDense: true,
items: vals.map((val) {
return new DropdownMenuItem<String>(
value: val,
child: Container(
child: Text(
val,
style: TextStyle(
fontSize: 4 * _deviceBlockSize,
),
),
);
}).toList(),
onChanged: (val) {
Provider.of<CyclesProvider>(context,
listen: false)
.changeLabelVal(val!, index);
},
),
),
Spacer(),
InkWell(
onTap: () {
scan().then(
(String result) {
if (result == 'cancel') {
print('cancel');
} else if (result == 'error') {
print('error');
} else if (result == 'access') {
print('access');
} else {
print(result);
Provider.of<CyclesProvider>(context,
listen: false)
.changeLabelVal(result, index);
}
},
),
);
}).toList(),
onChanged: (val) {
Provider.of<CyclesProvider>(context,
listen: false)
.changeLabelVal(val!, index);
},
child: Container(
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black,
),
child: Icon(
Icons.qr_code_scanner,
size: 5 * _deviceBlockSize,
color: Colors.white,
),
),
),
Spacer(),
InkWell(
onTap: () {
scan().then(
(String result) {
if (result == 'cancel') {
print('cancel');
} else if (result == 'error') {
print('error');
} else if (result == 'access') {
print('access');
} else {
print(result);
Provider.of<CyclesProvider>(context,
listen: false)
.changeLabelVal(result, index);
}
},
);
},
child: Container(
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black,
),
)
],
),
]),
child: Icon(
Icons.qr_code_scanner,
size: 5 * _deviceBlockSize,
color: Colors.white,
),
),
)
],
),
],
),
),
],
),
@@ -206,6 +209,28 @@ class AddLabelBox extends StatelessWidget {
),
),
),
if (hasRemoveButton)
Positioned(
bottom: 15,
right: 50,
child: InkWell(
onTap: () {
Provider.of<CyclesProvider>(context, listen: false)
.removeLabelVal();
},
child: Container(
padding: EdgeInsets.all(3),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: iconColor,
),
child: Icon(
Icons.remove,
color: Colors.white,
),
),
),
),
],
),
);
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
+3 -1
View File
@@ -9,6 +9,7 @@ class ResultSearchBox extends StatelessWidget {
required this.text,
required this.onChanged,
this.text2 = 'ID',
this.textInputType = TextInputType.number,
}) : _deviceBlockSize = deviceBlockSize,
super(key: key);
@@ -17,6 +18,7 @@ class ResultSearchBox extends StatelessWidget {
final String text;
final String text2;
final dynamic onChanged;
final TextInputType textInputType;
@override
Widget build(BuildContext context) {
@@ -43,7 +45,7 @@ class ResultSearchBox extends StatelessWidget {
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
keyboardType: TextInputType.number,
keyboardType: textInputType,
);
}
}
Regular → Executable
+56 -65
View File
@@ -24,7 +24,6 @@ class _AppDrawerState extends State<AppDrawer> {
@override
Widget build(BuildContext context) {
final userData = Provider.of<Auth>(context, listen: false).user;
return SafeArea(
child: SizedBox(
width: 250,
@@ -193,39 +192,35 @@ class _AppDrawerState extends State<AppDrawer> {
),
),
),
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: <Widget>[
Icon(
Icons.all_inbox_rounded,
color: Colors.white,
),
SizedBox(
width: 10,
),
Text(
'Packages',
style: TextStyle(
color: Colors.white,
),
)
],
),
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: <Widget>[
Icon(
Icons.all_inbox_rounded,
color: Colors.white,
),
),
SizedBox(
width: 10,
),
Text(
'Packages',
style: TextStyle(
color: Colors.white,
),
)
],
),
),
),
InkWell(
onTap: () {
Navigator.of(context)
@@ -256,39 +251,35 @@ class _AppDrawerState extends State<AppDrawer> {
),
),
),
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: <Widget>[
Icon(
Icons.book,
color: Colors.white,
),
SizedBox(
width: 10,
),
Text(
'Items',
style: TextStyle(
color: Colors.white,
),
)
],
),
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: <Widget>[
Icon(
Icons.book,
color: Colors.white,
),
),
SizedBox(
width: 10,
),
Text(
'Items',
style: TextStyle(
color: Colors.white,
),
)
],
),
),
),
InkWell(
onTap: () {
Navigator.of(context).pushNamed(Routes.myItemsResultScreen);
View File
View File
View File
View File
View File
View File
+38 -11
View File
@@ -1,10 +1,14 @@
import 'package:cssd/config/routes.dart';
// ignore_for_file: invalid_use_of_visible_for_testing_member, deprecated_member_use
import 'dart:io';
import 'package:cssd/providers/items.dart';
import 'package:file_picker/file_picker.dart';
import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';
import 'package:provider/provider.dart';
class UploaderImage extends StatelessWidget {
class UploaderImage extends StatefulWidget {
final double deviceBlockSize;
final ItemProvider providerObject;
const UploaderImage({
@@ -13,6 +17,11 @@ class UploaderImage extends StatelessWidget {
required this.providerObject,
});
@override
State<UploaderImage> createState() => _UploaderImageState();
}
class _UploaderImageState extends State<UploaderImage> {
@override
Widget build(BuildContext context) {
return Container(
@@ -24,18 +33,18 @@ class UploaderImage extends StatelessWidget {
children: <Widget>[
Container(
margin: EdgeInsets.only(top: 20),
height: providerObject.catchImages.length != 0 ? 60 : 0,
height: widget.providerObject.catchImages.length != 0 ? 60 : 0,
child: ImageBox(
deviceBlockSize: deviceBlockSize,
itemProvider: providerObject,
deviceBlockSize: widget.deviceBlockSize,
itemProvider: widget.providerObject,
),
),
SizedBox(
height: providerObject.catchImages.length != 0 ? 10 : 0,
height: widget.providerObject.catchImages.length != 0 ? 10 : 0,
),
InkWell(
onTap: () async {
await loadAssets(context);
await loadAssetsFromFilePicker(context);
},
child: Container(
width: MediaQuery.of(context).size.width - 40,
@@ -57,9 +66,7 @@ class UploaderImage extends StatelessWidget {
),
InkWell(
onTap: () async {
await Navigator.of(context)
.pushNamed(Routes.captureImageScreen);
// await captureImage(context);
await loadAssetsFromCamera(context);
},
child: Container(
width: MediaQuery.of(context).size.width - 40,
@@ -82,7 +89,7 @@ class UploaderImage extends StatelessWidget {
);
}
Future<void> loadAssets(BuildContext context) async {
Future<void> loadAssetsFromFilePicker(BuildContext context) async {
var providerObject = Provider.of<ItemProvider>(context, listen: false);
List<PlatformFile> files = providerObject.catchImages;
try {
@@ -98,6 +105,26 @@ class UploaderImage extends StatelessWidget {
providerObject.setCatchImages(files);
providerObject.setImages();
}
Future<void> loadAssetsFromCamera(BuildContext context) async {
var providerObject = Provider.of<ItemProvider>(context, listen: false);
List<PlatformFile> _catchImages = [];
var image = await ImagePicker.platform.pickImage(
source: ImageSource.camera,
);
if (image != null) {
_catchImages.add(
PlatformFile(
path: image.path,
name: "item_image",
bytes: File(image.path).readAsBytesSync(),
size: File(image.path).lengthSync(),
),
);
providerObject.setCatchImages(_catchImages);
providerObject.setImages();
}
}
}
class ImageBox extends StatelessWidget {
+1 -1
View File
@@ -306,7 +306,7 @@ class ItemDetailsDataBox extends StatelessWidget {
Container(
width: 45 * _deviceBlockSize,
child: Text(
datas.status == 1 ? 'Success' : 'Failure',
datas.status == 1 ? 'Confirmed' : 'Rejected',
style: TextStyle(
fontWeight: FontWeight.w700,
color: datas.status == 1 ? kBlue : kPink,
View File
View File
+4 -1
View File
@@ -125,7 +125,10 @@ class ItemItemBox extends StatelessWidget {
builder: (context) {
return AlertDialog(
title: Text(
'Do you want to change the status of the item?'),
item!.status == 1
? 'Are you Reject this item?'
: 'Are you Confirm this item?',
),
actions: <Widget>[
TextButton(
onPressed: () {
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
+1 -1
View File
@@ -364,7 +364,7 @@ class MyItemsDetailsDataBox extends StatelessWidget {
),
content: SizedBox(
width: _deviceBlockSize,
height: 250,
height: 220,
child: Column(
children: [
Text(
View File
View File
View File
View File
+11 -1
View File
@@ -9,7 +9,7 @@ class ItemHistoryDate extends StatelessWidget {
}) : _deviceBlockSize = deviceBlockSize;
final double _deviceBlockSize;
final MyItemResultObject items;
final ItemHistoryObject items;
@override
Widget build(BuildContext context) {
@@ -22,6 +22,16 @@ class ItemHistoryDate extends StatelessWidget {
color: Colors.grey,
),
),
// Text(
// DateFormat.yMMMd().format(
// DateTime.parse(
// datas.createdAt,
// ),
// ),
// style: TextStyle(
// color: kDarkBlue,
// ),
// ),
SizedBox(
width: 6.0,
),
@@ -0,0 +1,70 @@
import 'package:cssd/models/my_item_model.dart';
import 'package:flutter/material.dart';
class UserItemDataBox extends StatelessWidget {
final ItemHistoryObject? user;
const UserItemDataBox({
Key? key,
required double deviceBlockSize,
this.user,
}) : _deviceBlockSize = deviceBlockSize,
super(key: key);
final double _deviceBlockSize;
@override
Widget build(BuildContext context) {
return Card(
elevation: 1,
child: Container(
padding: EdgeInsets.all(8),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Container(
padding: const EdgeInsets.all(6.0),
child: Text(
user!.userHistoryId.toString(),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
),
),
SizedBox(
width: 3 * _deviceBlockSize,
),
// Spacer(),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
width: 30 * _deviceBlockSize,
child: Text(
user!.userHistoryName,
style: TextStyle(
fontSize: 3 * _deviceBlockSize,
fontWeight: FontWeight.w700,
),
),
),
Container(
width: 30 * _deviceBlockSize,
child: Text(
user!.userHistoryPhon,
style: TextStyle(
fontSize: 3 * _deviceBlockSize,
fontWeight: FontWeight.w700,
color: Colors.grey,
),
),
),
],
),
],
),
),
);
}
}
View File
View File
View File
View File
+3 -3
View File
@@ -9,7 +9,7 @@ class PackageHistoryDate extends StatelessWidget {
}) : _deviceBlockSize = deviceBlockSize;
final double _deviceBlockSize;
final MyPackageResultObject packages;
final PackageHistoryObject packages;
@override
Widget build(BuildContext context) {
@@ -26,7 +26,7 @@ class PackageHistoryDate extends StatelessWidget {
width: 6.0,
),
Text(
packages.fromDate!,
packages.fromDate,
style: TextStyle(
fontSize: 3 * _deviceBlockSize,
fontWeight: FontWeight.w700,
@@ -49,7 +49,7 @@ class PackageHistoryDate extends StatelessWidget {
width: 6.0,
),
Text(
packages.toDate!,
packages.toDate,
style: TextStyle(
fontSize: 3 * _deviceBlockSize,
fontWeight: FontWeight.w700,
@@ -0,0 +1,70 @@
import 'package:cssd/models/my_package_model.dart';
import 'package:flutter/material.dart';
class UserPackageDataBox extends StatelessWidget {
final PackageHistoryObject? user;
const UserPackageDataBox({
Key? key,
required double deviceBlockSize,
this.user,
}) : _deviceBlockSize = deviceBlockSize,
super(key: key);
final double _deviceBlockSize;
@override
Widget build(BuildContext context) {
return Card(
elevation: 1,
child: Container(
padding: EdgeInsets.all(8),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Container(
padding: const EdgeInsets.all(6.0),
child: Text(
user!.userHistoryId.toString(),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
),
),
SizedBox(
width: 3 * _deviceBlockSize,
),
// Spacer(),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
width: 30 * _deviceBlockSize,
child: Text(
user!.userHistoryName,
style: TextStyle(
fontSize: 3 * _deviceBlockSize,
fontWeight: FontWeight.w700,
),
),
),
Container(
width: 30 * _deviceBlockSize,
child: Text(
user!.userHistoryPhon,
style: TextStyle(
fontSize: 3 * _deviceBlockSize,
fontWeight: FontWeight.w700,
color: Colors.grey,
),
),
),
],
),
],
),
),
);
}
}
View File
View File
+35 -1
View File
@@ -1,3 +1,4 @@
import 'package:cssd/models/item_model.dart';
import 'package:cssd/providers/packages.dart';
import 'package:cssd/utils/scan.dart';
import 'package:flutter/material.dart';
@@ -13,20 +14,29 @@ class AddItemBox extends StatelessWidget {
required this.initialItemValue,
required this.index,
required this.text,
// required this.scanUdi,
this.iconColor,
required this.filteredItems,
required this.hasRemoveButton,
}) : _deviceBlockSize = deviceBlockSize,
super(key: key);
final double _deviceBlockSize;
final TextEditingController values;
// final List<Map<String, dynamic>> vals;
final List<String> vals;
final String initialItemValue;
final int index;
final String text;
final Color? iconColor;
final bool hasRemoveButton;
final List<ItemResultObject> filteredItems;
// final String scanUdi;
@override
Widget build(BuildContext context) {
bool isEnabled = true;
return Container(
height: 150,
child: Stack(
@@ -125,6 +135,7 @@ class AddItemBox extends StatelessWidget {
isDense: true,
items: vals.map((val) {
return new DropdownMenuItem<String>(
enabled: isEnabled,
value: val,
child: Container(
child: Text(
@@ -158,7 +169,8 @@ class AddItemBox extends StatelessWidget {
print(result);
Provider.of<PackageProvider>(context,
listen: false)
.changeItemVal(result, index);
.changeItemValByScan(result, index);
isEnabled = false;
}
},
);
@@ -206,6 +218,28 @@ class AddItemBox extends StatelessWidget {
),
),
),
if (hasRemoveButton)
Positioned(
bottom: 15,
right: 50,
child: InkWell(
onTap: () {
Provider.of<PackageProvider>(context, listen: false)
.removeItemVal();
},
child: Container(
padding: EdgeInsets.all(3),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: iconColor,
),
child: Icon(
Icons.remove,
color: Colors.white,
),
),
),
),
],
),
);
View File
View File
+13 -18
View File
@@ -1,5 +1,6 @@
import 'package:cssd/config/colors.dart';
import 'package:cssd/models/package_model.dart';
import 'package:cssd/widgets/MyItemsScreens/Detail/transfer_destroy_button.dart';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:url_launcher/url_launcher.dart';
@@ -9,11 +10,13 @@ class PackageDetailsDataBox extends StatelessWidget {
Key? key,
required this.datas,
required double deviceBlockSize,
required this.goToAddLabelPage,
}) : _deviceBlockSize = deviceBlockSize,
super(key: key);
final PackageDetailObject datas;
final double _deviceBlockSize;
final VoidCallback goToAddLabelPage;
@override
Widget build(BuildContext context) {
@@ -255,24 +258,16 @@ class PackageDetailsDataBox extends StatelessWidget {
SizedBox(
height: 50,
),
// TransferDestroyButton(
// deviceBlockSize: _deviceBlockSize,
// firstColor: kPurple,
// secondColor: kPurpleSub,
// onTap: () {
// Navigator.pushNamed(
// context,
// Routes.labelAddScreen,
// arguments: {
// 'id': datas.id,
// },
// );
// },
// text: 'Make a Label For Package',
// ),
// SizedBox(
// height: 5.0,
// ),
TransferDestroyButton(
deviceBlockSize: _deviceBlockSize,
firstColor: kPurple,
secondColor: kPurpleSub,
onTap: goToAddLabelPage,
text: 'Make a Label For Package',
),
SizedBox(
height: 5.0,
),
],
),
),
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File