-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/SplashByte/widget_loading i…
…nto main
- Loading branch information
Showing
12 changed files
with
140 additions
and
186 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
import 'dart:math'; | ||
import 'package:flutter/animation.dart'; | ||
|
||
extension Derivation on CurvedAnimation{ | ||
extension Derivation on CurvedAnimation { | ||
/// Returns the current speed/derivation of the Curve. | ||
/// | ||
/// Does not handle the case that [parent.value] is not between 0.0 and 1.0. | ||
double get speed{ | ||
double get speed { | ||
double dif = 0.01; | ||
switch (this.status){ | ||
switch (this.status) { | ||
case AnimationStatus.forward: | ||
double value = max(this.parent.value - dif, 0.0); | ||
if(value == this.parent.value) return 0.0; | ||
return (this.value - this.curve.transform(value))/(this.parent.value-value); | ||
if (value == this.parent.value) return 0.0; | ||
return (this.value - this.curve.transform(value)) / (this.parent.value - value); | ||
case AnimationStatus.reverse: | ||
double value = min(this.parent.value + dif, 1.0); | ||
if(value == this.parent.value) return 0.0; | ||
return (this.value - this.curve.transform(value))/(value-this.parent.value); | ||
if (value == this.parent.value) return 0.0; | ||
return (this.value - this.curve.transform(value)) / (value - this.parent.value); | ||
case AnimationStatus.dismissed: | ||
case AnimationStatus.completed: | ||
break; | ||
} | ||
|
||
return 0.0; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
enum LoadingState { APPEARING, DISAPPEARING, LOADED, LOADING } | ||
enum LoadingState { APPEARING, DISAPPEARING, LOADED, LOADING } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class WidgetSizedBox extends StatelessWidget { | ||
final Widget child; | ||
|
||
const WidgetSizedBox({Key? key, required this.child}) : super(key: key); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Opacity( | ||
child: child, | ||
opacity: 0.0, | ||
); | ||
} | ||
} |
Oops, something went wrong.