aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/core/constants/val_client_helper.dart2
-rw-r--r--lib/data/data_providers/vehicle_notifier.dart47
-rw-r--r--lib/presentation/screens/dashboard/widgets/temperature.dart104
-rw-r--r--lib/presentation/screens/home/home.dart5
-rw-r--r--lib/presentation/screens/hvac/widgets/fan_speed_controls.dart129
-rw-r--r--lib/presentation/screens/hvac/widgets/semi_circle_painter.dart83
-rw-r--r--lib/presentation/screens/settings/settings_screens/audio_settings/widget/slider_widgets.dart1
7 files changed, 174 insertions, 197 deletions
diff --git a/lib/core/constants/val_client_helper.dart b/lib/core/constants/val_client_helper.dart
index 02912b0..60b3842 100644
--- a/lib/core/constants/val_client_helper.dart
+++ b/lib/core/constants/val_client_helper.dart
@@ -51,7 +51,7 @@ class ValClientHelper {
request.updates.add(update);
Map<String, String> metadata = {};
if (authorization.isNotEmpty) {
- metadata = {'authorization': "Bearer ${authorization}"};
+ metadata = {'authorization': "Bearer $authorization"};
}
await stub.set(request, options: CallOptions(metadata: metadata));
}
diff --git a/lib/data/data_providers/vehicle_notifier.dart b/lib/data/data_providers/vehicle_notifier.dart
index 8538ac1..c11332c 100644
--- a/lib/data/data_providers/vehicle_notifier.dart
+++ b/lib/data/data_providers/vehicle_notifier.dart
@@ -158,10 +158,10 @@ class VehicleNotifier extends StateNotifier<Vehicle> {
Future<KuksaConfig> readConfig() async {
String hostname = KuksaConfig.defaultHostname;
int port = KuksaConfig.defaultPort;
- bool use_tls = false;
- String ca_path = KuksaConfig.defaultCaCertPath;
- List<int> ca_cert = [];
- String tls_server_name = "";
+ bool useTls = false;
+ String caPath = KuksaConfig.defaultCaCertPath;
+ List<int> caCert = [];
+ String tlsServerName = "";
String token = "";
// Read build time configuration from bundle
@@ -179,16 +179,18 @@ class VehicleNotifier extends StateNotifier<Vehicle> {
if (yamlMap.containsKey('use-tls')) {
var value = yamlMap['use-tls'];
- if (value is bool) use_tls = value;
+ if (value is bool) {
+ useTls = value;
+ }
}
- if (use_tls) {
+ if (useTls) {
if (yamlMap.containsKey('ca-certificate')) {
- ca_path = yamlMap['ca-certificate'];
+ caPath = yamlMap['ca-certificate'];
}
if (yamlMap.containsKey('tls-server-name')) {
- tls_server_name = yamlMap['tls_server_name'];
+ tlsServerName = yamlMap['tls_server_name'];
}
}
@@ -217,24 +219,26 @@ class VehicleNotifier extends StateNotifier<Vehicle> {
if (yamlMap.containsKey('use-tls')) {
var value = yamlMap['use-tls'];
- if (value is bool) use_tls = value;
+ if (value is bool) {
+ useTls = value;
+ }
}
//debugPrint("Use TLS = $use_tls");
- if (use_tls) {
+ if (useTls) {
if (yamlMap.containsKey('ca-certificate')) {
- ca_path = yamlMap['ca-certificate'];
+ caPath = yamlMap['ca-certificate'];
}
try {
- ca_cert = File(ca_path).readAsBytesSync();
+ caCert = File(caPath).readAsBytesSync();
} on Exception catch (_) {
- print("ERROR: Could not read CA certificate file $ca_path");
- ca_cert = [];
+ print("ERROR: Could not read CA certificate file $caPath");
+ caCert = [];
}
//debugPrint("CA cert = $ca_cert");
if (yamlMap.containsKey('tls-server-name')) {
- tls_server_name = yamlMap['tls_server_name'];
+ tlsServerName = yamlMap['tls_server_name'];
}
}
@@ -262,9 +266,9 @@ class VehicleNotifier extends StateNotifier<Vehicle> {
hostname: hostname,
port: port,
authorization: token,
- use_tls: use_tls,
- ca_certificate: ca_cert,
- tls_server_name: tls_server_name);
+ use_tls: useTls,
+ ca_certificate: caCert,
+ tls_server_name: tlsServerName);
}
void startListen() async {
@@ -272,14 +276,15 @@ class VehicleNotifier extends StateNotifier<Vehicle> {
ChannelCredentials creds;
if (config.use_tls && config.ca_certificate.isNotEmpty) {
print("Using TLS");
- if (config.tls_server_name.isNotEmpty)
+ if (config.tls_server_name.isNotEmpty) {
creds = ChannelCredentials.secure(
certificates: config.ca_certificate,
authority: config.tls_server_name);
- else
+ } else {
creds = ChannelCredentials.secure(certificates: config.ca_certificate);
+ }
} else {
- creds = ChannelCredentials.insecure();
+ creds = const ChannelCredentials.insecure();
}
channel = ClientChannel(config.hostname,
port: config.port, options: ChannelOptions(credentials: creds));
diff --git a/lib/presentation/screens/dashboard/widgets/temperature.dart b/lib/presentation/screens/dashboard/widgets/temperature.dart
index 0817b53..1701c68 100644
--- a/lib/presentation/screens/dashboard/widgets/temperature.dart
+++ b/lib/presentation/screens/dashboard/widgets/temperature.dart
@@ -10,10 +10,10 @@ class TemperatureWidget extends ConsumerWidget {
// .watch(vehicleProvider.select((vehicle) => vehicle.outsideTemperature));
final tempUnit =
ref.watch(unitStateProvider.select((unit) => unit.temperatureUnit));
-
+
TextStyle temperatureTextStyle = const TextStyle(
fontFamily: 'BrunoAce',
- color: Colors.white,
+ color: Colors.white,
fontSize: 44,
);
@@ -39,7 +39,8 @@ class TemperatureWidget extends ConsumerWidget {
),
//color: Colors.grey,
shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(65), // Half of the height for an oval effect
+ borderRadius: BorderRadius.circular(
+ 65), // Half of the height for an oval effect
side: const BorderSide(
color: Color.fromARGB(156, 0, 0, 0),
width: 2,
@@ -76,8 +77,8 @@ class TemperatureWidget extends ConsumerWidget {
),
);
}
-
- Widget buildTemperatureRow(
+
+ Widget buildTemperatureRow(
BuildContext context,
IconData icon,
String label,
@@ -86,58 +87,59 @@ class TemperatureWidget extends ConsumerWidget {
TextStyle tempTextStyle,
TextStyle unitTextStyle,
bool isOutside,
-
) {
- int temperatureAsInt = temperatureValue.toInt();
- double convertedTemperature = tempUnit == TemperatureUnit.celsius
- ? temperatureAsInt.toDouble()
- : (temperatureAsInt * 9 / 5) + 32;
+ int temperatureAsInt = temperatureValue.toInt();
+ double convertedTemperature = tempUnit == TemperatureUnit.celsius
+ ? temperatureAsInt.toDouble()
+ : (temperatureAsInt * 9 / 5) + 32;
- // Format the temperature for display.
- String temperatureDisplay = tempUnit == TemperatureUnit.celsius
- ? '$temperatureAsInt'
- : '${convertedTemperature.toStringAsFixed(0)}';
+ // Format the temperature for display.
+ String temperatureDisplay = tempUnit == TemperatureUnit.celsius
+ ? '$temperatureAsInt'
+ : convertedTemperature.toStringAsFixed(0);
return Padding(
- padding: isOutside
- ? const EdgeInsets.only(right: 22) // Padding for the outside temperature
- : const EdgeInsets.only(left: 12), // Padding for the inside temperature
+ padding: isOutside
+ ? const EdgeInsets.only(
+ right: 22) // Padding for the outside temperature
+ : const EdgeInsets.only(
+ left: 12), // Padding for the inside temperature
child: Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- Icon(
- icon,
- color: const Color(0xFF2962FF),
- size: 48,
- ),
- const SizedBox(width: 4), // Space between icon and text
- Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisSize: MainAxisSize.min,
- children: [
- Text(
- label,
- style: const TextStyle(
- color: Color(0xFFC1D8FF),
- fontSize: 26,
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Icon(
+ icon,
+ color: const Color(0xFF2962FF),
+ size: 48,
+ ),
+ const SizedBox(width: 4), // Space between icon and text
+ Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Text(
+ label,
+ style: const TextStyle(
+ color: Color(0xFFC1D8FF),
+ fontSize: 26,
+ ),
),
- ),
- RichText(
- text: TextSpan(
- text: temperatureDisplay,
- style: tempTextStyle,
- children: <TextSpan>[
- TextSpan(
- text: tempUnit == TemperatureUnit.celsius ? '°C' : '°F',
- style: unitTextStyle,
- ),
- ],
+ RichText(
+ text: TextSpan(
+ text: temperatureDisplay,
+ style: tempTextStyle,
+ children: <TextSpan>[
+ TextSpan(
+ text: tempUnit == TemperatureUnit.celsius ? '°C' : '°F',
+ style: unitTextStyle,
+ ),
+ ],
+ ),
),
- ),
- ],
- ),
- ],
- ),
+ ],
+ ),
+ ],
+ ),
);
}
-} \ No newline at end of file
+}
diff --git a/lib/presentation/screens/home/home.dart b/lib/presentation/screens/home/home.dart
index 9719f8f..da20753 100644
--- a/lib/presentation/screens/home/home.dart
+++ b/lib/presentation/screens/home/home.dart
@@ -11,9 +11,6 @@ class HomeScreen extends ConsumerStatefulWidget {
}
class HomeScreenState extends ConsumerState<HomeScreen> {
-
-
-
@override
void initState() {
super.initState();
@@ -32,7 +29,7 @@ class HomeScreenState extends ConsumerState<HomeScreen> {
return Consumer(builder: (context, ref, child) {
final state = ref.read(appProvider);
if (disableBkgAnimation) {
- debugPrint('Background animation: disabled');
+ print('Background animation: disabled');
}
return Scaffold(
key: homeScaffoldKey,
diff --git a/lib/presentation/screens/hvac/widgets/fan_speed_controls.dart b/lib/presentation/screens/hvac/widgets/fan_speed_controls.dart
index c373bd8..ac813ca 100644
--- a/lib/presentation/screens/hvac/widgets/fan_speed_controls.dart
+++ b/lib/presentation/screens/hvac/widgets/fan_speed_controls.dart
@@ -25,6 +25,7 @@ class FanSpeedControlsState extends ConsumerState<FanSpeedControls>
double controlProgress = 0.0;
int selectedFanSpeed = 0;
late rive.RiveAnimationController _controller;
+ bool isButtonHighlighted = false;
bool _isPlaying = false;
@@ -90,33 +91,32 @@ class FanSpeedControlsState extends ConsumerState<FanSpeedControls>
Center(
child: Container(
margin: const EdgeInsets.only(top: 3),
- // decoration: BoxDecoration(
- // shape: BoxShape.circle,
- // gradient: LinearGradient(
- // colors: !isMainACSelected
- // ? [
- // AGLDemoColors.neonBlueColor,
- // AGLDemoColors.neonBlueColor.withOpacity(0.2)
- // ]
- // : [
- // const Color.fromARGB(255, 255, 193, 193)
- // .withOpacity(0.2),
- // const Color.fromARGB(255, 255, 193, 193)
- // ]),
- // boxShadow: isMainACSelected
- // ? [
- // BoxShadow(
- // offset: Offset(
- // isMainACSelected ? 1 : 1, isMainACSelected ? 2 : 2),
- // blurRadius: isMainACSelected ? 16 : 16,
- // spreadRadius: 0,
- // color: isMainACSelected
- // ? Colors.black.withOpacity(0.5)
- // : Colors.black)
- // ]
- // : [],
- // ),
- //border: Border.all(color: Colors.white12, width: 1)),
+ decoration: BoxDecoration(
+ shape: BoxShape.circle,
+ gradient: LinearGradient(
+ colors: !isButtonHighlighted
+ ? [
+ AGLDemoColors.neonBlueColor,
+ AGLDemoColors.neonBlueColor.withOpacity(0.2)
+ ]
+ : [
+ AGLDemoColors.resolutionBlueColor,
+ const Color(0xff141F64)
+ ]),
+ boxShadow: isButtonHighlighted
+ ? [
+ BoxShadow(
+ offset: Offset(isButtonHighlighted ? 1 : 1,
+ isButtonHighlighted ? 2 : 2),
+ blurRadius: isButtonHighlighted ? 16 : 16,
+ spreadRadius: 0,
+ color: isButtonHighlighted
+ ? Colors.black.withOpacity(0.5)
+ : Colors.black)
+ ]
+ : [],
+ ),
+ // border: Border.all(color: Colors.white12, width: 1),
//width: 90,
//height: 90,
child: Container(
@@ -126,18 +126,16 @@ class FanSpeedControlsState extends ConsumerState<FanSpeedControls>
image: const DecorationImage(
image: AssetImage("assets/PlusVector.png"),
),
- gradient: Gradient.lerp(gradientEnable1, gradientEnable2, 0.5),
- // border: Border.all(
- // color: isMainACSelected
- // ? AGLDemoColors.buttonFillEnabledColor
- // : Colors.white12,
- // width: isMainACSelected ? 3 : 1),
- border: const GradientBoxBorder(
- width: 2,
+ border: GradientBoxBorder(
+ width: 1,
gradient: LinearGradient(
colors: [
- Color(0x30C1D8FF),
- Color(0xFFC1D8FF),
+ isButtonHighlighted
+ ? AGLDemoColors.neonBlueColor
+ : AGLDemoColors.periwinkleColor.withOpacity(0.20),
+ isButtonHighlighted
+ ? AGLDemoColors.neonBlueColor.withOpacity(0.20)
+ : AGLDemoColors.periwinkleColor,
],
),
),
@@ -150,6 +148,11 @@ class FanSpeedControlsState extends ConsumerState<FanSpeedControls>
hoverColor: Colors.transparent,
highlightColor: Colors.transparent,
customBorder: const CircleBorder(),
+ onHighlightChanged: (value) {
+ setState(() {
+ isButtonHighlighted = value;
+ });
+ },
onTap: () {
setState(() {
if (controlProgress >= 0.80) {
@@ -158,9 +161,8 @@ class FanSpeedControlsState extends ConsumerState<FanSpeedControls>
_isPlaying = false;
animationController.reverse();
} else {
- _isPlaying ? null : _controller.isActive = true;
- isMainACSelected = true;
_controller.isActive = true;
+ isMainACSelected = true;
_isPlaying = true;
controlProgress += 0.30;
animationController.forward();
@@ -168,44 +170,11 @@ class FanSpeedControlsState extends ConsumerState<FanSpeedControls>
ref
.read(vehicleProvider.notifier)
.updateFanSpeed(controlProgress ~/ 0.3);
-
- // isMainACSelected = !isMainACSelected;
- // if (controlProgress != 0.0) {
- // previousProgress = controlProgress;
- // }
- // if (isMainACSelected) {
- // controlProgress = previousProgress;
- // animationController.forward();
- // } else {
- // controlProgress = 0.0;
- // animationController.reverse();
- // }
});
},
onTapDown: (details) {
- setState(() {
- gradientEnable1 = LinearGradient(colors: <Color>[
- const Color(0xFF2962FF).withOpacity(0.15),
- const Color(0x802962FF).withOpacity(0.15),
- ]);
- gradientEnable2 = const LinearGradient(colors: <Color>[
- Color(0xFF1A237E),
- Color(0xFF1C2D92),
- ]);
- });
- //change style
},
onTapUp: (details) {
- setState(() {
- gradientEnable1 = const LinearGradient(colors: <Color>[
- Color(0xFF2962FF),
- Color(0x802962FF),
- ]);
- gradientEnable2 = const LinearGradient(colors: <Color>[
- Color(0xFF1A237E),
- Color(0xFF141F64),
- ]);
- });
},
child: Container(
width: size,
@@ -217,12 +186,6 @@ class FanSpeedControlsState extends ConsumerState<FanSpeedControls>
width: iconSize,
height: iconSize,
)
- // : !_isPlaying && controlProgress > 0.8
- // ? SvgPicture.asset(
- // "assets/ACMainButton.svg",
- // width: iconSize,
- // height: iconSize,
- // )
: SizedBox(
width: iconSize,
height: iconSize,
@@ -232,16 +195,6 @@ class FanSpeedControlsState extends ConsumerState<FanSpeedControls>
onInit: (_) => setState(() {
_controller.isActive = true;
}))))
- // Container(
- // width: size,
- // height: size,
- // alignment: Alignment.center,
- // child: SvgPicture.asset(
- // "assets/ACMainButton.svg",
- // width: iconSize,
- // height: iconSize,
- // ),
- // ),
),
),
),
diff --git a/lib/presentation/screens/hvac/widgets/semi_circle_painter.dart b/lib/presentation/screens/hvac/widgets/semi_circle_painter.dart
index e2003c5..9756e7f 100644
--- a/lib/presentation/screens/hvac/widgets/semi_circle_painter.dart
+++ b/lib/presentation/screens/hvac/widgets/semi_circle_painter.dart
@@ -14,13 +14,17 @@ class AnimatedColorPainter extends CustomPainter {
@override
void paint(Canvas canvas, Size size) {
// const strokeWidth = 25.0;
- const borderWidth = 2.0;
// Divide the arc into equal parts based on the number of colors
const arcAngle = math.pi;
const arcPart = arcAngle / 3;
const gapAngle = arcAngle / 150;
+ // Define drop shadow properties
+ const shadowOffset = Offset(0, 0);
+ const shadowBlur = 12.0;
+ const shadowColor = AGLDemoColors.jordyBlueColor;
+
// Calculate the current color index based on animation progress and progress value
final double normalizedProgress = progress * 3;
int currentColorIndex =
@@ -40,37 +44,50 @@ class AnimatedColorPainter extends CustomPainter {
currentColor = backgroundColor;
}
+ // Create paths for drop shadow and actual color
+ final shadowPath = Path()
+ ..addArc(
+ Rect.fromCircle(
+ center: Offset(size.width / 2, size.height / 2) + shadowOffset,
+ radius: size.width / 2,
+ ),
+ startAngle,
+ arcPart - 2 * gapAngle,
+ // Draw clockwise
+ );
+ final colorPath = Path()
+ ..addArc(
+ Rect.fromCircle(
+ center: Offset(size.width / 2, size.height / 2),
+ radius: size.width / 2,
+ ),
+ startAngle,
+ arcPart - 2 * gapAngle,
+ // Draw clockwise
+ );
+
+ // Draw drop shadow using offset and blur
+ final shadowPaint = Paint()
+ ..color = shadowColor
+ ..style = PaintingStyle.fill
+ ..maskFilter = const MaskFilter.blur(BlurStyle.normal, shadowBlur);
+ if (currentColor == progressColor) {
+ canvas.drawPath(shadowPath, shadowPaint);
+ }
+
// Draw border
final borderPaint = Paint()
- ..strokeWidth = strokeWidth + borderWidth
+ ..strokeWidth = strokeWidth + 2.0 // Add border width
..style = PaintingStyle.stroke
..color = Colors.white12;
- canvas.drawArc(
- Rect.fromCircle(
- center: Offset(size.width / 2, size.height / 2),
- radius: size.width / 2,
- ),
- startAngle,
- arcPart - 2 * gapAngle,
- false, // Draw clockwise
- borderPaint,
- );
+ canvas.drawPath(colorPath, borderPaint);
// Draw inner color
final colorPaint = Paint()
..strokeWidth = strokeWidth
..style = PaintingStyle.stroke
- ..shader = _createColorShader(currentColor, size);
- canvas.drawArc(
- Rect.fromCircle(
- center: Offset(size.width / 2, size.height / 2),
- radius: size.width / 2,
- ),
- startAngle,
- arcPart - 2 * gapAngle,
- false, // Draw clockwise
- colorPaint,
- );
+ ..shader = _createColorShader(currentColor, size, i);
+ canvas.drawPath(colorPath, colorPaint);
startAngle += arcPart + gapAngle;
}
@@ -79,15 +96,19 @@ class AnimatedColorPainter extends CustomPainter {
@override
bool shouldRepaint(covariant CustomPainter oldDelegate) => true;
- Shader _createColorShader(Color color, Size size) {
+ Shader _createColorShader(Color color, Size size, int index) {
+ Alignment alignment = index == 0
+ ? const Alignment(-0.78, -0.38)
+ : index == 1
+ ? const Alignment(0, -1)
+ : const Alignment(0.78, -0.38);
if (color == progressColor) {
- return const RadialGradient(
- center: Alignment.center,
- radius: 2,
- tileMode: TileMode.repeated,
- focal: Alignment.center,
- focalRadius: 8,
- colors: [
+ return RadialGradient(
+ center: alignment,
+ radius: 0.35,
+ focal: alignment,
+ focalRadius: 0.02,
+ colors: const [
AGLDemoColors.blueGlowFillColor,
AGLDemoColors.jordyBlueColor,
AGLDemoColors.neonBlueColor
diff --git a/lib/presentation/screens/settings/settings_screens/audio_settings/widget/slider_widgets.dart b/lib/presentation/screens/settings/settings_screens/audio_settings/widget/slider_widgets.dart
index 973c9bf..36e45e3 100644
--- a/lib/presentation/screens/settings/settings_screens/audio_settings/widget/slider_widgets.dart
+++ b/lib/presentation/screens/settings/settings_screens/audio_settings/widget/slider_widgets.dart
@@ -116,7 +116,6 @@ class CustomTrebleSliderState extends ConsumerState<CustomTrebleSlider> {
),
),
),
-
Padding(
padding: const EdgeInsets.only(
right: 40,