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
+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