Skip to content

Conversation

@csongorkeller
Copy link
Contributor

@csongorkeller csongorkeller commented Sep 16, 2025

Refined PR Summary

This PR introduces a new VoiceNoteRecorderStyle class and integrates it into the chat input system to provide configurable styling for the waveform recorder component. The changes centralize waveform recorder styling configuration and eliminate hardcoded values.

Changes Made

1. Added VoiceNoteRecorderStyle class (lib/src/styles/waveform_recorder_style.dart)

  • New style class with height, waveColor, and durationTextStyle properties
  • Includes resolve() factory method for handling null checks and fallback values
  • Provides defaultStyle() factory with sensible defaults (height: 48.0, black color)

2. Integrated VoiceNoteRecorderStyle into LlmChatViewStyle

  • Added voiceNoteRecorderStyle property to LlmChatViewStyle
  • Updated resolve() method to handle the new style property
  • Added default style to defaultStyle() factory

3. Updated TextOrAudioInput widget

  • Added voiceNoteRecorderStyle parameter to constructor
  • Replaced hardcoded height: _minInputHeight with height: _voiceNoteRecorderStyle.height!
  • Added waveColor and durationTextStyle properties from the style object
  • Updated constructor documentation

4. Updated ChatInput widget

  • Pass voiceNoteRecorderStyle from _chatStyle to TextOrAudioInput

5. Updated example app

  • Added example VoiceNoteRecorderStyle configuration with custom height (60.0), orange wave color, and custom text style

6. Updated exports

  • Added waveform_recorder_style.dart to lib/src/styles/styles.dart exports

Before/After Comparison

// Before - hardcoded values
WaveformRecorder(
  controller: _waveController,
  height: _minInputHeight,  // hardcoded 48.0
  onRecordingStopped: _onRecordingStopped,
)

// After - configurable styling
WaveformRecorder(
  controller: _waveController,
  height: _voiceNoteRecorderStyle.height!,
  waveColor: _voiceNoteRecorderStyle.waveColor!,
  durationTextStyle: _voiceNoteRecorderStyle.durationTextStyle!,
  onRecordingStopped: _onRecordingStopped,
)

This refactoring improves maintainability by centralizing waveform recorder styling configuration and makes the component more customizable for different use cases.

@google-cla
Copy link

google-cla bot commented Sep 16, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@csongorkeller
Copy link
Contributor Author

I signed the CLA just now

@mit-mit mit-mit requested a review from csells November 17, 2025 23:13
@csells
Copy link
Contributor

csells commented Nov 18, 2025

great. I'll take a look later today.

Copy link
Contributor

@csells csells left a comment

Choose a reason for hiding this comment

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

lgtm

@csells csells merged commit d316c24 into flutter:main Nov 19, 2025
3 checks passed
@csells
Copy link
Contributor

csells commented Nov 19, 2025

nice work @csongorkeller . that was clean code. I'm working on a new release at the moment with a set of fixes, including yours.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants