Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion example/ios/Flutter/AppFrameworkInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>9.0</string>
<string>11.0</string>
</dict>
</plist>
6 changes: 3 additions & 3 deletions example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
Expand Down Expand Up @@ -361,7 +361,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -408,7 +408,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
Expand Down
92 changes: 47 additions & 45 deletions example/ios/Runner/Info.plist
Original file line number Diff line number Diff line change
@@ -1,45 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>example</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(FLUTTER_BUILD_NAME)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>example</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(FLUTTER_BUILD_NAME)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
</dict>
</plist>
1 change: 1 addition & 0 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ class _MyHomePageState extends State<MyHomePage> {
),
),
body: LiquidPullToRefresh(
showDroplet: false,
key: _refreshIndicatorKey,
onRefresh: _handleRefresh,
showChildOpacityTransition: false,
Expand Down
88 changes: 53 additions & 35 deletions lib/liquid_pull_to_refresh.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,20 @@ enum _LiquidPullToRefreshMode {
}

class LiquidPullToRefresh extends StatefulWidget {
const LiquidPullToRefresh({
Key? key,
this.animSpeedFactor = 1.0,
required this.child,
required this.onRefresh,
this.color,
this.backgroundColor,
this.height,
this.springAnimationDurationInMilliseconds = 1000,
this.borderWidth = 2.0,
this.showChildOpacityTransition = true,
}) : assert(animSpeedFactor >= 1.0),
const LiquidPullToRefresh(
{Key? key,
this.animSpeedFactor = 1.0,
required this.child,
required this.onRefresh,
this.color,
this.backgroundColor,
this.height,
this.springAnimationDurationInMilliseconds = 1000,
this.borderWidth = 2.0,
this.showChildOpacityTransition = true,
this.showDroplet = true,
this.loaderWidget})
: assert(animSpeedFactor >= 1.0),
super(key: key);

/// The widget below this widget in the tree.
Expand Down Expand Up @@ -107,6 +109,12 @@ class LiquidPullToRefresh extends StatefulWidget {
/// [ThemeData.canvasColor] by default.
final Color? backgroundColor;

/// show the animated droplet, the default is true
final bool showDroplet;

/// the default is a container with the specified color
final Widget? loaderWidget;

@override
LiquidPullToRefreshState createState() => LiquidPullToRefreshState();
}
Expand Down Expand Up @@ -596,6 +604,7 @@ class LiquidPullToRefreshState extends State<LiquidPullToRefresh>
: 1.0,
child: child);
}

return Transform.translate(
offset: new Offset(0.0, _positionController.value * height * 1.5),
child: child,
Expand All @@ -613,7 +622,7 @@ class LiquidPullToRefreshState extends State<LiquidPullToRefresh>
clipper: CurveHillClipper(
centreHeight: height,
curveHeight: height / 2 * _springAnimation.value, // 50.0
peakHeight: height *
peakHeight: (widget.showDroplet ? height : 0) *
3 /
10 *
((_peakHeightUpAnimation.value != 1.0) //30.0
Expand Down Expand Up @@ -649,28 +658,37 @@ class LiquidPullToRefreshState extends State<LiquidPullToRefresh>
(0.36 * _indicatorTranslateWithPeakAnimation.value) -
(0.64 * _indicatorTranslateAnimation.value)),
),
child: Transform(
transform: Matrix4.identity()
..rotateZ(_progressingRotateAnimation.value * 5 * pi / 6),
alignment: FractionalOffset.center,
child: CircularProgress(
backgroundColor: backgroundColor,
progressCircleOpacity: _ringOpacityAnimation.value,
innerCircleRadius: height *
15 /
100 * // 15.0
((_mode != _LiquidPullToRefreshMode.done)
? _indicatorRadiusWithPeakAnimation.value
: _radiusAnimation.value),
progressCircleBorderWidth: widget.borderWidth,
//2.0
progressCircleRadius: (_ringOpacityAnimation.value != 0.0)
? (height * 2 / 10) * _ringRadiusAnimation.value //20.0
: 0.0,
startAngle: _progressingStartAngleAnimation.value * pi,
progressPercent: _progressingPercentAnimation.value,
),
),
child: widget.loaderWidget != null
? Opacity(
opacity: _indicatorMoveWithPeakController.value,
child: widget.loaderWidget,
)
: Transform(
transform: Matrix4.identity()
..rotateZ(
_progressingRotateAnimation.value * 5 * pi / 6),
alignment: FractionalOffset.center,
child: CircularProgress(
backgroundColor: backgroundColor,
progressCircleOpacity: _ringOpacityAnimation.value,
innerCircleRadius: height *
15 /
100 * // 15.0
((_mode != _LiquidPullToRefreshMode.done)
? _indicatorRadiusWithPeakAnimation.value
: _radiusAnimation.value),
progressCircleBorderWidth: widget.borderWidth,
//2.0
progressCircleRadius:
(_ringOpacityAnimation.value != 0.0)
? (height * 2 / 10) *
_ringRadiusAnimation.value //20.0
: 0.0,
startAngle:
_progressingStartAngleAnimation.value * pi,
progressPercent: _progressingPercentAnimation.value,
),
),
);
},
),
Expand Down