Skip to content

feat: added layout for the Wave Generator screen #2803

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

Merged
merged 6 commits into from
Aug 9, 2025

Conversation

AsCress
Copy link
Collaborator

@AsCress AsCress commented Jul 23, 2025

Adds the layout for the Wave Generator instrument screen.

Screenshots

Screenshot_20250809_200232 Screenshot_20250809_200250

Summary by Sourcery

Add Wave Generator instrument screen with route registration and navigation support

New Features:

  • Add WaveGeneratorScreen widget stub
  • Register '/waveGenerator' route in the application router
  • Integrate Wave Generator navigation case in InstrumentsScreen menu

Summary by Sourcery

Add the Wave Generator instrument screen layout with navigation integration and localization support

New Features:

  • Add localization entries for analog, digital, wave and control labels
  • Introduce WaveGeneratorScreen with supporting route in the application router
  • Implement analog/digital waveform controls, main controls and graph widgets
  • Integrate Wave Generator option into the InstrumentsScreen navigation menu

@AsCress AsCress self-assigned this Jul 23, 2025
@AsCress AsCress added Feature New addition to the existing app flutter labels Jul 23, 2025
Copy link
Contributor

sourcery-ai bot commented Jul 23, 2025

Reviewer's Guide

Introduces a Wave Generator instrument screen by registering its route, extending localizations, and adding stub widgets for the UI layout including controls and graph rendering.

File-Level Changes

Change Details Files
Localization enhancements for Wave Generator
  • Added getters for analog, digital, wave1/wave2, sqr1–sqr4, freq, phase, duty, produceSound in AppLocalizations
  • Provided corresponding English translations
  • Included new entries in the app_en.arb resource file
lib/l10n/app_localizations.dart
lib/l10n/app_localizations_en.dart
lib/l10n/app_en.arb
Route registration and navigation logic
  • Imported WaveGeneratorScreen in main.dart
  • Registered '/waveGenerator' route alongside existing instrument screens
  • Extended InstrumentsScreen to navigate to the new route on menu selection
lib/main.dart
lib/view/instruments_screen.dart
Wave Generator screen implementation
  • Created WaveGeneratorScreen with CommonScaffold wrapper
  • Structured the body into graph view, waveform controls, toggle buttons, and main controls
lib/view/wave_generator_screen.dart
New widget stubs for controls and graph
  • Added DigitalWaveformControls and AnalogWaveformControls for selecting wave types
  • Added WaveGeneratorMainControls for slider navigation and parameter display
  • Added WaveGeneratorGraph using fl_chart for waveform plotting
lib/view/widgets/digital_waveform_controls.dart
lib/view/widgets/analog_waveform_controls.dart
lib/view/widgets/wave_generator_main_controls.dart
lib/view/widgets/wave_generator_graph.dart

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

github-actions bot commented Jul 23, 2025

@AsCress AsCress changed the title feat: added Wave Generator screen feat: added layout for the Wave Generator screen Aug 9, 2025
@AsCress AsCress marked this pull request as ready for review August 9, 2025 14:37
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @AsCress - I've reviewed your changes - here's some feedback:

  • You have a lot of repeated button‐styling code in AnalogWaveformControls and DigitalWaveformControls—consider extracting a reusable widget or generating the buttons from a configuration list to reduce duplication.
  • There are several hard-coded English strings (e.g. ‘Wave Generator’, ‘Sine’, ‘Frequency’, ‘Phase Offset’) that should be pulled into your localization ARB files and referenced via AppLocalizations.
  • Instead of grabbing AppLocalizations from getIt in your state class, use AppLocalizations.of(context) in build() so the UI properly updates when the app locale changes.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- You have a lot of repeated button‐styling code in AnalogWaveformControls and DigitalWaveformControls—consider extracting a reusable widget or generating the buttons from a configuration list to reduce duplication.
- There are several hard-coded English strings (e.g. ‘Wave Generator’, ‘Sine’, ‘Frequency’, ‘Phase Offset’) that should be pulled into your localization ARB files and referenced via AppLocalizations.
- Instead of grabbing AppLocalizations from getIt in your state class, use AppLocalizations.of(context) in build() so the UI properly updates when the app locale changes.

## Individual Comments

### Comment 1
<location> `lib/view/widgets/wave_generator_main_controls.dart:125` </location>
<code_context>
+                  width: 30,
+                  child: IconButton.filled(
+                    padding: EdgeInsets.zero,
+                    icon: Icon(Icons.chevron_left),
+                    onPressed: () async {},
+                    style: IconButton.styleFrom(
+                      backgroundColor: primaryRed,
</code_context>

<issue_to_address>
Empty onPressed for navigation buttons may confuse users.

If these buttons are placeholders, disable them or add a TODO to clarify their purpose.
</issue_to_address>

<suggested_fix>
<<<<<<< SEARCH
                  child: IconButton.filled(
                    padding: EdgeInsets.zero,
                    icon: Icon(Icons.chevron_left),
                    onPressed: () async {},
                    style: IconButton.styleFrom(
                      backgroundColor: primaryRed,
                      shape: RoundedRectangleBorder(
                        borderRadius: BorderRadius.circular(4),
                      ),
                    ),
                  ),
=======
                  // TODO: Implement navigation logic for chevron_left button
                  child: IconButton.filled(
                    padding: EdgeInsets.zero,
                    icon: Icon(Icons.chevron_left),
                    onPressed: null, // Disabled until implemented
                    style: IconButton.styleFrom(
                      backgroundColor: primaryRed,
                      shape: RoundedRectangleBorder(
                        borderRadius: BorderRadius.circular(4),
                      ),
                    ),
                  ),
>>>>>>> REPLACE

</suggested_fix>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@AsCress
Copy link
Collaborator Author

AsCress commented Aug 9, 2025

@CloudyPadmal @marcnause We can merge this without worrying about the hardcoding again. The changes associated with the Wave Generator instrument are quite large so I'm pushing in parts. This PR would be followed up by another one which would add all the functionality.

@marcnause marcnause merged commit 198a5ec into fossasia:flutter Aug 9, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature New addition to the existing app flutter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants