push toggle buttons color

This commit is contained in:
ashrafzarkanisala
2024-07-16 01:45:44 +03:00
parent 9ea4997467
commit 8f1db7615f

View File

@ -70,19 +70,41 @@ class _AlertDialogSliderStepsState extends State<AlertDialogSliderSteps> {
selectedColor: Colors.white,
color: ColorsManager.blackColor,
fillColor: ColorsManager.primaryColorWithOpacity,
constraints: const BoxConstraints(minHeight: 30, minWidth: 30),
children: const [
Padding(
padding: EdgeInsets.symmetric(horizontal: 30.0),
child: Text("<"),
borderColor: ColorsManager.greyColor,
constraints: BoxConstraints.tight(const Size(70, 30)),
children: [
SizedBox(
width: 70,
height: 30,
child: Container(
color: selectedToggleIndex == 0
? ColorsManager.primaryColorWithOpacity
: ColorsManager.greyColor,
alignment: Alignment.center,
child: const Text("<"),
),
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 30.0),
child: Text("="),
SizedBox(
width: 70,
height: 30,
child: Container(
color: selectedToggleIndex == 1
? ColorsManager.primaryColorWithOpacity
: ColorsManager.greyColor,
alignment: Alignment.center,
child: const Text("="),
),
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 30.0),
child: Text(">"),
SizedBox(
width: 70,
height: 30,
child: Container(
color: selectedToggleIndex == 2
? ColorsManager.primaryColorWithOpacity
: ColorsManager.greyColor,
alignment: Alignment.center,
child: const Text(">"),
),
),
],
),
@ -97,7 +119,11 @@ class _AlertDialogSliderStepsState extends State<AlertDialogSliderSteps> {
mainAxisAlignment: MainAxisAlignment.center,
children: [
TitleMedium(
text: groupValue?.toStringAsFixed(1) ?? "0",
text: groupValue != null
? (groupValue! % 1 == 0
? groupValue!.toStringAsFixed(0)
: groupValue!.toStringAsFixed(1))
: "0",
style: context.titleMedium.copyWith(
color: ColorsManager.primaryColorWithOpacity,
fontSize: 30,
@ -114,22 +140,26 @@ class _AlertDialogSliderStepsState extends State<AlertDialogSliderSteps> {
],
),
const SizedBox(height: 8),
Slider(
value: groupValue ?? 0,
min: operation.minValue?.toDouble() ?? 0,
max: operation.maxValue?.toDouble() ?? 0,
inactiveColor: ColorsManager.primaryColorWithOpacity,
divisions: operation.stepValue != null
? ((operation.maxValue!.toDouble() -
operation.minValue!.toDouble()) /
operation.stepValue!.toDouble())
.round()
: null,
onChanged: (value) {
setState(() {
groupValue = value;
});
},
Padding(
padding: const EdgeInsets.symmetric(horizontal: 8),
child: Slider(
value: groupValue ?? 0,
min: operation.minValue?.toDouble() ?? 0,
max: operation.maxValue?.toDouble() ?? 0,
inactiveColor: ColorsManager.primaryColorWithOpacity
.withOpacity(0.2),
divisions: operation.stepValue != null
? ((operation.maxValue!.toDouble() -
operation.minValue!.toDouble()) /
operation.stepValue!.toDouble())
.round()
: null,
onChanged: (value) {
setState(() {
groupValue = value;
});
},
),
),
const SizedBox(height: 12),
],