Skip to content

Commit 099d342

Browse files
committed
style(discovery): improve m3 ux of scan progress
- Moved the Start/Stop Scan button to a permanent `bottomBar` surface so it is always accessible without scrolling. - Automatically collapse the configuration UI (Preset picker and Dwell time picker) when a scan begins, immediately bringing the 'Scan Progress' card to the top of the screen.
1 parent 1f7c579 commit 099d342

1 file changed

Lines changed: 38 additions & 27 deletions

File tree

feature/discovery/src/commonMain/kotlin/org/meshtastic/feature/discovery/ui/DiscoveryScanScreen.kt

Lines changed: 38 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -108,45 +108,56 @@ fun DiscoveryScanScreen(
108108
},
109109
)
110110
},
111+
bottomBar = {
112+
androidx.compose.material3.Surface(
113+
modifier = Modifier.fillMaxWidth(),
114+
color = MaterialTheme.colorScheme.surface,
115+
tonalElevation = 8.dp,
116+
shadowElevation = 8.dp,
117+
) {
118+
androidx.compose.foundation.layout.Box(
119+
modifier = Modifier.padding(horizontal = CONTENT_PADDING, vertical = 16.dp),
120+
) {
121+
ScanButton(
122+
scanState = scanState,
123+
isConnected = isConnected,
124+
hasPresetsSelected = selectedPresets.isNotEmpty(),
125+
onStart = viewModel::startScan,
126+
onStop = viewModel::stopScan,
127+
)
128+
}
129+
}
130+
},
111131
) { padding ->
112132
val isScanning = scanState !is DiscoveryScanState.Idle
113133
LazyColumn(
114134
contentPadding = padding,
115135
verticalArrangement = Arrangement.spacedBy(SECTION_SPACING),
116-
modifier = Modifier.fillMaxSize().padding(horizontal = CONTENT_PADDING),
136+
modifier = Modifier.fillMaxSize().padding(horizontal = CONTENT_PADDING).padding(top = SECTION_SPACING),
117137
) {
118138
// Connection warning
119139
if (!isConnected) {
120140
item(key = "connection_warning") { ConnectionWarningCard() }
121141
}
122142

123-
// Preset picker
124-
item(key = "preset_picker") {
125-
PresetPickerCard(
126-
selectedPresets = selectedPresets,
127-
onTogglePreset = viewModel::togglePreset,
128-
enabled = !isScanning,
129-
)
130-
}
131-
132-
// Dwell time picker
133-
item(key = "dwell_picker") {
134-
DwellTimePicker(
135-
selectedMinutes = dwellMinutes,
136-
onMinutesSelected = viewModel::setDwellDuration,
137-
enabled = !isScanning,
138-
)
139-
}
143+
if (!isScanning) {
144+
// Preset picker
145+
item(key = "preset_picker") {
146+
PresetPickerCard(
147+
selectedPresets = selectedPresets,
148+
onTogglePreset = viewModel::togglePreset,
149+
enabled = true,
150+
)
151+
}
140152

141-
// Start / Stop button
142-
item(key = "scan_button") {
143-
ScanButton(
144-
scanState = scanState,
145-
isConnected = isConnected,
146-
hasPresetsSelected = selectedPresets.isNotEmpty(),
147-
onStart = viewModel::startScan,
148-
onStop = viewModel::stopScan,
149-
)
153+
// Dwell time picker
154+
item(key = "dwell_picker") {
155+
DwellTimePicker(
156+
selectedMinutes = dwellMinutes,
157+
onMinutesSelected = viewModel::setDwellDuration,
158+
enabled = true,
159+
)
160+
}
150161
}
151162

152163
// Scan progress section

0 commit comments

Comments
 (0)