mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 07:07:19 +00:00
Merge pull request #219 from SyncrowIOT/SP-1607-FE-Adjust-Padding-Between-Comparison-Signs-for-Visual-Consistency
Sp 1607 fe adjust padding between comparison signs for visual consistency
This commit is contained in:
@ -12,22 +12,53 @@ class ConditionToggle extends StatelessWidget {
|
|||||||
});
|
});
|
||||||
|
|
||||||
static const _conditions = ["<", "==", ">"];
|
static const _conditions = ["<", "==", ">"];
|
||||||
|
static const _icons = [
|
||||||
|
Icons.chevron_left,
|
||||||
|
Icons.drag_handle,
|
||||||
|
Icons.chevron_right
|
||||||
|
];
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return ToggleButtons(
|
final selectedIndex = _conditions.indexOf(currentCondition ?? "==");
|
||||||
onPressed: (index) => onChanged(_conditions[index]),
|
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(8)),
|
return Container(
|
||||||
selectedBorderColor: ColorsManager.primaryColorWithOpacity,
|
height: 30,
|
||||||
selectedColor: Colors.white,
|
width: MediaQuery.of(context).size.width * 0.1,
|
||||||
fillColor: ColorsManager.primaryColorWithOpacity,
|
decoration: BoxDecoration(
|
||||||
color: ColorsManager.primaryColorWithOpacity,
|
color: ColorsManager.softGray.withOpacity(0.5),
|
||||||
constraints: const BoxConstraints(
|
borderRadius: BorderRadius.circular(50),
|
||||||
minHeight: 40.0,
|
),
|
||||||
minWidth: 40.0,
|
clipBehavior: Clip.antiAlias,
|
||||||
|
child: Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: List.generate(_conditions.length, (index) {
|
||||||
|
final isSelected = index == selectedIndex;
|
||||||
|
return Expanded(
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () => onChanged(_conditions[index]),
|
||||||
|
child: AnimatedContainer(
|
||||||
|
duration: const Duration(milliseconds: 180),
|
||||||
|
curve: Curves.ease,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color:
|
||||||
|
isSelected ? ColorsManager.vividBlue : Colors.transparent,
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: Icon(
|
||||||
|
_icons[index],
|
||||||
|
size: 20,
|
||||||
|
color: isSelected
|
||||||
|
? ColorsManager.whiteColors
|
||||||
|
: ColorsManager.blackColor,
|
||||||
|
weight: isSelected ? 700 : 500,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}),
|
||||||
),
|
),
|
||||||
isSelected: _conditions.map((c) => c == (currentCondition ?? "==")).toList(),
|
|
||||||
children: _conditions.map((c) => Text(c)).toList(),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user