Skip to content

Commit b8c7617

Browse files
Merge pull request #197 from deepikahr/master
Master pull
2 parents 1b62a84 + d898db8 commit b8c7617

File tree

12 files changed

+361
-267
lines changed

12 files changed

+361
-267
lines changed

lib/components/animation/gf_animation.dart

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ class GFAnimation extends StatefulWidget {
3838
/// The duration for animation to perform
3939
final Duration duration;
4040

41-
/// The duration for animation to perform
41+
/// The duration for reverse animation to perform
4242
final Duration reverseDuration;
4343

44-
/// Defines how the animated widget is aligned within the Animation.
44+
/// Defines how the animated widget is aligned during Animation.
4545
final Alignment alignment;
4646

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

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

56-
///type of [GFAnimation] which takes the type ie, align, size, container, rotateTransition, scaleTransition, slideTransition, and textStyle for the [GFAnimation]
56+
///type of [GFAnimation] which takes the type ie, align, size, container,
57+
/// rotateTransition, scaleTransition, slideTransition, and textStyle for the [GFAnimation]
5758
final GFAnimationType type;
5859

5960
/// defines [AnimatedContainer] initial width
6061
final double width;
6162

62-
/// defines the width of [AnimatedContainer] upto which it can extend during animation
63+
/// defines the width of [AnimatedContainer] upto which it can expand during animation
6364
final double changedWidth;
6465

6566
/// defines [AnimatedContainer] initial height
6667
final double height;
6768

68-
/// defines the height of [AnimatedContainer] upto which it can extend during animation
69+
/// defines the height of [AnimatedContainer] upto which it can expand during animation
6970
final double changedHeight;
7071

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

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

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

94-
/// controls animation
93+
/// Type of [AnimationController], its a controller of an animation.
9594
final AnimationController controller;
9695

97-
///direction of the [AnimatedDefaultTextStyle] TextDirection for [ltr,rtl]
96+
/// Defines direction of the [AnimatedDefaultTextStyle] TextDirection i.e [ltr,rtl]
9897
final TextDirection textDirection;
9998

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

103-
/// defines the [TextStyle] of [AnimatedDefaultTextStyle]
102+
/// Defines the [TextStyle] of [AnimatedDefaultTextStyle]
104103
final TextStyle style;
105104

106-
/// defines the [TextAlign] of [AnimatedDefaultTextStyle]
105+
/// Defines the [TextAlign] of [AnimatedDefaultTextStyle]
107106
final TextAlign textAlign;
108107

109-
/// defines the [TextOverflow] of [AnimatedDefaultTextStyle]
108+
/// Defines the [TextOverflow] of [AnimatedDefaultTextStyle]
110109
final TextOverflow textOverflow;
111110

112-
/// defines the [maxLines] of [AnimatedDefaultTextStyle]
111+
/// Defines the [maxLines] of [AnimatedDefaultTextStyle]
113112
final int maxLines;
114113

115-
/// defines the [TextWidthBasis] of [AnimatedDefaultTextStyle]
114+
/// Defines the [TextWidthBasis] of [AnimatedDefaultTextStyle]
116115
final TextWidthBasis textWidthBasis;
117116

118-
/// defines the [fontSize] of [AnimatedDefaultTextStyle]
117+
/// Defines the [fontSize] of [AnimatedDefaultTextStyle]
119118
final double fontSize;
120119

121-
/// defines the [fontWeight] of [AnimatedDefaultTextStyle]
120+
/// Defines the [fontWeight] of [AnimatedDefaultTextStyle]
122121
final FontWeight fontWeight;
123122

124123
@override

lib/components/bottom_sheet/gf_bottom_sheet.dart

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class GFBottomSheet extends StatefulWidget {
1414
this.elevation = 0.0,
1515
this.stickyFooterHeight = 0.0,
1616
this.stickyHeaderHeight = 0.0,
17-
this.animationDuration = 300,
17+
this.animationDuration = 1200,
1818
this.enableExpandableContent = false,
1919
}) : assert(elevation >= 0.0),
2020
assert(minContentHeight >= 0.0),
@@ -71,7 +71,8 @@ class GFBottomSheet extends StatefulWidget {
7171

7272
class _GFBottomSheetState extends State<GFBottomSheet>
7373
with TickerProviderStateMixin {
74-
final StreamController<double> controller = StreamController.broadcast();
74+
final StreamController<double> _streamController =
75+
StreamController.broadcast();
7576
bool isDragDirectionUp;
7677
bool showBottomSheet = false;
7778
Function _controllerListener;
@@ -152,11 +153,20 @@ class _GFBottomSheetState extends State<GFBottomSheet>
152153
child: widget.contentBody),
153154
),
154155
)
155-
: showContent
156-
? StreamBuilder(
157-
stream: controller.stream,
156+
: widget.controller.height == widget.minContentHeight
157+
? Container()
158+
: StreamBuilder(
159+
stream: _streamController.stream,
158160
initialData: widget.controller.height,
159-
builder: (context, snapshot) => GestureDetector(
161+
builder: (BuildContext context, AsyncSnapshot snapshot) =>
162+
AnimatedContainer(
163+
curve: Curves.easeOut,
164+
duration: Duration(
165+
milliseconds: widget.controller.animationDuration),
166+
height: snapshot.hasData == null
167+
? widget.minContentHeight
168+
: snapshot.data,
169+
child: GestureDetector(
160170
onVerticalDragUpdate: (DragUpdateDetails details) {
161171
if (((widget.controller.height - details.delta.dy) >
162172
widget.minContentHeight) &&
@@ -167,19 +177,15 @@ class _GFBottomSheetState extends State<GFBottomSheet>
167177
isDragDirectionUp = details.delta.dy <= 0;
168178
widget.controller.height -= details.delta.dy;
169179
}
170-
controller.add(widget.controller.height);
180+
_streamController.add(widget.controller.height);
171181
},
172182
onVerticalDragEnd: _onVerticalDragEnd,
173183
onTap: _onTap,
174184
behavior: HitTestBehavior.translucent,
175-
child: Container(
176-
height: snapshot.hasData == null
177-
? widget.minContentHeight
178-
: snapshot.data,
179-
child: widget.contentBody,
180-
)),
181-
)
182-
: Container(),
185+
child: widget.contentBody,
186+
),
187+
),
188+
),
183189
widget.stickyFooter == null
184190
? Container()
185191
: AnimatedBuilder(

lib/components/button/gf_icon_button.dart

Lines changed: 57 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ class _GFIconButtonState extends State<GFIconButton> {
111111
BoxShadow boxShadow;
112112
double height;
113113
double width;
114-
double iconPixel;
114+
double iconPixel = 18;
115115

116116
@override
117117
void initState() {
@@ -230,31 +230,34 @@ class _GFIconButtonState extends State<GFIconButton> {
230230
} else if (widget.size == GFSize.MEDIUM) {
231231
height = 35.0;
232232
width = 35.0;
233-
iconPixel = 18.0;
233+
iconPixel = 28.0;
234234
} else if (widget.size == GFSize.LARGE) {
235235
height = 40.0;
236236
width = 40.0;
237-
iconPixel = 18.0;
238-
} else {
239-
height = 35.0;
240-
width = 35.0;
241-
iconPixel = 18.0;
237+
iconPixel = 38.0;
242238
}
243239

244240
Widget result = Container(
245-
height: widget.shape == GFIconButtonShape.circle ? height + 6.0 : height,
246-
width: widget.shape == GFIconButtonShape.pills
247-
? width + 10
248-
: widget.shape == GFIconButtonShape.circle
249-
? height + 6
250-
: width,
241+
// height: widget.shape == GFIconButtonShape.circle ? height + 6.0 : height,
242+
// width: widget.shape == GFIconButtonShape.pills
243+
// ? width + 10
244+
// : widget.shape == GFIconButtonShape.circle
245+
// ? height + 6
246+
// : width,
251247
padding: widget.padding,
252-
child: IconTheme.merge(
253-
data: IconThemeData(
254-
size: widget.iconSize > 0.0 ? widget.iconSize : iconPixel,
255-
color: getIconColor(),
248+
child: SizedBox(
249+
height: widget.iconSize != 0 ? widget.iconSize : iconPixel,
250+
width: widget.iconSize != 0 ? widget.iconSize : iconPixel,
251+
child: Align(
252+
alignment: Alignment.center,
253+
child: IconTheme.merge(
254+
data: IconThemeData(
255+
size: widget.iconSize > 0.0 ? widget.iconSize : iconPixel,
256+
color: getIconColor(),
257+
),
258+
child: widget.icon,
259+
),
256260
),
257-
child: widget.icon,
258261
),
259262
);
260263

@@ -308,46 +311,42 @@ class _GFIconButtonState extends State<GFIconButton> {
308311
child: Focus(
309312
focusNode: widget.focusNode,
310313
autofocus: widget.autofocus,
311-
child: ConstrainedBox(
312-
constraints: const BoxConstraints(maxWidth: 60, maxHeight: 60),
313-
child: Container(
314-
height:
315-
widget.shape == GFIconButtonShape.circle ? height + 6 : height,
316-
width: widget.shape == GFIconButtonShape.pills
317-
? width + 10
318-
: widget.shape == GFIconButtonShape.circle
319-
? height + 6
320-
: width,
321-
decoration:
322-
widget.type == GFButtonType.solid ? getBoxShadow() : null,
323-
child: Material(
324-
shape: widget.type == GFButtonType.transparent
325-
? null
326-
: widget.borderShape ?? shapeBorderType,
327-
color: widget.onPressed != null
328-
? getColor()
329-
: getDisabledFillColor(),
330-
type: widget.type == GFButtonType.transparent
331-
? MaterialType.transparency
332-
: MaterialType.button,
333-
child: InkResponse(
334-
onTap: widget.onPressed,
335-
child: result,
336-
focusColor: widget.focusColor ?? Theme.of(context).focusColor,
337-
hoverColor: widget.hoverColor ?? Theme.of(context).hoverColor,
338-
highlightColor:
339-
widget.highlightColor ?? Theme.of(context).highlightColor,
340-
splashColor:
341-
widget.splashColor ?? Theme.of(context).splashColor,
342-
radius: math.max(
343-
Material.defaultSplashRadius,
344-
(widget.iconSize +
345-
math.min(
346-
widget.padding.horizontal,
347-
widget.padding.vertical,
348-
)) *
349-
0.7),
350-
),
314+
child: Container(
315+
// height:
316+
// widget.shape == GFIconButtonShape.circle ? height + 6 : height,
317+
// width: widget.shape == GFIconButtonShape.pills
318+
// ? width + 10
319+
// : widget.shape == GFIconButtonShape.circle
320+
// ? height + 6
321+
// : width,
322+
decoration: widget.type == GFButtonType.solid ? getBoxShadow() : null,
323+
child: Material(
324+
shape: widget.type == GFButtonType.transparent
325+
? null
326+
: widget.borderShape ?? shapeBorderType,
327+
color:
328+
widget.onPressed != null ? getColor() : getDisabledFillColor(),
329+
type: widget.type == GFButtonType.transparent
330+
? MaterialType.transparency
331+
: MaterialType.button,
332+
child: InkResponse(
333+
onTap: widget.onPressed,
334+
child: result,
335+
focusColor: widget.focusColor ?? Theme.of(context).focusColor,
336+
hoverColor: widget.hoverColor ?? Theme.of(context).hoverColor,
337+
highlightColor:
338+
widget.highlightColor ?? Theme.of(context).highlightColor,
339+
splashColor: widget.splashColor ?? Theme.of(context).splashColor,
340+
radius: math.max(
341+
Material.defaultSplashRadius,
342+
(widget.iconSize > 0.0
343+
? widget.iconSize
344+
: iconPixel +
345+
math.min(
346+
widget.padding.horizontal,
347+
widget.padding.vertical,
348+
)) *
349+
0.7),
351350
),
352351
),
353352
),

lib/components/checkbox_list_tile/gf_checkbox_list_tile.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class GFCheckboxListTile extends StatelessWidget {
1616
this.icon,
1717
this.description,
1818
this.padding = const EdgeInsets.all(8),
19-
this.margin = const EdgeInsets.all(16),
19+
this.margin = const EdgeInsets.symmetric(vertical: 8, horizontal: 16),
2020
this.size = GFSize.MEDIUM,
2121
this.type = GFCheckboxType.basic,
2222
this.checkColor = GFColors.WHITE,

0 commit comments

Comments
 (0)