ref: add `VerticalSpacing.zero` and `HorizontalSpacing.zero` named constants (#2083)

* feat: add named constants to HorizontalSpacing/VerticalSpacing

* ref: use VerticalSpacing.zero across code
pull/2086/head v10.1.5
Adil Hanney 8 months ago committed by GitHub
parent 9a7421a53b
commit e11af21fba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      example/lib/screens/quill/my_quill_editor.dart
  2. 2
      lib/src/common/structs/horizontal_spacing.dart
  3. 2
      lib/src/common/structs/vertical_spacing.dart
  4. 4
      lib/src/editor/raw_editor/raw_editor_state.dart
  5. 46
      lib/src/editor/widgets/default_styles.dart

@ -54,9 +54,9 @@ class MyQuillEditor extends StatelessWidget {
height: 1.15,
fontWeight: FontWeight.w300,
),
const HorizontalSpacing(0, 0),
HorizontalSpacing.zero,
const VerticalSpacing(16, 0),
const VerticalSpacing(0, 0),
VerticalSpacing.zero,
null,
),
sizeSmall: defaultTextStyle.style.copyWith(fontSize: 9),

@ -9,4 +9,6 @@ class HorizontalSpacing {
final double left;
final double right;
static const zero = HorizontalSpacing(0, 0);
}

@ -9,4 +9,6 @@ class VerticalSpacing {
final double top;
final double bottom;
static const zero = VerticalSpacing(0, 0);
}

@ -1145,7 +1145,7 @@ class QuillRawEditorState extends EditorState
} else if (attrs.containsKey(Attribute.align.key)) {
return defaultStyles!.align!.horizontalSpacing;
}
return const HorizontalSpacing(0, 0);
return HorizontalSpacing.zero;
}
VerticalSpacing _getVerticalSpacingForBlock(
@ -1162,7 +1162,7 @@ class QuillRawEditorState extends EditorState
} else if (attrs.containsKey(Attribute.align.key)) {
return defaultStyles!.align!.verticalSpacing;
}
return const VerticalSpacing(0, 0);
return VerticalSpacing.zero;
}
void _didChangeTextEditingValueListener() {

@ -271,7 +271,7 @@ class DefaultStyles {
),
baseHorizontalSpacing,
const VerticalSpacing(16, 0),
const VerticalSpacing(0, 0),
VerticalSpacing.zero,
null),
h2: DefaultTextBlockStyle(
defaultTextStyle.style.copyWith(
@ -284,7 +284,7 @@ class DefaultStyles {
),
baseHorizontalSpacing,
const VerticalSpacing(8, 0),
const VerticalSpacing(0, 0),
VerticalSpacing.zero,
null),
h3: DefaultTextBlockStyle(
defaultTextStyle.style.copyWith(
@ -297,7 +297,7 @@ class DefaultStyles {
),
baseHorizontalSpacing,
const VerticalSpacing(8, 0),
const VerticalSpacing(0, 0),
VerticalSpacing.zero,
null,
),
h4: DefaultTextBlockStyle(
@ -311,7 +311,7 @@ class DefaultStyles {
),
baseHorizontalSpacing,
const VerticalSpacing(6, 0),
const VerticalSpacing(0, 0),
VerticalSpacing.zero,
null,
),
h5: DefaultTextBlockStyle(
@ -325,7 +325,7 @@ class DefaultStyles {
),
baseHorizontalSpacing,
const VerticalSpacing(6, 0),
const VerticalSpacing(0, 0),
VerticalSpacing.zero,
null,
),
h6: DefaultTextBlockStyle(
@ -339,42 +339,42 @@ class DefaultStyles {
),
baseHorizontalSpacing,
const VerticalSpacing(4, 0),
const VerticalSpacing(0, 0),
VerticalSpacing.zero,
null,
),
lineHeightNormal: DefaultTextBlockStyle(
baseStyle.copyWith(height: 1.15),
baseHorizontalSpacing,
const VerticalSpacing(0, 0),
const VerticalSpacing(0, 0),
VerticalSpacing.zero,
VerticalSpacing.zero,
null,
),
lineHeightTight: DefaultTextBlockStyle(
baseStyle.copyWith(height: 1.30),
baseHorizontalSpacing,
const VerticalSpacing(0, 0),
const VerticalSpacing(0, 0),
VerticalSpacing.zero,
VerticalSpacing.zero,
null,
),
lineHeightOneAndHalf: DefaultTextBlockStyle(
baseStyle.copyWith(height: 1.55),
baseHorizontalSpacing,
const VerticalSpacing(0, 0),
const VerticalSpacing(0, 0),
VerticalSpacing.zero,
VerticalSpacing.zero,
null,
),
lineHeightDouble: DefaultTextBlockStyle(
baseStyle.copyWith(height: 2),
baseHorizontalSpacing,
const VerticalSpacing(0, 0),
const VerticalSpacing(0, 0),
VerticalSpacing.zero,
VerticalSpacing.zero,
null,
),
paragraph: DefaultTextBlockStyle(
baseStyle,
baseHorizontalSpacing,
const VerticalSpacing(0, 0),
const VerticalSpacing(0, 0),
VerticalSpacing.zero,
VerticalSpacing.zero,
null,
),
bold: const TextStyle(fontWeight: FontWeight.bold),
@ -422,8 +422,8 @@ class DefaultStyles {
color: Colors.grey.withOpacity(0.6),
),
baseHorizontalSpacing,
const VerticalSpacing(0, 0),
const VerticalSpacing(0, 0),
VerticalSpacing.zero,
VerticalSpacing.zero,
null),
lists: DefaultListBlockStyle(
baseStyle,
@ -453,7 +453,7 @@ class DefaultStyles {
),
baseHorizontalSpacing,
baseVerticalSpacing,
const VerticalSpacing(0, 0),
VerticalSpacing.zero,
BoxDecoration(
color: Colors.grey.shade50,
borderRadius: BorderRadius.circular(2),
@ -468,15 +468,15 @@ class DefaultStyles {
align: DefaultTextBlockStyle(
baseStyle,
baseHorizontalSpacing,
const VerticalSpacing(0, 0),
const VerticalSpacing(0, 0),
VerticalSpacing.zero,
VerticalSpacing.zero,
null,
),
leading: DefaultTextBlockStyle(
baseStyle,
baseHorizontalSpacing,
const VerticalSpacing(0, 0),
const VerticalSpacing(0, 0),
VerticalSpacing.zero,
VerticalSpacing.zero,
null,
),
sizeSmall: const TextStyle(fontSize: 10),

Loading…
Cancel
Save