Skip to content

Commit

Permalink
fix ui issues in sensor_control tab
Browse files Browse the repository at this point in the history
  • Loading branch information
o-bagge committed Nov 15, 2024
1 parent 05c9932 commit 27f8e51
Show file tree
Hide file tree
Showing 3 changed files with 191 additions and 175 deletions.
5 changes: 3 additions & 2 deletions open_earable/lib/controls_tab/views/led_color.dart
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ class _InternalLedColorCardState extends State<_InternalLedColorCard> {
fontWeight: FontWeight.bold,
),
),
SizedBox(height: 8),
Row(
children: [
MouseRegion(
Expand All @@ -244,7 +245,7 @@ class _InternalLedColorCardState extends State<_InternalLedColorCard> {
),
),
),
SizedBox(width: 5),
SizedBox(width: 4),
SizedBox(
width: 66,
height: 36,
Expand All @@ -258,7 +259,7 @@ class _InternalLedColorCardState extends State<_InternalLedColorCard> {
child: Text('Set'),
),
),
SizedBox(width: 5),
SizedBox(width: 4),
SizedBox(
width: 66,
height: 36,
Expand Down
216 changes: 110 additions & 106 deletions open_earable/lib/controls_tab/views/sensor_control/sensor_control.dart
Original file line number Diff line number Diff line change
Expand Up @@ -74,128 +74,132 @@ class _SensorControlCardState extends State<SensorControlCard> {
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,
fontSize: 18.0,
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<SensorSettings>.value(
value: OpenEarableSettingsV2().microphone1Settings,
child: SensorControlRow("Microphone 1"),
),
SizedBox(height: 4),
ChangeNotifierProvider<SensorSettings>.value(
value: OpenEarableSettingsV2().microphone2Settings,
child: SensorControlRow("Microphone 2"),
),
Divider(
color: Color.fromRGBO(168, 168, 172, 1.0),
),
ChangeNotifierProvider<SensorSettings>.value(
value: OpenEarableSettingsV2().imuSettings,
child: SensorControlRow("9-Axis IMU"),
),
SizedBox(height: 4),
ChangeNotifierProvider<SensorSettings>.value(
value: OpenEarableSettingsV2().pulseOximeterSettings,
child: SensorControlRow("Pulse Oximeter\n(Red/Infrared)"),
),
SizedBox(height: 4),
ChangeNotifierProvider<SensorSettings>.value(
value: OpenEarableSettingsV2().vitalsSettings,
child: SensorControlRow("Heart Rate,\nSpO2"),
),
SizedBox(height: 4),
ChangeNotifierProvider<SensorSettings>.value(
value: OpenEarableSettingsV2().opticalTemperatureSettings,
child: SensorControlRow("Optical Temp.\n(Surface)"),
),
SizedBox(height: 4),
ChangeNotifierProvider<SensorSettings>.value(
value: OpenEarableSettingsV2().barometerSettings,
child: SensorControlRow("Pressure,\nTemp. (Ambient)"),
),
SizedBox(height: 8),
Row(
children: [
Expanded(
child: SizedBox(
height: 37,
child: ElevatedButton(
onPressed:
Provider.of<BluetoothController>(context).connected
? _writeSensorConfigs
: null,
style: ElevatedButton.styleFrom(
backgroundColor:
Provider.of<BluetoothController>(context)
.connected
? Theme.of(context).colorScheme.secondary
: Colors.grey,
foregroundColor: Colors.black,
enableFeedback:
Provider.of<BluetoothController>(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<SensorSettings>.value(
value: OpenEarableSettingsV2().microphone1Settings,
child: SensorControlRow("Microphone 1"),
),
SizedBox(height: 4),
ChangeNotifierProvider<SensorSettings>.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<SensorSettings>.value(
value: OpenEarableSettingsV2().imuSettings,
child: SensorControlRow("9-Axis IMU"),
),
SizedBox(height: 4),
ChangeNotifierProvider<SensorSettings>.value(
value: OpenEarableSettingsV2().pulseOximeterSettings,
child: SensorControlRow("Pulse Oximeter\n(Red/Infrared)"),
),
SizedBox(height: 4),
ChangeNotifierProvider<SensorSettings>.value(
value: OpenEarableSettingsV2().vitalsSettings,
child: SensorControlRow("Heart Rate,\nSpO2"),
),
SizedBox(height: 4),
ChangeNotifierProvider<SensorSettings>.value(
value: OpenEarableSettingsV2().opticalTemperatureSettings,
child: SensorControlRow("Optical Temp.\n(Surface)"),
),
SizedBox(height: 4),
ChangeNotifierProvider<SensorSettings>.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<BluetoothController>(context)
.connected
? _writeSensorConfigs
: null,
style: ElevatedButton.styleFrom(
backgroundColor:
Provider.of<BluetoothController>(context)
.connected
? Theme.of(context).colorScheme.secondary
: Colors.grey,
foregroundColor: Colors.black,
enableFeedback:
Provider.of<BluetoothController>(context)
.connected,
),
child: Text("Set Configuration"),
),
child: Text("Set Configuration"),
),
),
),
],
),
],
),
],
)),
],
),
),
);
Expand Down
Loading

0 comments on commit 27f8e51

Please sign in to comment.