Skip to content
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

feat(flutter): pre-defined response formats #7128

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

richardshiue
Copy link
Collaborator

Desktop:

input:
Screenshot 2025-01-02 at 7 59 50 PM

regenerate:
Screenshot 2025-01-02 at 7 59 13 PM

Mobile:

input:
Screenshot 2025-01-02 at 8 01 47 PM

regenerate:
Screenshot 2025-01-02 at 8 01 22 PM

Feature Preview


PR Checklist

  • My code adheres to AppFlowy's Conventions
  • I've listed at least one issue that this PR fixes in the description above.
  • I've added a test(s) to validate changes in this PR, or this PR only contains semantic changes.
  • All existing tests are passing.

Copy link

github-actions bot commented Jan 2, 2025

🥷 Ninja i18n – 🛎️ Translations need to be updated

Project /project.inlang

lint rule new reports level link
Missing translation 420 warning contribute (via Fink 🐦)

Copy link

codecov bot commented Jan 2, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 57.62%. Comparing base (5121138) to head (6361147).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7128      +/-   ##
==========================================
- Coverage   57.69%   57.62%   -0.08%     
==========================================
  Files         320      320              
  Lines       14057    14057              
  Branches     2039     2039              
==========================================
- Hits         8110     8100      -10     
- Misses       5683     5694      +11     
+ Partials      264      263       -1     
Flag Coverage Δ
appflowy_web_app 57.62% <ø> (-0.08%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@richardshiue richardshiue force-pushed the feat/pre-defined-formats branch from 4092970 to cb81747 Compare January 2, 2025 12:17
@richardshiue richardshiue changed the title feat: pre-defined response formats feat(flutter): pre-defined response formats Jan 3, 2025
@richardshiue richardshiue force-pushed the feat/pre-defined-formats branch from 5b75bdb to c9bca30 Compare January 3, 2025 02:12
@richardshiue richardshiue force-pushed the feat/pre-defined-formats branch from 7e4baa7 to dc0e491 Compare January 3, 2025 10:31
Copy link
Contributor

@Xazin Xazin left a comment

Choose a reason for hiding this comment

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

👍

TextFormat.bulletList => ResponseTextFormatPB.BulletedList,
TextFormat.numberedList => ResponseTextFormatPB.NumberedList,
TextFormat.table => ResponseTextFormatPB.Table,
null => null
Copy link
Contributor

@Xazin Xazin Jan 4, 2025

Choose a reason for hiding this comment

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

I understand the sentiment, but might as well be a default case no? _ => null

I guess it's not important, this way you get a warning I suppose when you add a new TextFormat.

Comment on lines +168 to +170
setState(() {
predefinedFormat = format;
});
Copy link
Contributor

Choose a reason for hiding this comment

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

\nit

Suggested change
setState(() {
predefinedFormat = format;
});
setState(() => predefinedFormat = format);

Comment on lines +258 to +262
if (showPredefinedFormatSection) {
widget.onSubmitted(trimmedText, predefinedFormat, metadata);
} else {
widget.onSubmitted(trimmedText, null, metadata);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (showPredefinedFormatSection) {
widget.onSubmitted(trimmedText, predefinedFormat, metadata);
} else {
widget.onSubmitted(trimmedText, null, metadata);
}
widget.onSubmitted(trimmedText, showPredefinedFormatSection ? predefinedFormat : null, metadata);

this.hintText = "",
// this.onStartMentioningPage,
Copy link
Contributor

Choose a reason for hiding this comment

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

remove?

final String hintText;
// final void Function()? onStartMentioningPage;
Copy link
Contributor

Choose a reason for hiding this comment

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

remove?

Comment on lines +139 to +141
setState(() {
predefinedFormat = format;
});
Copy link
Contributor

Choose a reason for hiding this comment

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

\nit

Suggested change
setState(() {
predefinedFormat = format;
});
setState(() => predefinedFormat = format);

child: _LeadingActions(
textController: textController,
// onMention: () {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we remove if we don't need this?

child: FlowySvg(
format.icon,
size: format == ImageFormat.textAndImage
? Size(21.0 / 16.0 * iconSize, iconSize)
Copy link
Contributor

Choose a reason for hiding this comment

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

This way of calculating the height seems scary haha.

Mobile: 26.25 if IconSize is 20
Desktop: 21 if IconSize is 16

Feels like black magic 😂

leftIcon: FlowySvg(
format.icon,
size: format == ImageFormat.textAndImage
? const Size(21.0 / 16.0 * 20, 20)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
? const Size(21.0 / 16.0 * 20, 20)
? const Size(26.25, 20)

This value is a bit odd, but there's no need to have a calculation here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants