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