Skip to content

Commit

Permalink
Remove superfluous type arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasWanke committed May 30, 2023
1 parent 84186bc commit db7ee11
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 47 deletions.
2 changes: 1 addition & 1 deletion example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ class _TimetableExampleState extends State<TimetableExample>
tooltip: 'Go to today',
),
const SizedBox(width: 8),
DropdownButton<PredefinedVisibleDateRange>(
DropdownButton(
onChanged: (visibleRange) => _updateVisibleDateRange(visibleRange!),
value: _visibleDateRange,
items: [
Expand Down
2 changes: 1 addition & 1 deletion example/lib/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class ExampleApp extends StatelessWidget {

@override
Widget build(BuildContext context) {
return ValueListenableBuilder<MediaOverrideState>(
return ValueListenableBuilder(
valueListenable: _mediaOverrideState,
builder: (context, overrideState, _) {
return MaterialApp(
Expand Down
2 changes: 1 addition & 1 deletion lib/src/components/month_indicator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class _MonthIndicatorForController extends StatelessWidget {
@override
Widget build(BuildContext context) {
final controller = this.controller ?? DefaultDateController.of(context)!;
return ValueListenableBuilder<DateTime>(
return ValueListenableBuilder(
valueListenable: controller.date.map((it) => it.firstDayOfMonth),
builder: (context, month, _) => MonthIndicator(month, style: style),
);
Expand Down
6 changes: 3 additions & 3 deletions lib/src/components/multi_date_content.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ class _MultiDateContentState<E extends Event>
@override
void initState() {
super.initState();
geometryKey = widget.geometryKey ?? GlobalKey<MultiDateContentGeometry>();
geometryKey = widget.geometryKey ?? GlobalKey();
wasGeometryKeyFromWidget = widget.geometryKey != null;
}

@override
void didUpdateWidget(covariant MultiDateContent<E> oldWidget) {
super.didUpdateWidget(oldWidget);
if (widget.geometryKey == null && wasGeometryKeyFromWidget) {
geometryKey = GlobalKey<MultiDateContentGeometry>();
geometryKey = GlobalKey();
wasGeometryKeyFromWidget = false;
} else if (widget.geometryKey != null &&
geometryKey != widget.geometryKey) {
Expand Down Expand Up @@ -133,7 +133,7 @@ class MultiDateContentGeometry extends State<_MultiDateContentGeometryWidget> {
RenderBox _findRenderBox() => context.findRenderObject()! as RenderBox;

static MultiDateContentGeometry? maybeOf(BuildContext context) =>
context.findAncestorStateOfType<MultiDateContentGeometry>();
context.findAncestorStateOfType();
}

typedef PartDayDragStartCallback = VoidCallback;
Expand Down
2 changes: 1 addition & 1 deletion lib/src/components/multi_date_event_header.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class MultiDateEventHeader<E extends Event> extends StatelessWidget {
maxEventRows = maxEventRowsFromHeight.coerceAtMost(maxEventRows);
}

return ValueListenableBuilder<DatePageValue>(
return ValueListenableBuilder(
valueListenable: DefaultDateController.of(context)!,
builder: (context, pageValue, __) => _buildContent(
context,
Expand Down
2 changes: 1 addition & 1 deletion lib/src/components/now_indicator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ class _NowIndicatorPainter extends CustomPainter {
controller: controller,
style: style,
devicePixelRatio: devicePixelRatio,
repaintNotifier: ValueNotifier<DateTime>(DateTimeTimetable.now()),
repaintNotifier: ValueNotifier(DateTimeTimetable.now()),
);
_NowIndicatorPainter._({
required this.controller,
Expand Down
2 changes: 1 addition & 1 deletion lib/src/components/week_indicator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ class _WeekIndicatorForController extends StatelessWidget {

@override
Widget build(BuildContext context) {
return ValueListenableBuilder<Week>(
return ValueListenableBuilder(
valueListenable: (controller ?? DefaultDateController.of(context)!)
.date
.map((it) => it.week),
Expand Down
9 changes: 3 additions & 6 deletions lib/src/date/controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,7 @@ class DatePageValue with Diagnosticable {
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
super.debugFillProperties(properties);
properties.add(
DiagnosticsProperty<VisibleDateRange>('visibleRange', visibleRange),
);
properties.add(DiagnosticsProperty('visibleRange', visibleRange));
properties.add(DoubleProperty('page', page));
properties.add(DateDiagnosticsProperty('date', date));
}
Expand Down Expand Up @@ -245,8 +243,7 @@ class DatePageValueWithScrollActivity extends DatePageValue {
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
super.debugFillProperties(properties);
properties
.add(DiagnosticsProperty<DateScrollActivity>('activity', activity));
properties.add(DiagnosticsProperty('activity', activity));
}
}

Expand Down Expand Up @@ -276,7 +273,7 @@ class DrivenDateScrollActivity extends DateScrollActivity {
@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
super.debugFillProperties(properties);
properties.add(DiagnosticsProperty<DatePageValue>('target', target));
properties.add(DiagnosticsProperty('target', target));
}
}

Expand Down
46 changes: 21 additions & 25 deletions lib/src/date/date_page_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,14 @@ class _DatePageViewState extends State<DatePageView> {

@override
Widget build(BuildContext context) {
Widget child = ValueListenableBuilder<bool>(
Widget child = ValueListenableBuilder(
valueListenable: _controller!.map((it) => it.visibleRange.canScroll),
builder: (context, canScroll, _) =>
canScroll ? _buildScrollingChild() : _buildNonScrollingChild(),
);

if (widget.shrinkWrapInCrossAxis) {
child = ValueListenableBuilder<DatePageValue>(
child = ValueListenableBuilder(
valueListenable: _controller!,
builder: (context, pageValue, child) => ImmediateSizedBox(
heightGetter: () => _getHeight(pageValue),
Expand All @@ -105,36 +105,32 @@ class _DatePageViewState extends State<DatePageView> {
axisDirection: AxisDirection.right,
physics: DateScrollPhysics(_controller!.map((it) => it.visibleRange)),
controller: _scrollController!,
viewportBuilder: (context, position) {
return Viewport(
axisDirection: AxisDirection.right,
offset: position,
slivers: [
ValueListenableBuilder<int>(
valueListenable: _controller!.map((it) => it.visibleDayCount),
builder: (context, visibleDayCount, _) => SliverFillViewport(
padEnds: false,
viewportFraction: 1 / visibleDayCount,
delegate: SliverChildBuilderDelegate(
(context, index) => _buildPage(context, _minPage + index),
),
viewportBuilder: (context, position) => Viewport(
axisDirection: AxisDirection.right,
offset: position,
slivers: [
ValueListenableBuilder(
valueListenable: _controller!.map((it) => it.visibleDayCount),
builder: (context, visibleDayCount, _) => SliverFillViewport(
padEnds: false,
viewportFraction: 1 / visibleDayCount,
delegate: SliverChildBuilderDelegate(
(context, index) => _buildPage(context, _minPage + index),
),
),
],
);
},
),
],
),
);
}

Widget _buildNonScrollingChild() {
return ValueListenableBuilder<DatePageValue>(
return ValueListenableBuilder(
valueListenable: _controller!,
builder: (context, value, _) => Row(
children: [
for (var i = 0; i < value.visibleDayCount; i++)
Expanded(child: _buildPage(context, value.page.toInt() + i)),
],
),
builder: (context, value, _) => Row(children: [
for (var i = 0; i < value.visibleDayCount; i++)
Expanded(child: _buildPage(context, value.page.toInt() + i)),
]),
);
}

Expand Down
11 changes: 5 additions & 6 deletions lib/src/time/zoom.dart
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,7 @@ class _TimeZoomState extends State<TimeZoom>
math.log(_kDrag / 100);

_animation =
Tween<double>(begin: _outerOffset, end: frictionSimulation.finalX)
.animate(
Tween(begin: _outerOffset, end: frictionSimulation.finalX).animate(
CurvedAnimation(parent: _animationController, curve: Curves.decelerate),
);
_animationController.duration = finalTime.seconds;
Expand Down Expand Up @@ -593,7 +592,7 @@ class _ScaleGestureRecognizer extends OneSequenceGestureRecognizer {
kMaxFlingVelocity,
);
}
invokeCallback<void>(
invokeCallback(
'onEnd',
() => onEnd!(
ScaleEndDetails(
Expand All @@ -603,7 +602,7 @@ class _ScaleGestureRecognizer extends OneSequenceGestureRecognizer {
),
);
} else {
invokeCallback<void>(
invokeCallback(
'onEnd',
() => onEnd!(
ScaleEndDetails(
Expand Down Expand Up @@ -648,7 +647,7 @@ class _ScaleGestureRecognizer extends OneSequenceGestureRecognizer {
}

if (_state == _ScaleState.started && onUpdate != null) {
invokeCallback<void>('onUpdate', () {
invokeCallback('onUpdate', () {
onUpdate!(ScaleUpdateDetails(
scale: _scaleFactor,
horizontalScale: _horizontalScaleFactor,
Expand All @@ -668,7 +667,7 @@ class _ScaleGestureRecognizer extends OneSequenceGestureRecognizer {
void _dispatchOnStartCallbackIfNeeded() {
assert(_state == _ScaleState.started);
if (onStart != null) {
invokeCallback<void>('onStart', () {
invokeCallback('onStart', () {
onStart!(ScaleStartDetails(
focalPoint: _currentFocalPoint,
localFocalPoint: PointerEvent.transformPosition(
Expand Down
2 changes: 1 addition & 1 deletion lib/src/utils/size_reporting_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class _SizeReportingWidgetState extends State<SizeReportingWidget> {
@override
Widget build(BuildContext context) {
WidgetsBinding.instance.addPostFrameCallback((_) => _notifySize());
return NotificationListener<SizeChangedLayoutNotification>(
return NotificationListener(
onNotification: (_) {
WidgetsBinding.instance.addPostFrameCallback((_) => _notifySize());
return true;
Expand Down

0 comments on commit db7ee11

Please sign in to comment.