-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from splashbyte/version0.8.0
0.8.0-beta.1
- Loading branch information
Showing
20 changed files
with
687 additions
and
356 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
include: package:flutter_lints/flutter.yaml | ||
|
||
analyzer: | ||
language: | ||
strict-casts: true | ||
strict-raw-types: true | ||
|
||
linter: | ||
rules: |
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 |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// coverage:ignore-file | ||
part of 'package:animated_toggle_switch/animated_toggle_switch.dart'; | ||
|
||
class ToggleCursors { | ||
/// [MouseCursor] to show when not hovering an indicator. | ||
/// | ||
/// Defaults to [SystemMouseCursors.click] if [iconsTappable] is [true] | ||
/// and to [MouseCursor.defer] otherwise. | ||
final MouseCursor? defaultCursor; | ||
|
||
/// [MouseCursor] to show when grabbing the indicators. | ||
final MouseCursor draggingCursor; | ||
|
||
/// [MouseCursor] to show when hovering the indicators. | ||
final MouseCursor dragCursor; | ||
|
||
/// [MouseCursor] to show during loading. | ||
final MouseCursor loadingCursor; | ||
|
||
/// [MouseCursor] to show when [active] is set to [false]. | ||
final MouseCursor inactiveCursor; | ||
|
||
const ToggleCursors({ | ||
this.defaultCursor, | ||
this.draggingCursor = SystemMouseCursors.grabbing, | ||
this.dragCursor = SystemMouseCursors.grab, | ||
this.loadingCursor = MouseCursor.defer, | ||
this.inactiveCursor = SystemMouseCursors.forbidden, | ||
}); | ||
|
||
const ToggleCursors.all(MouseCursor cursor) | ||
: defaultCursor = cursor, | ||
draggingCursor = cursor, | ||
dragCursor = cursor, | ||
loadingCursor = cursor, | ||
inactiveCursor = cursor; | ||
|
||
@override | ||
bool operator ==(Object other) => | ||
identical(this, other) || | ||
other is ToggleCursors && | ||
runtimeType == other.runtimeType && | ||
defaultCursor == other.defaultCursor && | ||
draggingCursor == other.draggingCursor && | ||
dragCursor == other.dragCursor && | ||
loadingCursor == other.loadingCursor && | ||
inactiveCursor == other.inactiveCursor; | ||
|
||
@override | ||
int get hashCode => | ||
defaultCursor.hashCode ^ | ||
draggingCursor.hashCode ^ | ||
dragCursor.hashCode ^ | ||
loadingCursor.hashCode ^ | ||
inactiveCursor.hashCode; | ||
} |
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,148 @@ | ||
part of 'package:animated_toggle_switch/animated_toggle_switch.dart'; | ||
|
||
class ToggleStyle { | ||
/// Background color of the indicator. | ||
final Color? indicatorColor; | ||
|
||
/// Background color of the switch. | ||
final Color? backgroundColor; | ||
|
||
/// Gradient of the background. Overwrites [innerColor] if not [null]. | ||
final Gradient? backgroundGradient; | ||
|
||
/// Border color of the switch. | ||
/// | ||
/// For deactivating please set this to [Colors.transparent]. | ||
final Color? borderColor; | ||
|
||
/// [BorderRadius] of the switch. | ||
final BorderRadiusGeometry? borderRadius; | ||
|
||
/// [BorderRadius] of the indicator. | ||
/// | ||
/// Defaults to [borderRadius]. | ||
final BorderRadiusGeometry? indicatorBorderRadius; | ||
|
||
/// [BorderRadius] of the indicator. | ||
final BoxBorder? indicatorBorder; | ||
|
||
/// Shadow for the indicator [Container]. | ||
final List<BoxShadow>? indicatorBoxShadow; | ||
|
||
/// Shadow for the [Container] in the background. | ||
final List<BoxShadow>? boxShadow; | ||
|
||
/// Default constructor for [ToggleStyle]. | ||
const ToggleStyle({ | ||
this.indicatorColor, | ||
this.backgroundColor, | ||
this.backgroundGradient, | ||
this.borderColor, | ||
this.borderRadius, | ||
this.indicatorBorderRadius, | ||
this.indicatorBorder, | ||
this.indicatorBoxShadow, | ||
this.boxShadow, | ||
}); | ||
|
||
/// Private constructor for setting all possible parameters. | ||
ToggleStyle._({ | ||
required this.indicatorColor, | ||
required this.backgroundColor, | ||
required this.backgroundGradient, | ||
required this.borderColor, | ||
required this.borderRadius, | ||
required this.indicatorBorderRadius, | ||
required this.indicatorBorder, | ||
required this.indicatorBoxShadow, | ||
required this.boxShadow, | ||
}); | ||
|
||
ToggleStyle _merge(ToggleStyle? other) => other == null | ||
? this | ||
: ToggleStyle._( | ||
indicatorColor: other.indicatorColor ?? indicatorColor, | ||
backgroundColor: other.backgroundColor ?? backgroundColor, | ||
backgroundGradient: other.backgroundGradient ?? | ||
(other.backgroundColor == null ? null : backgroundGradient), | ||
borderColor: other.borderColor ?? borderColor, | ||
borderRadius: other.borderRadius ?? borderRadius, | ||
indicatorBorderRadius: other.indicatorBorderRadius ?? | ||
other.borderRadius ?? | ||
indicatorBorderRadius ?? | ||
borderRadius, | ||
indicatorBorder: other.indicatorBorder ?? indicatorBorder, | ||
indicatorBoxShadow: other.indicatorBoxShadow ?? indicatorBoxShadow, | ||
boxShadow: other.boxShadow ?? boxShadow, | ||
); | ||
|
||
static ToggleStyle _lerp(ToggleStyle style1, ToggleStyle style2, double t) => | ||
ToggleStyle._( | ||
indicatorColor: | ||
Color.lerp(style1.indicatorColor, style2.indicatorColor, t), | ||
backgroundColor: | ||
Color.lerp(style1.backgroundColor, style2.backgroundColor, t), | ||
backgroundGradient: Gradient.lerp( | ||
style1.backgroundGradient ?? style1.backgroundColor?.toGradient(), | ||
style2.backgroundGradient ?? style2.backgroundColor?.toGradient(), | ||
t, | ||
), | ||
borderColor: Color.lerp(style1.borderColor, style2.borderColor, t), | ||
borderRadius: BorderRadiusGeometry.lerp( | ||
style1.borderRadius, | ||
style2.borderRadius, | ||
t, | ||
), | ||
indicatorBorderRadius: BorderRadiusGeometry.lerp( | ||
style1.indicatorBorderRadius ?? style1.borderRadius, | ||
style2.indicatorBorderRadius ?? style2.borderRadius, | ||
t, | ||
), | ||
indicatorBorder: BoxBorder.lerp( | ||
style1.indicatorBorder, | ||
style2.indicatorBorder, | ||
t, | ||
), | ||
indicatorBoxShadow: BoxShadow.lerpList( | ||
style1.indicatorBoxShadow, | ||
style2.indicatorBoxShadow, | ||
t, | ||
), | ||
boxShadow: BoxShadow.lerpList( | ||
style1.boxShadow, | ||
style2.boxShadow, | ||
t, | ||
), | ||
); | ||
|
||
// coverage:ignore-start | ||
|
||
@override | ||
bool operator ==(Object other) => | ||
identical(this, other) || | ||
other is ToggleStyle && | ||
runtimeType == other.runtimeType && | ||
indicatorColor == other.indicatorColor && | ||
backgroundColor == other.backgroundColor && | ||
backgroundGradient == other.backgroundGradient && | ||
borderColor == other.borderColor && | ||
borderRadius == other.borderRadius && | ||
indicatorBorderRadius == other.indicatorBorderRadius && | ||
indicatorBorder == other.indicatorBorder && | ||
indicatorBoxShadow == other.indicatorBoxShadow && | ||
boxShadow == other.boxShadow; | ||
|
||
@override | ||
int get hashCode => | ||
indicatorColor.hashCode ^ | ||
backgroundColor.hashCode ^ | ||
backgroundGradient.hashCode ^ | ||
borderColor.hashCode ^ | ||
borderRadius.hashCode ^ | ||
indicatorBorderRadius.hashCode ^ | ||
indicatorBorder.hashCode ^ | ||
indicatorBoxShadow.hashCode ^ | ||
boxShadow.hashCode; | ||
|
||
// coverage:ignore-end | ||
} |
Oops, something went wrong.