This commit is contained in:
unknown
2023-12-07 13:45:51 +03:30
parent a7f57688a7
commit 6464557956
67 changed files with 456 additions and 275 deletions
+4
View File
@@ -187,4 +187,8 @@ class Url {
static String getUsers(String id) {
return '$baseUrl/Users?medical_center_id=$id';
}
static String showItemImage(String file) {
return 'https://www.cssd-doc.com/$file';
}
}
+3
View File
@@ -49,6 +49,7 @@ class ItemDetailObject extends Equatable {
final String createdAt;
final String udi;
final int status;
final List<String>? filePath;
ItemDetailObject({
required this.id,
@@ -61,6 +62,7 @@ class ItemDetailObject extends Equatable {
required this.createdAt,
required this.udi,
required this.status,
this.filePath,
});
@override
@@ -76,6 +78,7 @@ class ItemDetailObject extends Equatable {
createdAt,
udi,
status,
filePath!,
];
}
+2 -1
View File
@@ -89,11 +89,12 @@ class _CycleAddScreenState extends State<CycleAddScreen> {
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text('Cycles'),
title: Text('Cycles', style: TextStyle(color: Colors.white,),),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context)
@@ -54,11 +54,12 @@ class _CycleDetailScreenState extends State<CycleDetailScreen> {
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text('Cycles'),
title: Text('Cycles', style: TextStyle(color: Colors.white,),),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
@@ -104,11 +104,12 @@ class _CycleFilterScreenState extends State<CycleFilterScreen> {
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text('Cycles'),
title: Text('Cycles', style: TextStyle(color: Colors.white,),),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context)
@@ -77,11 +77,12 @@ class _CycleResultScreenState extends State<CycleResultScreen> {
),
appBar: AppBar(
titleSpacing: -10,
title: Text('Home'),
title: Text('Home', style: TextStyle(color: Colors.white,),),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
+2 -1
View File
@@ -35,11 +35,12 @@ class _CycleScanScreenState extends State<CycleScanScreen> {
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text('Cycles'),
title: Text('Cycles', style: TextStyle(color: Colors.white,),),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
@@ -93,10 +93,11 @@ class _CycleUpdateScreenState extends State<CycleUpdateScreen> {
appBar: AppBar(
titleSpacing: -10,
backgroundColor: Colors.black,
title: Text('Cycles'),
title: Text('Cycles', style: TextStyle(color: Colors.white,),),
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context)
+60 -15
View File
@@ -4,7 +4,6 @@ import 'package:cssd/widgets/ItemScreens/Add/item_save_button.dart';
import 'package:cssd/widgets/ItemScreens/Add/upload_image.dart';
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:intl/intl.dart';
import 'package:provider/provider.dart';
import 'package:random_string/random_string.dart';
@@ -27,9 +26,9 @@ class _ItemAddScreenState extends State<ItemAddScreen> {
TextEditingController nameCTRL = new TextEditingController();
TextEditingController specificCTRL = new TextEditingController();
TextEditingController sizeCTRL = new TextEditingController();
TextEditingController dateCTRL = new TextEditingController();
final _form = GlobalKey<FormState>();
bool isInit = true;
bool isLoading = false;
ItemFilterObject? filters;
final batchId = randomString(10);
@@ -41,25 +40,70 @@ class _ItemAddScreenState extends State<ItemAddScreen> {
nameCTRL.text = '';
sizeCTRL.text = '';
specificCTRL.text = '';
dateCTRL.text = DateFormat('y-M-d').format(DateTime.now());
super.initState();
}
void _saveForm(String name, String size, String specific, String udi,String description) {
setState(() {
isLoading = true;
});
if (!_form.currentState!.validate()) {
return;
}
Provider.of<ItemProvider>(context, listen: false)
.createItemResult(
name,
size,
specific,
udi,
description,
batchId,
)
.then(
(result) {
setState(() {
isLoading = false;
});
if (result == 'done') {
showDialog(
context: context,
builder: (ctx) => AlertDialog(
content: Text('Item added.'),
actions: <Widget>[
TextButton(
onPressed: () {
Navigator.of(ctx).pop();
},
child: Text('Ok'),
)
],
),
).then((value) => Navigator.of(context)
.popAndPushNamed(Routes.itemResultScreen));
}
},
);
}
@override
void didChangeDependencies() async {
if (isInit) {
setState(() {
isLoading = true;
});
var itemProviderObject = Provider.of<ItemProvider>(context);
itemProviderObject.catchImages.clear();
itemProviderObject.getItemResults().then(
(result) {
setState(
() {
isInit = false;
isLoading = false;
},
);
},
);
}
isInit = false;
super.didChangeDependencies();
}
@@ -85,11 +129,12 @@ class _ItemAddScreenState extends State<ItemAddScreen> {
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text('Items'),
title: Text('Items', style: TextStyle(color: Colors.white,),),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context)
@@ -99,7 +144,7 @@ class _ItemAddScreenState extends State<ItemAddScreen> {
body: Consumer<ConnectivityProvider>(
builder: (ct, connection, _) {
return connection.conStatus != 'offline'
? isInit
? isLoading
? Center(
child: CircularProgressIndicator(
color: Colors.black,
@@ -315,16 +360,16 @@ class _ItemAddScreenState extends State<ItemAddScreen> {
height: 70,
),
ItemAddSaveButton(
form: _form,
nameCTRL: nameCTRL,
udiCTRL: udiCTRL,
descriptionCTRL: descriptionCTRL,
sizeCTRL: sizeCTRL,
specificCTRL: specificCTRL,
batchId: batchId,
dateValue: dateCTRL.text,
onTap: (){
_saveForm(
nameCTRL.text,
sizeCTRL.text,
specificCTRL.text,
udiCTRL.text,
descriptionCTRL.text,
);
},
deviceBlockSize: _deviceBlockSize,
isLoading: isInit,
),
SizedBox(
height: 100,
+2 -1
View File
@@ -54,11 +54,12 @@ class _ItemDetailScreenState extends State<ItemDetailScreen> {
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text('Items'),
title: Text('Items', style: TextStyle(color: Colors.white,),),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
+2 -1
View File
@@ -99,11 +99,12 @@ class _ItemFilterScreenState extends State<ItemFilterScreen> {
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text('Items'),
title: Text('Items', style: TextStyle(color: Colors.white,),),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context)
+4 -1
View File
@@ -74,11 +74,12 @@ class _ItemResultScreenState extends State<ItemResultScreen> {
),
appBar: AppBar(
titleSpacing: -10,
title: Text('Home'),
title: Text('Home', style: TextStyle(color: Colors.white,),),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
@@ -191,6 +192,8 @@ class _ItemResultScreenState extends State<ItemResultScreen> {
searchCTRL: searchCTRL,
text: 'item',
deviceBlockSize: _deviceBlockSize,
textInputType: TextInputType.visiblePassword,
text2: "Udi",
onChanged: (value) {
Provider.of<ItemProvider>(context, listen: false)
.search(value);
+2 -1
View File
@@ -33,11 +33,12 @@ class _ItemScanScreenState extends State<ItemScanScreen> {
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text('Items'),
title: Text('Items', style: TextStyle(color: Colors.white,),),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
+2 -1
View File
@@ -84,10 +84,11 @@ class _ItemUpdateScreenState extends State<ItemUpdateScreen> {
appBar: AppBar(
titleSpacing: -10,
backgroundColor: Colors.black,
title: Text('Items'),
title: Text('Items', style: TextStyle(color: Colors.white,),),
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context)
+2 -1
View File
@@ -88,11 +88,12 @@ class _LabelAddScreenState extends State<LabelAddScreen> {
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text('Labels'),
title: Text('Labels', style: TextStyle(color: Colors.white,),),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context)
@@ -54,11 +54,12 @@ class _LabelDetailScreenState extends State<LabelDetailScreen> {
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text('Labels'),
title: Text('Labels', style: TextStyle(color: Colors.white,),),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
@@ -95,11 +95,12 @@ class _LabelFilterScreenState extends State<LabelFilterScreen> {
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text('Labels'),
title: Text('Labels', style: TextStyle(color: Colors.white,),),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context)
@@ -72,11 +72,12 @@ class _LabelResultScreenState extends State<LabelResultScreen> {
),
appBar: AppBar(
titleSpacing: -10,
title: Text('Home'),
title: Text('Home', style: TextStyle(color: Colors.white,),),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
+2 -1
View File
@@ -36,11 +36,12 @@ class _LabelScanScreenState extends State<LabelScanScreen> {
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text('Labels'),
title: Text('Labels', style: TextStyle(color: Colors.white,),),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
@@ -107,10 +107,11 @@ class _LabelUpdateScreenState extends State<LabelUpdateScreen> {
appBar: AppBar(
titleSpacing: -10,
backgroundColor: Colors.black,
title: Text('Labels'),
title: Text('Labels', style: TextStyle(color: Colors.white,),),
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context)
@@ -94,7 +94,7 @@ class _ForgetPassScreenState extends State<ForgetPassScreen> {
child: Scaffold(
appBar: AppBar(
centerTitle: true,
title: Text('CSSD'),
title: Text('CSSD', style: TextStyle(color: Colors.white,),),
backgroundColor: Colors.black,
),
body: Selector<ConnectivityProvider, String>(
@@ -106,7 +106,7 @@ class _LoginScreenState extends State<LoginScreen> {
child: Scaffold(
appBar: AppBar(
centerTitle: true,
title: Text('CSSD'),
title: Text('CSSD', style: TextStyle(color: Colors.white,),),
backgroundColor: Colors.black,
),
body: Selector<ConnectivityProvider, String>(
@@ -83,7 +83,7 @@ class _RePassScreenState extends State<RePassScreen> {
child: Scaffold(
appBar: AppBar(
centerTitle: true,
title: Text('CSSD'),
title: Text('CSSD', style: TextStyle(color: Colors.white,),),
backgroundColor: Colors.black,
),
body: Selector<ConnectivityProvider, String>(
+2 -1
View File
@@ -88,10 +88,11 @@ class _RegisterState extends State<Register> {
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text('Login'),
title: Text('Login', style: TextStyle(color: Colors.white,),),
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
@@ -90,7 +90,7 @@ class _VerifyPassScreenState extends State<VerifyPassScreen> {
child: Scaffold(
appBar: AppBar(
centerTitle: true,
title: Text('CSSD'),
title: Text('CSSD', style: TextStyle(color: Colors.white,),),
backgroundColor: Colors.black,
),
body: Selector<ConnectivityProvider, String>(
@@ -173,6 +173,8 @@ class _MyItemsMineScreenState extends State<MyItemsMineScreen> {
ResultSearchBox(
searchCTRL: searchCTRL,
text: 'item',
text2: "Udi",
textInputType: TextInputType.visiblePassword,
deviceBlockSize: _deviceBlockSize,
onChanged: (value) {
if (userData['roles']?.contains('User')) {
@@ -42,11 +42,12 @@ class _MyItemsResultScreenState extends State<MyItemsResultScreen>
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text('Home'),
title: Text('Home', style: TextStyle(color: Colors.white,),),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
@@ -54,6 +55,7 @@ class _MyItemsResultScreenState extends State<MyItemsResultScreen>
bottom: TabBar(
controller: _tabController,
indicatorColor: kBlue,
labelColor: Colors.white,
tabs: [
Tab(
text: 'Mine',
@@ -55,11 +55,12 @@ class _MyItemsDetailScreenState extends State<MyItemsDetailScreen> {
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text('My Items'),
title: Text('My Items', style: TextStyle(color: Colors.white,),),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
@@ -68,11 +68,12 @@ class _MyItemsFilterScreenState extends State<MyItemsFilterScreen> {
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text('My Items'),
title: Text('My Items', style: TextStyle(color: Colors.white,),),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context)
@@ -74,11 +74,12 @@ class _MyItemsHistoryScreenState extends State<MyItemsHistoryScreen> {
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text('My Items'),
title: Text('My Items', style: TextStyle(color: Colors.white,),),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
@@ -33,11 +33,12 @@ class _MyItemsScanScreenState extends State<MyItemsScanScreen> {
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text('My Items'),
title: Text('My Items', style: TextStyle(color: Colors.white,),),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
@@ -85,11 +85,12 @@ class _ItemsTransferScreenState extends State<ItemsTransferScreen> {
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text('Item Details'),
title: Text('Item Details', style: TextStyle(color: Colors.white,),),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
@@ -122,7 +123,7 @@ class _ItemsTransferScreenState extends State<ItemsTransferScreen> {
text: 'user',
text2: 'name or ID',
deviceBlockSize: _deviceBlockSize,
textInputType: TextInputType.name,
textInputType: TextInputType.visiblePassword,
onChanged: (value) {
Provider.of<UsersProvider>(context, listen: false)
.searchUsers(value);
@@ -42,11 +42,12 @@ class _MyPackagesResultScreenState extends State<MyPackagesResultScreen>
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text('Home'),
title: Text('Home', style: TextStyle(color: Colors.white,),),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
@@ -54,6 +55,7 @@ class _MyPackagesResultScreenState extends State<MyPackagesResultScreen>
bottom: TabBar(
controller: _tabController,
indicatorColor: kPurple,
labelColor: Colors.white,
tabs: [
Tab(
text: 'Mine',
@@ -55,11 +55,12 @@ class _MyPackagesDetailScreenState extends State<MyPackagesDetailScreen> {
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text('My Packages'),
title: Text('My Packages', style: TextStyle(color: Colors.white,),),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
@@ -65,11 +65,12 @@ class _MyPackageFilterScreenState extends State<MyPackageFilterScreen> {
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text('My Packages'),
title: Text('My Packages', style: TextStyle(color: Colors.white,),),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context)
@@ -74,11 +74,12 @@ class _MyPackagesHistoryScreenState extends State<MyPackagesHistoryScreen> {
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text('My Packages'),
title: Text('My Packages', style: TextStyle(color: Colors.white,),),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
@@ -33,11 +33,12 @@ class _MyPackagesScanScreenState extends State<MyPackagesScanScreen> {
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text('My Packages'),
title: Text('My Packages', style: TextStyle(color: Colors.white,),),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
@@ -81,11 +81,12 @@ class _PackageTransferScreenState extends State<PackageTransferScreen> {
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text('Package Details'),
title: Text('Package Details', style: TextStyle(color: Colors.white,),),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
@@ -118,7 +119,7 @@ class _PackageTransferScreenState extends State<PackageTransferScreen> {
text: 'user',
text2: 'name or ID',
deviceBlockSize: _deviceBlockSize,
textInputType: TextInputType.name,
textInputType: TextInputType.visiblePassword,
onChanged: (value) {
Provider.of<UsersProvider>(context, listen: false)
.searchUsers(value);
+2 -18
View File
@@ -48,23 +48,6 @@ class _PackageAddScreenState extends State<PackageAddScreen> {
(result) {
setState(
() {
// itemVals = [
// {'id': '', 'name-udi': ''}
// ];
// for (var item in result) {
// itemVals.add(item);
// packageProviderObject.itemVals = itemVals;
// }
// initialItemValue.text = itemVals[1]['name-udi'];
// packageProviderObject.initialItemValue = initialItemValue.text;
// itemVals.forEach(
// (item) {
// if (item['id'] == '') {
// selectedItemsCTRL.text = item['name']!;
// }
// },
// );
isInit = false;
},
);
@@ -95,11 +78,12 @@ class _PackageAddScreenState extends State<PackageAddScreen> {
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text('Packages'),
title: Text('Packages', style: TextStyle(color: Colors.white,),),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context)
@@ -49,11 +49,12 @@ class _PackageDetailScreenState extends State<PackageDetailScreen> {
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text('Packages'),
title: Text('Packages', style: TextStyle(color: Colors.white,),),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
@@ -92,11 +92,12 @@ class _PackageFilterScreenState extends State<PackageFilterScreen> {
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text('Packages'),
title: Text('Packages', style: TextStyle(color: Colors.white,),),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context)
@@ -74,11 +74,12 @@ class _PackageResultScreenState extends State<PackageResultScreen> {
),
appBar: AppBar(
titleSpacing: -10,
title: Text('Home'),
title: Text('Home', style: TextStyle(color: Colors.white,),),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
@@ -33,11 +33,12 @@ class _PackageScanScreenState extends State<PackageScanScreen> {
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text('Packages'),
title: Text('Packages', style: TextStyle(color: Colors.white,),),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
@@ -81,10 +81,11 @@ class _PackageUpdateScreenState extends State<PackageUpdateScreen> {
appBar: AppBar(
titleSpacing: -10,
backgroundColor: Colors.black,
title: Text('Packages'),
title: Text('Packages', style: TextStyle(color: Colors.white,),),
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context)
+2 -1
View File
@@ -60,11 +60,12 @@ class _TestResultAddScreenState extends State<TestResultAddScreen> {
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text('Test Results'),
title: Text('Test Results', style: TextStyle(color: Colors.white,),),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
// padding: EdgeInsets.all(0),
+2 -1
View File
@@ -46,11 +46,12 @@ class _TestDetailsScreenState extends State<TestDetailsScreen> {
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text('Test Results'),
title: Text('Test Results', style: TextStyle(color: Colors.white,),),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
+2 -2
View File
@@ -1,5 +1,4 @@
import 'package:barcode_scan2/barcode_scan2.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
@@ -139,11 +138,12 @@ class _TestFilterScreenState extends State<TestFilterScreen> {
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text('Test Results'),
title: Text('Test Results', style: TextStyle(color: Colors.white,),),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context).popAndPushNamed(
+5 -2
View File
@@ -74,8 +74,10 @@ class _FormPageState extends State<FormPage> {
setState(() {
_isLoading = true;
});
var providerObject = Provider.of<TestResultsProvider>(context);
String testTypeName = Provider.of<TestResultsProvider>(context).testType;
String testCode = Provider.of<TestResultsProvider>(context).testCode;
providerObject.catchImages.clear();
Provider.of<Inputs>(context, listen: false)
.getInputs(
testResultId: '',
@@ -107,11 +109,11 @@ class _FormPageState extends State<FormPage> {
child: Scaffold(
appBar: AppBar(
centerTitle: true,
title: Text('Add Test Result'),
title: Text('Add Test Result', style: TextStyle(color: Colors.white,),),
backgroundColor: Colors.black,
actions: <Widget>[
IconButton(
icon: Icon(Icons.save),
icon: Icon(Icons.save, color: Colors.white,),
onPressed: () {
_saveForm();
},
@@ -120,6 +122,7 @@ class _FormPageState extends State<FormPage> {
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () {
+2 -1
View File
@@ -82,11 +82,12 @@ class _TestResultScreenState extends State<TestResultScreen> {
TestResultFloatingButton(deviceBlockSize: _deviceBlockSize),
appBar: AppBar(
titleSpacing: -10,
title: Text('Home'),
title: Text('Home', style: TextStyle(color: Colors.white,),),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
+2 -1
View File
@@ -30,11 +30,12 @@ class _TestScanScreenState extends State<TestScanScreen> {
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text('Test Results'),
title: Text('Test Results', style: TextStyle(color: Colors.white,),),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
+2 -1
View File
@@ -76,11 +76,12 @@ class _TestVerifyScreenState extends State<TestVerifyScreen> {
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text('Home'),
title: Text('Home', style: TextStyle(color: Colors.white,),),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
+3 -4
View File
@@ -34,14 +34,16 @@ class HomePage extends StatelessWidget {
),
appBar: AppBar(
centerTitle: true,
title: Text('CSSD'),
title: Text('CSSD', style: TextStyle(color: Colors.white,),),
backgroundColor: Colors.black,
iconTheme: IconThemeData(color: Colors.white),
actions: <Widget>[
Padding(
padding: const EdgeInsets.only(right: 10.0),
child: IconButton(
icon: Icon(
Icons.power_settings_new,
color: Colors.white,
),
onPressed: () {
showDialog(
@@ -159,9 +161,6 @@ class HomePage extends StatelessWidget {
),
),
),
Divider(
height: 2,
),
SelectionItem(
firstLine: 'CYCLES',
secondLine: 'List, Details & Add a one',
+2 -1
View File
@@ -48,11 +48,12 @@ class _MyInfoScreenState extends State<MyInfoScreen> {
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text('Dashboard'),
title: Text('Dashboard', style: TextStyle(color: Colors.white,),),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
+12 -1
View File
@@ -238,7 +238,7 @@ class ItemProvider extends ChangeNotifier {
items = [];
searchBoxValue = value;
originalItems!.forEach((result) {
if (result.id.toString().contains(searchBoxValue)) {
if (result.udi.toString().contains(searchBoxValue)) {
items!.add(result);
}
});
@@ -312,10 +312,20 @@ class ItemProvider extends ChangeNotifier {
createdAt: '2019-09-18 10:02:03',
udi: 'null',
status: 0,
filePath: [],
);
}
var data = json.decode(response.body)['data'];
print(data);
List<String> mediaList = [];
if (data['filesPath'] != null) {
for (var file in data['filesPath']) {
mediaList.add(Url.showItemImage(file));
}
}
result = ItemDetailObject(
id: data['id'].toString(),
description: data['note'] != null ? data['note'] : '',
@@ -328,6 +338,7 @@ class ItemProvider extends ChangeNotifier {
createdAt: data['created_at'] != null ? data['created_at'] : '',
udi: data['udi'] != null ? data['udi'] : '',
status: data['status'],
filePath: mediaList,
);
return result!;
}
+2 -2
View File
@@ -45,7 +45,7 @@ class MyItemProvider extends ChangeNotifier {
myItems = [];
searchBoxValue = value;
originalMyItems!.forEach((result) {
if (result.id.toString().contains(searchBoxValue)) {
if (result.udi.toString().contains(searchBoxValue)) {
myItems!.add(result);
}
});
@@ -56,7 +56,7 @@ class MyItemProvider extends ChangeNotifier {
hospitalItems = [];
searchBoxValue = value;
originalHospitalItems!.forEach((result) {
if (result.id.toString().contains(searchBoxValue)) {
if (result.udi.toString().contains(searchBoxValue)) {
hospitalItems!.add(result);
}
});
+4 -2
View File
@@ -312,8 +312,10 @@ class PackageProvider extends ChangeNotifier {
var data = json.decode(response.body)['data'];
List<String> itemsList = [];
for (var item in data['items']) {
itemsList
.add("${item['name']} - ${item['udi'] != null ? item['udi'] : ''}");
// itemsList
// .add("${item['name']} - ${item['udi'] != null ? item['udi'] : ''}");
itemsList
.add("${item['id']} ${item['name']}");
}
print(data);
result = PackageDetailObject(
@@ -1,108 +1,23 @@
// ignore_for_file: must_be_immutable
import 'package:cssd/config/colors.dart';
import 'package:cssd/providers/items.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../../../config/routes.dart';
class ItemAddSaveButton extends StatefulWidget {
ItemAddSaveButton({
class ItemAddSaveButton extends StatelessWidget {
const ItemAddSaveButton({
Key? key,
required GlobalKey<FormState> form,
this.batchId,
required this.nameCTRL,
required this.descriptionCTRL,
required this.udiCTRL,
required double deviceBlockSize,
required this.sizeCTRL,
required this.specificCTRL,
required this.dateValue,
required this.isLoading,
}) : _form = form,
_deviceBlockSize = deviceBlockSize,
required this.onTap,
}) : _deviceBlockSize = deviceBlockSize,
super(key: key);
final GlobalKey<FormState> _form;
final TextEditingController nameCTRL;
final TextEditingController descriptionCTRL;
final TextEditingController udiCTRL;
final TextEditingController sizeCTRL;
final TextEditingController specificCTRL;
final String dateValue;
final String? batchId;
final double _deviceBlockSize;
bool isLoading;
@override
State<ItemAddSaveButton> createState() => _ItemAddSaveButtonState();
}
class _ItemAddSaveButtonState extends State<ItemAddSaveButton> {
final VoidCallback onTap;
@override
Widget build(BuildContext context) {
return InkWell(
onTap: () {
if (!widget._form.currentState!.validate()) {
return;
}
setState(() {
widget.isLoading = true;
});
Provider.of<ItemProvider>(context, listen: false)
.createItemResult(
widget.nameCTRL.text,
widget.sizeCTRL.text,
widget.specificCTRL.text,
widget.udiCTRL.text,
widget.descriptionCTRL.text,
widget.batchId,
)
.then(
(result) {
setState(() {
widget.isLoading = false;
});
if (result == 'done') {
showDialog(
context: context,
builder: (ctx) => AlertDialog(
content: Text('Item added.'),
actions: <Widget>[
TextButton(
onPressed: () {
Navigator.of(ctx).pop();
},
child: Text('Ok'),
)
],
),
).then((value) => Navigator.of(context)
.popAndPushNamed(Routes.testResultScreen));
}
},
);
showDialog(
context: context,
builder: (ctx) => AlertDialog(
content: Text('Item added.'),
actions: <Widget>[
TextButton(
onPressed: () {
Navigator.of(ctx).pop();
},
child: Text('Ok'),
)
],
),
).then((_) {
Navigator.of(context).pushReplacementNamed(Routes.itemResultScreen);
});
},
onTap: onTap,
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 5 * widget._deviceBlockSize,
horizontal: 5 * _deviceBlockSize,
vertical: 10,
),
decoration: BoxDecoration(
@@ -117,7 +32,7 @@ class _ItemAddSaveButtonState extends State<ItemAddSaveButton> {
'Save',
style: TextStyle(
color: Colors.white,
fontSize: 5 * widget._deviceBlockSize,
fontSize: 5 * _deviceBlockSize,
),
),
),
+19 -14
View File
@@ -90,20 +90,24 @@ class _UploaderImageState extends State<UploaderImage> {
}
Future<void> loadAssetsFromFilePicker(BuildContext context) async {
var providerObject = Provider.of<ItemProvider>(context, listen: false);
List<PlatformFile> files = providerObject.catchImages;
try {
var datas = await FilePicker.platform.pickFiles(
type: FileType.custom,
allowedExtensions: ['jpg', 'png', 'bmp', 'jpeg', 'pdf', 'docx', 'doc'],
withData: true,
withReadStream: true,
);
files += datas!.files;
} catch (_) {}
providerObject.setCatchImages(files);
providerObject.setImages();
var providerObject = Provider.of<ItemProvider>(context, listen: false);
List<PlatformFile> files = providerObject.catchImages;
var image = await ImagePicker.platform.pickImage(
source: ImageSource.gallery,
imageQuality: 25,
);
if (image != null) {
files.add(
PlatformFile(
path: image.path,
name: "item_image",
bytes: File(image.path).readAsBytesSync(),
size: File(image.path).lengthSync(),
),
);
providerObject.setCatchImages(files);
providerObject.setImages();
}
}
Future<void> loadAssetsFromCamera(BuildContext context) async {
@@ -111,6 +115,7 @@ class _UploaderImageState extends State<UploaderImage> {
List<PlatformFile> _catchImages = providerObject.catchImages;
var image = await ImagePicker.platform.pickImage(
source: ImageSource.camera,
imageQuality: 25,
);
if (image != null) {
_catchImages.add(
@@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:url_launcher/url_launcher.dart';
class ItemDetailsDataBox extends StatelessWidget {
const ItemDetailsDataBox({
Key? key,
@@ -316,6 +317,22 @@ class ItemDetailsDataBox extends StatelessWidget {
),
],
),
Divider(),
SizedBox(
height: 10,
),
Container(
width: double.infinity,
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 20),
child: ListView.separated(
shrinkWrap: true,
itemBuilder: (ctx, index) {
return Image(image: NetworkImage(datas.filePath![index]));
},
separatorBuilder: (ctx, index) => Divider(),
itemCount: datas.filePath!.length,
),
),
],
),
),
@@ -35,21 +35,21 @@ class ItemItemBox extends StatelessWidget {
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
if (item!.udi != null)
Container(
padding: const EdgeInsets.all(6.0),
child: Text(
item!.udi!,
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 3 * _deviceBlockSize,
),
),
),
if (item!.udi != null)
SizedBox(
width: 3 * _deviceBlockSize,
),
// if (item!.udi != null)
// Container(
// padding: const EdgeInsets.all(6.0),
// child: Text(
// item!.udi!,
// style: TextStyle(
// fontWeight: FontWeight.w700,
// fontSize: 3 * _deviceBlockSize,
// ),
// ),
// ),
// if (item!.udi != null)
// SizedBox(
// width: 3 * _deviceBlockSize,
// ),
// Spacer(),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
@@ -69,7 +69,7 @@ class ItemItemBox extends StatelessWidget {
child: Row(
children: [
Text(
'Size: ',
'Udi: ',
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 3 * _deviceBlockSize,
@@ -77,7 +77,7 @@ class ItemItemBox extends StatelessWidget {
),
),
Text(
item!.size,
item!.udi ?? '',
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontWeight: FontWeight.w700,
@@ -92,7 +92,7 @@ class ItemItemBox extends StatelessWidget {
child: Row(
children: <Widget>[
Text(
'User: ',
'Owner: ',
style: TextStyle(
color: Colors.grey,
fontSize: 3 * _deviceBlockSize,
@@ -37,21 +37,21 @@ class MyItemsItemDataBox extends StatelessWidget {
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
if (items!.udi != null)
Container(
padding: const EdgeInsets.all(6.0),
child: Text(
items!.udi!,
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 3 * _deviceBlockSize,
),
),
),
if (items!.udi != null)
SizedBox(
width: 3 * _deviceBlockSize,
),
// if (items!.udi != null)
// Container(
// padding: const EdgeInsets.all(6.0),
// child: Text(
// items!.udi!,
// style: TextStyle(
// fontWeight: FontWeight.w700,
// fontSize: 3 * _deviceBlockSize,
// ),
// ),
// ),
// if (items!.udi != null)
// SizedBox(
// width: 3 * _deviceBlockSize,
// ),
// Spacer(),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
@@ -71,7 +71,7 @@ class MyItemsItemDataBox extends StatelessWidget {
child: Row(
children: [
Text(
'Size: ',
'Udi: ',
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 3 * _deviceBlockSize,
@@ -79,7 +79,7 @@ class MyItemsItemDataBox extends StatelessWidget {
),
),
Text(
items!.size,
items!.udi ?? '',
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontWeight: FontWeight.w700,
@@ -95,7 +95,7 @@ class MyItemsItemDataBox extends StatelessWidget {
child: Row(
children: <Widget>[
Text(
'User: ',
'Owner: ',
style: TextStyle(
color: Colors.grey,
fontSize: 3 * _deviceBlockSize,
@@ -235,7 +235,7 @@ class PackageDetailsDataBox extends StatelessWidget {
shrinkWrap: true,
itemBuilder: (ctx, index) => RichText(
text: TextSpan(
text: 'Item ',
text: '${index + 1}. ',
style: TextStyle(
color: Colors.grey,
fontFamily: 'montserrat',
@@ -105,7 +105,7 @@ class _FormCreatorState extends State<FormCreator> {
),
InkWell(
onTap: () async {
await loadAssets(context);
await loadAssetsFromFilePicker(context);
},
child: Container(
width: MediaQuery.of(context).size.width - 40,
@@ -570,34 +570,33 @@ class _FormCreatorState extends State<FormCreator> {
profileProviderObject.setImages();
}
Future<void> loadAssets(BuildContext context) async {
var profileProviderObject =
Provider.of<TestResultsProvider>(context, listen: false);
List<PlatformFile> files = profileProviderObject.catchImages;
try {
var datas = await FilePicker.platform.pickFiles(
type: FileType.custom,
allowedExtensions: ['jpg', 'png', 'bmp', 'jpeg', 'pdf', 'docx', 'doc'],
withData: true,
withReadStream: true,
);
files += datas!.files;
// files +=
// print(files);
} catch (_) {}
profileProviderObject.setCatchImages(files);
profileProviderObject.setImages();
// profileProviderObject.addImage();
Future<void> loadAssetsFromFilePicker(BuildContext context) async {
var providerObject = Provider.of<TestResultsProvider>(context, listen: false);
List<PlatformFile> files = providerObject.catchImages;
var image = await ImagePicker.platform.pickImage(
source: ImageSource.gallery,
imageQuality: 25,
);
if (image != null) {
files.add(
PlatformFile(
path: image.path,
name: "item_image",
bytes: File(image.path).readAsBytesSync(),
size: File(image.path).lengthSync(),
),
);
providerObject.setCatchImages(files);
providerObject.setImages();
}
}
Future<void> loadAssetsFromCamera(BuildContext context) async {
var providerObject =
Provider.of<TestResultsProvider>(context, listen: false);
var providerObject = Provider.of<TestResultsProvider>(context, listen: false);
List<PlatformFile> _catchImages = providerObject.catchImages;
var image = await ImagePicker.platform.pickImage(
source: ImageSource.camera,
imageQuality: 25,
);
if (image != null) {
_catchImages.add(