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
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
24 changes: 16 additions & 8 deletions lib/components/dropdown/gf_dropdown.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:getwidget/getwidget.dart';

class GFDropdown<T> extends StatefulWidget {
///
Expand All @@ -18,7 +19,7 @@ class GFDropdown<T> extends StatefulWidget {
this.iconDisabledColor,
this.iconEnabledColor,
this.iconSize = 24.0,
this.isDense = false,
this.isDense = true,
this.isExpanded = false,
this.itemHeight = kMinInteractiveDimension,
this.focusColor,
Expand All @@ -27,7 +28,9 @@ class GFDropdown<T> extends StatefulWidget {
this.dropdownColor,
this.padding = const EdgeInsets.all(5),
this.borderRadius = const BorderRadius.all(Radius.circular(4)),
this.borderColor})
this.border = const BorderSide(
color: Colors.white, width: 1, style: BorderStyle.solid),
this.dropdownButtonColor = GFColors.WHITE})
: super(key: key);

final DropdownButtonBuilder selectedItemBuilder;
Expand All @@ -44,7 +47,7 @@ class GFDropdown<T> extends StatefulWidget {
final T value;

/// the color of the border of the dropdown button
final Color borderColor;
final BorderSide border;

///The padding given inside the dropdown
final EdgeInsets padding;
Expand Down Expand Up @@ -108,18 +111,23 @@ class GFDropdown<T> extends StatefulWidget {
/// The border radius of the dropdown.
final BorderRadius borderRadius;

/// The background color of the dropdownButton.
final dynamic dropdownButtonColor;

@override
_GFDropdownState createState() => _GFDropdownState();
}

class _GFDropdownState extends State<GFDropdown> {
@override
Widget build(BuildContext context) => Card(
child: Container(
Widget build(BuildContext context) => Material(
color: widget.dropdownButtonColor,
shape: RoundedRectangleBorder(
side: widget.border,
borderRadius: widget.borderRadius,
),
child: Padding(
padding: widget.padding,
decoration: BoxDecoration(
borderRadius: widget.borderRadius,
border: Border.all(color: widget.borderColor ?? Colors.white)),
child: DropdownButton(
items: widget.items,
selectedItemBuilder: widget.selectedItemBuilder,
Expand Down
Loading