Skip to content

Commit 410d150

Browse files
committed
chore: adjust flutter lint 2.0
1 parent a2d8fe9 commit 410d150

File tree

19 files changed

+219
-115
lines changed

19 files changed

+219
-115
lines changed

frontend/app_flowy/lib/core/frameless_window.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ class MoveWindowDetector extends StatefulWidget {
3131
final Widget? child;
3232

3333
@override
34-
_MoveWindowDetectorState createState() => _MoveWindowDetectorState();
34+
MoveWindowDetectorState createState() => MoveWindowDetectorState();
3535
}
3636

37-
class _MoveWindowDetectorState extends State<MoveWindowDetector> {
37+
class MoveWindowDetectorState extends State<MoveWindowDetector> {
3838
double winX = 0;
3939
double winY = 0;
4040

@@ -59,7 +59,8 @@ class _MoveWindowDetectorState extends State<MoveWindowDetector> {
5959
final double dy = windowPos[1];
6060
final deltaX = details.globalPosition.dx - winX;
6161
final deltaY = details.globalPosition.dy - winY;
62-
await CocoaWindowChannel.instance.setWindowPosition(Offset(dx + deltaX, dy - deltaY));
62+
await CocoaWindowChannel.instance
63+
.setWindowPosition(Offset(dx + deltaX, dy - deltaY));
6364
},
6465
child: widget.child,
6566
);

frontend/app_flowy/lib/plugins/doc/presentation/style_widgets.dart

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@ class EditorCheckboxBuilder extends QuillCheckboxBuilder {
1616
EditorCheckboxBuilder(this.theme);
1717

1818
@override
19-
Widget build({required BuildContext context, required bool isChecked, required ValueChanged<bool> onChanged}) {
19+
Widget build(
20+
{required BuildContext context,
21+
required bool isChecked,
22+
required ValueChanged<bool> onChanged}) {
2023
return FlowyEditorCheckbox(
2124
theme: theme,
2225
isChecked: isChecked,
@@ -37,10 +40,10 @@ class FlowyEditorCheckbox extends StatefulWidget {
3740
}) : super(key: key);
3841

3942
@override
40-
_FlowyEditorCheckboxState createState() => _FlowyEditorCheckboxState();
43+
FlowyEditorCheckboxState createState() => FlowyEditorCheckboxState();
4144
}
4245

43-
class _FlowyEditorCheckboxState extends State<FlowyEditorCheckbox> {
46+
class FlowyEditorCheckboxState extends State<FlowyEditorCheckbox> {
4447
late bool isChecked;
4548

4649
@override
@@ -51,7 +54,9 @@ class _FlowyEditorCheckboxState extends State<FlowyEditorCheckbox> {
5154

5255
@override
5356
Widget build(BuildContext context) {
54-
final icon = isChecked ? svgWidget('editor/editor_check') : svgWidget('editor/editor_uncheck');
57+
final icon = isChecked
58+
? svgWidget('editor/editor_check')
59+
: svgWidget('editor/editor_uncheck');
5560
return Align(
5661
alignment: Alignment.centerLeft,
5762
child: FlowyIconButton(

frontend/app_flowy/lib/plugins/doc/presentation/toolbar/check_button.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ class FlowyCheckListButton extends StatefulWidget {
2828
final String tooltipText;
2929

3030
@override
31-
_FlowyCheckListButtonState createState() => _FlowyCheckListButtonState();
31+
FlowyCheckListButtonState createState() => FlowyCheckListButtonState();
3232
}
3333

34-
class _FlowyCheckListButtonState extends State<FlowyCheckListButton> {
34+
class FlowyCheckListButtonState extends State<FlowyCheckListButton> {
3535
bool? _isToggled;
3636

3737
Style get _selectionStyle => widget.controller.getSelectionStyle();

frontend/app_flowy/lib/plugins/doc/presentation/toolbar/color_picker.dart

Lines changed: 42 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ class FlowyColorButton extends StatefulWidget {
2424
final QuillIconTheme? iconTheme;
2525

2626
@override
27-
_FlowyColorButtonState createState() => _FlowyColorButtonState();
27+
FlowyColorButtonState createState() => FlowyColorButtonState();
2828
}
2929

30-
class _FlowyColorButtonState extends State<FlowyColorButton> {
30+
class FlowyColorButtonState extends State<FlowyColorButton> {
3131
late bool _isToggledColor;
3232
late bool _isToggledBackground;
3333
late bool _isWhite;
@@ -37,10 +37,14 @@ class _FlowyColorButtonState extends State<FlowyColorButton> {
3737

3838
void _didChangeEditingValue() {
3939
setState(() {
40-
_isToggledColor = _getIsToggledColor(widget.controller.getSelectionStyle().attributes);
41-
_isToggledBackground = _getIsToggledBackground(widget.controller.getSelectionStyle().attributes);
42-
_isWhite = _isToggledColor && _selectionStyle.attributes['color']!.value == '#ffffff';
43-
_isWhitebackground = _isToggledBackground && _selectionStyle.attributes['background']!.value == '#ffffff';
40+
_isToggledColor =
41+
_getIsToggledColor(widget.controller.getSelectionStyle().attributes);
42+
_isToggledBackground = _getIsToggledBackground(
43+
widget.controller.getSelectionStyle().attributes);
44+
_isWhite = _isToggledColor &&
45+
_selectionStyle.attributes['color']!.value == '#ffffff';
46+
_isWhitebackground = _isToggledBackground &&
47+
_selectionStyle.attributes['background']!.value == '#ffffff';
4448
});
4549
}
4650

@@ -49,8 +53,10 @@ class _FlowyColorButtonState extends State<FlowyColorButton> {
4953
super.initState();
5054
_isToggledColor = _getIsToggledColor(_selectionStyle.attributes);
5155
_isToggledBackground = _getIsToggledBackground(_selectionStyle.attributes);
52-
_isWhite = _isToggledColor && _selectionStyle.attributes['color']!.value == '#ffffff';
53-
_isWhitebackground = _isToggledBackground && _selectionStyle.attributes['background']!.value == '#ffffff';
56+
_isWhite = _isToggledColor &&
57+
_selectionStyle.attributes['color']!.value == '#ffffff';
58+
_isWhitebackground = _isToggledBackground &&
59+
_selectionStyle.attributes['background']!.value == '#ffffff';
5460
widget.controller.addListener(_didChangeEditingValue);
5561
}
5662

@@ -69,9 +75,12 @@ class _FlowyColorButtonState extends State<FlowyColorButton> {
6975
oldWidget.controller.removeListener(_didChangeEditingValue);
7076
widget.controller.addListener(_didChangeEditingValue);
7177
_isToggledColor = _getIsToggledColor(_selectionStyle.attributes);
72-
_isToggledBackground = _getIsToggledBackground(_selectionStyle.attributes);
73-
_isWhite = _isToggledColor && _selectionStyle.attributes['color']!.value == '#ffffff';
74-
_isWhitebackground = _isToggledBackground && _selectionStyle.attributes['background']!.value == '#ffffff';
78+
_isToggledBackground =
79+
_getIsToggledBackground(_selectionStyle.attributes);
80+
_isWhite = _isToggledColor &&
81+
_selectionStyle.attributes['color']!.value == '#ffffff';
82+
_isWhitebackground = _isToggledBackground &&
83+
_selectionStyle.attributes['background']!.value == '#ffffff';
7584
}
7685
}
7786

@@ -88,9 +97,10 @@ class _FlowyColorButtonState extends State<FlowyColorButton> {
8897
final fillColor = _isToggledColor && !widget.background && _isWhite
8998
? stringToColor('#ffffff')
9099
: (widget.iconTheme?.iconUnselectedFillColor ?? theme.canvasColor);
91-
final fillColorBackground = _isToggledBackground && widget.background && _isWhitebackground
92-
? stringToColor('#ffffff')
93-
: (widget.iconTheme?.iconUnselectedFillColor ?? theme.canvasColor);
100+
final fillColorBackground =
101+
_isToggledBackground && widget.background && _isWhitebackground
102+
? stringToColor('#ffffff')
103+
: (widget.iconTheme?.iconUnselectedFillColor ?? theme.canvasColor);
94104

95105
return Tooltip(
96106
message: LocaleKeys.toolbar_highlight.tr(),
@@ -99,7 +109,8 @@ class _FlowyColorButtonState extends State<FlowyColorButton> {
99109
highlightElevation: 0,
100110
hoverElevation: 0,
101111
size: widget.iconSize * kIconButtonFactor,
102-
icon: Icon(widget.icon, size: widget.iconSize, color: theme.iconTheme.color),
112+
icon: Icon(widget.icon,
113+
size: widget.iconSize, color: theme.iconTheme.color),
103114
fillColor: widget.background ? fillColorBackground : fillColor,
104115
onPressed: _showColorPicker,
105116
),
@@ -112,13 +123,16 @@ class _FlowyColorButtonState extends State<FlowyColorButton> {
112123
hex = hex.substring(2);
113124
}
114125
hex = '#$hex';
115-
widget.controller.formatSelection(widget.background ? BackgroundAttribute(hex) : ColorAttribute(hex));
126+
widget.controller.formatSelection(
127+
widget.background ? BackgroundAttribute(hex) : ColorAttribute(hex));
116128
Navigator.of(context).pop();
117129
}
118130

119131
void _showColorPicker() {
120132
final style = widget.controller.getSelectionStyle();
121-
final values = style.values.where((v) => v.key == Attribute.background.key).map((v) => v.value);
133+
final values = style.values
134+
.where((v) => v.key == Attribute.background.key)
135+
.map((v) => v.value);
122136
int initialColor = 0;
123137
if (values.isNotEmpty) {
124138
assert(values.length == 1);
@@ -160,7 +174,9 @@ class FlowyColorPicker extends StatefulWidget {
160174
];
161175
final Function(Color?) onColorChanged;
162176
final int initialColor;
163-
FlowyColorPicker({Key? key, required this.onColorChanged, this.initialColor = 0}) : super(key: key);
177+
FlowyColorPicker(
178+
{Key? key, required this.onColorChanged, this.initialColor = 0})
179+
: super(key: key);
164180

165181
@override
166182
State<FlowyColorPicker> createState() => _FlowyColorPickerState();
@@ -178,8 +194,10 @@ class _FlowyColorPickerState extends State<FlowyColorPicker> {
178194
const double crossAxisSpacing = 10;
179195
final numberOfRows = (widget.colors.length / crossAxisCount).ceil();
180196

181-
const perRowHeight = ((width - ((crossAxisCount - 1) * mainAxisSpacing)) / crossAxisCount);
182-
final totalHeight = numberOfRows * perRowHeight + numberOfRows * crossAxisSpacing;
197+
const perRowHeight =
198+
((width - ((crossAxisCount - 1) * mainAxisSpacing)) / crossAxisCount);
199+
final totalHeight =
200+
numberOfRows * perRowHeight + numberOfRows * crossAxisSpacing;
183201

184202
return Container(
185203
constraints: BoxConstraints.tightFor(width: width, height: totalHeight),
@@ -198,7 +216,8 @@ class _FlowyColorPickerState extends State<FlowyColorPicker> {
198216
delegate: SliverChildBuilderDelegate(
199217
(BuildContext context, int index) {
200218
if (widget.colors.length > index) {
201-
final isSelected = widget.colors[index] == widget.initialColor;
219+
final isSelected =
220+
widget.colors[index] == widget.initialColor;
202221
return ColorItem(
203222
color: Color(widget.colors[index]),
204223
onPressed: widget.onColorChanged,
@@ -242,7 +261,8 @@ class ColorItem extends StatelessWidget {
242261
);
243262
} else {
244263
return RawMaterialButton(
245-
shape: const CircleBorder(side: BorderSide(color: Colors.white, width: 8)) +
264+
shape: const CircleBorder(
265+
side: BorderSide(color: Colors.white, width: 8)) +
246266
CircleBorder(side: BorderSide(color: color, width: 4)),
247267
onPressed: () {
248268
if (isSelected) {

frontend/app_flowy/lib/plugins/doc/presentation/toolbar/header_button.dart

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ class FlowyHeaderStyleButton extends StatefulWidget {
1616
final double iconSize;
1717

1818
@override
19-
_FlowyHeaderStyleButtonState createState() => _FlowyHeaderStyleButtonState();
19+
FlowyHeaderStyleButtonState createState() => FlowyHeaderStyleButtonState();
2020
}
2121

22-
class _FlowyHeaderStyleButtonState extends State<FlowyHeaderStyleButton> {
22+
class FlowyHeaderStyleButtonState extends State<FlowyHeaderStyleButton> {
2323
Attribute? _value;
2424

2525
Style get _selectionStyle => widget.controller.getSelectionStyle();
@@ -28,7 +28,8 @@ class _FlowyHeaderStyleButtonState extends State<FlowyHeaderStyleButton> {
2828
void initState() {
2929
super.initState();
3030
setState(() {
31-
_value = _selectionStyle.attributes[Attribute.header.key] ?? Attribute.header;
31+
_value =
32+
_selectionStyle.attributes[Attribute.header.key] ?? Attribute.header;
3233
});
3334
widget.controller.addListener(_didChangeEditingValue);
3435
}
@@ -41,7 +42,11 @@ class _FlowyHeaderStyleButtonState extends State<FlowyHeaderStyleButton> {
4142
Attribute.h3: 'H3',
4243
};
4344

44-
final valueAttribute = <Attribute>[Attribute.h1, Attribute.h2, Attribute.h3];
45+
final valueAttribute = <Attribute>[
46+
Attribute.h1,
47+
Attribute.h2,
48+
Attribute.h3
49+
];
4550
final valueString = <String>['H1', 'H2', 'H3'];
4651
final attributeImageName = <String>['editor/H1', 'editor/H2', 'editor/H3'];
4752

@@ -72,7 +77,8 @@ class _FlowyHeaderStyleButtonState extends State<FlowyHeaderStyleButton> {
7277

7378
void _didChangeEditingValue() {
7479
setState(() {
75-
_value = _selectionStyle.attributes[Attribute.header.key] ?? Attribute.header;
80+
_value =
81+
_selectionStyle.attributes[Attribute.header.key] ?? Attribute.header;
7682
});
7783
}
7884

@@ -82,7 +88,8 @@ class _FlowyHeaderStyleButtonState extends State<FlowyHeaderStyleButton> {
8288
if (oldWidget.controller != widget.controller) {
8389
oldWidget.controller.removeListener(_didChangeEditingValue);
8490
widget.controller.addListener(_didChangeEditingValue);
85-
_value = _selectionStyle.attributes[Attribute.header.key] ?? Attribute.header;
91+
_value =
92+
_selectionStyle.attributes[Attribute.header.key] ?? Attribute.header;
8693
}
8794
}
8895

frontend/app_flowy/lib/plugins/doc/presentation/toolbar/link_button.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ class FlowyLinkStyleButton extends StatefulWidget {
1919
final double iconSize;
2020

2121
@override
22-
_FlowyLinkStyleButtonState createState() => _FlowyLinkStyleButtonState();
22+
FlowyLinkStyleButtonState createState() => FlowyLinkStyleButtonState();
2323
}
2424

25-
class _FlowyLinkStyleButtonState extends State<FlowyLinkStyleButton> {
25+
class FlowyLinkStyleButtonState extends State<FlowyLinkStyleButton> {
2626
void _didChangeSelection() {
2727
setState(() {});
2828
}
@@ -75,7 +75,9 @@ class _FlowyLinkStyleButtonState extends State<FlowyLinkStyleButton> {
7575

7676
void _openLinkDialog(BuildContext context) {
7777
final style = widget.controller.getSelectionStyle();
78-
final values = style.values.where((v) => v.key == Attribute.link.key).map((v) => v.value);
78+
final values = style.values
79+
.where((v) => v.key == Attribute.link.key)
80+
.map((v) => v.value);
7981
String value = "";
8082
if (values.isNotEmpty) {
8183
assert(values.length == 1);

frontend/app_flowy/lib/plugins/doc/presentation/toolbar/toggle_button.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ class FlowyToggleStyleButton extends StatefulWidget {
2121
}) : super(key: key);
2222

2323
@override
24-
_ToggleStyleButtonState createState() => _ToggleStyleButtonState();
24+
ToggleStyleButtonState createState() => ToggleStyleButtonState();
2525
}
2626

27-
class _ToggleStyleButtonState extends State<FlowyToggleStyleButton> {
27+
class ToggleStyleButtonState extends State<FlowyToggleStyleButton> {
2828
bool? _isToggled;
2929
Style get _selectionStyle => widget.controller.getSelectionStyle();
3030
@override
@@ -77,6 +77,8 @@ class _ToggleStyleButtonState extends State<FlowyToggleStyleButton> {
7777
}
7878

7979
void _toggleAttribute() {
80-
widget.controller.formatSelection(_isToggled! ? Attribute.clone(widget.attribute, null) : widget.attribute);
80+
widget.controller.formatSelection(_isToggled!
81+
? Attribute.clone(widget.attribute, null)
82+
: widget.attribute);
8183
}
8284
}

frontend/app_flowy/lib/plugins/doc/presentation/toolbar/tool_bar.dart

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ class EditorToolbar extends StatelessWidget implements PreferredSizeWidget {
3232
return Container(
3333
color: Theme.of(context).canvasColor,
3434
constraints: BoxConstraints.tightFor(height: preferredSize.height),
35-
child: ToolbarButtonList(buttons: children).padding(horizontal: 4, vertical: 4),
35+
child: ToolbarButtonList(buttons: children)
36+
.padding(horizontal: 4, vertical: 4),
3637
);
3738
}
3839

@@ -168,10 +169,11 @@ class ToolbarButtonList extends StatefulWidget {
168169
final List<Widget> buttons;
169170

170171
@override
171-
_ToolbarButtonListState createState() => _ToolbarButtonListState();
172+
ToolbarButtonListState createState() => ToolbarButtonListState();
172173
}
173174

174-
class _ToolbarButtonListState extends State<ToolbarButtonList> with WidgetsBindingObserver {
175+
class ToolbarButtonListState extends State<ToolbarButtonList>
176+
with WidgetsBindingObserver {
175177
final ScrollController _controller = ScrollController();
176178
bool _showLeftArrow = false;
177179
bool _showRightArrow = false;
@@ -196,7 +198,8 @@ class _ToolbarButtonListState extends State<ToolbarButtonList> with WidgetsBindi
196198
return LayoutBuilder(
197199
builder: (BuildContext context, BoxConstraints constraints) {
198200
List<Widget> children = [];
199-
double width = (widget.buttons.length + 2) * defaultIconSize * kIconButtonFactor;
201+
double width =
202+
(widget.buttons.length + 2) * defaultIconSize * kIconButtonFactor;
200203
final isFit = constraints.maxWidth > width;
201204
if (!isFit) {
202205
children.add(_buildLeftArrow());
@@ -233,8 +236,10 @@ class _ToolbarButtonListState extends State<ToolbarButtonList> with WidgetsBindi
233236
void _handleScroll() {
234237
if (!mounted) return;
235238
setState(() {
236-
_showLeftArrow = _controller.position.minScrollExtent != _controller.position.pixels;
237-
_showRightArrow = _controller.position.maxScrollExtent != _controller.position.pixels;
239+
_showLeftArrow =
240+
_controller.position.minScrollExtent != _controller.position.pixels;
241+
_showRightArrow =
242+
_controller.position.maxScrollExtent != _controller.position.pixels;
238243
});
239244
}
240245

frontend/app_flowy/lib/plugins/grid/application/cell/select_option_editor_bloc.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
import 'dart:async';
2+
3+
import 'package:app_flowy/plugins/grid/application/cell/cell_service/cell_service.dart';
4+
import 'package:collection/collection.dart';
25
import 'package:dartz/dartz.dart';
36
import 'package:flowy_sdk/log.dart';
47
import 'package:flowy_sdk/protobuf/flowy-grid/select_option.pb.dart';
58
import 'package:flutter_bloc/flutter_bloc.dart';
69
import 'package:freezed_annotation/freezed_annotation.dart';
7-
import 'package:app_flowy/plugins/grid/application/cell/cell_service/cell_service.dart';
10+
811
import 'select_option_service.dart';
9-
import 'package:collection/collection.dart';
1012

1113
part 'select_option_editor_bloc.freezed.dart';
1214

frontend/app_flowy/lib/plugins/grid/presentation/widgets/header/type_option/number.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,10 @@ class NumberTypeOptionWidget extends TypeOptionWidget {
9090
}
9191
}
9292

93-
typedef _SelectNumberFormatCallback = Function(NumberFormat format);
93+
typedef SelectNumberFormatCallback = Function(NumberFormat format);
9494

9595
class NumberFormatList extends StatelessWidget {
96-
final _SelectNumberFormatCallback onSelected;
96+
final SelectNumberFormatCallback onSelected;
9797
final NumberFormat selectedFormat;
9898
const NumberFormatList(
9999
{required this.selectedFormat, required this.onSelected, Key? key})

0 commit comments

Comments
 (0)