|
|
|
|
@ -12,15 +12,16 @@ import '../../../providers/service_request_providers/equipment_status_provider.d
|
|
|
|
|
|
|
|
|
|
class EquipmentStatusButtons extends StatefulWidget {
|
|
|
|
|
final Function(Lookup) onSelect;
|
|
|
|
|
int initialvalue;
|
|
|
|
|
|
|
|
|
|
const EquipmentStatusButtons({Key key, this.onSelect}) : super(key: key);
|
|
|
|
|
EquipmentStatusButtons({Key key, this.onSelect, this.initialvalue}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
State<EquipmentStatusButtons> createState() => _EquipmentStatusButtonsState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _EquipmentStatusButtonsState extends State<EquipmentStatusButtons> {
|
|
|
|
|
int _selectedEquipmentStatusIndex = 0;
|
|
|
|
|
//int _selectedEquipmentStatusIndex = 0;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
@ -61,18 +62,18 @@ class _EquipmentStatusButtonsState extends State<EquipmentStatusButtons> {
|
|
|
|
|
padding: EdgeInsetsDirectional.only(start: 16.toScreenWidth),
|
|
|
|
|
itemBuilder: (context, index) => Container(
|
|
|
|
|
margin: EdgeInsets.symmetric(horizontal: 4.toScreenWidth),
|
|
|
|
|
padding: EdgeInsets.symmetric(vertical: 8.toScreenHeight, horizontal: (_selectedEquipmentStatusIndex == index ? 12 : 8).toScreenWidth),
|
|
|
|
|
padding: EdgeInsets.symmetric(vertical: 8.toScreenHeight, horizontal: (widget.initialvalue == index ? 12 : 8).toScreenWidth),
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
borderRadius: BorderRadius.circular(7),
|
|
|
|
|
color: _selectedEquipmentStatusIndex == index ? AppColor.neutral30 : Colors.white,
|
|
|
|
|
border: _selectedEquipmentStatusIndex == index ? Border.all(width: 1, color: AppColor.primary50) : null,
|
|
|
|
|
color: widget.initialvalue == index ? AppColor.neutral30 : Colors.white,
|
|
|
|
|
border: widget.initialvalue == index ? Border.all(width: 1, color: AppColor.primary50) : null,
|
|
|
|
|
boxShadow: [BoxShadow(color: Colors.black.withOpacity(0.03), blurRadius: 14)],
|
|
|
|
|
),
|
|
|
|
|
child: (index == 0 ? "All Assets" : snapshot.items[index - 1].name).tinyFont(context).custom(color: AppColor.neutral50),
|
|
|
|
|
).onPress(() {
|
|
|
|
|
setState(() {
|
|
|
|
|
_selectedEquipmentStatusIndex = index;
|
|
|
|
|
widget.initialvalue = index;
|
|
|
|
|
});
|
|
|
|
|
widget.onSelect(index == 0 ? null : snapshot.items[index - 1]);
|
|
|
|
|
}),
|
|
|
|
|
|