diff --git a/Frontend/lib/mih_components/mih_package_components/mih_toggle.dart b/Frontend/lib/mih_components/mih_package_components/mih_toggle.dart index 9eda3852..42ff508c 100644 --- a/Frontend/lib/mih_components/mih_package_components/mih_toggle.dart +++ b/Frontend/lib/mih_components/mih_package_components/mih_toggle.dart @@ -5,6 +5,7 @@ class MihToggle extends StatefulWidget { final bool initialPostion; final Color fillColor; final Color secondaryFillColor; + final bool? readOnly; final void Function(bool) onChange; const MihToggle({ super.key, @@ -12,6 +13,7 @@ class MihToggle extends StatefulWidget { required this.initialPostion, required this.fillColor, required this.secondaryFillColor, + this.readOnly, required this.onChange, }); @@ -49,11 +51,20 @@ class _MihToggleState extends State { const SizedBox(width: 10), Switch( value: widget.initialPostion, - activeColor: widget.secondaryFillColor, - activeTrackColor: widget.fillColor, - inactiveThumbColor: widget.fillColor, - inactiveTrackColor: widget.secondaryFillColor, - onChanged: widget.onChange, + activeColor: + widget.readOnly == true ? Colors.grey : widget.secondaryFillColor, + activeTrackColor: + widget.readOnly == true ? Colors.grey.shade400 : widget.fillColor, + inactiveThumbColor: + widget.readOnly == true ? Colors.grey : widget.fillColor, + inactiveTrackColor: widget.readOnly == true + ? Colors.grey.shade400 + : widget.secondaryFillColor, + // activeColor: widget.secondaryFillColor, + // activeTrackColor: widget.fillColor, + // inactiveThumbColor: widget.fillColor, + // inactiveTrackColor: widget.secondaryFillColor, + onChanged: widget.readOnly != true ? widget.onChange : null, ), ], );