-
Notifications
You must be signed in to change notification settings - Fork 814
feat: added Settings screen #2696
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Reviewer's GuideThis PR introduces a new Settings screen for configuring auto-start and export format options, integrates it into the app navigation, and extends the BoardStateProvider to persist these settings and conditionally manage USB auto-connect behavior. Sequence Diagram for Conditional USB Auto-ConnectionsequenceDiagram
participant BSP as BoardStateProvider
participant US as UsbSerial
participant SCL as ScienceLabCommon
BSP->>BSP: initialize()
alt autoStart is true
BSP->>US: usbEventStream.listen(...)
US-->>BSP: UsbEvent.ACTION_USB_ATTACHED
BSP->>BSP: attemptToConnectPSLab()
BSP->>SCL: openDevice()
SCL-->>BSP: pslabIsConnected = true
BSP->>BSP: setPSLabVersionIDs()
else autoStart is false
BSP->>BSP: Skip UsbSerial event listening
end
Sequence Diagram for Updating SettingssequenceDiagram
actor User
participant SS as SettingsScreen
participant BSP as BoardStateProvider
User->>SS: Toggles "Auto Start" checkbox
SS->>BSP: autoStart = (new value)
BSP-->>SS: Notifies listeners (UI updates)
User->>SS: Taps "Export Data Format" list tile
SS->>SS: _showExportFormatDialog()
Note right of SS: Dialog with TXT/CSV options appears
User->>SS: Selects export format (e.g., CSV) in Dialog
SS->>BSP: exportFormat = (selected format)
BSP-->>SS: Notifies listeners (UI updates)
SS->>User: Dialog closes, selection applied
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
@CloudyPadmal @AsCress Could you please review this as well ? |
Build successful. APKs to test: https://github.com/fossasia/pslab-android/actions/runs/15117143419/artifacts/3153025629 |
lib/view/settings_screen.dart
Outdated
ListTile( | ||
title: Text(export), | ||
subtitle: Text( | ||
'Current format is ${GetIt.instance.get<BoardStateProvider>().exportFormat}'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fetch the text from the constant file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@CloudyPadmal Done.
lib/view/settings_screen.dart
Outdated
title: Text(txtFormat), | ||
value: true, | ||
groupValue: isTxtFormatSelected, | ||
activeColor: const Color(0xFFD32F2F), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Create a colors.dart
file in the same directory as the constants.dart
and move all the hard-coded colors to colors.dart
.
Then use those here and rest of this file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your suggestions ! I've implemented this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM @Vidhijain20 !
Adds the Settings screen.
Screenshots / Recordings
Checklist:
strings.xml
,dimens.xml
andcolors.xml
without hard coding any value.strings.xml
,dimens.xml
orcolors.xml
.Summary by Sourcery
Add a new Settings screen to allow users to toggle auto-start behavior and choose export data format, integrate it into the app’s navigation and provider logic.
New Features:
Enhancements: