Skip to content

Commit

Permalink
fix: update lints (jamesblasco#380)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesblasco authored and TasnimAnas committed Jul 13, 2024
1 parent 24fa9e9 commit 255fdc8
Show file tree
Hide file tree
Showing 24 changed files with 95 additions and 409 deletions.
5 changes: 2 additions & 3 deletions modal_bottom_sheet/lib/src/bottom_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ typedef WidgetWithChildBuilder = Widget Function(
class ModalBottomSheet extends StatefulWidget {
/// Creates a bottom sheet.
const ModalBottomSheet({
Key? key,
super.key,
required this.animationController,
this.animationCurve,
this.enableDrag = true,
Expand All @@ -48,8 +48,7 @@ class ModalBottomSheet extends StatefulWidget {
double? closeProgressThreshold,
this.willPopThreshold = _willPopThreshold,
}) : closeProgressThreshold =
closeProgressThreshold ?? _closeProgressThreshold,
super(key: key);
closeProgressThreshold ?? _closeProgressThreshold;

/// The closeProgressThreshold parameter
/// specifies when the bottom sheet will be dismissed when user drags it.
Expand Down
9 changes: 4 additions & 5 deletions modal_bottom_sheet/lib/src/bottom_sheet_route.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ const Duration _bottomSheetDuration = Duration(milliseconds: 400);

class _ModalBottomSheet<T> extends StatefulWidget {
const _ModalBottomSheet({
Key? key,
super.key,
this.closeProgressThreshold,
required this.route,
this.secondAnimationController,
this.bounce = false,
this.expanded = false,
this.enableDrag = true,
this.animationCurve,
}) : super(key: key);
});

final double? closeProgressThreshold;
final ModalSheetRoute<T> route;
Expand Down Expand Up @@ -137,9 +137,8 @@ class ModalSheetRoute<T> extends PageRoute<T> {
this.bounce = false,
this.animationCurve,
Duration? duration,
RouteSettings? settings,
}) : duration = duration ?? _bottomSheetDuration,
super(settings: settings);
super.settings,
}) : duration = duration ?? _bottomSheetDuration;

final double? closeProgressThreshold;
final WidgetWithChildBuilder? containerBuilder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ class BarBottomSheet extends StatelessWidget {
final SystemUiOverlayStyle? overlayStyle;

const BarBottomSheet({
Key? key,
super.key,
required this.child,
this.control,
this.clipBehavior,
this.shape,
this.backgroundColor,
this.elevation,
this.overlayStyle,
}) : super(key: key);
});

@override
Widget build(BuildContext context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,12 @@ class _CupertinoBottomSheetContainer extends StatelessWidget {
final SystemUiOverlayStyle? overlayStyle;

const _CupertinoBottomSheetContainer({
Key? key,
required this.child,
this.backgroundColor,
required this.topRadius,
this.overlayStyle,
this.shadow,
}) : super(key: key);
});

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -178,44 +177,29 @@ class CupertinoModalBottomSheetRoute<T> extends ModalSheetRoute<T> {
final SystemUiOverlayStyle? overlayStyle;

CupertinoModalBottomSheetRoute({
required WidgetBuilder builder,
WidgetWithChildBuilder? containerBuilder,
double? closeProgressThreshold,
String? barrierLabel,
required super.builder,
super.containerBuilder,
super.closeProgressThreshold,
super.barrierLabel,
double? elevation,
ShapeBorder? shape,
Clip? clipBehavior,
AnimationController? secondAnimationController,
Curve? animationCurve,
Color? modalBarrierColor,
bool bounce = true,
bool isDismissible = true,
bool enableDrag = true,
required bool expanded,
Duration? duration,
RouteSettings? settings,
ScrollController? scrollController,
super.secondAnimationController,
super.animationCurve,
super.modalBarrierColor,
super.bounce = true,
super.isDismissible,
super.enableDrag,
required super.expanded,
super.duration,
super.settings,
super.scrollController,
this.boxShadow = _kDefaultBoxShadow,
this.transitionBackgroundColor,
this.topRadius = _kDefaultTopRadius,
this.previousRouteAnimationCurve,
this.overlayStyle,
}) : super(
closeProgressThreshold: closeProgressThreshold,
scrollController: scrollController,
containerBuilder: containerBuilder,
builder: builder,
bounce: bounce,
barrierLabel: barrierLabel,
secondAnimationController: secondAnimationController,
modalBarrierColor: modalBarrierColor,
isDismissible: isDismissible,
enableDrag: enableDrag,
expanded: expanded,
settings: settings,
animationCurve: animationCurve,
duration: duration,
);
});

@override
Widget buildTransitions(
Expand Down Expand Up @@ -264,13 +248,12 @@ class _CupertinoModalTransition extends StatelessWidget {
final Widget body;

const _CupertinoModalTransition({
Key? key,
required this.secondaryAnimation,
required this.body,
required this.topRadius,
this.backgroundColor = Colors.black,
this.animationCurve,
}) : super(key: key);
});

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -431,12 +414,12 @@ class CupertinoScaffold extends StatefulWidget {
final SystemUiOverlayStyle? overlayStyle;

const CupertinoScaffold({
Key? key,
super.key,
required this.body,
this.topRadius = _kDefaultTopRadius,
this.transitionBackgroundColor = Colors.black,
this.overlayStyle,
}) : super(key: key);
});

@override
State<StatefulWidget> createState() => _CupertinoScaffoldState();
Expand Down
14 changes: 5 additions & 9 deletions modal_bottom_sheet/lib/src/material_with_modal_page_route.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,11 @@ class MaterialWithModalsPageRoute<T> extends MaterialPageRoute<T> {
/// The values of [builder], [maintainState], and [fullScreenDialog] must not
/// be null.
MaterialWithModalsPageRoute({
required WidgetBuilder builder,
RouteSettings? settings,
bool maintainState = true,
bool fullscreenDialog = false,
}) : super(
settings: settings,
fullscreenDialog: fullscreenDialog,
builder: builder,
maintainState: maintainState);
required super.builder,
super.settings,
super.maintainState,
super.fullscreenDialog,
});

ModalSheetRoute? _nextModalRoute;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@ import 'package:flutter/widgets.dart';
class ModalScrollController extends InheritedWidget {
/// Creates a widget that associates a [ScrollController] with a subtree.
ModalScrollController({
Key? key,
super.key,
required this.controller,
required Widget child,
}) : super(
key: key,
child: PrimaryScrollController(
controller: controller,
child: child,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ class ScrollToTopStatusBarHandler extends StatefulWidget {
final ScrollController scrollController;

const ScrollToTopStatusBarHandler({
Key? key,
super.key,
required this.child,
required this.scrollController,
}) : super(key: key);
});

@override
ScrollToTopStatusBarState createState() => ScrollToTopStatusBarState();
Expand Down
4 changes: 2 additions & 2 deletions modal_bottom_sheet/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ packages:
dependency: "direct dev"
description:
name: lints
sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452"
sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290
url: "https://pub.dev"
source: hosted
version: "2.1.1"
version: "3.0.0"
matcher:
dependency: transitive
description:
Expand Down
2 changes: 1 addition & 1 deletion modal_bottom_sheet/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
lints: ^2.0.0
lints: ^3.0.0
3 changes: 1 addition & 2 deletions modal_bottom_sheet/test/bottom_sheet_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,9 @@ Finder _textButtonWithText(String text) {

class _TestWidget extends StatefulWidget {
const _TestWidget({
Key? key,
this.onInitState,
this.onDispose,
}) : super(key: key);
});

final VoidCallback? onInitState;
final VoidCallback? onDispose;
Expand Down
23 changes: 10 additions & 13 deletions sheet/lib/src/physics.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ mixin SheetPhysics on ScrollPhysics {
/// Sheet physics that does not allow the user to drag a sheet.
class NeverDraggableSheetPhysics extends NeverScrollableScrollPhysics
with SheetPhysics {
const NeverDraggableSheetPhysics({ScrollPhysics? parent})
: super(parent: parent);
const NeverDraggableSheetPhysics({super.parent});

@override
NeverDraggableSheetPhysics applyTo(ScrollPhysics? ancestor) {
Expand All @@ -30,8 +29,7 @@ class NeverDraggableSheetPhysics extends NeverScrollableScrollPhysics
class AlwaysDraggableSheetPhysics extends AlwaysScrollableScrollPhysics
with SheetPhysics {
/// Creates scroll physics that always lets the user scroll.
const AlwaysDraggableSheetPhysics({ScrollPhysics? parent})
: super(parent: parent);
const AlwaysDraggableSheetPhysics({super.parent});

@override
AlwaysDraggableSheetPhysics applyTo(ScrollPhysics? ancestor) {
Expand All @@ -43,9 +41,9 @@ class AlwaysDraggableSheetPhysics extends AlwaysScrollableScrollPhysics
class BouncingSheetPhysics extends ScrollPhysics with SheetPhysics {
/// Creates sheet physics that bounce back from the edge.
const BouncingSheetPhysics({
ScrollPhysics? parent,
super.parent,
this.overflowViewport = false,
}) : super(parent: parent);
});

final bool overflowViewport;

Expand Down Expand Up @@ -169,7 +167,6 @@ class BouncingSheetPhysics extends ScrollPhysics with SheetPhysics {
@override
Simulation? createBallisticSimulation(
ScrollMetrics position, double velocity) {

if (position.outOfRange) {
return BouncingScrollSimulation(
spring: const SpringDescription(
Expand Down Expand Up @@ -223,8 +220,8 @@ class BouncingSheetPhysics extends ScrollPhysics with SheetPhysics {
class NoMomentumSheetPhysics extends ScrollPhysics with SheetPhysics {
/// Creates sheet physics that has no momentum after the user stops dragging.
const NoMomentumSheetPhysics({
ScrollPhysics? parent,
}) : super(parent: parent);
super.parent,
});

@override
NoMomentumSheetPhysics applyTo(ScrollPhysics? ancestor) {
Expand Down Expand Up @@ -289,8 +286,8 @@ class NoMomentumSheetPhysics extends ScrollPhysics with SheetPhysics {
class ClampingSheetPhysics extends ScrollPhysics with SheetPhysics {
/// Creates sheet physics that has no momentum after the user stops dragging.
const ClampingSheetPhysics({
ScrollPhysics? parent,
}) : super(parent: parent);
super.parent,
});

@override
ClampingSheetPhysics applyTo(ScrollPhysics? ancestor) {
Expand Down Expand Up @@ -384,10 +381,10 @@ class ClampingSheetPhysics extends ScrollPhysics with SheetPhysics {
class SnapSheetPhysics extends ScrollPhysics with SheetPhysics {
/// Creates snapping physics for a [Sheet].
const SnapSheetPhysics({
ScrollPhysics? parent,
super.parent,
this.stops = const <double>[],
this.relative = true,
}) : super(parent: parent);
});

/// Positions where the sheet could be snapped once the user stops
/// dragging
Expand Down
24 changes: 10 additions & 14 deletions sheet/lib/src/route/cupertino/sheet_route.dart
Original file line number Diff line number Diff line change
Expand Up @@ -222,11 +222,11 @@ class CupertinoSheetRoute<T> extends SheetRoute<T> {
@visibleForTesting
class CupertinoSheetBottomRouteTransition extends StatelessWidget {
const CupertinoSheetBottomRouteTransition({
Key? key,
super.key,
required this.sheetAnimation,
required this.secondaryAnimation,
required this.body,
}) : super(key: key);
});

final Widget body;

Expand Down Expand Up @@ -319,10 +319,10 @@ class CupertinoSheetPage<T> extends Page<T> {
const CupertinoSheetPage({
required this.child,
this.maintainState = true,
LocalKey? key,
String? name,
Object? arguments,
}) : super(key: key, name: name, arguments: arguments);
super.key,
super.name,
super.arguments,
});

/// The content to be shown in the [Route] created by this page.
final Widget child;
Expand All @@ -343,17 +343,13 @@ class CupertinoSheetPage<T> extends Page<T> {
class _PageBasedCupertinoSheetRoute<T> extends CupertinoSheetRoute<T> {
_PageBasedCupertinoSheetRoute({
required CupertinoSheetPage<T> page,
List<double>? stops,
double initialStop = 1,
Color? backgroundColor,
bool maintainState = true,
super.stops,
super.initialStop,
super.backgroundColor,
super.maintainState,
}) : super(
settings: page,
builder: (BuildContext context) => page.child,
initialStop: initialStop,
backgroundColor: backgroundColor,
stops: stops,
maintainState: maintainState,
);

CupertinoSheetPage<T> get _page => settings as CupertinoSheetPage<T>;
Expand Down
3 changes: 1 addition & 2 deletions sheet/lib/src/route/sheet_route.dart
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,7 @@ class _PageBasedSheetRoute<T> extends SheetRoute<T> {
}

class _SheetRouteContainer extends StatefulWidget {
const _SheetRouteContainer({Key? key, required this.sheetRoute})
: super(key: key);
const _SheetRouteContainer({required this.sheetRoute});

final SheetRoute<dynamic> sheetRoute;
@override
Expand Down
Loading

0 comments on commit 255fdc8

Please sign in to comment.