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

style: refactor build leading function style, width, and padding parameters for custom node leading builder #2182

Merged
merged 3 commits into from
Sep 5, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 29 additions & 24 deletions lib/src/editor/widgets/text/text_block.dart
Original file line number Diff line number Diff line change
Expand Up @@ -269,30 +269,35 @@ class EditableTextBlock extends StatelessWidget {
index: isOrdered || isCodeBlock ? index : null,
count: count,
enabled: !isCheck ? null : !(checkBoxReadOnly ?? readOnly),
style: isOrdered
? defaultStyles.leading!.style.copyWith(
fontSize: size,
color: context.quillEditorElementOptions?.orderedList
.useTextColorForDot ==
true
? fontColor
: null,
)
: isUnordered
? defaultStyles.leading!.style.copyWith(
fontWeight: FontWeight.bold,
fontSize: size,
color: context.quillEditorElementOptions?.unorderedList
.useTextColorForDot ==
true
? fontColor
: null,
)
: isCheck
? null
: defaultStyles.code!.style.copyWith(
color: defaultStyles.code!.style.color!.withOpacity(0.4),
),
style: () {
if (isOrdered) {
return defaultStyles.leading!.style.copyWith(
fontSize: size,
color: context.quillEditorElementOptions?.orderedList
.useTextColorForDot ==
true
? fontColor
: null,
);
}
if (isUnordered) {
return defaultStyles.leading!.style.copyWith(
fontWeight: FontWeight.bold,
fontSize: size,
color: context.quillEditorElementOptions?.unorderedList
.useTextColorForDot ==
true
? fontColor
: null,
);
}
if (isCheck) {
return null;
}
return defaultStyles.code!.style.copyWith(
color: defaultStyles.code!.style.color!.withOpacity(0.4),
);
}(),
width: isOrdered || isCodeBlock
EchoEllet marked this conversation as resolved.
Show resolved Hide resolved
? numberPointWidthBuilder(fontSize, count)
: isUnordered
Expand Down