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

Always put required named parameters first #115

Merged
merged 1 commit into from
Mar 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ analyzer:
unsafe_html: ignore
linter:
rules:
- always_put_required_named_parameters_first
- avoid_print
2 changes: 1 addition & 1 deletion lib/widgets/default_styles.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ class QuillStyles extends InheritedWidget {
final DefaultStyles data;

QuillStyles({
Key? key,
required this.data,
required Widget child,
Key? key,
}) : super(key: key, child: child);

@override
Expand Down
4 changes: 2 additions & 2 deletions lib/widgets/editor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,14 @@ class QuillEditor extends StatefulWidget {
required this.scrollable,
required this.padding,
required this.autoFocus,
this.showCursor,
required this.readOnly,
required this.expands,
this.showCursor,
this.placeholder,
this.enableInteractiveSelection = true,
this.minHeight,
this.maxHeight,
this.customStyles,
required this.expands,
this.textCapitalization = TextCapitalization.sentences,
this.keyboardAppearance = Brightness.light,
this.scrollPhysics,
Expand Down
12 changes: 6 additions & 6 deletions lib/widgets/responsive_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ class ResponsiveWidget extends StatelessWidget {
final Widget? mediumScreen;
final Widget? smallScreen;

const ResponsiveWidget(
{Key? key,
required this.largeScreen,
this.mediumScreen,
this.smallScreen})
: super(key: key);
const ResponsiveWidget({
required this.largeScreen,
this.mediumScreen,
this.smallScreen,
Key? key,
}) : super(key: key);

static bool isSmallScreen(BuildContext context) {
return MediaQuery.of(context).size.width < 800;
Expand Down
6 changes: 3 additions & 3 deletions lib/widgets/text_block.dart
Original file line number Diff line number Diff line change
Expand Up @@ -253,11 +253,11 @@ class EditableTextBlock extends StatelessWidget {
class RenderEditableTextBlock extends RenderEditableContainerBox
implements RenderEditableBox {
RenderEditableTextBlock({
List<RenderEditableBox>? children,
required Block block,
required TextDirection textDirection,
required EdgeInsetsGeometry padding,
required Decoration decoration,
List<RenderEditableBox>? children,
ImageConfiguration configuration = ImageConfiguration.empty,
EdgeInsets contentPadding = EdgeInsets.zero,
}) : _decoration = decoration,
Expand Down Expand Up @@ -558,7 +558,6 @@ class _NumberPoint extends StatelessWidget {
final double padding;

const _NumberPoint({
Key? key,
required this.index,
required this.indentLevelCounts,
required this.count,
Expand All @@ -567,6 +566,7 @@ class _NumberPoint extends StatelessWidget {
required this.attrs,
this.withDot = true,
this.padding = 0.0,
Key? key,
}) : super(key: key);

@override
Expand Down Expand Up @@ -656,9 +656,9 @@ class _BulletPoint extends StatelessWidget {
final double width;

const _BulletPoint({
Key? key,
required this.style,
required this.width,
Key? key,
}) : super(key: key);

@override
Expand Down
17 changes: 9 additions & 8 deletions lib/widgets/text_line.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ class TextLine extends StatelessWidget {
final EmbedBuilder embedBuilder;
final DefaultStyles styles;

const TextLine(
{Key? key,
required this.line,
this.textDirection,
required this.embedBuilder,
required this.styles})
: super(key: key);
const TextLine({
required this.line,
required this.embedBuilder,
required this.styles,
this.textDirection,
Key? key,
}) : super(key: key);

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -839,7 +839,8 @@ class _TextLineElement extends RenderObjectElement {
}

@override
void moveRenderObjectChild(RenderObject child, dynamic oldSlot, dynamic newSlot) {
void moveRenderObjectChild(
RenderObject child, dynamic oldSlot, dynamic newSlot) {
throw UnimplementedError();
}

Expand Down
6 changes: 3 additions & 3 deletions lib/widgets/text_selection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ class EditorTextSelectionOverlay {

class _TextSelectionHandleOverlay extends StatefulWidget {
const _TextSelectionHandleOverlay({
Key? key,
required this.selection,
required this.position,
required this.startHandleLayerLink,
Expand All @@ -255,6 +254,7 @@ class _TextSelectionHandleOverlay extends StatefulWidget {
required this.onSelectionHandleTapped,
required this.selectionControls,
this.dragStartBehavior = DragStartBehavior.start,
Key? key,
}) : super(key: key);

final TextSelection selection;
Expand Down Expand Up @@ -468,7 +468,7 @@ class _TextSelectionHandleOverlayState

class EditorTextSelectionGestureDetector extends StatefulWidget {
const EditorTextSelectionGestureDetector({
Key? key,
required this.child,
this.onTapDown,
this.onForcePressStart,
this.onForcePressEnd,
Expand All @@ -482,7 +482,7 @@ class EditorTextSelectionGestureDetector extends StatefulWidget {
this.onDragSelectionUpdate,
this.onDragSelectionEnd,
this.behavior,
required this.child,
Key? key,
}) : super(key: key);

final GestureTapDownCallback? onTapDown;
Expand Down
127 changes: 64 additions & 63 deletions lib/widgets/toolbar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ class InsertEmbedButton extends StatelessWidget {
final IconData icon;

const InsertEmbedButton({
Key? key,
required this.controller,
required this.icon,
Key? key,
}) : super(key: key);

@override
Expand Down Expand Up @@ -56,9 +56,9 @@ class LinkStyleButton extends StatefulWidget {
final IconData? icon;

const LinkStyleButton({
Key? key,
required this.controller,
this.icon,
Key? key,
}) : super(key: key);

@override
Expand Down Expand Up @@ -183,11 +183,11 @@ class ToggleStyleButton extends StatefulWidget {
final ToggleStyleButtonBuilder childBuilder;

ToggleStyleButton({
Key? key,
required this.attribute,
required this.icon,
required this.controller,
this.childBuilder = defaultToggleStyleButtonBuilder,
Key? key,
}) : super(key: key);

@override
Expand Down Expand Up @@ -267,11 +267,11 @@ class ToggleCheckListButton extends StatefulWidget {
final Attribute attribute;

ToggleCheckListButton({
Key? key,
required this.icon,
required this.controller,
this.childBuilder = defaultToggleStyleButtonBuilder,
required this.attribute,
this.childBuilder = defaultToggleStyleButtonBuilder,
Key? key,
}) : super(key: key);

@override
Expand Down Expand Up @@ -371,7 +371,7 @@ Widget defaultToggleStyleButtonBuilder(
class SelectHeaderStyleButton extends StatefulWidget {
final QuillController controller;

const SelectHeaderStyleButton({Key? key, required this.controller})
const SelectHeaderStyleButton({required this.controller, Key? key})
: super(key: key);

@override
Expand Down Expand Up @@ -494,14 +494,14 @@ class ImageButton extends StatefulWidget {

final ImageSource imageSource;

ImageButton(
{Key? key,
required this.icon,
required this.controller,
required this.imageSource,
this.onImagePickCallback,
this.imagePickImpl})
: super(key: key);
ImageButton({
required this.icon,
required this.controller,
required this.imageSource,
this.onImagePickCallback,
this.imagePickImpl,
Key? key,
}) : super(key: key);

@override
_ImageButtonState createState() => _ImageButtonState();
Expand Down Expand Up @@ -601,12 +601,12 @@ class ColorButton extends StatefulWidget {
final bool background;
final QuillController controller;

ColorButton(
{Key? key,
required this.icon,
required this.controller,
required this.background})
: super(key: key);
ColorButton({
required this.icon,
required this.controller,
required this.background,
Key? key,
}) : super(key: key);

@override
_ColorButtonState createState() => _ColorButtonState();
Expand Down Expand Up @@ -739,12 +739,12 @@ class HistoryButton extends StatefulWidget {
final bool undo;
final QuillController controller;

HistoryButton(
{Key? key,
required this.icon,
required this.controller,
required this.undo})
: super(key: key);
HistoryButton({
required this.icon,
required this.controller,
required this.undo,
Key? key,
}) : super(key: key);

@override
_HistoryButtonState createState() => _HistoryButtonState();
Expand Down Expand Up @@ -811,12 +811,12 @@ class IndentButton extends StatefulWidget {
final QuillController controller;
final bool isIncrease;

IndentButton(
{Key? key,
required this.icon,
required this.controller,
required this.isIncrease})
: super(key: key);
IndentButton({
required this.icon,
required this.controller,
required this.isIncrease,
Key? key,
}) : super(key: key);

@override
_IndentButtonState createState() => _IndentButtonState();
Expand Down Expand Up @@ -866,7 +866,7 @@ class ClearFormatButton extends StatefulWidget {

final QuillController controller;

ClearFormatButton({Key? key, required this.icon, required this.controller})
ClearFormatButton({required this.icon, required this.controller, Key? key})
: super(key: key);

@override
Expand Down Expand Up @@ -897,30 +897,31 @@ class _ClearFormatButtonState extends State<ClearFormatButton> {
class QuillToolbar extends StatefulWidget implements PreferredSizeWidget {
final List<Widget> children;

const QuillToolbar({Key? key, required this.children}) : super(key: key);

factory QuillToolbar.basic(
{Key? key,
required QuillController controller,
double toolbarIconSize = 18.0,
bool showBoldButton = true,
bool showItalicButton = true,
bool showUnderLineButton = true,
bool showStrikeThrough = true,
bool showColorButton = true,
bool showBackgroundColorButton = true,
bool showClearFormat = true,
bool showHeaderStyle = true,
bool showListNumbers = true,
bool showListBullets = true,
bool showListCheck = true,
bool showCodeBlock = true,
bool showQuote = true,
bool showIndent = true,
bool showLink = true,
bool showHistory = true,
bool showHorizontalRule = false,
OnImagePickCallback? onImagePickCallback}) {
const QuillToolbar({required this.children, Key? key}) : super(key: key);

factory QuillToolbar.basic({
required QuillController controller,
double toolbarIconSize = 18.0,
bool showBoldButton = true,
bool showItalicButton = true,
bool showUnderLineButton = true,
bool showStrikeThrough = true,
bool showColorButton = true,
bool showBackgroundColorButton = true,
bool showClearFormat = true,
bool showHeaderStyle = true,
bool showListNumbers = true,
bool showListBullets = true,
bool showListCheck = true,
bool showCodeBlock = true,
bool showQuote = true,
bool showIndent = true,
bool showLink = true,
bool showHistory = true,
bool showHorizontalRule = false,
OnImagePickCallback? onImagePickCallback,
Key? key,
}) {
iconSize = toolbarIconSize;
return QuillToolbar(key: key, children: [
Visibility(
Expand Down Expand Up @@ -1147,13 +1148,13 @@ class QuillIconButton extends StatelessWidget {
final double highlightElevation;

const QuillIconButton({
Key? key,
required this.onPressed,
this.icon,
this.size = 40,
this.fillColor,
this.hoverElevation = 1,
this.highlightElevation = 1,
Key? key,
}) : super(key: key);

@override
Expand Down Expand Up @@ -1186,15 +1187,15 @@ class QuillDropdownButton<T> extends StatefulWidget {
final ValueChanged<T> onSelected;

const QuillDropdownButton({
Key? key,
this.height = 40,
this.fillColor,
this.hoverElevation = 1,
this.highlightElevation = 1,
required this.child,
required this.initialValue,
required this.items,
required this.onSelected,
this.height = 40,
this.fillColor,
this.hoverElevation = 1,
this.highlightElevation = 1,
Key? key,
}) : super(key: key);

@override
Expand Down