mirror of
https://git.meshkee.com/applications/cssd.git
synced 2026-10-13 19:38:55 +03:30
2.2.0
This commit is contained in:
Regular → Executable
+35
-1
@@ -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,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user