refactor and cleanup in prep for profile changing

This commit is contained in:
Christien Rioux 2024-06-13 14:52:34 -04:00
parent 87bb1657c7
commit 56d65442f4
49 changed files with 967 additions and 655 deletions

View file

@ -1,5 +1,6 @@
import 'package:async_tools/async_tools.dart';
import 'package:awesome_extensions/awesome_extensions.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
@ -11,7 +12,7 @@ import '../../theme/theme.dart';
import '../cubit/connection_state_cubit.dart';
class SignalStrengthMeterWidget extends StatelessWidget {
const SignalStrengthMeterWidget({super.key});
const SignalStrengthMeterWidget({super.key, this.color, this.inactiveColor});
@override
// ignore: prefer_expression_function_bodies
@ -33,32 +34,35 @@ class SignalStrengthMeterWidget extends StatelessWidget {
switch (connectionState.attachment.state) {
case AttachmentState.detached:
iconWidget = Icon(Icons.signal_cellular_nodata,
size: iconSize, color: scale.primaryScale.primaryText);
size: iconSize,
color: this.color ?? scale.primaryScale.primaryText);
return;
case AttachmentState.detaching:
iconWidget = Icon(Icons.signal_cellular_off,
size: iconSize, color: scale.primaryScale.primaryText);
size: iconSize,
color: this.color ?? scale.primaryScale.primaryText);
return;
case AttachmentState.attaching:
value = 0;
color = scale.primaryScale.primaryText;
color = this.color ?? scale.primaryScale.primaryText;
case AttachmentState.attachedWeak:
value = 1;
color = scale.primaryScale.primaryText;
color = this.color ?? scale.primaryScale.primaryText;
case AttachmentState.attachedStrong:
value = 2;
color = scale.primaryScale.primaryText;
color = this.color ?? scale.primaryScale.primaryText;
case AttachmentState.attachedGood:
value = 3;
color = scale.primaryScale.primaryText;
color = this.color ?? scale.primaryScale.primaryText;
case AttachmentState.fullyAttached:
value = 4;
color = scale.primaryScale.primaryText;
color = this.color ?? scale.primaryScale.primaryText;
case AttachmentState.overAttached:
value = 4;
color = scale.primaryScale.primaryText;
color = this.color ?? scale.primaryScale.primaryText;
}
inactiveColor = scale.primaryScale.primaryText;
inactiveColor =
this.inactiveColor ?? scale.primaryScale.primaryText;
iconWidget = SignalStrengthIndicator.bars(
value: value,
@ -86,4 +90,16 @@ class SignalStrengthMeterWidget extends StatelessWidget {
child: iconWidget);
});
}
////////////////////////////////////////////////////////////////////////////
final Color? color;
final Color? inactiveColor;
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
super.debugFillProperties(properties);
properties
..add(ColorProperty('color', color))
..add(ColorProperty('inactiveColor', inactiveColor));
}
}