Merge pull request #205 from yaso-meth/QOL--MIH-Toggle-Colors
QOL--MIH-Toggle-Colors
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:mzansi_innovation_hub/main.dart';
|
||||||
|
|
||||||
class MihToggle extends StatefulWidget {
|
class MihToggle extends StatefulWidget {
|
||||||
final String hintText;
|
final String hintText;
|
||||||
@@ -51,15 +52,31 @@ class _MihToggleState extends State<MihToggle> {
|
|||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
Switch(
|
Switch(
|
||||||
value: widget.initialPostion,
|
value: widget.initialPostion,
|
||||||
|
trackOutlineColor: WidgetStateProperty.resolveWith<Color?>(
|
||||||
|
(states) {
|
||||||
|
if (widget.readOnly == true) {
|
||||||
|
return Colors.grey;
|
||||||
|
}
|
||||||
|
if (states.contains(WidgetState.selected)) {
|
||||||
|
return MzanziInnovationHub.of(context)!
|
||||||
|
.theme
|
||||||
|
.successColor(); // Outline color when active
|
||||||
|
}
|
||||||
|
return MzanziInnovationHub.of(context)!
|
||||||
|
.theme
|
||||||
|
.errorColor(); // Outline color when active
|
||||||
|
},
|
||||||
|
),
|
||||||
activeColor:
|
activeColor:
|
||||||
widget.readOnly == true ? Colors.grey : widget.secondaryFillColor,
|
widget.readOnly == true ? Colors.grey : widget.secondaryFillColor,
|
||||||
activeTrackColor:
|
activeTrackColor: widget.readOnly == true
|
||||||
widget.readOnly == true ? Colors.grey.shade400 : widget.fillColor,
|
? Colors.grey.shade400
|
||||||
|
: MzanziInnovationHub.of(context)!.theme.successColor(),
|
||||||
inactiveThumbColor:
|
inactiveThumbColor:
|
||||||
widget.readOnly == true ? Colors.grey : widget.fillColor,
|
widget.readOnly == true ? Colors.grey : widget.secondaryFillColor,
|
||||||
inactiveTrackColor: widget.readOnly == true
|
inactiveTrackColor: widget.readOnly == true
|
||||||
? Colors.grey.shade400
|
? Colors.grey.shade400
|
||||||
: widget.secondaryFillColor,
|
: MzanziInnovationHub.of(context)!.theme.errorColor(),
|
||||||
// activeColor: widget.secondaryFillColor,
|
// activeColor: widget.secondaryFillColor,
|
||||||
// activeTrackColor: widget.fillColor,
|
// activeTrackColor: widget.fillColor,
|
||||||
// inactiveThumbColor: widget.fillColor,
|
// inactiveThumbColor: widget.fillColor,
|
||||||
|
|||||||
Reference in New Issue
Block a user