mirror of
https://git.meshkee.com/applications/cssd.git
synced 2026-10-10 19:28:56 +03:30
Set clear icon of add package box
This commit is contained in:
@@ -99,72 +99,145 @@ class AddItemBox extends StatelessWidget {
|
||||
width: MediaQuery.of(context).size.width -
|
||||
(40 * _deviceBlockSize),
|
||||
// height: 30,
|
||||
child: DropdownButtonFormField(
|
||||
decoration: InputDecoration(
|
||||
contentPadding: EdgeInsets.only(
|
||||
left: _deviceBlockSize,
|
||||
),
|
||||
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: Consumer<PackageProvider>(
|
||||
builder: (context, packageProvider, _) {
|
||||
return TextFormField(
|
||||
controller:
|
||||
packageProvider.itemValues[index],
|
||||
validator: (val) {
|
||||
if (val!.isEmpty) {
|
||||
return 'Item required!';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
contentPadding: EdgeInsets.only(
|
||||
bottom: 12,
|
||||
child: Consumer<PackageProvider>(
|
||||
builder: (context, packageProvider, _) {
|
||||
return DropdownButtonFormField(
|
||||
decoration: InputDecoration(
|
||||
contentPadding: EdgeInsets.only(
|
||||
left: _deviceBlockSize,
|
||||
),
|
||||
border: InputBorder.none,
|
||||
suffixIcon: Padding(
|
||||
padding: EdgeInsets.all(8),
|
||||
child: InkWell(
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: iconColor,
|
||||
),
|
||||
child: Icon(
|
||||
Icons.clear,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
isDense: true,
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Colors.black,
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
),
|
||||
);
|
||||
},
|
||||
onTap: () async {
|
||||
packageProvider.setClear(index);
|
||||
// _key.currentState?.reset();
|
||||
},
|
||||
)),
|
||||
),
|
||||
),
|
||||
isDense: true,
|
||||
// selectedItemBuilder: packageProvider.itemValues[index].value,
|
||||
items: vals.map((val) {
|
||||
return new DropdownMenuItem<String>(
|
||||
enabled: isEnabled,
|
||||
value: val,
|
||||
child: Container(
|
||||
child: Text(
|
||||
val,
|
||||
style: TextStyle(
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
iconSize: 7 * _deviceBlockSize,
|
||||
icon: Icon(
|
||||
FontAwesomeIcons.angleDown,
|
||||
color: Colors.black,
|
||||
),
|
||||
isExpanded: true,
|
||||
selectedItemBuilder: (context) =>
|
||||
vals.map((val) {
|
||||
return packageProvider.isClear
|
||||
? Container(
|
||||
height: 70,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 0),
|
||||
child: Consumer<PackageProvider>(
|
||||
builder: (context,
|
||||
packageProvider, _) {
|
||||
return TextFormField(
|
||||
controller: packageProvider
|
||||
.itemValues[index],
|
||||
validator: (val) {
|
||||
if (val!.isEmpty) {
|
||||
return 'Item required!';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
contentPadding:
|
||||
EdgeInsets.only(
|
||||
bottom: 12,
|
||||
),
|
||||
isDense: true,
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Colors.black,
|
||||
fontSize:
|
||||
4 * _deviceBlockSize,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
)
|
||||
: new DropdownMenuItem<String>(
|
||||
enabled: isEnabled,
|
||||
value: val,
|
||||
child: Container(
|
||||
child: Text(
|
||||
packageProvider.isClear
|
||||
? ""
|
||||
: val ?? "",
|
||||
style: TextStyle(
|
||||
fontSize:
|
||||
4 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
hint: Container(
|
||||
// width: 100,
|
||||
height: 70,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 0),
|
||||
child: Consumer<PackageProvider>(
|
||||
builder: (context, packageProvider, _) {
|
||||
return TextFormField(
|
||||
controller:
|
||||
packageProvider.itemValues[index],
|
||||
validator: (val) {
|
||||
if (val!.isEmpty) {
|
||||
return 'Item required!';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
contentPadding: EdgeInsets.only(
|
||||
bottom: 12,
|
||||
),
|
||||
isDense: true,
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w700,
|
||||
color: Colors.black,
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
isDense: true,
|
||||
items: vals.map((val) {
|
||||
return new DropdownMenuItem<String>(
|
||||
enabled: isEnabled,
|
||||
value: val,
|
||||
child: Container(
|
||||
child: Text(
|
||||
val ?? "",
|
||||
style: TextStyle(
|
||||
fontSize: 4 * _deviceBlockSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: (val) {
|
||||
Provider.of<PackageProvider>(context,
|
||||
listen: false)
|
||||
.changeItemVal(val!, index);
|
||||
},
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: (val) async {
|
||||
await packageProvider.reSetClear();
|
||||
await Provider.of<PackageProvider>(context,
|
||||
listen: false)
|
||||
.changeItemVal(val.toString()!, index);
|
||||
},
|
||||
);
|
||||
}),
|
||||
),
|
||||
Spacer(),
|
||||
InkWell(
|
||||
|
||||
Reference in New Issue
Block a user