Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
chore: use super parameters
  • Loading branch information
GroovinChip committed May 12, 2022
commit 7da8e94de2c1a85f4237fa08a3e6800045871b88
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## [1.4.0]
* Migrate to Flutter 3.0
* Minimumin dart sdk version is now 2.17.0
* Use new super parameters feature
* Update to `flutter_lints: ^2.0.1` with subsequent fixes
* `MacosScrollbar` API more closely matches its material counterpart

Expand Down
2 changes: 1 addition & 1 deletion analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ include: package:flutter_lints/flutter.yaml

linter:
rules:
- use_super_parameters: true
- use_super_parameters

analyzer:
plugins:
Expand Down
2 changes: 1 addition & 1 deletion example/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ linter:
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
- use_super_parameters: true
- use_super_parameters

# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
4 changes: 2 additions & 2 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ void main() {
}

class MacosUIGalleryApp extends StatelessWidget {
const MacosUIGalleryApp({Key? key}) : super(key: key);
const MacosUIGalleryApp({super.key});

@override
Widget build(BuildContext context) {
Expand All @@ -38,7 +38,7 @@ class MacosUIGalleryApp extends StatelessWidget {
}

class WidgetGallery extends StatefulWidget {
const WidgetGallery({Key? key}) : super(key: key);
const WidgetGallery({super.key});

@override
State<WidgetGallery> createState() => _WidgetGalleryState();
Expand Down
2 changes: 1 addition & 1 deletion example/lib/pages/buttons_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'package:provider/provider.dart';
import '../theme.dart';

class ButtonsPage extends StatefulWidget {
const ButtonsPage({Key? key}) : super(key: key);
const ButtonsPage({super.key});

@override
State<ButtonsPage> createState() => _ButtonsPageState();
Expand Down
6 changes: 3 additions & 3 deletions example/lib/pages/colors_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'package:flutter/cupertino.dart';
import 'package:macos_ui/macos_ui.dart';

class ColorsPage extends StatefulWidget {
const ColorsPage({Key? key}) : super(key: key);
const ColorsPage({super.key});

@override
State<ColorsPage> createState() => _ColorsPageState();
Expand Down Expand Up @@ -341,9 +341,9 @@ class _ColorsPageState extends State<ColorsPage> {

class ColorBox extends StatelessWidget {
const ColorBox({
Key? key,
super.key,
required this.color,
}) : super(key: key);
});

final Color color;

Expand Down
6 changes: 3 additions & 3 deletions example/lib/pages/dialogs_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:macos_ui/macos_ui.dart';
import 'package:macos_ui/src/library.dart';

class DialogsPage extends StatefulWidget {
const DialogsPage({Key? key}) : super(key: key);
const DialogsPage({super.key});

@override
State<DialogsPage> createState() => _DialogsPageState();
Expand Down Expand Up @@ -179,7 +179,7 @@ class _DialogsPageState extends State<DialogsPage> {
}

class DoNotNotifyRow extends StatefulWidget {
const DoNotNotifyRow({Key? key}) : super(key: key);
const DoNotNotifyRow({super.key});

@override
State<DoNotNotifyRow> createState() => _DoNotNotifyRowState();
Expand Down Expand Up @@ -207,7 +207,7 @@ class _DoNotNotifyRowState extends State<DoNotNotifyRow> {
}

class MacosuiSheet extends StatelessWidget {
const MacosuiSheet({Key? key}) : super(key: key);
const MacosuiSheet({super.key});

@override
Widget build(BuildContext context) {
Expand Down
2 changes: 1 addition & 1 deletion example/lib/pages/fields_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'package:flutter/cupertino.dart' hide OverlayVisibilityMode;
import 'package:macos_ui/macos_ui.dart';

class FieldsPage extends StatefulWidget {
const FieldsPage({Key? key}) : super(key: key);
const FieldsPage({super.key});

@override
State<FieldsPage> createState() => _FieldsPageState();
Expand Down
2 changes: 1 addition & 1 deletion example/lib/pages/indicators_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:macos_ui/macos_ui.dart';
import 'package:macos_ui/src/library.dart';

class IndicatorsPage extends StatefulWidget {
const IndicatorsPage({Key? key}) : super(key: key);
const IndicatorsPage({super.key});

@override
State<IndicatorsPage> createState() => _IndicatorsPageState();
Expand Down
4 changes: 1 addition & 3 deletions example/lib/pages/selectors_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ import 'package:flutter/cupertino.dart';
import 'package:macos_ui/macos_ui.dart';

class SelectorsPage extends StatefulWidget {
const SelectorsPage({
Key? key,
}) : super(key: key);
const SelectorsPage({super.key});

@override
State<SelectorsPage> createState() => _SelectorsPageState();
Expand Down
2 changes: 1 addition & 1 deletion example/lib/pages/toolbar_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:macos_ui/macos_ui.dart';
import 'package:macos_ui/src/library.dart';

class ToolbarPage extends StatefulWidget {
const ToolbarPage({Key? key}) : super(key: key);
const ToolbarPage({super.key});

@override
State<ToolbarPage> createState() => _ToolbarPageState();
Expand Down
4 changes: 2 additions & 2 deletions lib/src/buttons/back_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ class MacosBackButton extends StatefulWidget {
/// Creates a `BackButton` with the appropriate icon/background colors based
/// on light/dark themes.
const MacosBackButton({
Key? key,
super.key,
this.onPressed,
this.fillColor,
this.hoverColor,
this.semanticLabel,
this.mouseCursor = SystemMouseCursors.basic,
}) : super(key: key);
});

/// An override callback to perform instead of the default behavior which is
/// to pop the [Navigator].
Expand Down
6 changes: 2 additions & 4 deletions lib/src/buttons/checkbox.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/rendering.dart';
import 'package:macos_ui/macos_ui.dart';
import 'package:macos_ui/src/library.dart';
Expand All @@ -13,16 +12,15 @@ class MacosCheckbox extends StatelessWidget {
///
/// [size] must be non-negative
const MacosCheckbox({
Key? key,
super.key,
required this.value,
required this.onChanged,
this.size = 16.0,
this.activeColor,
this.disabledColor = CupertinoColors.quaternaryLabel,
this.offBorderColor = CupertinoColors.tertiaryLabel,
this.semanticLabel,
}) : assert(size >= 0),
super(key: key);
}) : assert(size >= 0);

/// Whether the checkbox is checked or not. If null, it'll be considered
/// mixed.
Expand Down
5 changes: 2 additions & 3 deletions lib/src/buttons/help_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import 'package:macos_ui/src/library.dart';
class HelpButton extends StatefulWidget {
///pressedOpacity, if non-null, must be in the range if 0.0 to 1.0
const HelpButton({
Key? key,
super.key,
this.color,
this.disabledColor,
this.onPressed,
Expand All @@ -21,8 +21,7 @@ class HelpButton extends StatefulWidget {
this.semanticLabel,
this.mouseCursor = SystemMouseCursors.basic,
}) : assert(pressedOpacity == null ||
(pressedOpacity >= 0.0 && pressedOpacity <= 1.0)),
super(key: key);
(pressedOpacity >= 0.0 && pressedOpacity <= 1.0));

/// The color of the button's background.
final Color? color;
Expand Down
5 changes: 2 additions & 3 deletions lib/src/buttons/icon_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'package:macos_ui/src/library.dart';
class MacosIconButton extends StatefulWidget {
/// Builds a macOS-style icon button
const MacosIconButton({
Key? key,
super.key,
required this.icon,
this.backgroundColor,
this.disabledColor,
Expand All @@ -26,8 +26,7 @@ class MacosIconButton extends StatefulWidget {
this.padding,
this.mouseCursor = SystemMouseCursors.basic,
}) : assert(pressedOpacity == null ||
(pressedOpacity >= 0.0 && pressedOpacity <= 1.0)),
super(key: key);
(pressedOpacity >= 0.0 && pressedOpacity <= 1.0));

/// The widget to use as the icon.
///
Expand Down
33 changes: 16 additions & 17 deletions lib/src/buttons/popup_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ typedef MacosPopupButtonBuilder = List<Widget> Function(BuildContext context);
// The widget that is the button wrapping the menu items.
class _MacosPopupMenuItemButton<T> extends StatefulWidget {
const _MacosPopupMenuItemButton({
Key? key,
super.key,
this.padding,
required this.route,
required this.buttonRect,
required this.constraints,
required this.itemIndex,
}) : super(key: key);
});

final _MacosPopupRoute<T> route;
final EdgeInsets? padding;
Expand Down Expand Up @@ -157,15 +157,15 @@ class _MacosPopupMenuItemButtonState<T>

class _MacosPopupMenu<T> extends StatefulWidget {
const _MacosPopupMenu({
Key? key,
super.key,
this.padding,
required this.route,
required this.buttonRect,
required this.constraints,
this.popupColor,
required this.hasTopItemsNotShown,
required this.hasBottomItemsNotShown,
}) : super(key: key);
});

final _MacosPopupRoute<T> route;
final EdgeInsets? padding;
Expand Down Expand Up @@ -597,7 +597,7 @@ class _MacosPopupRoute<T> extends PopupRoute<_MacosPopupRouteResult<T>> {

class _MacosPopupRoutePage<T> extends StatelessWidget {
const _MacosPopupRoutePage({
Key? key,
super.key,
required this.route,
required this.constraints,
this.items,
Expand All @@ -607,7 +607,7 @@ class _MacosPopupRoutePage<T> extends StatelessWidget {
required this.capturedThemes,
this.style,
required this.popupColor,
}) : super(key: key);
});

final _MacosPopupRoute<T> route;
final BoxConstraints constraints;
Expand Down Expand Up @@ -674,10 +674,10 @@ class _MacosPopupRoutePage<T> extends StatelessWidget {
// as closely as possible.
class _MenuItem<T> extends SingleChildRenderObjectWidget {
const _MenuItem({
Key? key,
super.key,
required this.onLayout,
required this.item,
}) : super(key: key, child: item);
}) : super(child: item);

final ValueChanged<Size> onLayout;
final MacosPopupMenuItem<T>? item;
Expand Down Expand Up @@ -716,10 +716,10 @@ class _MacosPopupMenuItemContainer extends StatelessWidget {
///
/// The [child] argument is required.
const _MacosPopupMenuItemContainer({
Key? key,
super.key,
this.alignment = AlignmentDirectional.centerStart,
required this.child,
}) : super(key: key);
});

/// The widget below this widget in the tree.
///
Expand Down Expand Up @@ -757,13 +757,13 @@ class MacosPopupMenuItem<T> extends _MacosPopupMenuItemContainer {
///
/// The [child] argument is required.
const MacosPopupMenuItem({
Key? key,
super.key,
this.onTap,
this.value,
this.enabled = true,
AlignmentGeometry alignment = AlignmentDirectional.centerStart,
required Widget child,
}) : super(key: key, alignment: alignment, child: child);
super.alignment,
required super.child,
});

/// Called when the popup menu item is tapped.
final VoidCallback? onTap;
Expand Down Expand Up @@ -828,7 +828,7 @@ class MacosPopupButton<T> extends StatefulWidget {
/// popup when it is open. If it is null, the appropriate macOS canvas color
/// will be used.
MacosPopupButton({
Key? key,
super.key,
required this.items,
this.selectedItemBuilder,
this.value,
Expand Down Expand Up @@ -856,8 +856,7 @@ class MacosPopupButton<T> extends StatefulWidget {
'Either zero or 2 or more [MacosPopupMenuItem]s were detected '
'with the same value',
),
assert(itemHeight == null || itemHeight >= _kMinInteractiveDimension),
super(key: key);
assert(itemHeight == null || itemHeight >= _kMinInteractiveDimension);

/// The list of items the user can select.
///
Expand Down
Loading