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: enable direction for card title, group column header #5429

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

Conversation

zoli
Copy link
Contributor

@zoli zoli commented May 28, 2024

resolves #5387

This depends on AppFlowy-IO/appflowy-editor#809.

Feature Preview

appflowy-board-auto-direction.webm

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.

@LucasXu0
Copy link
Collaborator

This depends on AppFlowy-IO/appflowy-editor#809.

Hi, @zoli. The PR has been merged.

zoli added 4 commits May 29, 2024 11:46
* main: (52 commits)
  chore: improve popup menu color (AppFlowy-IO#5725)
  fix: ai chat result contains html escape text (AppFlowy-IO#5721)
  chore: bump version 0.6.4 (AppFlowy-IO#5719)
  feat: support sign-in and sign-up on Web (AppFlowy-IO#5712)
  fix: syntax error when generating translation files (AppFlowy-IO#5718)
  feat: choose cursor/selection color from palette or color picker AppFlowy-IO#5041 (AppFlowy-IO#5677)
  feat: render ai text message with appflowy_editor (AppFlowy-IO#5682)
  feat: enable debug logs in internal build (AppFlowy-IO#5713)
  chore: update yrs and appflowy collab dependencies (AppFlowy-IO#5707)
  chore: bump version 0.6.3 (AppFlowy-IO#5701)
  feat: support publish document (AppFlowy-IO#5576)
  refactor: extract chat plugin to new repo (AppFlowy-IO#5699)
  fix: take the max value of the keyboard height and the view insets bottom to make the toolbar visible  (AppFlowy-IO#5700)
  chore: use latest macos runner to build the release package (AppFlowy-IO#5686)
  fix: filter chat page when duplicating (AppFlowy-IO#5676)
  chore: show ai service error (AppFlowy-IO#5675)
  feat: sync the created view after duplicating (AppFlowy-IO#5674)
  chore: disable cloud search (AppFlowy-IO#5663)
  feat: support moving page to a space (AppFlowy-IO#5665)
  chore: update German translations (AppFlowy-IO#5640)
  ...
* main:
  fix: integration test failed (grid row detail page: hide and show hidden fields) (AppFlowy-IO#5781)
  feat: ai billing (AppFlowy-IO#5741)
  fix: can not display rows when rows overthan 1000 (AppFlowy-IO#5777)
  feat: support publish database on web (AppFlowy-IO#5748)
  feat: publish databse to Web (AppFlowy-IO#5709)
  chore: update Spanish translations (AppFlowy-IO#5742)
  chore: update Chinese translations (AppFlowy-IO#5727)
  fix: Add retry for admin client sign in for test (AppFlowy-IO#5767)
  chore: update Hebrew translation (AppFlowy-IO#5738)
  chore: update German translations (AppFlowy-IO#5722)
  chore: update Russian translations (AppFlowy-IO#5730)
  chore: update build config (AppFlowy-IO#5759)
  chore: enable local ai and local ai chat (AppFlowy-IO#5755)
  chore: bump version 0.6.4 (AppFlowy-IO#5744)
  fix: improve color selector (AppFlowy-IO#5743)
  fix: reset space relationship when clearing cache (AppFlowy-IO#5737)
  chore: show plugin state (AppFlowy-IO#5740)
  chore: download llm files (AppFlowy-IO#5723)
  feat: optimize the read recent views speed (AppFlowy-IO#5726)
  chore: fix compile (AppFlowy-IO#5733)
@Xazin Xazin requested a review from LucasXu0 August 2, 2024 14:01
import 'package:appflowy/workspace/application/settings/appearance/appearance_cubit.dart';
import 'package:appflowy_editor/appflowy_editor.dart';

TextDirection getTextDirectionBaseOnContext(
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would suggest adding these functions to the BuildContext extension to allow easy accessibility.

emoji: state.rowMeta.icon,
showEmojiPicker: () => popoverController.show(),
Widget? emojiWidget, child;
if (state.rowMeta.icon.isNotEmpty) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

The widget builder logic is not clear here. It's not good for maintenance.

return BlocBuilder<TextCellBloc, TextCellState>(
builder: (context, state) {
final text = _textEditingController.text.isNotEmpty
Copy link
Collaborator

Choose a reason for hiding this comment

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

How about setting LocaleKeys.grid_row_titlePlaceholder.tr() as the hint text instead of the text?

color: Theme.of(context).colorScheme.primary,
return ValueListenableBuilder(
valueListenable: _controller,
builder: (context, TextEditingValue value, __) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Using _ (single underscore).

Comment on lines 291 to 299
class _TitleSkin extends IEditableTextCellSkin {
_TitleSkin({this.emojiWidget});

final Widget? emojiWidget;
ui.TextDirection? lastDirection;

@override
Widget build(
BuildContext context,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure I like this.

Auto bidi is okay for text fields, but if we want to reverse the positioning of widgets in a row, the user should choose RTL from the settings. Otherwise, there are too many changes that we need to do throughout the entire application.

Comment on lines +314 to +323
final cText = c.content.isNotEmpty
? c.content
: LocaleKeys.grid_row_titlePlaceholder.tr();
final cTextDirection = getTextDirectionBaseOnContext(
context,
cText,
lastDirection: lastDirection,
);

return lastDirection != cTextDirection;
Copy link
Collaborator

Choose a reason for hiding this comment

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

We can't rely on the text in the bloc state. We might be only saving the text upon submission, so this won't react quickly enough. A better direction will be listening to the text editing controller like you've done in other places

@LucasXu0 LucasXu0 removed the v0.7.2 label Oct 17, 2024
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.

[FR] RTL & AUTO direction support in board view
3 participants