-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
refactor: rename dialog #8059
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
refactor: rename dialog #8059
Conversation
Reviewer's GuideIntroduces a new flexible text‐field dialog component (AFTextFieldDialog and its showAFTextFieldDialog API), replaces all legacy NavigatorTextFieldDialog usages across the UI and tests, refactors modal header styling to use DefaultTextStyle, and extends AFTextField to support maxLength enforcement. Sequence diagram for the new rename dialogsequenceDiagram
actor User
participant UI as Calling UI Component
participant Func as showAFTextFieldDialog()
participant Dialog as AFTextFieldDialog
participant Navigator
User->>UI: Clicks "Rename"
UI->>Func: Calls with initial value and onConfirm callback
Func->>Navigator: showDialog(builder: AFTextFieldDialog)
activate Dialog
Navigator-->>User: Displays rename dialog
User->>Dialog: Enters new name
User->>Dialog: Clicks "Confirm" button
Dialog->>Dialog: handleConfirm()
Dialog->>UI: Executes onConfirm(newName) callback
Dialog->>Navigator: pop(newName)
deactivate Dialog
Class diagram for the dialog refactoringclassDiagram
direction LR
class NavigatorTextFieldDialog {
<<Removed>>
+String value
+String title
+void Function(String, BuildContext) onConfirm
+bool autoSelectAllText
+int? maxLength
+String? hintText
}
class CreateWorkspaceDialog {
<<Removed>>
+void Function(String) onConfirm
}
class AFTextFieldDialog {
<<Added>>
+String title
+String initialValue
+void Function(String)? onConfirm
+bool selectAll
+int? maxLength
+String? hintText
-TextEditingController textController
+handleConfirm() void
}
class showAFTextFieldDialog {
<<Function>>
+showAFTextFieldDialog(context, title, initialValue, onConfirm) Future~String?~
}
class AFTextField {
<<Modified>>
+int? maxLength
}
class AFModalHeader {
<<Modified>>
+Widget leading
+List~Widget~ trailing
}
CreateWorkspaceDialog --* NavigatorTextFieldDialog : uses
showAFTextFieldDialog ..> AFTextFieldDialog : creates
AFTextFieldDialog "1" *-- "1" AFTextField : uses
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Hey @richardshiue - I've reviewed your changes and they look great!
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `frontend/appflowy_flutter/lib/workspace/presentation/widgets/dialog_v2.dart:112` </location>
<code_context>
+ required String title,
+ required String initialValue,
+ void Function(String)? onConfirm,
+ SimpleAFDialogAction? secondaryAction,
+ bool barrierDismissible = true,
+ bool selectAll = true,
</code_context>
<issue_to_address>
The `secondaryAction` parameter is declared but never used
Consider removing the unused `secondaryAction` parameter or implementing it in the dialog's footer, such as by adding a secondary button.
</issue_to_address>
### Comment 2
<location> `frontend/appflowy_flutter/packages/appflowy_ui/lib/src/component/textfield/textfield.dart:189` </location>
<code_context>
+ autoFocus: true,
+ size: AFTextFieldSize.m,
+ hintText: widget.hintText,
+ maxLength: widget.maxLength,
+ controller: textController,
+ onSubmitted: (_) {
</code_context>
<issue_to_address>
Adding `maxLength` will show a default counter below the field
If you don't want the default counter, set `counterText: ''` or use a custom `buildCounter` in the decoration.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
frontend/appflowy_flutter/lib/workspace/presentation/widgets/dialog_v2.dart
Outdated
Show resolved
Hide resolved
| onChanged: widget.onChanged, | ||
| onSubmitted: widget.onSubmitted, | ||
| autofocus: widget.autoFocus ?? false, | ||
| maxLength: widget.maxLength, |
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.
suggestion: Adding maxLength will show a default counter below the field
If you don't want the default counter, set counterText: '' or use a custom buildCounter in the decoration.
4530781 to
bf38ad3
Compare
bf38ad3 to
30851db
Compare
Feature Preview
PR Checklist