Skip to content

Commit

Permalink
-Updated flutter version [3.16.4] & Dart[3.2.3]
Browse files Browse the repository at this point in the history
-[breaking change]Remove the colon-syntax for default values ,to make project compatible for Dart 3 and above
Reported issue: dart-lang/language#2357
  • Loading branch information
hemang committed Dec 17, 2023
1 parent 0be096c commit c036d51
Show file tree
Hide file tree
Showing 14 changed files with 152 additions and 170 deletions.
1 change: 1 addition & 0 deletions lib/pull_to_refresh.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export 'src/indicator/waterdrop_header.dart';
export 'src/indicator/custom_indicator.dart';
export 'src/internals/refresh_physics.dart';
export "src/internals/indicator_wrap.dart";
export 'src/internals/slivers.dart';
export 'src/indicator/link_indicator.dart';
export 'src/indicator/material_indicator.dart';
export 'src/indicator/bezier_indicator.dart';
Expand Down
26 changes: 11 additions & 15 deletions lib/src/indicator/bezier_indicator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,11 @@
* Time: 2019-08-02 19:20
*/

import 'package:flutter/animation.dart';
import 'package:flutter/cupertino.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter/material.dart'
hide RefreshIndicator, RefreshIndicatorState;
import 'package:pull_to_refresh/src/internals/indicator_wrap.dart';
import 'dart:math' as math;
import 'package:flutter/physics.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';

enum BezierDismissType { None, RectSpread, ScaleToCenter }

Expand All @@ -38,15 +34,15 @@ class BezierHeader extends RefreshIndicator {
final double rectHeight;

BezierHeader(
{this.child: const Text(""),
{this.child = const Text(""),
this.onOffsetChange,
this.onModeChange,
this.readyRefresh,
this.enableChildOverflow: false,
this.enableChildOverflow = false,
this.endRefresh,
this.onResetValue,
this.dismissType: BezierDismissType.RectSpread,
this.rectHeight: 70,
this.dismissType = BezierDismissType.RectSpread,
this.rectHeight = 70,
this.bezierColor})
: super(refreshStyle: RefreshStyle.UnFollow, height: rectHeight);

Expand Down Expand Up @@ -306,12 +302,12 @@ class BezierCircleHeader extends StatefulWidget {

BezierCircleHeader(
{this.bezierColor,
this.rectHeight: 70,
this.circleColor: Colors.white,
this.enableChildOverflow: false,
this.dismissType: BezierDismissType.RectSpread,
this.circleType: BezierCircleType.Progress,
this.circleRadius: 12});
this.rectHeight = 70,
this.circleColor = Colors.white,
this.enableChildOverflow = false,
this.dismissType = BezierDismissType.RectSpread,
this.circleType = BezierCircleType.Progress,
this.circleRadius = 12});

@override
State<StatefulWidget> createState() {
Expand Down
35 changes: 16 additions & 19 deletions lib/src/indicator/classic_indicator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@

import 'package:flutter/material.dart'
hide RefreshIndicator, RefreshIndicatorState;
import 'package:flutter/widgets.dart';
import '../../pull_to_refresh.dart';
import '../internals/indicator_wrap.dart';
import '../smart_refresher.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';

Expand Down Expand Up @@ -59,11 +56,11 @@ class ClassicHeader extends RefreshIndicator {

const ClassicHeader({
Key? key,
RefreshStyle refreshStyle: RefreshStyle.Follow,
double height: 60.0,
Duration completeDuration: const Duration(milliseconds: 600),
RefreshStyle refreshStyle = RefreshStyle.Follow,
double height = 60.0,
Duration completeDuration = const Duration(milliseconds: 600),
this.outerBuilder,
this.textStyle: const TextStyle(color: Colors.grey),
this.textStyle = const TextStyle(color: Colors.grey),
this.releaseText,
this.refreshingText,
this.canTwoLevelIcon,
Expand All @@ -72,11 +69,11 @@ class ClassicHeader extends RefreshIndicator {
this.completeText,
this.failedText,
this.idleText,
this.iconPos: IconPosition.left,
this.spacing: 15.0,
this.iconPos = IconPosition.left,
this.spacing = 15.0,
this.refreshingIcon,
this.failedIcon: const Icon(Icons.error, color: Colors.grey),
this.completeIcon: const Icon(Icons.done, color: Colors.grey),
this.failedIcon = const Icon(Icons.error, color: Colors.grey),
this.completeIcon = const Icon(Icons.done, color: Colors.grey),
this.idleIcon = const Icon(Icons.arrow_downward, color: Colors.grey),
this.releaseIcon = const Icon(Icons.refresh, color: Colors.grey),
}) : super(
Expand Down Expand Up @@ -217,22 +214,22 @@ class ClassicFooter extends LoadIndicator {
const ClassicFooter({
Key? key,
VoidCallback? onClick,
LoadStyle loadStyle: LoadStyle.ShowAlways,
double height: 60.0,
LoadStyle loadStyle = LoadStyle.ShowAlways,
double height = 60.0,
this.outerBuilder,
this.textStyle: const TextStyle(color: Colors.grey),
this.textStyle = const TextStyle(color: Colors.grey),
this.loadingText,
this.noDataText,
this.noMoreIcon,
this.idleText,
this.failedText,
this.canLoadingText,
this.failedIcon: const Icon(Icons.error, color: Colors.grey),
this.iconPos: IconPosition.left,
this.spacing: 15.0,
this.completeDuration: const Duration(milliseconds: 300),
this.failedIcon = const Icon(Icons.error, color: Colors.grey),
this.iconPos = IconPosition.left,
this.spacing = 15.0,
this.completeDuration = const Duration(milliseconds: 300),
this.loadingIcon,
this.canLoadingIcon: const Icon(Icons.autorenew, color: Colors.grey),
this.canLoadingIcon = const Icon(Icons.autorenew, color: Colors.grey),
this.idleIcon = const Icon(Icons.arrow_upward, color: Colors.grey),
}) : super(
key: key,
Expand Down
10 changes: 5 additions & 5 deletions lib/src/indicator/custom_indicator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ class CustomHeader extends RefreshIndicator {
this.onOffsetChange,
this.onModeChange,
this.onResetValue,
double height: 60.0,
Duration completeDuration: const Duration(milliseconds: 600),
RefreshStyle refreshStyle: RefreshStyle.Follow,
double height = 60.0,
Duration completeDuration = const Duration(milliseconds: 600),
RefreshStyle refreshStyle = RefreshStyle.Follow,
}) : super(
key: key,
completeDuration: completeDuration,
Expand Down Expand Up @@ -147,12 +147,12 @@ class CustomFooter extends LoadIndicator {

const CustomFooter({
Key? key,
double height: 60.0,
double height = 60.0,
this.onModeChange,
this.onOffsetChange,
this.readyLoading,
this.endLoading,
LoadStyle loadStyle: LoadStyle.ShowAlways,
LoadStyle loadStyle = LoadStyle.ShowAlways,
required this.builder,
Function? onClick,
}) : super(
Expand Down
10 changes: 5 additions & 5 deletions lib/src/indicator/link_indicator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* Email: peng8350@gmail.com
* Time: 2019-06-26 13:17
*/
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:flutter/widgets.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';

/// enable header link other header place outside the viewport
class LinkHeader extends RefreshIndicator {
Expand All @@ -14,9 +14,9 @@ class LinkHeader extends RefreshIndicator {
const LinkHeader(
{Key? key,
required this.linkKey,
double height: 0.0,
double height = 0.0,
RefreshStyle? refreshStyle,
Duration completeDuration: const Duration(milliseconds: 200)})
Duration completeDuration = const Duration(milliseconds: 200)})
: super(
height: height,
refreshStyle: refreshStyle,
Expand Down Expand Up @@ -81,8 +81,8 @@ class LinkFooter extends LoadIndicator {
const LinkFooter(
{Key? key,
required this.linkKey,
double height: 0.0,
LoadStyle loadStyle: LoadStyle.ShowAlways})
double height = 0.0,
LoadStyle loadStyle = LoadStyle.ShowAlways})
: super(height: height, loadStyle: loadStyle, key: key);

@override
Expand Down
20 changes: 9 additions & 11 deletions lib/src/indicator/material_indicator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
* Time: 2019/5/19 下午9:23
*/

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'
hide RefreshIndicator, RefreshIndicatorState;
import 'package:flutter/widgets.dart';
import '../internals/indicator_wrap.dart';
import '../smart_refresher.dart';

Expand All @@ -34,12 +32,12 @@ class MaterialClassicHeader extends RefreshIndicator {

const MaterialClassicHeader({
Key? key,
double height: 80.0,
double height = 80.0,
this.semanticsLabel,
this.semanticsValue,
this.color,
double offset: 0,
this.distance: 50.0,
double offset = 0,
this.distance = 50.0,
this.backgroundColor,
}) : super(
key: key,
Expand Down Expand Up @@ -95,7 +93,7 @@ class _MaterialClassicHeaderState
@override
void didUpdateWidget(covariant MaterialClassicHeader oldWidget) {
// TODO: implement didUpdateWidget
_position = Scrollable.of(context)!.position;
_position = Scrollable.of(context).position;
super.didUpdateWidget(oldWidget);
}

Expand All @@ -113,7 +111,7 @@ class _MaterialClassicHeaderState
alignment: Alignment.topCenter,
child: RefreshProgressIndicator(
semanticsLabel: widget.semanticsLabel ??
MaterialLocalizations?.of(context)
MaterialLocalizations.of(context)
.refreshIndicatorSemanticLabel,
semanticsValue: widget.semanticsValue,
value: floating ? null : _valueAni.value,
Expand Down Expand Up @@ -157,7 +155,7 @@ class _MaterialClassicHeaderState
@override
void didChangeDependencies() {
final ThemeData theme = Theme.of(context);
_position = Scrollable.of(context)!.position;
_position = Scrollable.of(context).position;
_valueColor = _positionController.drive(
ColorTween(
begin: (widget.color ?? theme.primaryColor).withOpacity(0.0),
Expand Down Expand Up @@ -195,10 +193,10 @@ class WaterDropMaterialHeader extends MaterialClassicHeader {
const WaterDropMaterialHeader({
Key? key,
String? semanticsLabel,
double distance: 60.0,
double offset: 0,
double distance = 60.0,
double offset = 0,
String? semanticsValue,
Color color: Colors.white,
Color color = Colors.white,
Color? backgroundColor,
}) : super(
key: key,
Expand Down
18 changes: 8 additions & 10 deletions lib/src/indicator/twolevel_indicator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
*/

import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart';
import 'classic_indicator.dart';
import '../smart_refresher.dart';

Expand Down Expand Up @@ -89,23 +87,23 @@ class TwoLevelHeader extends StatelessWidget {

const TwoLevelHeader(
{Key? key,
this.height: 80.0,
this.height = 80.0,
this.decoration,
this.displayAlignment: TwoLevelDisplayAlignment.fromBottom,
this.completeDuration: const Duration(milliseconds: 600),
this.textStyle: const TextStyle(color: const Color(0xff555555)),
this.displayAlignment = TwoLevelDisplayAlignment.fromBottom,
this.completeDuration = const Duration(milliseconds: 600),
this.textStyle = const TextStyle(color: const Color(0xff555555)),
this.releaseText,
this.refreshingText,
this.canTwoLevelIcon,
this.canTwoLevelText,
this.completeText,
this.failedText,
this.idleText,
this.iconPos: IconPosition.left,
this.spacing: 15.0,
this.iconPos = IconPosition.left,
this.spacing = 15.0,
this.refreshingIcon,
this.failedIcon: const Icon(Icons.error, color: Colors.grey),
this.completeIcon: const Icon(Icons.done, color: Colors.grey),
this.failedIcon = const Icon(Icons.error, color: Colors.grey),
this.completeIcon = const Icon(Icons.done, color: Colors.grey),
this.idleIcon = const Icon(Icons.arrow_downward, color: Colors.grey),
this.releaseIcon = const Icon(Icons.refresh, color: Colors.grey),
this.twoLevelWidget});
Expand Down
15 changes: 6 additions & 9 deletions lib/src/indicator/waterdrop_header.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,9 @@
import 'dart:async';
import 'package:flutter/material.dart'
hide RefreshIndicatorState, RefreshIndicator;
import 'package:flutter/widgets.dart';
import 'package:flutter/foundation.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import '../internals/indicator_wrap.dart';
import 'package:flutter/cupertino.dart';
import '../smart_refresher.dart';

/// QQ ios refresh header effect
class WaterDropHeader extends RefreshIndicator {
Expand All @@ -35,10 +32,10 @@ class WaterDropHeader extends RefreshIndicator {
Key? key,
this.refresh,
this.complete,
Duration completeDuration: const Duration(milliseconds: 600),
Duration completeDuration = const Duration(milliseconds: 600),
this.failed,
this.waterDropColor: Colors.grey,
this.idleIcon: const Icon(
this.waterDropColor = Colors.grey,
this.idleIcon = const Icon(
Icons.autorenew,
size: 15,
color: Colors.white,
Expand Down Expand Up @@ -165,17 +162,17 @@ class _WaterDropHeaderState extends RefreshIndicatorState<WaterDropHeader>
),
),
quarterTurns:
Scrollable.of(context)!.axisDirection == AxisDirection.up
Scrollable.of(context).axisDirection == AxisDirection.up
? 10
: 0,
),
Container(
alignment:
Scrollable.of(context)!.axisDirection == AxisDirection.up
Scrollable.of(context).axisDirection == AxisDirection.up
? Alignment.bottomCenter
: Alignment.topCenter,
margin:
Scrollable.of(context)!.axisDirection == AxisDirection.up
Scrollable.of(context).axisDirection == AxisDirection.up
? EdgeInsets.only(bottom: 12.0)
: EdgeInsets.only(top: 12.0),
child: widget.idleIcon,
Expand Down
Loading

0 comments on commit c036d51

Please sign in to comment.