From 8d867bfd4dffb9334103e792fcbd1054e73f42be Mon Sep 17 00:00:00 2001 From: Yugesh-Kumar-S Date: Tue, 10 Jun 2025 18:36:45 +0530 Subject: [PATCH 1/3] Applied theming to instrument screens and removed hardcoded strings --- lib/constants.dart | 16 +++++ lib/others/theme.dart | 23 +++++++ lib/view/widgets/accelerometer_card.dart | 6 +- .../widgets/channel_parameters_widget.dart | 69 ++++++++++--------- lib/view/widgets/data_analysis_widget.dart | 26 ++++--- lib/view/widgets/gyroscope_card.dart | 6 +- lib/view/widgets/timebase_trigger_widget.dart | 24 ++++--- lib/view/widgets/xyplot_widget.dart | 15 ++-- 8 files changed, 124 insertions(+), 61 deletions(-) diff --git a/lib/constants.dart b/lib/constants.dart index 323a4c469..6f869060f 100644 --- a/lib/constants.dart +++ b/lib/constants.dart @@ -144,3 +144,19 @@ String maxValue = 'Max: '; String gyroscopeTitle = "Gyroscope"; String gyroscopeAxisLabel = 'rad/s'; String noData = 'No data available'; +String xyPlot = 'XY Plot'; +String enablePlot = 'Enable XY Plot'; +String trigger = 'Trigger'; +String timeBase = 'Timebase'; +String timeBaseAndTrigger = 'Timebase & Trigger'; +String offsets = 'Offsets'; +String dataAnalysis = 'Data Analysis'; +String fourierAnalysis = 'Fourier Analysis'; +String channels = 'Channels'; +String pslabMic = 'PSLab MIC'; +String inBuiltMic = 'In-Built MIC'; +String ch3Range = 'CH3 (+/- 3.3V)'; +String rangeValue = '+/-16V'; +String range = 'Range'; +String ch2 = 'CH2'; +String ch1 = 'CH1'; diff --git a/lib/others/theme.dart b/lib/others/theme.dart index f34bc3574..f232139a8 100644 --- a/lib/others/theme.dart +++ b/lib/others/theme.dart @@ -6,11 +6,34 @@ class AppTheme { useMaterial3: true, scaffoldBackgroundColor: Colors.white, colorSchemeSeed: Colors.white, + checkboxTheme: const CheckboxThemeData( + side: BorderSide(color: Colors.black, width: 2), + ), + radioTheme: RadioThemeData( + fillColor: WidgetStateProperty.resolveWith((states) { + if (states.contains(WidgetState.selected)) { + return const Color(0xFFCE525F); + } + return Colors.black; + }), + ), ); + static final darkTheme = ThemeData( brightness: Brightness.dark, useMaterial3: true, scaffoldBackgroundColor: Colors.black, colorSchemeSeed: Colors.black, + checkboxTheme: const CheckboxThemeData( + side: BorderSide(color: Colors.black, width: 2), + ), + radioTheme: RadioThemeData( + fillColor: WidgetStateProperty.resolveWith((states) { + if (states.contains(WidgetState.selected)) { + return const Color(0xFFCE525F); + } + return Colors.black; + }), + ), ); } diff --git a/lib/view/widgets/accelerometer_card.dart b/lib/view/widgets/accelerometer_card.dart index ae9c23888..104e7cc58 100644 --- a/lib/view/widgets/accelerometer_card.dart +++ b/lib/view/widgets/accelerometer_card.dart @@ -67,7 +67,7 @@ class _AccelerometerCardState extends State { margin: const EdgeInsets.only(top: 8, bottom: 12), child: Text( "${currVal.toStringAsFixed(1)} $accelerationAxisLabel", - style: const TextStyle(fontSize: 14), + style: const TextStyle(color: Colors.black, fontSize: 14), ), ), Container( @@ -75,7 +75,7 @@ class _AccelerometerCardState extends State { margin: const EdgeInsets.only(left: 8, top: 4), child: Text( "$minValue ${minVal.toStringAsFixed(1)} $accelerationAxisLabel", - style: const TextStyle(fontSize: 10), + style: const TextStyle(color: Colors.black, fontSize: 10), ), ), Container( @@ -83,7 +83,7 @@ class _AccelerometerCardState extends State { margin: const EdgeInsets.only(left: 8, top: 2), child: Text( "$maxValue ${maxVal.toStringAsFixed(1)} $accelerationAxisLabel", - style: const TextStyle(fontSize: 10), + style: const TextStyle(color: Colors.black, fontSize: 10), ), ), ]), diff --git a/lib/view/widgets/channel_parameters_widget.dart b/lib/view/widgets/channel_parameters_widget.dart index 780d9e152..85c4e7e4e 100644 --- a/lib/view/widgets/channel_parameters_widget.dart +++ b/lib/view/widgets/channel_parameters_widget.dart @@ -45,19 +45,20 @@ class _ChannelParametersState extends State { ); }, ), - const Text( - 'CH1', - style: TextStyle( + Text( + ch1, + style: const TextStyle( + color: Colors.black, fontWeight: FontWeight.bold, fontStyle: FontStyle.normal, fontSize: 15, ), ), - const Padding( - padding: EdgeInsets.only(left: 8), + Padding( + padding: const EdgeInsets.only(left: 8), child: Text( - 'Range', - style: TextStyle( + range, + style: const TextStyle( color: Color(0xFF424242), fontWeight: FontWeight.normal, fontStyle: FontStyle.normal, @@ -82,7 +83,8 @@ class _ChannelParametersState extends State { inputDecorationTheme: const InputDecorationTheme( border: InputBorder.none, ), - textStyle: const TextStyle(fontSize: 15), + textStyle: + const TextStyle(color: Colors.black, fontSize: 15), onSelected: (String? value) { switch (yAxisRanges.indexOf(value!)) { case 0: @@ -143,19 +145,20 @@ class _ChannelParametersState extends State { ); }, ), - const Text( - 'CH2', - style: TextStyle( + Text( + ch2, + style: const TextStyle( + color: Colors.black, fontWeight: FontWeight.bold, fontStyle: FontStyle.normal, fontSize: 15, ), ), - const Padding( - padding: EdgeInsets.only(left: 8), + Padding( + padding: const EdgeInsets.only(left: 8), child: Text( - 'Range', - style: TextStyle( + range, + style: const TextStyle( color: Color(0xFF424242), fontWeight: FontWeight.normal, fontStyle: FontStyle.normal, @@ -163,13 +166,14 @@ class _ChannelParametersState extends State { ), ), ), - const Padding( - padding: EdgeInsets.only(left: 8), + Padding( + padding: const EdgeInsets.only(left: 8), child: SizedBox( width: 120, child: Text( - '+/-16V', - style: TextStyle( + rangeValue, + style: const TextStyle( + color: Colors.black, fontStyle: FontStyle.normal, fontWeight: FontWeight.normal, fontSize: 15, @@ -199,9 +203,10 @@ class _ChannelParametersState extends State { ); }, ), - const Text( - 'CH3 (+/- 3.3V)', - style: TextStyle( + Text( + ch3Range, + style: const TextStyle( + color: Colors.black, fontWeight: FontWeight.bold, fontStyle: FontStyle.normal, fontSize: 15, @@ -251,9 +256,10 @@ class _ChannelParametersState extends State { ); }, ), - const Text( - 'In-Built MIC', - style: TextStyle( + Text( + inBuiltMic, + style: const TextStyle( + color: Colors.black, fontSize: 15, fontWeight: FontWeight.bold, fontStyle: FontStyle.normal, @@ -283,9 +289,10 @@ class _ChannelParametersState extends State { ); }, ), - const Text( - 'PSLab MIC', - style: TextStyle( + Text( + pslabMic, + style: const TextStyle( + color: Colors.black, fontSize: 15, fontWeight: FontWeight.bold, fontStyle: FontStyle.normal, @@ -306,9 +313,9 @@ class _ChannelParametersState extends State { child: Container( padding: const EdgeInsets.symmetric(horizontal: 2), decoration: const BoxDecoration(color: Colors.white), - child: const Text( - 'Channels', - style: TextStyle( + child: Text( + channels, + style: const TextStyle( color: Color(0xFFC72C2C), fontStyle: FontStyle.normal, fontWeight: FontWeight.bold, diff --git a/lib/view/widgets/data_analysis_widget.dart b/lib/view/widgets/data_analysis_widget.dart index d2edca9c7..2c197f128 100644 --- a/lib/view/widgets/data_analysis_widget.dart +++ b/lib/view/widgets/data_analysis_widget.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:pslab/providers/oscilloscope_state_provider.dart'; +import 'package:pslab/constants.dart'; class DataAnalysisWidget extends StatefulWidget { const DataAnalysisWidget({super.key}); @@ -50,9 +51,10 @@ class _DataAnalysisState extends State { ); }, ), - const Text( - 'Fourier Analysis', - style: TextStyle( + Text( + fourierAnalysis, + style: const TextStyle( + color: Colors.black, fontSize: 15, fontWeight: FontWeight.normal, fontStyle: FontStyle.normal, @@ -88,6 +90,7 @@ class _DataAnalysisState extends State { border: InputBorder.none, ), textStyle: const TextStyle( + color: Colors.black, fontSize: 15, ), onSelected: (String? value) { @@ -128,6 +131,7 @@ class _DataAnalysisState extends State { border: InputBorder.none, ), textStyle: const TextStyle( + color: Colors.black, fontSize: 15, ), onSelected: (value) { @@ -165,6 +169,7 @@ class _DataAnalysisState extends State { border: InputBorder.none, ), textStyle: const TextStyle( + color: Colors.black, fontSize: 15, ), onSelected: (value) { @@ -189,9 +194,9 @@ class _DataAnalysisState extends State { child: Container( padding: const EdgeInsets.symmetric(horizontal: 2), decoration: const BoxDecoration(color: Colors.white), - child: const Text( - 'Data Analysis', - style: TextStyle( + child: Text( + dataAnalysis, + style: const TextStyle( color: Color(0xFFC72C2C), fontStyle: FontStyle.normal, fontWeight: FontWeight.bold, @@ -241,6 +246,7 @@ class _DataAnalysisState extends State { border: InputBorder.none, ), textStyle: const TextStyle( + color: Colors.black, fontSize: 15, ), onSelected: (value) => { @@ -304,6 +310,7 @@ class _DataAnalysisState extends State { border: InputBorder.none, ), style: const TextStyle( + color: Colors.black, fontSize: 14, fontWeight: FontWeight.normal, fontStyle: FontStyle.normal, @@ -403,6 +410,7 @@ class _DataAnalysisState extends State { : '${oscilloscopeStateProvider.xOffsets[oscilloscopeStateProvider.selectedChannelOffset]!.toStringAsFixed(2)} ms', ), style: const TextStyle( + color: Colors.black, fontSize: 14, fontWeight: FontWeight.normal, fontStyle: FontStyle.normal, @@ -456,9 +464,9 @@ class _DataAnalysisState extends State { child: Container( padding: const EdgeInsets.symmetric(horizontal: 2), decoration: const BoxDecoration(color: Colors.white), - child: const Text( - 'Offsets', - style: TextStyle( + child: Text( + offsets, + style: const TextStyle( color: Color(0xFFC72C2C), fontStyle: FontStyle.normal, fontWeight: FontWeight.bold, diff --git a/lib/view/widgets/gyroscope_card.dart b/lib/view/widgets/gyroscope_card.dart index e38f89da7..30bb69be3 100644 --- a/lib/view/widgets/gyroscope_card.dart +++ b/lib/view/widgets/gyroscope_card.dart @@ -101,7 +101,7 @@ class _GyroscopeCardState extends State { margin: const EdgeInsets.only(top: 8, bottom: 12), child: Text( "${currVal.toStringAsFixed(1)} $gyroscopeAxisLabel", - style: const TextStyle(fontSize: 14), + style: const TextStyle(color: Colors.black, fontSize: 14), ), ), Container( @@ -109,7 +109,7 @@ class _GyroscopeCardState extends State { margin: const EdgeInsets.only(left: 8, top: 4), child: Text( "$minValue ${minVal.toStringAsFixed(1)} $gyroscopeAxisLabel", - style: const TextStyle(fontSize: 10), + style: const TextStyle(color: Colors.black, fontSize: 10), ), ), Container( @@ -117,7 +117,7 @@ class _GyroscopeCardState extends State { margin: const EdgeInsets.only(left: 8, top: 2), child: Text( "$maxValue ${maxVal.toStringAsFixed(1)} $gyroscopeAxisLabel", - style: const TextStyle(fontSize: 10), + style: const TextStyle(color: Colors.black, fontSize: 10), ), ), ]), diff --git a/lib/view/widgets/timebase_trigger_widget.dart b/lib/view/widgets/timebase_trigger_widget.dart index ed8b95756..1b20a28da 100644 --- a/lib/view/widgets/timebase_trigger_widget.dart +++ b/lib/view/widgets/timebase_trigger_widget.dart @@ -44,9 +44,10 @@ class _TimebaseTriggerState extends State { ); }, ), - const Text( - 'Trigger', - style: TextStyle( + Text( + trigger, + style: const TextStyle( + color: Colors.black, fontSize: 15, fontWeight: FontWeight.bold, fontStyle: FontStyle.normal, @@ -70,6 +71,7 @@ class _TimebaseTriggerState extends State { border: InputBorder.none, ), textStyle: const TextStyle( + color: Colors.black, fontSize: 15, ), onSelected: (String? value) { @@ -117,6 +119,7 @@ class _TimebaseTriggerState extends State { border: InputBorder.none, ), style: const TextStyle( + color: Colors.black, fontSize: 14, fontWeight: FontWeight.normal, fontStyle: FontStyle.normal, @@ -171,6 +174,7 @@ class _TimebaseTriggerState extends State { border: InputBorder.none, ), textStyle: const TextStyle( + color: Colors.black, fontSize: 14, ), onSelected: (String? value) { @@ -202,9 +206,10 @@ class _TimebaseTriggerState extends State { mainAxisSize: MainAxisSize.max, crossAxisAlignment: CrossAxisAlignment.center, children: [ - const Text( - 'Timebase', - style: TextStyle( + Text( + timeBase, + style: const TextStyle( + color: Colors.black, fontSize: 15, fontWeight: FontWeight.bold, fontStyle: FontStyle.normal, @@ -303,6 +308,7 @@ class _TimebaseTriggerState extends State { ? '${oscilloscopeStateProvider.timebase.toStringAsFixed(2)} \u00b5s' : '${(oscilloscopeStateProvider.timebase / 1000).toStringAsFixed(2)} ms', style: const TextStyle( + color: Colors.black, fontSize: 14, fontWeight: FontWeight.normal, fontStyle: FontStyle.normal, @@ -324,9 +330,9 @@ class _TimebaseTriggerState extends State { child: Container( padding: const EdgeInsets.symmetric(horizontal: 2), decoration: const BoxDecoration(color: Colors.white), - child: const Text( - 'Timebase & Trigger', - style: TextStyle( + child: Text( + timeBaseAndTrigger, + style: const TextStyle( color: Color(0xFFC72C2C), fontStyle: FontStyle.normal, fontWeight: FontWeight.bold, diff --git a/lib/view/widgets/xyplot_widget.dart b/lib/view/widgets/xyplot_widget.dart index 33da189ed..d1ee814d1 100644 --- a/lib/view/widgets/xyplot_widget.dart +++ b/lib/view/widgets/xyplot_widget.dart @@ -44,9 +44,10 @@ class _XYPlotState extends State { ); }, ), - const Text( - 'Enable XY Plot', - style: TextStyle( + Text( + enablePlot, + style: const TextStyle( + color: Colors.black, fontSize: 15, fontWeight: FontWeight.normal, fontStyle: FontStyle.normal, @@ -77,6 +78,7 @@ class _XYPlotState extends State { border: InputBorder.none, ), textStyle: const TextStyle( + color: Colors.black, fontSize: 15, ), onSelected: (String? value) { @@ -98,6 +100,7 @@ class _XYPlotState extends State { border: InputBorder.none, ), textStyle: const TextStyle( + color: Colors.black, fontSize: 15, ), onSelected: (String? value) { @@ -119,9 +122,9 @@ class _XYPlotState extends State { child: Container( padding: const EdgeInsets.symmetric(horizontal: 2), decoration: const BoxDecoration(color: Colors.white), - child: const Text( - 'XY Plot', - style: TextStyle( + child: Text( + xyPlot, + style: const TextStyle( color: Color(0xFFC72C2C), fontStyle: FontStyle.normal, fontWeight: FontWeight.bold, From 11141997894cb0cb2a44844faaa2bbc693281d60 Mon Sep 17 00:00:00 2001 From: Yugesh-Kumar-S Date: Tue, 10 Jun 2025 18:58:40 +0530 Subject: [PATCH 2/3] Changed slider color to black --- lib/view/widgets/data_analysis_widget.dart | 2 ++ lib/view/widgets/timebase_trigger_widget.dart | 2 ++ 2 files changed, 4 insertions(+) diff --git a/lib/view/widgets/data_analysis_widget.dart b/lib/view/widgets/data_analysis_widget.dart index 2c197f128..290e66cf5 100644 --- a/lib/view/widgets/data_analysis_widget.dart +++ b/lib/view/widgets/data_analysis_widget.dart @@ -269,6 +269,7 @@ class _DataAnalysisState extends State { Expanded( child: SliderTheme( data: const SliderThemeData( + inactiveTrackColor: Colors.black, trackHeight: 1, thumbShape: RoundSliderThumbShape( enabledThumbRadius: 6), @@ -351,6 +352,7 @@ class _DataAnalysisState extends State { Expanded( child: SliderTheme( data: const SliderThemeData( + inactiveTrackColor: Colors.black, trackHeight: 1, thumbShape: RoundSliderThumbShape( enabledThumbRadius: 6), diff --git a/lib/view/widgets/timebase_trigger_widget.dart b/lib/view/widgets/timebase_trigger_widget.dart index 1b20a28da..ef890da55 100644 --- a/lib/view/widgets/timebase_trigger_widget.dart +++ b/lib/view/widgets/timebase_trigger_widget.dart @@ -82,6 +82,7 @@ class _TimebaseTriggerState extends State { Expanded( child: SliderTheme( data: const SliderThemeData( + inactiveTrackColor: Colors.black, trackHeight: 1, thumbShape: RoundSliderThumbShape(enabledThumbRadius: 6), @@ -218,6 +219,7 @@ class _TimebaseTriggerState extends State { Expanded( child: SliderTheme( data: const SliderThemeData( + inactiveTrackColor: Colors.black, trackHeight: 1, thumbShape: RoundSliderThumbShape(enabledThumbRadius: 6), From 7e9445993002dbdc437fba85554bd3cbe347a928 Mon Sep 17 00:00:00 2001 From: Yugesh-Kumar-S Date: Thu, 12 Jun 2025 17:38:04 +0530 Subject: [PATCH 3/3] Changed slider color --- lib/view/widgets/data_analysis_widget.dart | 12 ++++++------ lib/view/widgets/timebase_trigger_widget.dart | 16 ++++++++-------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/view/widgets/data_analysis_widget.dart b/lib/view/widgets/data_analysis_widget.dart index 290e66cf5..bd4dfda48 100644 --- a/lib/view/widgets/data_analysis_widget.dart +++ b/lib/view/widgets/data_analysis_widget.dart @@ -268,10 +268,10 @@ class _DataAnalysisState extends State { children: [ Expanded( child: SliderTheme( - data: const SliderThemeData( - inactiveTrackColor: Colors.black, + data: SliderThemeData( + inactiveTrackColor: Colors.blueGrey[100], trackHeight: 1, - thumbShape: RoundSliderThumbShape( + thumbShape: const RoundSliderThumbShape( enabledThumbRadius: 6), ), child: Slider( @@ -351,10 +351,10 @@ class _DataAnalysisState extends State { children: [ Expanded( child: SliderTheme( - data: const SliderThemeData( - inactiveTrackColor: Colors.black, + data: SliderThemeData( + inactiveTrackColor: Colors.blueGrey[100], trackHeight: 1, - thumbShape: RoundSliderThumbShape( + thumbShape: const RoundSliderThumbShape( enabledThumbRadius: 6), ), child: Slider( diff --git a/lib/view/widgets/timebase_trigger_widget.dart b/lib/view/widgets/timebase_trigger_widget.dart index ef890da55..8c94f202a 100644 --- a/lib/view/widgets/timebase_trigger_widget.dart +++ b/lib/view/widgets/timebase_trigger_widget.dart @@ -81,11 +81,11 @@ class _TimebaseTriggerState extends State { ), Expanded( child: SliderTheme( - data: const SliderThemeData( - inactiveTrackColor: Colors.black, + data: SliderThemeData( + inactiveTrackColor: Colors.blueGrey[100], trackHeight: 1, - thumbShape: - RoundSliderThumbShape(enabledThumbRadius: 6), + thumbShape: const RoundSliderThumbShape( + enabledThumbRadius: 6), ), child: Selector( selector: (context, provider) => @@ -218,11 +218,11 @@ class _TimebaseTriggerState extends State { ), Expanded( child: SliderTheme( - data: const SliderThemeData( - inactiveTrackColor: Colors.black, + data: SliderThemeData( + inactiveTrackColor: Colors.blueGrey[100], trackHeight: 1, - thumbShape: - RoundSliderThumbShape(enabledThumbRadius: 6), + thumbShape: const RoundSliderThumbShape( + enabledThumbRadius: 6), ), child: Slider( activeColor: const Color(0xFFCE525F),