-
Notifications
You must be signed in to change notification settings - Fork 856
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 BoxDecoration for DefaultTextBlockStyle of header Attribute #2438
base: master
Are you sure you want to change the base?
Conversation
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.
Thank you for your contribution.
Unfortunately, we can't accept PRs that change too much to add new features as explained in the contributing guide, mainly because we have too many issues, and regressions and we don't have a good coverage.
line, | ||
_buildLeading( | ||
context: context, | ||
line: line, | ||
index: index, | ||
indentLevelCounts: indentLevelCounts, | ||
count: count, |
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.
Could you minimize the changes and remove any formatting or changes that not related to this functionality, reverting the changes to the example and sample data json, mainly because we want a cleaner commit history that's organized and also to avoid any possible regressions.
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.
example/lib/main.dart
Outdated
customStyles: DefaultStyles( | ||
h1: DefaultTextBlockStyle( | ||
DefaultTextStyle.of(context).style.copyWith( | ||
fontSize: 34, | ||
color: DefaultTextStyle.of(context).style.color, | ||
letterSpacing: -0.5, | ||
height: 1.083, | ||
fontWeight: FontWeight.bold, | ||
decoration: TextDecoration.none, | ||
), | ||
HorizontalSpacing(16, 16), | ||
const VerticalSpacing(16, 16), | ||
VerticalSpacing.zero, | ||
BoxDecoration( | ||
border: Border.all( | ||
width: 3, | ||
color: Colors.red, | ||
), | ||
)), | ||
h2: DefaultTextBlockStyle( | ||
DefaultTextStyle.of(context).style.copyWith( | ||
fontSize: 30, | ||
color: DefaultTextStyle.of(context).style.color, | ||
letterSpacing: -0.8, | ||
height: 1.067, | ||
fontWeight: FontWeight.bold, | ||
decoration: TextDecoration.none, | ||
), | ||
HorizontalSpacing(8, 8), | ||
const VerticalSpacing(8, 8), | ||
VerticalSpacing.zero, | ||
BoxDecoration( | ||
border: Border.all( | ||
width: 3, | ||
color: Colors.blue, | ||
), | ||
)), | ||
h3: DefaultTextBlockStyle( | ||
DefaultTextStyle.of(context).style.copyWith( | ||
fontSize: 24, | ||
color: DefaultTextStyle.of(context).style.color, | ||
letterSpacing: -0.5, | ||
height: 1.083, | ||
fontWeight: FontWeight.bold, | ||
decoration: TextDecoration.none, | ||
), | ||
HorizontalSpacing(8, 8), | ||
const VerticalSpacing(8, 8), | ||
VerticalSpacing.zero, | ||
BoxDecoration( | ||
border: Border.all( | ||
width: 3, | ||
color: Colors.green, | ||
), | ||
)), | ||
), |
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.
The example should be minimal without much configuration.
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.
@EchoEllet
thank you for your review.
I have fixed
d9c6a7b
example/lib/quill_delta_sample.dart
Outdated
@@ -9,6 +9,7 @@ const kQuillDefaultSample = [ | |||
'style': 'width:500px; height:350px;' | |||
} | |||
}, | |||
{"insert": "\n"}, |
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.
Should be reverted as it's unrelated.
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.
@EchoEllet
thank you for your review.
I have fixed
d9c6a7b
example/lib/main.dart
Outdated
color: Colors.blue, | ||
), | ||
)), | ||
), |
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.
The example should not be edited and remain minimal, we don't want to use all features with complex code in the example, it's confusing and doesn't help users to get started by documenting all possible features without much organization, we did this with the previous example, instead any code snippets sample should be somewhere else (other than README.md
, like in the doc
directory).
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.
if (decoration != null) { | ||
final paintRect = offset & size; | ||
decoration!.createBoxPainter().paint( |
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.
Please avoid using the null assertion operator (!
), instead:
fix boxDecoration = decoration;
if (boxDecoration != null) {
boxDecoration.createBoxPainter();
// ...
}
Our codebase extensively uses this and we're trying to avoid it for future code.
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.
@EchoEllet
I have fixed it.
Description
Add support for BoxDecoration in DefaultTextBlockStyle for the header attribute. This allows developers to customize headers with borders, background colors, and other styles. Related to #2428.
Related Issues
Type of Change