chore: run dart fix --apply

This commit is contained in:
appflowy 2022-08-31 09:19:31 +08:00
parent 94a440f773
commit a2d8fe9e80
43 changed files with 77 additions and 75 deletions

@ -23,7 +23,7 @@ class BoardBloc extends Bloc<BoardEvent, BoardState> {
final BoardDataController _gridDataController;
late final AFBoardDataController boardController;
final MoveRowFFIService _rowService;
LinkedHashMap<String, GroupController> groupControllers = LinkedHashMap.new();
LinkedHashMap<String, GroupController> groupControllers = LinkedHashMap();
GridFieldCache get fieldCache => _gridDataController.fieldCache;
String get gridId => _gridDataController.gridId;

@ -52,7 +52,8 @@ class BoardDataController {
BoardDataController({required ViewPB view})
: gridId = view.id,
_listener = BoardListener(view.id),
_blocks = LinkedHashMap.new(),
// ignore: prefer_collection_literals
_blocks = LinkedHashMap(),
_gridFFIService = GridFFIService(gridId: view.id),
fieldCache = GridFieldCache(gridId: view.id);

@ -79,7 +79,7 @@ class BoardDateCellState with _$BoardDateCellState {
String _dateStrFromCellData(DateCellDataPB? cellData) {
String dateStr = "";
if (cellData != null) {
dateStr = cellData.date + " " + cellData.time;
dateStr = "${cellData.date} ${cellData.time}";
}
return dateStr;
}

@ -65,7 +65,7 @@ class _BoardSelectOptionCellState extends State<BoardSelectOptionCell> {
alignment: AlignmentDirectional.center,
fit: StackFit.expand,
children: [
Wrap(children: children, spacing: 4, runSpacing: 2),
Wrap(spacing: 4, runSpacing: 2, children: children),
_SelectOptionDialog(
controller: widget.cellControllerBuilder.build(),
),

@ -26,8 +26,8 @@ class BoardCardContainer extends StatelessWidget {
final accessories = accessoryBuilder!(context);
if (accessories.isNotEmpty) {
container = _CardEnterRegion(
child: container,
accessories: accessories,
child: container,
);
}
}
@ -78,9 +78,9 @@ class CardAccessoryContainer extends StatelessWidget {
),
);
return GestureDetector(
child: hover,
behavior: HitTestBehavior.opaque,
onTap: () => accessory.onTap(context),
child: hover,
);
}).toList();

@ -40,11 +40,11 @@ class DocumentBanner extends StatelessWidget {
downColor: theme.main1,
outlineColor: Colors.white,
borderRadius: Corners.s8Border,
onPressed: onRestore,
child: FlowyText.medium(
LocaleKeys.deletePagePrompt_restore.tr(),
color: Colors.white,
fontSize: 14),
onPressed: onRestore),
fontSize: 14)),
const HSpace(20),
BaseStyledButton(
minWidth: 220,
@ -55,11 +55,11 @@ class DocumentBanner extends StatelessWidget {
downColor: theme.main1,
outlineColor: Colors.white,
borderRadius: Corners.s8Border,
onPressed: onDelete,
child: FlowyText.medium(
LocaleKeys.deletePagePrompt_deletePermanent.tr(),
color: Colors.white,
fontSize: 14),
onPressed: onDelete),
fontSize: 14)),
],
),
),

@ -35,15 +35,15 @@ class _FlowyHeaderStyleButtonState extends State<FlowyHeaderStyleButton> {
@override
Widget build(BuildContext context) {
final _valueToText = <Attribute, String>{
final valueToText = <Attribute, String>{
Attribute.h1: 'H1',
Attribute.h2: 'H2',
Attribute.h3: 'H3',
};
final _valueAttribute = <Attribute>[Attribute.h1, Attribute.h2, Attribute.h3];
final _valueString = <String>['H1', 'H2', 'H3'];
final _attributeImageName = <String>['editor/H1', 'editor/H2', 'editor/H3'];
final valueAttribute = <Attribute>[Attribute.h1, Attribute.h2, Attribute.h3];
final valueString = <String>['H1', 'H2', 'H3'];
final attributeImageName = <String>['editor/H1', 'editor/H2', 'editor/H3'];
return Row(
mainAxisSize: MainAxisSize.min,
@ -52,18 +52,18 @@ class _FlowyHeaderStyleButtonState extends State<FlowyHeaderStyleButton> {
// _valueToText[_value] == _valueString[index] ? svg('editor/H1', color: Colors.white) : svg('editor/H1');
final headerTitle = "${LocaleKeys.toolbar_header.tr()} ${index + 1}";
final _isToggled = _valueToText[_value] == _valueString[index];
final isToggled = valueToText[_value] == valueString[index];
return ToolbarIconButton(
onPressed: () {
if (_isToggled) {
if (isToggled) {
widget.controller.formatSelection(Attribute.header);
} else {
widget.controller.formatSelection(_valueAttribute[index]);
widget.controller.formatSelection(valueAttribute[index]);
}
},
width: widget.iconSize * kIconButtonFactor,
iconName: _attributeImageName[index],
isToggled: _isToggled,
iconName: attributeImageName[index],
isToggled: isToggled,
tooltipText: headerTitle,
);
}),

@ -71,6 +71,6 @@ class GridCellIdentifier with _$GridCellIdentifier {
FieldType get fieldType => field.fieldType;
ValueKey key() {
return ValueKey(rowId + fieldId + "${field.fieldType}");
return ValueKey("$rowId$fieldId${field.fieldType}");
}
}

@ -119,13 +119,13 @@ class DateCalBloc extends Bloc<DateCalEvent, DateCalState> {
}
String timeFormatPrompt(FlowyError error) {
String msg = LocaleKeys.grid_field_invalidTimeFormat.tr() + ". ";
String msg = "${LocaleKeys.grid_field_invalidTimeFormat.tr()}. ";
switch (state.dateTypeOptionPB.timeFormat) {
case TimeFormat.TwelveHour:
msg = msg + "e.g. 01: 00 AM";
msg = "${msg}e.g. 01: 00 AM";
break;
case TimeFormat.TwentyFourHour:
msg = msg + "e.g. 13: 00";
msg = "${msg}e.g. 13: 00";
break;
default:
break;

@ -79,7 +79,7 @@ class DateCellState with _$DateCellState {
String _dateStrFromCellData(DateCellDataPB? cellData) {
String dateStr = "";
if (cellData != null) {
dateStr = cellData.date + " " + cellData.time;
dateStr = "${cellData.date} ${cellData.time}";
}
return dateStr;
}

@ -46,7 +46,8 @@ class GridDataController {
GridDataController({required ViewPB view})
: gridId = view.id,
_blocks = LinkedHashMap.new(),
// ignore: prefer_collection_literals
_blocks = LinkedHashMap(),
_gridFFIService = GridFFIService(gridId: view.id),
fieldCache = GridFieldCache(gridId: view.id);

@ -210,7 +210,8 @@ class GridRowCache {
}
GridCellMap _makeGridCells(String rowId, RowPB? row) {
var cellDataMap = GridCellMap.new();
// ignore: prefer_collection_literals
var cellDataMap = GridCellMap();
for (final field in _fieldNotifier.fields) {
if (field.visibility) {
cellDataMap[field.id] = GridCellIdentifier(

@ -190,12 +190,12 @@ class CellAccessoryContainer extends StatelessWidget {
),
);
return GestureDetector(
child: hover,
behavior: HitTestBehavior.opaque,
onTap: () => accessory.onTap(),
child: hover,
);
}).toList();
return Wrap(children: children, spacing: 6);
return Wrap(spacing: 6, children: children);
}
}

@ -44,8 +44,8 @@ class CellContainer extends StatelessWidget {
if (accessories.isNotEmpty) {
container = _GridCellEnterRegion(
child: container,
accessories: accessories,
child: container,
);
}
}

@ -48,8 +48,8 @@ class DateCellEditor with FlowyOverlayDelegate {
FlowyOverlay.of(context).insertWithAnchor(
widget: OverlayContainer(
child: calendar,
constraints: BoxConstraints.loose(const Size(320, 500)),
child: calendar,
),
identifier: DateCellEditor.identifier(),
anchorContext: context,
@ -304,9 +304,7 @@ class _DateTypeOptionButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
final theme = context.watch<AppTheme>();
final title = LocaleKeys.grid_field_dateFormat.tr() +
" &" +
LocaleKeys.grid_field_timeFormat.tr();
final title = "${LocaleKeys.grid_field_dateFormat.tr()} &${LocaleKeys.grid_field_timeFormat.tr()}";
return BlocSelector<DateCalBloc, DateCalState, DateTypeOptionPB>(
selector: (state) => state.dateTypeOptionPB,
builder: (context, dateTypeOptionPB) {
@ -349,8 +347,8 @@ class _CalDateTimeSetting extends StatefulWidget {
hide(context);
FlowyOverlay.of(context).insertWithAnchor(
widget: OverlayContainer(
child: this,
constraints: BoxConstraints.loose(const Size(140, 100)),
child: this,
),
identifier: _CalDateTimeSetting.identifier(),
anchorContext: context,
@ -415,8 +413,8 @@ class _CalDateTimeSettingState extends State<_CalDateTimeSetting> {
overlayIdentifier = child.toString();
FlowyOverlay.of(context).insertWithAnchor(
widget: OverlayContainer(
child: child,
constraints: BoxConstraints.loose(const Size(460, 440)),
child: child,
),
identifier: overlayIdentifier!,
anchorContext: context,

@ -163,14 +163,14 @@ class SelectOptionWrap extends StatelessWidget {
child = Align(
alignment: Alignment.centerLeft,
child: Wrap(
spacing: 4,
runSpacing: 2,
children: selectOptions
.map((option) => SelectOptionTag.fromOption(
context: context,
option: option,
))
.toList(),
spacing: 4,
runSpacing: 2,
),
);
}

@ -72,8 +72,8 @@ class SelectOptionCellEditor extends StatelessWidget with FlowyOverlayDelegate {
//
FlowyOverlay.of(context).insertWithAnchor(
widget: OverlayContainer(
child: SizedBox(width: _editorPannelWidth, child: editor),
constraints: BoxConstraints.loose(const Size(_editorPannelWidth, 300)),
child: SizedBox(width: _editorPannelWidth, child: editor),
),
identifier: SelectOptionCellEditor.identifier(),
anchorContext: context,
@ -289,8 +289,8 @@ class _SelectOptionCell extends StatelessWidget {
FlowyOverlay.of(context).remove(overlayIdentifier);
FlowyOverlay.of(context).insertWithAnchor(
widget: OverlayContainer(
child: pannel,
constraints: BoxConstraints.loose(const Size(200, 300)),
child: pannel,
),
identifier: overlayIdentifier,
anchorContext: context,

@ -108,7 +108,7 @@ class SelectOptionTextField extends StatelessWidget {
child: SingleChildScrollView(
controller: sc,
scrollDirection: Axis.horizontal,
child: Wrap(children: children, spacing: 4),
child: Wrap(spacing: 4, children: children),
),
);
}

@ -30,11 +30,11 @@ class URLCellEditor extends StatefulWidget with FlowyOverlayDelegate {
//
FlowyOverlay.of(context).insertWithAnchor(
widget: OverlayContainer(
constraints: BoxConstraints.loose(const Size(300, 160)),
child: SizedBox(
width: 200,
child: Padding(padding: const EdgeInsets.all(6), child: editor),
),
constraints: BoxConstraints.loose(const Size(300, 160)),
),
identifier: URLCellEditor.identifier(),
anchorContext: context,

@ -24,8 +24,8 @@ class GridFieldCellActionSheet extends StatelessWidget
void show(BuildContext overlayContext) {
FlowyOverlay.of(overlayContext).insertWithAnchor(
widget: OverlayContainer(
child: this,
constraints: BoxConstraints.loose(const Size(240, 200)),
child: this,
),
identifier: GridFieldCellActionSheet.identifier(),
anchorContext: overlayContext,

@ -56,8 +56,8 @@ class FieldEditor extends StatelessWidget with FlowyOverlayDelegate {
FlowyOverlay.of(context).remove(identifier());
FlowyOverlay.of(context).insertWithAnchor(
widget: OverlayContainer(
child: this,
constraints: BoxConstraints.loose(const Size(280, 400)),
child: this,
),
identifier: identifier(),
anchorContext: context,

@ -110,8 +110,8 @@ class _FieldTypeOptionEditorState extends State<FieldTypeOptionEditor> {
currentOverlayIdentifier = identifier;
FlowyOverlay.of(context).insertWithAnchor(
widget: OverlayContainer(
child: child,
constraints: BoxConstraints.loose(const Size(460, 440)),
child: child,
),
identifier: identifier,
anchorContext: context,

@ -190,7 +190,6 @@ class RowContent extends StatelessWidget {
return CellContainer(
width: cellId.field.width.toDouble(),
child: child,
rowStateNotifier:
Provider.of<RegionStateNotifier>(context, listen: false),
accessoryBuilder: (buildContext) {
@ -208,6 +207,7 @@ class RowContent extends StatelessWidget {
}
return accessories;
},
child: child,
);
},
).toList();

@ -59,8 +59,8 @@ class GridRowActionSheet extends StatelessWidget {
}) {
FlowyOverlay.of(overlayContext).insertWithAnchor(
widget: OverlayContainer(
child: this,
constraints: BoxConstraints.loose(const Size(140, 200)),
child: this,
),
identifier: GridRowActionSheet.identifier(),
anchorContext: overlayContext,

@ -38,8 +38,8 @@ class RowDetailPage extends StatefulWidget with FlowyOverlayDelegate {
final size = windowSize * 0.5;
FlowyOverlay.of(context).insertWithRect(
widget: OverlayContainer(
child: this,
constraints: BoxConstraints.tight(size),
child: this,
),
identifier: RowDetailPage.identifier(),
anchorPosition: Offset(-size.width / 2.0, -size.height / 2.0),
@ -156,9 +156,9 @@ class _RowDetailCell extends StatelessWidget {
behavior: HitTestBehavior.translucent,
onTap: () => cell.beginFocus.notify(),
child: AccessoryHover(
child: cell,
contentPadding:
const EdgeInsets.symmetric(horizontal: 10, vertical: 12),
child: cell,
),
);

@ -30,8 +30,8 @@ class GridPropertyList extends StatelessWidget with FlowyOverlayDelegate {
void show(BuildContext context) {
FlowyOverlay.of(context).insertWithAnchor(
widget: OverlayContainer(
child: this,
constraints: BoxConstraints.loose(const Size(260, 400)),
child: this,
),
identifier: identifier(),
anchorContext: context,

@ -53,8 +53,8 @@ class GridSettingList extends StatelessWidget {
FlowyOverlay.of(context).insertWithAnchor(
widget: OverlayContainer(
child: list,
constraints: BoxConstraints.loose(const Size(140, 400)),
child: list,
),
identifier: list.identifier(),
anchorContext: context,

@ -91,12 +91,12 @@ class _TrashPageState extends State<TrashPage> {
builder: (context, state) {
return SizedBox.expand(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
_renderTopBar(context, theme, state),
const VSpace(32),
_renderTrashList(context, state),
],
mainAxisAlignment: MainAxisAlignment.start,
).padding(horizontal: horizontalPadding, vertical: 48),
);
},

@ -20,8 +20,8 @@ class InitAppWidgetTask extends LaunchTask {
final setting = await UserSettingsService().getAppearanceSettings();
final settingModel = AppearanceSettingModel(setting);
final app = ApplicationWidget(
child: widget,
settingModel: settingModel,
child: widget,
);
BlocOverrides.runZoned(
() {

@ -94,6 +94,7 @@ class SignUpPrompt extends StatelessWidget {
Widget build(BuildContext context) {
final theme = context.watch<AppTheme>();
return Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(LocaleKeys.signIn_dontHaveAnAccount.tr(), style: TextStyle(color: theme.shader3, fontSize: 12)),
TextButton(
@ -107,7 +108,6 @@ class SignUpPrompt extends StatelessWidget {
),
),
],
mainAxisAlignment: MainAxisAlignment.center,
);
}
}

@ -86,6 +86,7 @@ class SignUpPrompt extends StatelessWidget {
Widget build(BuildContext context) {
final theme = context.watch<AppTheme>();
return Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
LocaleKeys.signUp_alreadyHaveAnAccount.tr(),
@ -97,7 +98,6 @@ class SignUpPrompt extends StatelessWidget {
child: Text(LocaleKeys.signIn_buttonText.tr(), style: TextStyle(color: theme.main1)),
),
],
mainAxisAlignment: MainAxisAlignment.center,
);
}
}

@ -13,14 +13,14 @@ class HomeHotKeys extends StatelessWidget {
@override
Widget build(BuildContext context) {
HotKey _hotKey = HotKey(
HotKey hotKey = HotKey(
KeyCode.backslash,
modifiers: [Platform.isMacOS ? KeyModifier.meta : KeyModifier.control],
// Set hotkey scope (default is HotKeyScope.system)
scope: HotKeyScope.inapp, // Set as inapp-wide hotkey.
);
hotKeyManager.register(
_hotKey,
hotKey,
keyDownHandler: (hotKey) {
context.read<HomeBloc>().add(const HomeEvent.collapseMenu());
getIt<HomeStackManager>().collapsedNotifier.value =

@ -222,7 +222,7 @@ class MenuTopBar extends StatelessWidget {
Tooltip(
richMessage: TextSpan(children: [
TextSpan(
text: LocaleKeys.sideBar_closeSidebar.tr() + "\n"),
text: "${LocaleKeys.sideBar_closeSidebar.tr()}\n"),
TextSpan(
text: Platform.isMacOS ? "⌘+\\" : "Ctrl+\\",
style: const TextStyle(color: Colors.white60),

@ -24,6 +24,7 @@ class MenuUser extends StatelessWidget {
getIt<MenuUserBloc>(param1: user)..add(const MenuUserEvent.initial()),
child: BlocBuilder<MenuUserBloc, MenuUserState>(
builder: (context, state) => Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
_renderAvatar(context),
const HSpace(10),
@ -34,7 +35,6 @@ class MenuUser extends StatelessWidget {
//we get the below block back
//_renderDropButton(context),
],
crossAxisAlignment: CrossAxisAlignment.center,
),
),
);

@ -101,7 +101,7 @@ class FlowyNavigation extends StatelessWidget {
turns: const AlwaysStoppedAnimation(180 / 360),
child: Tooltip(
richMessage: TextSpan(children: [
TextSpan(text: LocaleKeys.sideBar_openSidebar.tr() + "\n"),
TextSpan(text: "${LocaleKeys.sideBar_openSidebar.tr()}\n"),
TextSpan(
text: Platform.isMacOS ? "⌘+\\" : "Ctrl+\\",
style: const TextStyle(color: Colors.white60),

@ -10,14 +10,14 @@ class FlowyMessageToast extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
child: FlowyText.medium(message, color: Colors.white),
),
decoration: const BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(4)),
color: Colors.black,
),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
child: FlowyText.medium(message, color: Colors.white),
),
);
}
}

@ -84,8 +84,8 @@ class _LanguageSelectorDropdownState extends State<LanguageSelectorDropdown> {
});
},
icon: const Visibility(
child: (Icon(Icons.arrow_downward)),
visible: false,
child: (Icon(Icons.arrow_downward)),
),
borderRadius: BorderRadius.circular(8),
items: EasyLocalization.of(context)!.supportedLocales.map((locale) {

@ -79,9 +79,9 @@ extension AnimatedPanelExtensions on Widget {
return AnimatedPanel(
closedX: closePos.dx,
closedY: closePos.dy,
child: this,
isClosed: isClosed ?? false,
duration: duration ?? .35,
curve: curve);
curve: curve,
child: this);
}
}

@ -199,8 +199,8 @@ class _DefaultEmojiPickerViewState extends State<DefaultEmojiPickerView> with Ti
if (widget.config.buttonMode == ButtonMode.MATERIAL) {
return TextButton(
onPressed: onPressed,
child: child,
style: ButtonStyle(padding: MaterialStateProperty.all(EdgeInsets.zero)),
child: child,
);
}
return CupertinoButton(padding: EdgeInsets.zero, onPressed: onPressed, child: child);

@ -87,7 +87,7 @@ class _DebugToast {
return deviceInfo.then((info) {
var debugText = "";
info.toMap().forEach((key, value) {
debugText = debugText + "$key: $value\n";
debugText = "$debugText$key: $value\n";
});
return debugText;
});

@ -10,8 +10,8 @@ class FlowyPoppuWindow extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Material(
child: child,
type: MaterialType.transparency,
child: child,
);
}

@ -7,14 +7,14 @@ packages:
name: _fe_analyzer_shared
url: "https://pub.dartlang.org"
source: hosted
version: "44.0.0"
version: "46.0.0"
analyzer:
dependency: "direct overridden"
description:
name: analyzer
url: "https://pub.dartlang.org"
source: hosted
version: "4.4.0"
version: "4.6.0"
animations:
dependency: transitive
description:
@ -182,7 +182,7 @@ packages:
name: connectivity_plus
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.0"
version: "2.3.6+1"
connectivity_plus_linux:
dependency: transitive
description:
@ -196,7 +196,7 @@ packages:
name: connectivity_plus_macos
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.2"
version: "1.2.4"
connectivity_plus_platform_interface:
dependency: transitive
description:
@ -210,14 +210,14 @@ packages:
name: connectivity_plus_web
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.2.3"
connectivity_plus_windows:
dependency: transitive
description:
name: connectivity_plus_windows
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.2.2"
convert:
dependency: transitive
description:

@ -81,6 +81,7 @@ dependencies:
reorderables: ^0.5.0
linked_scroll_controller: ^0.2.0
hotkey_manager: ^0.1.7
fixnum: ^1.0.1
dev_dependencies:
flutter_lints: ^2.0.1