-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
zoli
wants to merge
6
commits into
AppFlowy-IO:main
Choose a base branch
from
zoli:feat/board-text-direction
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
7d76b24
feat: enable direction for card title, group column header
zoli 23ea1be
build: updated appflowy_editor to use latest
zoli daa550f
style: merge main resolve conflict
zoli 1e7f385
style: Merge branch 'main' into feat/board-text-direction
zoli 4dd1684
style: Merge branch 'main' into feat/board-text-direction
zoli e9951c7
style: merge main
zoli File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
import 'dart:ui' as ui; | ||
import 'package:flutter/foundation.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter/services.dart'; | ||
|
@@ -8,6 +9,7 @@ import 'package:appflowy/plugins/database/application/cell/bloc/text_cell_bloc.d | |
import 'package:appflowy/plugins/database/application/cell/cell_controller.dart'; | ||
import 'package:appflowy/plugins/database/application/cell/cell_controller_builder.dart'; | ||
import 'package:appflowy/plugins/database/application/database_controller.dart'; | ||
import 'package:appflowy/util/text_direction.dart'; | ||
import 'package:easy_localization/easy_localization.dart'; | ||
import 'package:flowy_infra_ui/flowy_infra_ui.dart'; | ||
import 'package:flutter_bloc/flutter_bloc.dart'; | ||
|
@@ -181,12 +183,25 @@ class _TextCellState extends State<TextCardCell> { | |
); | ||
} | ||
|
||
ui.TextDirection? lastDirection; | ||
|
||
Widget _buildTitle() { | ||
final textField = _buildTextField(); | ||
return BlocBuilder<TextCellBloc, TextCellState>( | ||
builder: (context, state) { | ||
final text = _textEditingController.text.isNotEmpty | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about setting |
||
? _textEditingController.text | ||
: LocaleKeys.grid_row_titlePlaceholder.tr(); | ||
lastDirection = getTextDirectionBaseOnContext( | ||
context, | ||
text, | ||
lastDirection: lastDirection, | ||
); | ||
|
||
final icon = _buildIcon(state); | ||
final textField = _buildTextField(lastDirection!); | ||
|
||
return Row( | ||
textDirection: lastDirection, | ||
children: [ | ||
if (icon != null) ...[ | ||
icon, | ||
|
@@ -199,7 +214,7 @@ class _TextCellState extends State<TextCardCell> { | |
); | ||
} | ||
|
||
Widget _buildTextField() { | ||
Widget _buildTextField(ui.TextDirection lastDirection) { | ||
return BlocSelector<TextCellBloc, TextCellState, bool>( | ||
selector: (state) => state.enableEdit, | ||
builder: (context, isEditing) { | ||
|
@@ -214,6 +229,7 @@ class _TextCellState extends State<TextCardCell> { | |
}, | ||
child: TextField( | ||
controller: _textEditingController, | ||
textDirection: lastDirection, | ||
focusNode: focusNode, | ||
onEditingComplete: () => focusNode.unfocus(), | ||
onSubmitted: (_) => focusNode.unfocus(), | ||
|
@@ -231,6 +247,7 @@ class _TextCellState extends State<TextCardCell> { | |
isDense: true, | ||
isCollapsed: true, | ||
hintText: LocaleKeys.grid_row_titlePlaceholder.tr(), | ||
hintTextDirection: lastDirection, | ||
hintStyle: widget.style.titleTextStyle.copyWith( | ||
color: Theme.of(context).hintColor, | ||
), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Using
_
(single underscore).