diff --git a/open_earable/lib/controls_tab/views/led_color.dart b/open_earable/lib/controls_tab/views/led_color.dart index e6b4c16..44022ac 100644 --- a/open_earable/lib/controls_tab/views/led_color.dart +++ b/open_earable/lib/controls_tab/views/led_color.dart @@ -224,6 +224,7 @@ class _InternalLedColorCardState extends State<_InternalLedColorCard> { fontWeight: FontWeight.bold, ), ), + SizedBox(height: 8), Row( children: [ MouseRegion( @@ -244,7 +245,7 @@ class _InternalLedColorCardState extends State<_InternalLedColorCard> { ), ), ), - SizedBox(width: 5), + SizedBox(width: 4), SizedBox( width: 66, height: 36, @@ -258,7 +259,7 @@ class _InternalLedColorCardState extends State<_InternalLedColorCard> { child: Text('Set'), ), ), - SizedBox(width: 5), + SizedBox(width: 4), SizedBox( width: 66, height: 36, diff --git a/open_earable/lib/controls_tab/views/sensor_control/sensor_control.dart b/open_earable/lib/controls_tab/views/sensor_control/sensor_control.dart index 24e8cd3..cacb2d7 100644 --- a/open_earable/lib/controls_tab/views/sensor_control/sensor_control.dart +++ b/open_earable/lib/controls_tab/views/sensor_control/sensor_control.dart @@ -74,14 +74,14 @@ class _SensorControlCardState extends State { child: Card( //Audio Player Card color: Theme.of(context).colorScheme.primary, - child: Padding( - padding: const EdgeInsets.fromLTRB(16, 12, 16, 16), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Text( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Padding( + padding: EdgeInsets.fromLTRB(16, 16, 16, 4), + child: Text( 'Sensor Control', style: TextStyle( color: Colors.white, @@ -89,113 +89,117 @@ class _SensorControlCardState extends State { fontWeight: FontWeight.bold, ), ), - Spacer(), - // This matches the Spacer in your DynamicValuePicker row - SizedBox( - width: 70, - height: 37, - child: Align( - alignment: Alignment.bottomCenter, - child: Text( - "BLE", - textAlign: TextAlign.center, - style: TextStyle( - color: Color.fromRGBO(168, 168, 172, 1.0), - ), + ), + Spacer(), + // This matches the Spacer in your DynamicValuePicker row + SizedBox( + width: 80, + height: 37, + child: Align( + alignment: Alignment.bottomCenter, + child: Text( + "BLE", + textAlign: TextAlign.center, + style: TextStyle( + color: Color.fromRGBO(168, 168, 172, 1.0), ), ), ), - SizedBox(width: 8), - // Space between the first title and the second title - SizedBox( - width: 70, - height: 37, - child: Align( - alignment: Alignment.bottomCenter, - child: Text( - "SD", - textAlign: TextAlign.center, - style: TextStyle( - color: Color.fromRGBO(168, 168, 172, 1.0), - ), + ), + SizedBox(width: 4), + // Space between the first title and the second title + SizedBox( + width: 80, + height: 37, + child: Align( + alignment: Alignment.bottomCenter, + child: Text( + "SD", + textAlign: TextAlign.center, + style: TextStyle( + color: Color.fromRGBO(168, 168, 172, 1.0), ), ), ), - SizedBox(width: 8), - // Space before the "Hz" label - Text( - "Hz", - textAlign: TextAlign.left, - style: TextStyle(color: Color.fromRGBO(168, 168, 172, 0)), - ), - ], - ), - ChangeNotifierProvider.value( - value: OpenEarableSettingsV2().microphone1Settings, - child: SensorControlRow("Microphone 1"), - ), - SizedBox(height: 4), - ChangeNotifierProvider.value( - value: OpenEarableSettingsV2().microphone2Settings, - child: SensorControlRow("Microphone 2"), - ), - Divider( - color: Color.fromRGBO(168, 168, 172, 1.0), - ), - ChangeNotifierProvider.value( - value: OpenEarableSettingsV2().imuSettings, - child: SensorControlRow("9-Axis IMU"), - ), - SizedBox(height: 4), - ChangeNotifierProvider.value( - value: OpenEarableSettingsV2().pulseOximeterSettings, - child: SensorControlRow("Pulse Oximeter\n(Red/Infrared)"), - ), - SizedBox(height: 4), - ChangeNotifierProvider.value( - value: OpenEarableSettingsV2().vitalsSettings, - child: SensorControlRow("Heart Rate,\nSpO2"), - ), - SizedBox(height: 4), - ChangeNotifierProvider.value( - value: OpenEarableSettingsV2().opticalTemperatureSettings, - child: SensorControlRow("Optical Temp.\n(Surface)"), - ), - SizedBox(height: 4), - ChangeNotifierProvider.value( - value: OpenEarableSettingsV2().barometerSettings, - child: SensorControlRow("Pressure,\nTemp. (Ambient)"), - ), - SizedBox(height: 8), - Row( - children: [ - Expanded( - child: SizedBox( - height: 37, - child: ElevatedButton( - onPressed: - Provider.of(context).connected - ? _writeSensorConfigs - : null, - style: ElevatedButton.styleFrom( - backgroundColor: - Provider.of(context) - .connected - ? Theme.of(context).colorScheme.secondary - : Colors.grey, - foregroundColor: Colors.black, - enableFeedback: - Provider.of(context) - .connected, + ), + SizedBox(width: 4), + // Space before the "Hz" label + Text( + "Hz", + textAlign: TextAlign.left, + style: TextStyle(color: Color.fromRGBO(168, 168, 172, 255)), + ), + SizedBox(width: 16), + ], + ), + ChangeNotifierProvider.value( + value: OpenEarableSettingsV2().microphone1Settings, + child: SensorControlRow("Microphone 1"), + ), + SizedBox(height: 4), + ChangeNotifierProvider.value( + value: OpenEarableSettingsV2().microphone2Settings, + child: SensorControlRow("Microphone 2"), + ), + Padding( + padding: EdgeInsets.fromLTRB(16, 0, 16, 0), + child: Divider( + color: Color.fromRGBO(168, 168, 172, 1.0), + )), + ChangeNotifierProvider.value( + value: OpenEarableSettingsV2().imuSettings, + child: SensorControlRow("9-Axis IMU"), + ), + SizedBox(height: 4), + ChangeNotifierProvider.value( + value: OpenEarableSettingsV2().pulseOximeterSettings, + child: SensorControlRow("Pulse Oximeter\n(Red/Infrared)"), + ), + SizedBox(height: 4), + ChangeNotifierProvider.value( + value: OpenEarableSettingsV2().vitalsSettings, + child: SensorControlRow("Heart Rate,\nSpO2"), + ), + SizedBox(height: 4), + ChangeNotifierProvider.value( + value: OpenEarableSettingsV2().opticalTemperatureSettings, + child: SensorControlRow("Optical Temp.\n(Surface)"), + ), + SizedBox(height: 4), + ChangeNotifierProvider.value( + value: OpenEarableSettingsV2().barometerSettings, + child: SensorControlRow("Pressure,\nTemp. (Ambient)"), + ), + Padding( + padding: EdgeInsets.all(16), + child: Row( + children: [ + Expanded( + child: SizedBox( + height: 37, + child: ElevatedButton( + onPressed: Provider.of(context) + .connected + ? _writeSensorConfigs + : null, + style: ElevatedButton.styleFrom( + backgroundColor: + Provider.of(context) + .connected + ? Theme.of(context).colorScheme.secondary + : Colors.grey, + foregroundColor: Colors.black, + enableFeedback: + Provider.of(context) + .connected, + ), + child: Text("Set Configuration"), ), - child: Text("Set Configuration"), ), ), - ), - ], - ), - ], - ), + ], + )), + ], ), ), ); diff --git a/open_earable/lib/controls_tab/views/sensor_control/sensor_control_row.dart b/open_earable/lib/controls_tab/views/sensor_control/sensor_control_row.dart index fe3de43..bad9089 100644 --- a/open_earable/lib/controls_tab/views/sensor_control/sensor_control_row.dart +++ b/open_earable/lib/controls_tab/views/sensor_control/sensor_control_row.dart @@ -18,81 +18,92 @@ class _SensorControlRow extends State { Widget build(BuildContext context) { SensorSettings sensorSettings = Provider.of(context, listen: true); - return Row( - children: [ - Checkbox( - checkColor: Theme.of(context).colorScheme.primary, - fillColor: WidgetStateProperty.resolveWith(_getCheckboxColor), - value: sensorSettings.sensorSelected, - onChanged: Provider.of(context).connected - ? (value) { - setState(() { - sensorSettings.sensorSelected = value ?? false; - }); - } - : null, - ), - Text( - widget.sensorName, - style: TextStyle( - color: Color.fromRGBO(168, 168, 172, 1.0), + return Padding( + padding: EdgeInsets.fromLTRB(8, 0, 16, 0), + child: Row( + children: [ + Theme( + data: Theme.of(context).copyWith( + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + ), + child: Checkbox( + checkColor: Theme.of(context).colorScheme.primary, + fillColor: WidgetStateProperty.resolveWith(_getCheckboxColor), + value: sensorSettings.sensorSelected, + onChanged: Provider.of(context).connected + ? (value) { + setState(() { + sensorSettings.sensorSelected = value ?? false; + }); + } + : null, + ), ), - ), - Spacer(), - Container( - decoration: BoxDecoration( - color: Provider.of(context).connected - ? Colors.white - : Colors.grey, - borderRadius: BorderRadius.circular(4.0), + Text( + widget.sensorName, + style: TextStyle( + color: Color.fromRGBO(168, 168, 172, 1.0), + ), ), - child: SizedBox( - width: 75, - height: 37, - child: Container( - alignment: Alignment.centerRight, - child: DynamicValuePicker( - context, - sensorSettings.frequencyOptionsBLE, - sensorSettings.selectedOptionBLE, - (newValue) { - sensorSettings.updateSelectedBLEOption(newValue); - }, - Provider.of(context).connected, - sensorSettings.isFakeDisabledBLE, + Spacer(), + Container( + decoration: BoxDecoration( + color: Provider.of(context).connected + ? Colors.white + : Colors.grey, + borderRadius: BorderRadius.circular(4.0), + ), + child: SizedBox( + width: 80, + height: 37, + child: Container( + alignment: Alignment.centerRight, + child: DynamicValuePicker( + context, + sensorSettings.frequencyOptionsBLE, + sensorSettings.selectedOptionBLE, + (newValue) { + sensorSettings.updateSelectedBLEOption(newValue); + }, + Provider.of(context).connected, + sensorSettings.isFakeDisabledBLE, + ), ), ), ), - ), - SizedBox(width: 4), - Container( - decoration: BoxDecoration( - color: Provider.of(context).connected - ? Colors.white - : Colors.grey, - borderRadius: BorderRadius.circular(4.0), - ), - child: SizedBox( - width: 75, - height: 37, - child: Container( - alignment: Alignment.centerRight, - child: DynamicValuePicker( - context, - sensorSettings.frequencyOptionsSD, - sensorSettings.selectedOptionSD, - (newValue) { - sensorSettings.updateSelectedSDOption(newValue); - }, - Provider.of(context).connected, - sensorSettings.isFakeDisabledSD, + SizedBox(width: 4), + Container( + decoration: BoxDecoration( + color: Provider.of(context).connected + ? Colors.white + : Colors.grey, + borderRadius: BorderRadius.circular(4.0), + ), + child: SizedBox( + width: 80, + height: 37, + child: Container( + alignment: Alignment.centerRight, + child: DynamicValuePicker( + context, + sensorSettings.frequencyOptionsSD, + sensorSettings.selectedOptionSD, + (newValue) { + sensorSettings.updateSelectedSDOption(newValue); + }, + Provider.of(context).connected, + sensorSettings.isFakeDisabledSD, + ), ), ), ), - ), - SizedBox(width: 4), - Text("Hz", style: TextStyle(color: Color.fromRGBO(168, 168, 172, 1.0))), - ], + SizedBox(width: 4), + Text( + "Hz", + style: TextStyle(color: Color.fromRGBO(168, 168, 172, 1.0)), + ), + ], + ), ); }