Skip to content
Merged
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
39 changes: 19 additions & 20 deletions lib/components/animation/gf_animation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ class GFAnimation extends StatefulWidget {
/// The duration for animation to perform
final Duration duration;

/// The duration for animation to perform
/// The duration for reverse animation to perform
final Duration reverseDuration;

/// Defines how the animated widget is aligned within the Animation.
/// Defines how the animated widget is aligned during Animation.
final Alignment alignment;

/// Defines how the animated widget is aligned(after the onTap) within the Animation.
/// Defines how the animated widget is aligned(after the onTap) during Animation.
final Alignment activeAlignment;

/// The child of type [Widget] to display animation effect.
Expand All @@ -53,19 +53,20 @@ class GFAnimation extends StatefulWidget {
/// Determines the animation curve. Defaults to [Curves.linear].
final Curve curve;

///type of [GFAnimation] which takes the type ie, align, size, container, rotateTransition, scaleTransition, slideTransition, and textStyle for the [GFAnimation]
///type of [GFAnimation] which takes the type ie, align, size, container,
/// rotateTransition, scaleTransition, slideTransition, and textStyle for the [GFAnimation]
final GFAnimationType type;

/// defines [AnimatedContainer] initial width
final double width;

/// defines the width of [AnimatedContainer] upto which it can extend during animation
/// defines the width of [AnimatedContainer] upto which it can expand during animation
final double changedWidth;

/// defines [AnimatedContainer] initial height
final double height;

/// defines the height of [AnimatedContainer] upto which it can extend during animation
/// defines the height of [AnimatedContainer] upto which it can expand during animation
final double changedHeight;

/// defines the color of [AnimatedContainer] when onTap triggers
Expand All @@ -83,42 +84,40 @@ class GFAnimation extends StatefulWidget {
/// Called when the user taps the [child]
final Function onTap;

/// Here's an illustration of the [RotationTransition] widget, with it's [turnsAnimation]
/// animated by a stuckValue set to animate
/// For GFAnimationType.rotateTransition, customized turns animation can be added to [RotationTransition] widget
final Animation<double> turnsAnimation;

/// Here's an illustration of the [ScaleTransition] widget, with it's [scaleAnimation]
/// animated by a [CurvedAnimation] set to [Curves.linear]
/// For GFAnimationType.scaleTransition, customized scale animation can be added to [ScaleTransition] widget
final Animation<double> scaleAnimation;

/// controls animation
/// Type of [AnimationController], its a controller of an animation.
final AnimationController controller;

///direction of the [AnimatedDefaultTextStyle] TextDirection for [ltr,rtl]
/// Defines direction of the [AnimatedDefaultTextStyle] TextDirection i.e [ltr,rtl]
final TextDirection textDirection;

/// [ScaleTransition], which animates the scale of a widget.
/// For GFAnimationType.slideTransition, which animates the position of a widget.
final Animation<Offset> slidePosition;

/// defines the [TextStyle] of [AnimatedDefaultTextStyle]
/// Defines the [TextStyle] of [AnimatedDefaultTextStyle]
final TextStyle style;

/// defines the [TextAlign] of [AnimatedDefaultTextStyle]
/// Defines the [TextAlign] of [AnimatedDefaultTextStyle]
final TextAlign textAlign;

/// defines the [TextOverflow] of [AnimatedDefaultTextStyle]
/// Defines the [TextOverflow] of [AnimatedDefaultTextStyle]
final TextOverflow textOverflow;

/// defines the [maxLines] of [AnimatedDefaultTextStyle]
/// Defines the [maxLines] of [AnimatedDefaultTextStyle]
final int maxLines;

/// defines the [TextWidthBasis] of [AnimatedDefaultTextStyle]
/// Defines the [TextWidthBasis] of [AnimatedDefaultTextStyle]
final TextWidthBasis textWidthBasis;

/// defines the [fontSize] of [AnimatedDefaultTextStyle]
/// Defines the [fontSize] of [AnimatedDefaultTextStyle]
final double fontSize;

/// defines the [fontWeight] of [AnimatedDefaultTextStyle]
/// Defines the [fontWeight] of [AnimatedDefaultTextStyle]
final FontWeight fontWeight;

@override
Expand Down
36 changes: 21 additions & 15 deletions lib/components/bottom_sheet/gf_bottom_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class GFBottomSheet extends StatefulWidget {
this.elevation = 0.0,
this.stickyFooterHeight = 0.0,
this.stickyHeaderHeight = 0.0,
this.animationDuration = 300,
this.animationDuration = 1200,
this.enableExpandableContent = false,
}) : assert(elevation >= 0.0),
assert(minContentHeight >= 0.0),
Expand Down Expand Up @@ -71,7 +71,8 @@ class GFBottomSheet extends StatefulWidget {

class _GFBottomSheetState extends State<GFBottomSheet>
with TickerProviderStateMixin {
final StreamController<double> controller = StreamController.broadcast();
final StreamController<double> _streamController =
StreamController.broadcast();
bool isDragDirectionUp;
bool showBottomSheet = false;
Function _controllerListener;
Expand Down Expand Up @@ -152,11 +153,20 @@ class _GFBottomSheetState extends State<GFBottomSheet>
child: widget.contentBody),
),
)
: showContent
? StreamBuilder(
stream: controller.stream,
: widget.controller.height == widget.minContentHeight
? Container()
: StreamBuilder(
stream: _streamController.stream,
initialData: widget.controller.height,
builder: (context, snapshot) => GestureDetector(
builder: (BuildContext context, AsyncSnapshot snapshot) =>
AnimatedContainer(
curve: Curves.easeOut,
duration: Duration(
milliseconds: widget.controller.animationDuration),
height: snapshot.hasData == null
? widget.minContentHeight
: snapshot.data,
child: GestureDetector(
onVerticalDragUpdate: (DragUpdateDetails details) {
if (((widget.controller.height - details.delta.dy) >
widget.minContentHeight) &&
Expand All @@ -167,19 +177,15 @@ class _GFBottomSheetState extends State<GFBottomSheet>
isDragDirectionUp = details.delta.dy <= 0;
widget.controller.height -= details.delta.dy;
}
controller.add(widget.controller.height);
_streamController.add(widget.controller.height);
},
onVerticalDragEnd: _onVerticalDragEnd,
onTap: _onTap,
behavior: HitTestBehavior.translucent,
child: Container(
height: snapshot.hasData == null
? widget.minContentHeight
: snapshot.data,
child: widget.contentBody,
)),
)
: Container(),
child: widget.contentBody,
),
),
),
widget.stickyFooter == null
? Container()
: AnimatedBuilder(
Expand Down
115 changes: 57 additions & 58 deletions lib/components/button/gf_icon_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class _GFIconButtonState extends State<GFIconButton> {
BoxShadow boxShadow;
double height;
double width;
double iconPixel;
double iconPixel = 18;

@override
void initState() {
Expand Down Expand Up @@ -230,31 +230,34 @@ class _GFIconButtonState extends State<GFIconButton> {
} else if (widget.size == GFSize.MEDIUM) {
height = 35.0;
width = 35.0;
iconPixel = 18.0;
iconPixel = 28.0;
} else if (widget.size == GFSize.LARGE) {
height = 40.0;
width = 40.0;
iconPixel = 18.0;
} else {
height = 35.0;
width = 35.0;
iconPixel = 18.0;
iconPixel = 38.0;
}

Widget result = Container(
height: widget.shape == GFIconButtonShape.circle ? height + 6.0 : height,
width: widget.shape == GFIconButtonShape.pills
? width + 10
: widget.shape == GFIconButtonShape.circle
? height + 6
: width,
// height: widget.shape == GFIconButtonShape.circle ? height + 6.0 : height,
// width: widget.shape == GFIconButtonShape.pills
// ? width + 10
// : widget.shape == GFIconButtonShape.circle
// ? height + 6
// : width,
padding: widget.padding,
child: IconTheme.merge(
data: IconThemeData(
size: widget.iconSize > 0.0 ? widget.iconSize : iconPixel,
color: getIconColor(),
child: SizedBox(
height: widget.iconSize != 0 ? widget.iconSize : iconPixel,
width: widget.iconSize != 0 ? widget.iconSize : iconPixel,
child: Align(
alignment: Alignment.center,
child: IconTheme.merge(
data: IconThemeData(
size: widget.iconSize > 0.0 ? widget.iconSize : iconPixel,
color: getIconColor(),
),
child: widget.icon,
),
),
child: widget.icon,
),
);

Expand Down Expand Up @@ -308,46 +311,42 @@ class _GFIconButtonState extends State<GFIconButton> {
child: Focus(
focusNode: widget.focusNode,
autofocus: widget.autofocus,
child: ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 60, maxHeight: 60),
child: Container(
height:
widget.shape == GFIconButtonShape.circle ? height + 6 : height,
width: widget.shape == GFIconButtonShape.pills
? width + 10
: widget.shape == GFIconButtonShape.circle
? height + 6
: width,
decoration:
widget.type == GFButtonType.solid ? getBoxShadow() : null,
child: Material(
shape: widget.type == GFButtonType.transparent
? null
: widget.borderShape ?? shapeBorderType,
color: widget.onPressed != null
? getColor()
: getDisabledFillColor(),
type: widget.type == GFButtonType.transparent
? MaterialType.transparency
: MaterialType.button,
child: InkResponse(
onTap: widget.onPressed,
child: result,
focusColor: widget.focusColor ?? Theme.of(context).focusColor,
hoverColor: widget.hoverColor ?? Theme.of(context).hoverColor,
highlightColor:
widget.highlightColor ?? Theme.of(context).highlightColor,
splashColor:
widget.splashColor ?? Theme.of(context).splashColor,
radius: math.max(
Material.defaultSplashRadius,
(widget.iconSize +
math.min(
widget.padding.horizontal,
widget.padding.vertical,
)) *
0.7),
),
child: Container(
// height:
// widget.shape == GFIconButtonShape.circle ? height + 6 : height,
// width: widget.shape == GFIconButtonShape.pills
// ? width + 10
// : widget.shape == GFIconButtonShape.circle
// ? height + 6
// : width,
decoration: widget.type == GFButtonType.solid ? getBoxShadow() : null,
child: Material(
shape: widget.type == GFButtonType.transparent
? null
: widget.borderShape ?? shapeBorderType,
color:
widget.onPressed != null ? getColor() : getDisabledFillColor(),
type: widget.type == GFButtonType.transparent
? MaterialType.transparency
: MaterialType.button,
child: InkResponse(
onTap: widget.onPressed,
child: result,
focusColor: widget.focusColor ?? Theme.of(context).focusColor,
hoverColor: widget.hoverColor ?? Theme.of(context).hoverColor,
highlightColor:
widget.highlightColor ?? Theme.of(context).highlightColor,
splashColor: widget.splashColor ?? Theme.of(context).splashColor,
radius: math.max(
Material.defaultSplashRadius,
(widget.iconSize > 0.0
? widget.iconSize
: iconPixel +
math.min(
widget.padding.horizontal,
widget.padding.vertical,
)) *
0.7),
),
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class GFCheckboxListTile extends StatelessWidget {
this.icon,
this.description,
this.padding = const EdgeInsets.all(8),
this.margin = const EdgeInsets.all(16),
this.margin = const EdgeInsets.symmetric(vertical: 8, horizontal: 16),
this.size = GFSize.MEDIUM,
this.type = GFCheckboxType.basic,
this.checkColor = GFColors.WHITE,
Expand Down
Loading