diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f840b0c..d7e1efb3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,26 @@ # Changelog + +## 1.2.2 - 2020-10-02 + +### Fixed +* [GFButton] width related issue. +* [GFRadio] minor issue. +* [GFRadioListTile] selection issue +* [GFCheckbox] minor issue. +* [GFCheckboxListTile] selection issue +* Many more minor improvements. + +### Added +* few new compoenents added + - GFBottomSheet + - GFIntroScreen + - GFAnimation + - GFBorder + - GFStickyHeader + + + ## 1.1.3 - 2020-07-30 ### Fixed @@ -9,7 +30,7 @@ * [GFCarousel] active page indicator is not being updated without "onPageChanged" #139 * [GFTabBar] Docs say about isScrollable which is not supported #132 -### Update +### Added * couple of compoenents (WIP) - GFCheckboxTile - GFRadioTile diff --git a/example/pubspec.lock b/example/pubspec.lock index 97c64e6d..10b10812 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -7,42 +7,42 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.4.2" + version: "2.5.0-nullsafety.1" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0-nullsafety.1" characters: dependency: transitive description: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.0.0" + version: "1.1.0-nullsafety.3" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.1.3" + version: "1.2.0-nullsafety.1" clock: dependency: transitive description: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.0.1" + version: "1.1.0-nullsafety.1" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.14.13" + version: "1.15.0-nullsafety.3" convert: dependency: transitive description: @@ -63,7 +63,7 @@ packages: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0-nullsafety.1" flutter: dependency: "direct main" description: flutter @@ -92,28 +92,28 @@ packages: path: ".." relative: true source: path - version: "1.1.3" + version: "1.2.2" matcher: dependency: transitive description: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.8" + version: "0.12.10-nullsafety.1" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.1.8" + version: "1.3.0-nullsafety.3" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.8.0-nullsafety.1" path_drawing: dependency: transitive description: @@ -148,7 +148,7 @@ packages: name: plugin_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.0.2" + version: "1.0.1" pub_semver: dependency: transitive description: @@ -167,49 +167,49 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.8.0-nullsafety.2" stack_trace: dependency: transitive description: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.9.5" + version: "1.10.0-nullsafety.1" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0-nullsafety.1" string_scanner: dependency: transitive description: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.0.5" + version: "1.1.0-nullsafety.1" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0-nullsafety.1" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.17" + version: "0.2.19-nullsafety.2" typed_data: dependency: transitive description: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.3.0-nullsafety.3" url_launcher: dependency: "direct main" description: @@ -251,7 +251,7 @@ packages: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.0.8" + version: "2.1.0-nullsafety.3" xml: dependency: transitive description: @@ -260,5 +260,5 @@ packages: source: hosted version: "4.2.0" sdks: - dart: ">=2.9.0-14.0.dev <3.0.0" - flutter: ">=1.18.0-6.0.pre <2.0.0" \ No newline at end of file + dart: ">=2.10.0-110 <2.11.0" + flutter: ">=1.18.0-6.0.pre <2.0.0" diff --git a/lib/components/accordian/gf_accordian.dart b/lib/components/accordian/gf_accordian.dart index d57cb475..7b331522 100644 --- a/lib/components/accordian/gf_accordian.dart +++ b/lib/components/accordian/gf_accordian.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:getwidget/getwidget.dart'; class GFAccordion extends StatefulWidget { + /// An accordion is used to show (and hide) content. Use [showAccordion] to hide & show the accordion content. const GFAccordion( {Key key, this.titleChild, diff --git a/lib/components/animation/gf_animation.dart b/lib/components/animation/gf_animation.dart index 900b13aa..f0849a86 100644 --- a/lib/components/animation/gf_animation.dart +++ b/lib/components/animation/gf_animation.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:getwidget/types/gf_animation_type.dart'; class GFAnimation extends StatefulWidget { + /// Wrap any widget with [GFAnimation] to animate your widget. see [GFAnimationType] for types of animations. const GFAnimation({ Key key, this.duration, diff --git a/lib/components/badge/gf_button_badge.dart b/lib/components/badge/gf_button_badge.dart index d198a622..ee3f08bc 100644 --- a/lib/components/badge/gf_button_badge.dart +++ b/lib/components/badge/gf_button_badge.dart @@ -272,53 +272,3 @@ class _GFButtonBadgeState extends State { ), ); } - -// -//class GFButtonBadge extends GFButton { -// -// -// Widget build(BuildContext context) => ConstrainedBox( -// constraints: const BoxConstraints( -// minHeight: 26, -// minWidth: 98, -// ), -// child: Container( -// height: size, -// child: GFButton( -// onPressed: onPressed, -// onHighlightChanged: onHighlightChanged, -// textStyle: textStyle, -// boxShadow: boxShadow, -// buttonBoxShadow: badgeBoxShadow, -// focusColor: focusColor, -// hoverColor: hoverColor, -// highlightColor: highlightColor, -// splashColor: splashColor, -// elevation: elevation, -// focusElevation: focusElevation, -// hoverElevation: hoverElevation, -// highlightElevation: highlightElevation, -// disabledElevation: disabledElevation, -// constraints: constraints, -// borderShape: borderShape, -// animationDuration: animationDuration, -// clipBehavior: clipBehavior, -// focusNode: focusNode, -// autofocus: autofocus, -// type: type, -// shape: shape, -// color: color, -// textColor: textColor, -// position: position, -// size: size, -// borderSide: borderSide, -// text: text, -// icon: icon, -// blockButton: blockButton, -// fullWidthButton: fullWidthButton, -// disabledColor: disabledTextColor, -// disabledTextColor: disabledColor, -// ), -// ), -// ); -//} diff --git a/lib/components/badge/gf_icon_badge.dart b/lib/components/badge/gf_icon_badge.dart index c0ec01d7..0045b2dc 100644 --- a/lib/components/badge/gf_icon_badge.dart +++ b/lib/components/badge/gf_icon_badge.dart @@ -34,9 +34,6 @@ class _GFIconBadgeState extends State { children: [ widget.child ?? Container(), Positioned( - // top: 2, - // left: 22, - right: 0, child: widget.counterChild ?? Container(), ), ], diff --git a/lib/components/border/gf_border.dart b/lib/components/border/gf_border.dart index bbec1e75..4057d5ed 100644 --- a/lib/components/border/gf_border.dart +++ b/lib/components/border/gf_border.dart @@ -5,11 +5,12 @@ import 'package:getwidget/components/border/gf_dashed_border.dart'; import 'package:getwidget/types/gf_border_type.dart'; class GFBorder extends StatelessWidget { + /// Create different types of borders around given child widget GFBorder({ @required this.child, this.color = Colors.black, this.strokeWidth = 1, - this.type = GFBorderType.Rect, + this.type = GFBorderType.rect, this.dashedLine = const [3, 1], this.padding = const EdgeInsets.all(10), this.radius = const Radius.circular(0), @@ -27,7 +28,7 @@ class GFBorder extends StatelessWidget { final double strokeWidth; /// color of type [Color] or GFColor which is used to change the color of the border type - final dynamic color; + final Color color; /// dashedLine of type [List] which is used for the linear and simple dashed line of border final List dashedLine; diff --git a/lib/components/border/gf_dashed_border.dart b/lib/components/border/gf_dashed_border.dart index a68d9d0a..ae321ead 100644 --- a/lib/components/border/gf_dashed_border.dart +++ b/lib/components/border/gf_dashed_border.dart @@ -9,7 +9,7 @@ class DashedType extends CustomPainter { this.strokeWidth = 2, this.dashedLine = const [3, 1], this.color = Colors.black, - this.type = GFBorderType.Rect, + this.type = GFBorderType.rect, this.radius = const Radius.circular(0), this.customPath, }) : assert(dashedLine.isNotEmpty, 'dash line cannot be empty'); @@ -21,7 +21,7 @@ class DashedType extends CustomPainter { final List dashedLine; /// color of type [Color] or GFColor which is used to change the color of the border type - final dynamic color; + final Color color; /// type of [GFBorderType] which is used to define the different types of borders ie, circle, Rect, RRect and oval final GFBorderType type; @@ -56,20 +56,19 @@ class DashedType extends CustomPainter { Path _getPath(Size size) { Path path; switch (type) { - case GFBorderType.Circle: + case GFBorderType.circle: path = _getCirclePath(size); break; - case GFBorderType.RRect: + case GFBorderType.rRect: path = _getRRectPath(size, radius); break; - case GFBorderType.Rect: + case GFBorderType.rect: path = _getRectPath(size); break; - case GFBorderType.Oval: + case GFBorderType.oval: path = _getOvalPath(size); break; } - return dashPath(path, dashedarray: CircularIntervalList(dashedLine)); } @@ -94,7 +93,6 @@ class DashedType extends CustomPainter { } /// gives a Rounded Rectangular Path with [radius] of [size] for borderType - Path _getRRectPath(Size size, Radius radius) => Path() ..addRRect( RRect.fromRectAndRadius( @@ -140,10 +138,8 @@ class DashedType extends CustomPainter { class CircularIntervalList { CircularIntervalList(this.values); - final List values; int index = 0; - T get next { if (index >= values.length) { index = 0; @@ -159,7 +155,6 @@ Path dashPath(Path source, if (source == null) { return null; } - final Path dest = Path(); for (final PathMetric metric in source.computeMetrics()) { double distance = dashOffset._calculate(metric.length); @@ -173,27 +168,26 @@ Path dashPath(Path source, draw = !draw; } } - return dest; } /// Specifies the starting position of a dashed array or line on a path, either as a percentage or absolute -enum _DashOffsetType { Absolute, Percentage } +enum _DashOffsetType { absolute, percentage } class DashOffset { ///gives offset of the dashed path that will be measured as a percentage which ranges from 0.0 to 1.0 DashOffset.percentage(double percentage) : _value = percentage.clamp(0.0, 1.0) ?? 0.0, - _dashOffsetType = _DashOffsetType.Percentage; + _dashOffsetType = _DashOffsetType.percentage; ///gives offset of the dashed path that will be measured as a absolute value const DashOffset.absolute(double start) : _value = start ?? 0.0, - _dashOffsetType = _DashOffsetType.Absolute; + _dashOffsetType = _DashOffsetType.absolute; final double _value; final _DashOffsetType _dashOffsetType; double _calculate(double length) => - _dashOffsetType == _DashOffsetType.Absolute ? _value : length * _value; + _dashOffsetType == _DashOffsetType.absolute ? _value : length * _value; } diff --git a/lib/components/bottom_sheet/gf_bottom_sheet.dart b/lib/components/bottom_sheet/gf_bottom_sheet.dart index e772ccf3..ad9ddf60 100644 --- a/lib/components/bottom_sheet/gf_bottom_sheet.dart +++ b/lib/components/bottom_sheet/gf_bottom_sheet.dart @@ -2,6 +2,7 @@ import 'dart:async'; import 'package:flutter/material.dart'; class GFBottomSheet extends StatefulWidget { + /// Opens sheet from bottom as a popup on current sheets it has different customization options. GFBottomSheet({ Key key, @required this.contentBody, @@ -122,7 +123,6 @@ class _GFBottomSheetState extends State Theme.of(context).bottomSheetTheme; final double elevation = widget.elevation ?? bottomSheetTheme.elevation ?? 0; - final Widget bottomSheet = Column( mainAxisSize: MainAxisSize.min, children: [ @@ -246,9 +246,7 @@ class GFBottomSheetController extends ValueNotifier { // ignore: unnecessary_getters_setters double get height => _height; - bool get isBottomSheetOpened => value; - void hideBottomSheet() => value = false; void showBottomSheet() => value = true; } diff --git a/lib/components/button/gf_button.dart b/lib/components/button/gf_button.dart index bd57593c..df810c6d 100644 --- a/lib/components/button/gf_button.dart +++ b/lib/components/button/gf_button.dart @@ -1,746 +1,3 @@ -//import 'dart:math' as math; -//import 'package:flutter/foundation.dart'; -//import 'package:flutter/gestures.dart'; -//import 'package:flutter/rendering.dart'; -//import 'package:flutter/widgets.dart'; -//import 'package:flutter/material.dart'; -//import 'package:getwidget/getwidget.dart'; -// -//class GFButton extends StatefulWidget { -// /// Create buttons of all types. check out [GFIconButton] for icon buttons, and [GFBadge] for badges -// const GFButton({ -// Key key, -// @required this.onPressed, -// this.onHighlightChanged, -// this.textStyle, -// this.boxShadow, -// this.buttonBoxShadow, -// this.focusColor, -// this.hoverColor, -// this.highlightColor, -// this.splashColor, -// this.elevation = 0.0, -// this.focusElevation = 4.0, -// this.hoverElevation = 4.0, -// this.highlightElevation = 1.0, -// this.disabledElevation = 0.0, -// this.padding = const EdgeInsets.symmetric(horizontal: 8), -// this.constraints, -// this.borderShape, -// this.animationDuration = kThemeChangeDuration, -// this.clipBehavior = Clip.none, -// this.focusNode, -// this.autofocus = false, -// MaterialTapTargetSize materialTapTargetSize, -// this.child, -// this.type = GFButtonType.solid, -// this.shape = GFButtonShape.standard, -// this.color = GFColors.PRIMARY, -// this.textColor, -// this.position = GFPosition.start, -// this.size = GFSize.MEDIUM, -// this.borderSide, -// this.text, -// this.icon, -// this.blockButton, -// this.fullWidthButton, -// this.colorScheme, -// this.enableFeedback, -// this.onLongPress, -// this.disabledColor, -// this.disabledTextColor, -// }) : materialTapTargetSize = -// materialTapTargetSize ?? MaterialTapTargetSize.padded, -// assert(shape != null, 'Button shape can not be null'), -// // assert(elevation != null && elevation >= 0.0), -// assert(focusElevation != null && focusElevation >= 0.0), -// assert(hoverElevation != null && hoverElevation >= 0.0), -// assert(highlightElevation != null && highlightElevation >= 0.0), -// assert(disabledElevation != null && disabledElevation >= 0.0), -// assert(padding != null), -// assert(animationDuration != null), -// assert(clipBehavior != null), -// assert(autofocus != null), -// super(key: key); -// -// /// Called when the button is tapped or otherwise activated. -// final VoidCallback onPressed; -// -// /// Called by the underlying [InkWell] widget's InkWell.onHighlightChanged callback. -// final ValueChanged onHighlightChanged; -// -// /// Defines the default text style, with [Material.textStyle], for the button's [child]. -// final TextStyle textStyle; -// -// /// The border side for the button's [Material]. -// final BorderSide borderSide; -// -// /// The box shadow for the button's [Material], if GFButtonType is solid -// final BoxShadow boxShadow; -// -// /// Pass [GFColors] or [Color]. The color for the button's [Material] when it has the input focus. -// final Color focusColor; -// -// /// Pass [GFColors] or [Color]. The color for the button's [Material] when a pointer is hovering over it. -// final Color hoverColor; -// -// /// Pass [GFColors] or [Color]. The highlight color for the button's [InkWell]. -// final Color highlightColor; -// -// /// Pass [GFColors] or [Color]. The splash color for the button's [InkWell]. -// final Color splashColor; -// -// /// The elevation for the button's [Material] when the button is [enabled] but not pressed. -// final double elevation; -// -// /// The elevation for the button's [Material] when the button is [enabled] and a pointer is hovering over it. -// final double hoverElevation; -// -// /// The elevation for the button's [Material] when the button is [enabled] and has the input focus. -// final double focusElevation; -// -// /// The elevation for the button's [Material] when the button is [enabled] and pressed. -// final double highlightElevation; -// -// /// The elevation for the button's [Material] when the button is not [enabled]. -// final double disabledElevation; -// -// /// The internal padding for the button's [child]. -// final EdgeInsetsGeometry padding; -// -// /// Defines the button's size. -// final BoxConstraints constraints; -// -// /// The shape of the button's [Material]. -// final ShapeBorder borderShape; -// -// /// Defines the duration of animated changes for [shape] and [elevation]. -// final Duration animationDuration; -// -// /// Typically the button's label. -// final Widget child; -// -// /// Whether the button is enabled or disabled. -// bool get enabled => onPressed != null; -// -// /// Configures the minimum size of the tap target. -// final MaterialTapTargetSize materialTapTargetSize; -// -// /// {@macro flutter.widgets.Focus.focusNode} -// final FocusNode focusNode; -// -// /// {@macro flutter.widgets.Focus.autofocus} -// final bool autofocus; -// -// /// {@macro flutter.widgets.Clip} -// final Clip clipBehavior; -// -// /// Button type of [GFButtonType] i.e, solid, outline, outline2x, transparent -// final GFButtonType type; -// -// /// Button type of [GFButtonShape] i.e, standard, pills, square, shadow, icons -// final GFButtonShape shape; -// -// /// Pass [GFColors] or [Color] -// final Color color; -// -// /// The fill color of the button when the button is disabled. -// /// -// /// The default value of this color is the theme's disabled color, -// /// [ThemeData.disabledColor]. -// /// -// /// See also: -// /// -// /// * [color] - the fill color of the button when the button is [enabled]. -// final Color disabledColor; -// -// /// Pass [GFColors] or [Color] -// final Color textColor; -// -// /// The color to use for this button's text when the button is disabled. -// /// -// /// The button's [Material.textStyle] will be the current theme's button -// /// text style, [ThemeData.textTheme.button], configured with this color. -// /// -// /// The default value is the theme's disabled color, -// /// [ThemeData.disabledColor]. -// /// -// /// If [textColor] is a [MaterialStateProperty], [disabledTextColor] -// /// will be ignored. -// /// -// /// See also: -// /// -// /// * [textColor] - The color to use for this button's text when the button is [enabled]. -// final Color disabledTextColor; -// -// /// size of [double] or [GFSize] i.e, 1.2, small, medium, large etc. -// final double size; -// -// /// text of type [String] is alternative to child. text will get priority over child -// final String text; -// -// /// icon of type [Widget] -// final Widget icon; -// -// /// icon type of [GFPosition] i.e, start, end -// final GFPosition position; -// -// /// on true state blockButton gives block size button -// final bool blockButton; -// -// /// on true state full width Button gives full width button -// final bool fullWidthButton; -// -// /// on true state default box shadow appears around button, if GFButtonType is solid -// final bool buttonBoxShadow; -// -// /// A set of thirteen colors that can be used to derive the button theme's -// /// colors. -// /// -// /// This property was added much later than the theme's set of highly -// /// specific colors, like [ThemeData.buttonColor], [ThemeData.highlightColor], -// /// [ThemeData.splashColor] etc. -// /// -// /// The colors for new button classes can be defined exclusively in terms -// /// of [colorScheme]. When it's possible, the existing buttons will -// /// (continue to) gradually migrate to it. -// final ColorScheme colorScheme; -// -// /// Whether detected gestures should provide acoustic and/or haptic feedback. -// /// -// /// For example, on Android a tap will produce a clicking sound and a -// /// long-press will produce a short vibration, when feedback is enabled. -// /// -// /// See also: -// /// -// /// * [Feedback] for providing platform-specific feedback to certain actions. -// final bool enableFeedback; -// -// /// Called when the button is long-pressed. -// /// -// /// If this callback and [onPressed] are null, then the button will be disabled. -// /// -// /// See also: -// /// -// /// * [enabled], which is true if the button is enabled. -// final VoidCallback onLongPress; -// -// @override -// _GFButtonState createState() => _GFButtonState(); -//} -// -//class _GFButtonState extends State { -// Color color; -// Color disabledColor; -// Color textColor; -// Color disabledTextColor; -// Widget child; -// Widget icon; -// Function onPressed; -// GFButtonType type; -// GFButtonShape shape; -// double size; -// GFPosition position; -// BoxShadow boxShadow; -// -// final Set _states = {}; -// -// @override -// void initState() { -// color = widget.color; -// textColor = widget.textColor; -// child = widget.text != null ? Text(widget.text) : widget.child; -// icon = widget.icon; -// onPressed = widget.onPressed; -// type = widget.type; -// shape = widget.shape; -// size = widget.size; -// position = widget.position; -// disabledColor = widget.disabledColor; -// disabledTextColor = widget.disabledTextColor; -// _updateState( -// MaterialState.disabled, -// !widget.enabled, -// ); -// super.initState(); -// } -// -// bool get _hovered => _states.contains(MaterialState.hovered); -// bool get _focused => _states.contains(MaterialState.focused); -// bool get _pressed => _states.contains(MaterialState.pressed); -// bool get _disabled => _states.contains(MaterialState.disabled); -// -// double buttonWidth() { -// if (widget.blockButton == true) { -// return MediaQuery.of(context).size.width * 0.88; -// } else if (widget.fullWidthButton == true) { -// return MediaQuery.of(context).size.width; -// } else { -// return null; -// } -// } -// -// void _updateState(MaterialState state, bool value) { -// value ? _states.add(state) : _states.remove(state); -// } -// -// void _handleHighlightChanged(bool value) { -// if (_pressed != value) { -// setState(() { -// _updateState(MaterialState.pressed, value); -// if (widget.onHighlightChanged != null) { -// widget.onHighlightChanged(value); -// } -// }); -// } -// } -// -// void _handleHoveredChanged(bool value) { -// if (_hovered != value) { -// setState(() { -// _updateState(MaterialState.hovered, value); -// }); -// } -// } -// -// void _handleFocusedChanged(bool value) { -// if (_focused != value) { -// setState(() { -// _updateState(MaterialState.focused, value); -// }); -// } -// } -// -// @override -// void didUpdateWidget(GFButton oldWidget) { -// _updateState(MaterialState.disabled, !widget.enabled); -// // If the button is disabled while a press gesture is currently ongoing, -// // InkWell makes a call to handleHighlightChanged. This causes an exception -// // because it calls setState in the middle of a build. To preempt this, we -// // manually update pressed to false when this situation occurs. -// if (_disabled && _pressed) { -// _handleHighlightChanged(false); -// } -// super.didUpdateWidget(oldWidget); -// } -// -// double get _effectiveElevation { -// // These conditionals are in order of precedence, so be careful about -// // reorganizing them. -// if (_disabled) { -// return widget.disabledElevation; -// } -// if (_pressed) { -// return widget.highlightElevation; -// } -// if (_hovered) { -// return widget.hoverElevation; -// } -// if (_focused) { -// return widget.focusElevation; -// } -// return widget.elevation; -// } -// -// @override -// Widget build(BuildContext context) { -// ShapeBorder shapeBorderType; -// -// Color getBorderColor() { -// if (widget.enabled) { -// final Color fillColor = color ?? GFColors.PRIMARY; -// if (fillColor != null) { -// return fillColor; -// } -// } else { -// if (disabledColor != null) { -// return disabledColor; -// } else { -// return color.withOpacity(0.48); -// } -// } -// return color ?? GFColors.PRIMARY; -// } -// -// Color getDisabledFillColor() { -// if (widget.type == GFButtonType.transparent || -// widget.type == GFButtonType.outline || -// widget.type == GFButtonType.outline2x) { -// return Colors.transparent; -// } -// if (disabledColor != null) { -// return disabledColor; -// } else { -// return color.withOpacity(0.48); -// } -// } -// -// Color getColor() { -// if (widget.type == GFButtonType.transparent || -// widget.type == GFButtonType.outline || -// widget.type == GFButtonType.outline2x) { -// return Colors.transparent; -// } -// final Color fillColor = color ?? GFColors.PRIMARY; -// return fillColor; -// } -// -// Color getDisabledTextColor() { -// if (disabledTextColor != null) { -// return disabledTextColor; -// } else if (widget.type == GFButtonType.outline || -// widget.type == GFButtonType.outline2x || -// widget.type == GFButtonType.transparent) { -// return color; -// } else { -// return GFColors.DARK; -// } -// } -// -// Color getTextColor() { -// if (widget.type == GFButtonType.outline || -// widget.type == GFButtonType.outline2x || -// widget.type == GFButtonType.transparent) { -// return widget.enabled -// ? textColor == null -// ? color == GFColors.TRANSPARENT ? GFColors.DARK : color -// : textColor -// : getDisabledTextColor(); -// } -// if (textColor == null) { -// if (color == GFColors.TRANSPARENT) { -// return GFColors.DARK; -// } else { -// return GFColors.WHITE; -// } -// } else { -// return textColor; -// } -// } -// -// final Color effectiveTextColor = MaterialStateProperty.resolveAs( -// widget.textStyle?.color, _states); -// final Color themeColor = -// Theme.of(context).colorScheme.onSurface.withOpacity(0.12); -// final BorderSide outlineBorder = BorderSide( -// color: color == null -// ? themeColor -// : widget.borderSide == null -// ? getBorderColor() -// : widget.borderSide.color, -// width: widget.borderSide?.width == null -// ? widget.type == GFButtonType.outline2x ? 2.0 : 1.0 -// : widget.borderSide?.width, -// ); -// -// Size minSize; -// switch (widget.materialTapTargetSize) { -// case MaterialTapTargetSize.padded: -// minSize = const Size(48, 48); -// break; -// case MaterialTapTargetSize.shrinkWrap: -// minSize = Size.zero; -// break; -// default: -// minSize = Size.zero; -// break; -// } -// -// final BorderSide shapeBorder = widget.type == GFButtonType.outline || -// widget.type == GFButtonType.outline2x -// ? outlineBorder -// : widget.borderSide ?? -// BorderSide( -// color: color == null ? themeColor : getBorderColor(), -// width: 0, -// ); -// -// if (shape == GFButtonShape.pills) { -// shapeBorderType = RoundedRectangleBorder( -// borderRadius: BorderRadius.circular( -// 50, -// ), -// side: shapeBorder, -// ); -// } else if (shape == GFButtonShape.square) { -// shapeBorderType = RoundedRectangleBorder( -// borderRadius: BorderRadius.circular(0), -// side: shapeBorder, -// ); -// } else if (shape == GFButtonShape.standard) { -// shapeBorderType = RoundedRectangleBorder( -// borderRadius: BorderRadius.circular(3), -// side: shapeBorder, -// ); -// } else { -// shapeBorderType = RoundedRectangleBorder( -// borderRadius: BorderRadius.circular(50), -// side: shapeBorder, -// ); -// } -// -// BoxDecoration getBoxShadow() { -// if (widget.type != GFButtonType.transparent) { -// if (widget.boxShadow == null && widget.buttonBoxShadow != true) { -// return null; -// } else { -// return BoxDecoration( -// color: widget.type == GFButtonType.transparent || -// widget.type == GFButtonType.outline || -// widget.type == GFButtonType.outline2x -// ? Colors.transparent -// : color, -// borderRadius: widget.shape == GFButtonShape.pills -// ? BorderRadius.circular(50) -// : widget.shape == GFButtonShape.standard -// ? BorderRadius.circular(5) -// : BorderRadius.zero, -// boxShadow: [ -// widget.boxShadow == null && widget.buttonBoxShadow == true -// ? BoxShadow( -// color: themeColor, -// blurRadius: 1.5, -// spreadRadius: 2, -// offset: Offset.zero, -// ) -// : widget.boxShadow != null -// ? widget.boxShadow -// : BoxShadow( -// color: Theme.of(context).canvasColor, -// blurRadius: 0, -// spreadRadius: 0, -// offset: Offset.zero, -// ), -// ], -// ); -// } -// } -// return null; -// } -// -// TextStyle getTextStyle() { -// if (widget.size == GFSize.SMALL) { -// return TextStyle( -// color: widget.enabled ? getTextColor() : getDisabledTextColor(), -// fontSize: 12, -// ); -// } else if (widget.size == GFSize.MEDIUM) { -// return TextStyle( -// color: widget.enabled ? getTextColor() : getDisabledTextColor(), -// fontSize: 13, -// fontWeight: FontWeight.w400, -// ); -// } else if (widget.size == GFSize.LARGE) { -// return TextStyle( -// color: widget.enabled ? getTextColor() : getDisabledTextColor(), -// fontSize: 14, -// fontWeight: FontWeight.w500, -// ); -// } -// return TextStyle( -// color: widget.enabled ? getTextColor() : getDisabledTextColor(), -// fontSize: 13, -// fontWeight: FontWeight.w400, -// ); -// } -// -// -// final Widget result = Container( -// constraints: icon == null -// ? const BoxConstraints(minWidth: 80) -// : const BoxConstraints(minWidth: 90), -// decoration: widget.type == GFButtonType.solid ? getBoxShadow() : null, -// child: Material( -// elevation: _effectiveElevation, -// textStyle: widget.textStyle == null ? getTextStyle() : widget.textStyle, -// shape: widget.type == GFButtonType.transparent -// ? null -// : widget.borderShape ?? shapeBorderType, -// color: widget.enabled ? getColor() : getDisabledFillColor(), -// type: color == null ? MaterialType.transparency : MaterialType.button, -// animationDuration: widget.animationDuration, -// clipBehavior: widget.clipBehavior, -// child: InkWell( -// focusNode: widget.focusNode, -// canRequestFocus: widget.enabled, -// onFocusChange: _handleFocusedChanged, -// autofocus: widget.autofocus, -// onHighlightChanged: _handleHighlightChanged, -// onHover: _handleHoveredChanged, -// onTap: widget.onPressed, -// onLongPress: widget.onLongPress, -// enableFeedback: widget.enableFeedback, -// splashColor: widget.splashColor, -// highlightColor: widget.highlightColor, -// focusColor: widget.focusColor, -// hoverColor: widget.hoverColor, -// customBorder: widget.type == GFButtonType.transparent -// ? null -// : widget.borderShape ?? shapeBorderType, -// child: IconTheme.merge( -// data: IconThemeData(color: effectiveTextColor), -// child: Container( -// height: size, -// width: buttonWidth(), -// padding: widget.padding, -// child: Center( -// widthFactor: 1, -// heightFactor: 1, -//// child: widget.child !=null? widget.child:Row( -//// children: [ -//// widget.icon!=null?widget.icon:Icons.sentiment_very_satisfied, -//// widget.child !=null? widget.child:Text('k') -//// ], -////), -// child: icon != null && -// (position == GFPosition.start || position == null) -// ? Row( -// mainAxisSize: MainAxisSize.min, -// children: [ -// icon, -// const SizedBox(width: 8), -// child -// ], -// ) -// : icon != null && (position == GFPosition.end) -// ? Row( -// mainAxisSize: MainAxisSize.min, -// children: [ -// child, -// const SizedBox(width: 8), -// icon -// ], -// ) -// : widget.child, -// ), -// ), -// ), -// ), -// ), -// ); -// -// return Semantics( -// container: true, -// button: true, -// enabled: widget.enabled, -// child: _InputPadding( -// minSize: minSize, -// child: Focus( -// focusNode: widget.focusNode, -// onFocusChange: _handleFocusedChanged, -// autofocus: widget.autofocus, -// child: result, -// ), -// ), -// ); -// } -//} -// -///// A widget to pad the area around a [MaterialButton]'s inner [Material]. -///// -///// Redirect taps that occur in the padded area around the child to the center -///// of the child. This increases the size of the button and the button's -///// "tap target", but not its material or its ink splashes. -//class _InputPadding extends SingleChildRenderObjectWidget { -// const _InputPadding({ -// Key key, -// Widget child, -// this.minSize, -// }) : super( -// key: key, -// child: child, -// ); -// -// final Size minSize; -// -// @override -// RenderObject createRenderObject(BuildContext context) => -// _RenderInputPadding(minSize); -// -// @override -// void updateRenderObject( -// BuildContext context, covariant _RenderInputPadding renderObject) { -// renderObject.minSize = minSize; -// } -//} -// -//class _RenderInputPadding extends RenderShiftedBox { -// _RenderInputPadding(this._minSize, [RenderBox child]) : super(child); -// -// Size get minSize => _minSize; -// Size _minSize; -// -// set minSize(Size value) { -// _minSize = value; -// markNeedsLayout(); -// } -// -// @override -// double computeMinIntrinsicWidth(double height) { -// if (child != null) { -// return math.max(child.getMinIntrinsicWidth(height), minSize.width); -// } -// return 0; -// } -// -// @override -// double computeMinIntrinsicHeight(double width) { -// if (child != null) { -// return math.max(child.getMinIntrinsicHeight(width), minSize.height); -// } -// return 0; -// } -// -// @override -// double computeMaxIntrinsicWidth(double height) { -// if (child != null) { -// return math.max(child.getMaxIntrinsicWidth(height), minSize.width); -// } -// return 0; -// } -// -// @override -// double computeMaxIntrinsicHeight(double width) { -// if (child != null) { -// return math.max(child.getMaxIntrinsicHeight(width), minSize.height); -// } -// return 0; -// } -// -// @override -// void performLayout() { -// if (child != null) { -// child.layout(constraints, parentUsesSize: true); -// final BoxParentData childParentData = child.parentData; -// final double height = math.max(child.size.width, minSize.width); -// final double width = math.max(child.size.height, minSize.height); -// size = constraints.constrain(Size(height, width)); -// childParentData.offset = Alignment.center.alongOffset(size - child.size); -// } else { -// size = Size.zero; -// } -// } -// -// @override -// bool hitTest(BoxHitTestResult result, {Offset position}) { -// if (super.hitTest(result, position: position)) { -// return true; -// } -// final Offset center = child.size.center(Offset.zero); -// return result.addWithRawTransform( -// transform: MatrixUtils.forceToPoint(center), -// position: center, -// hitTest: (BoxHitTestResult result, Offset position) { -// assert(position == center); -// return child.hitTest( -// result, -// position: center, -// ); -// }, -// ); -// } -//} - import 'dart:math' as math; import 'package:flutter/foundation.dart'; import 'package:flutter/gestures.dart'; @@ -1163,7 +420,9 @@ class _GFButtonState extends State { widget.type == GFButtonType.transparent) { return widget.enabled ? textColor == null - ? color == GFColors.TRANSPARENT ? GFColors.DARK : color + ? color == GFColors.TRANSPARENT + ? GFColors.DARK + : color : textColor : getDisabledTextColor(); } @@ -1189,7 +448,9 @@ class _GFButtonState extends State { ? getBorderColor() : widget.borderSide.color, width: widget.borderSide?.width == null - ? widget.type == GFButtonType.outline2x ? 2.0 : 1.0 + ? widget.type == GFButtonType.outline2x + ? 2.0 + : 1.0 : widget.borderSide?.width, ); diff --git a/lib/components/button/gf_icon_button.dart b/lib/components/button/gf_icon_button.dart index 356aabac..93acc6fa 100644 --- a/lib/components/button/gf_icon_button.dart +++ b/lib/components/button/gf_icon_button.dart @@ -162,7 +162,9 @@ class _GFIconButtonState extends State { widget.type == GFButtonType.outline || widget.type == GFButtonType.outline2x) { return widget.onPressed != null - ? color == GFColors.TRANSPARENT ? GFColors.DARK : color + ? color == GFColors.TRANSPARENT + ? GFColors.DARK + : color : color.withOpacity(0.48); } else if (color == GFColors.TRANSPARENT) { return widget.onPressed != null ? GFColors.DARK : GFColors.WHITE; @@ -182,7 +184,9 @@ class _GFIconButtonState extends State { ? getBorderColor() : widget.borderSide.color, width: widget.borderSide?.width == null - ? widget.type == GFButtonType.outline2x ? 2.0 : 1.0 + ? widget.type == GFButtonType.outline2x + ? 2.0 + : 1.0 : widget.borderSide?.width, ); @@ -241,7 +245,9 @@ class _GFIconButtonState extends State { height: widget.shape == GFIconButtonShape.circle ? height + 6.0 : height, width: widget.shape == GFIconButtonShape.pills ? width + 10 - : widget.shape == GFIconButtonShape.circle ? height + 6 : width, + : widget.shape == GFIconButtonShape.circle + ? height + 6 + : width, padding: widget.padding, child: IconTheme.merge( data: IconThemeData( @@ -309,7 +315,9 @@ class _GFIconButtonState extends State { widget.shape == GFIconButtonShape.circle ? height + 6 : height, width: widget.shape == GFIconButtonShape.pills ? width + 10 - : widget.shape == GFIconButtonShape.circle ? height + 6 : width, + : widget.shape == GFIconButtonShape.circle + ? height + 6 + : width, decoration: widget.type == GFButtonType.solid ? getBoxShadow() : null, child: Material( diff --git a/lib/components/card/gf_card.dart b/lib/components/card/gf_card.dart index 9c5959b9..dfadce1c 100644 --- a/lib/components/card/gf_card.dart +++ b/lib/components/card/gf_card.dart @@ -176,7 +176,9 @@ class GFCard extends StatelessWidget { _defaultClipBehavior, child: imageOverlay == null ? cardChild : overlayImage, ) - : imageOverlay == null ? cardChild : overlayImage, + : imageOverlay == null + ? cardChild + : overlayImage, ); } } diff --git a/lib/components/carousel/gf_carousel.dart b/lib/components/carousel/gf_carousel.dart index 65f80b24..4718e4ca 100644 --- a/lib/components/carousel/gf_carousel.dart +++ b/lib/components/carousel/gf_carousel.dart @@ -1,7 +1,6 @@ import 'dart:async'; import 'package:flutter/material.dart'; -// ignore: must_be_immutable class GFCarousel extends StatefulWidget { /// Creates slide show of Images and [Widget] with animation for sliding. GFCarousel({ @@ -235,7 +234,9 @@ class _GFCarouselState extends State with TickerProviderStateMixin { reverse: widget.reverse, itemCount: widget.items.length == 1 ? widget.items.length - : widget.enableInfiniteScroll ? null : widget.items.length, + : widget.enableInfiniteScroll + ? null + : widget.items.length, onPageChanged: (int index) { int currentPage; currentPage = _getRealIndex(index + widget.initialPage, diff --git a/lib/components/checkbox/gf_checkbox.dart b/lib/components/checkbox/gf_checkbox.dart index 3a06baf8..8fe7709c 100644 --- a/lib/components/checkbox/gf_checkbox.dart +++ b/lib/components/checkbox/gf_checkbox.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:getwidget/getwidget.dart'; class GFCheckbox extends StatefulWidget { + /// [GFCheckbox] is a small box (as in a checklist) in which to place a check mark to make a selection with various customization options. const GFCheckbox( {Key key, this.size = GFSize.MEDIUM, @@ -18,7 +19,7 @@ class GFCheckbox extends StatefulWidget { size: 20, color: GFColors.WHITE, ), - this.inactiveIcon = const Icon(Icons.close), + this.inactiveIcon, this.custombgColor = GFColors.SUCCESS, this.autofocus = false, this.focusNode}) diff --git a/lib/components/checkbox_list_tile/gf_checkbox_list_tile.dart b/lib/components/checkbox_list_tile/gf_checkbox_list_tile.dart index 8fbc0c17..fda47044 100644 --- a/lib/components/checkbox_list_tile/gf_checkbox_list_tile.dart +++ b/lib/components/checkbox_list_tile/gf_checkbox_list_tile.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:getwidget/getwidget.dart'; class GFCheckboxListTile extends StatelessWidget { + /// [GFCheckboxListTile] is a tile with small box at right (as in a checklist) in which to place a check mark to make a selection with various customization options. const GFCheckboxListTile({ Key key, @required this.value, @@ -12,6 +13,7 @@ class GFCheckboxListTile extends StatelessWidget { this.avatar, this.title, this.subTitle, + this.icon, this.description, this.padding = const EdgeInsets.all(8), this.margin = const EdgeInsets.all(16), @@ -27,8 +29,9 @@ class GFCheckboxListTile extends StatelessWidget { size: 20, color: GFColors.WHITE, ), - this.inactiveIcon = const Icon(Icons.close), + this.inactiveIcon, this.custombgColor = GFColors.SUCCESS, + this.position = GFPosition.end, this.selected = false, this.autofocus = false, }) : assert(value != null), @@ -45,7 +48,7 @@ class GFCheckboxListTile extends StatelessWidget { /// The GFListTile's background color. Can be given [Color] or [GFColors] final Color color; - /// type of [Widget] or [GFAvatar] used to create rounded user profile + /// If position is start Checkbox will come instead of avatar, type of [Widget] or [GFAvatar] used to create rounded user profile final Widget avatar; /// The title to display inside the [GFListTile]. see [Text] @@ -87,13 +90,16 @@ class GFCheckboxListTile extends StatelessWidget { /// Called when the user checks or unchecks the checkbox. final ValueChanged onChanged; - ///Used to set the current state of the checkbox + /// Used to set the current state of the checkbox final bool value; - ///type of Widget used to change the checkbox's active icon + /// Position allows user to set position of [GFCheckbox] based on given [GFPosition] + final GFPosition position; + + /// type of Widget used to change the checkbox's active icon final Widget activeIcon; - ///type of [Widget] used to change the checkbox's inactive icon + /// type of [Widget] used to change the checkbox's inactive icon final Widget inactiveIcon; /// type of [Color] used to change the background color of the custom active checkbox only @@ -106,41 +112,46 @@ class GFCheckboxListTile extends StatelessWidget { /// {@macro flutter.widgets.Focus.autofocus} final bool autofocus; + /// If position is end Checkbox will come instead of icon, The icon to display inside the [GFListTile]. see [Icon] + final Widget icon; + @override - Widget build(BuildContext context) => MergeSemantics( - child: GFListTile( - autofocus: autofocus, - enabled: onChanged != null, - onTap: onChanged != null - ? () { - onChanged(!value); - } - : null, - selected: selected, - avatar: avatar, - titleText: titleText, - subTitle: subTitle, - subtitleText: subtitleText, - description: description, - color: color, - padding: padding, - margin: margin, - title: title, - icon: GFCheckbox( - autofocus: autofocus, - onChanged: onChanged, - value: value, - size: size, - activebgColor: activebgColor, - inactiveIcon: inactiveIcon, - activeBorderColor: activeBorderColor, - inactivebgColor: inactivebgColor, - activeIcon: activeIcon, - inactiveBorderColor: inactiveBorderColor, - custombgColor: custombgColor, - checkColor: checkColor, - type: type, - ), - ), - ); + Widget build(BuildContext context) { + final GFCheckbox checkbox = GFCheckbox( + autofocus: autofocus, + onChanged: onChanged, + value: value, + size: size, + activebgColor: activebgColor, + inactiveIcon: inactiveIcon, + activeBorderColor: activeBorderColor, + inactivebgColor: inactivebgColor, + activeIcon: activeIcon, + inactiveBorderColor: inactiveBorderColor, + custombgColor: custombgColor, + checkColor: checkColor, + type: type); + return MergeSemantics( + child: GFListTile( + autofocus: autofocus, + enabled: onChanged != null, + onTap: onChanged != null + ? () { + onChanged(!value); + } + : null, + selected: selected, + avatar: position == GFPosition.start ? checkbox : avatar, + titleText: titleText, + subTitle: subTitle, + subtitleText: subtitleText, + description: description, + color: color, + padding: padding, + margin: margin, + title: title, + icon: position == GFPosition.end ? checkbox : icon, + ), + ); + } } diff --git a/lib/components/drawer/gf_drawer.dart b/lib/components/drawer/gf_drawer.dart index 5dd595e7..76226e3f 100644 --- a/lib/components/drawer/gf_drawer.dart +++ b/lib/components/drawer/gf_drawer.dart @@ -53,9 +53,7 @@ const double _kWidth = 304; /// class GFDrawer extends StatelessWidget { /// Creates a material design drawer. - /// /// Typically used in the [Scaffold.drawer] property. - /// /// The [elevation] must be non-negative. const GFDrawer({ Key key, diff --git a/lib/components/drawer/gf_drawer_header.dart b/lib/components/drawer/gf_drawer_header.dart index f512c43d..3f8f3d39 100644 --- a/lib/components/drawer/gf_drawer_header.dart +++ b/lib/components/drawer/gf_drawer_header.dart @@ -75,9 +75,7 @@ class GFDrawerHeaderPictures extends StatelessWidget { } /// A material design [Drawer] header that identifies the app's user. -/// /// Requires one of its ancestors to be a [Material] widget. -/// class GFDrawerHeader extends StatefulWidget { /// Creates a material design drawer header. /// diff --git a/lib/components/dropdown/gf_dropdown.dart b/lib/components/dropdown/gf_dropdown.dart index 9fcf2a2c..a8b4f137 100644 --- a/lib/components/dropdown/gf_dropdown.dart +++ b/lib/components/dropdown/gf_dropdown.dart @@ -1,7 +1,8 @@ import 'package:flutter/material.dart'; class GFDropdown extends StatefulWidget { - GFDropdown( + /// + const GFDropdown( {Key key, @required this.items, this.icon, @@ -26,13 +27,13 @@ class GFDropdown extends StatefulWidget { this.dropdownColor, this.padding = const EdgeInsets.all(5), this.borderRadius = const BorderRadius.all(Radius.circular(4)), - this.borderColor}); + this.borderColor}) + : super(key: key); - DropdownButtonBuilder selectedItemBuilder; + final DropdownButtonBuilder selectedItemBuilder; final List> items; /// The widget to use for the drop-down button's icon. - /// /// Defaults to an [Icon] with the [Icons.arrow_drop_down] glyph. final Widget icon; @@ -55,7 +56,6 @@ class GFDropdown extends StatefulWidget { final Widget disabledHint; /// Called when the user selects an item. - /// /// If the [onChanged] callback is null or the list of [DropdownButton.items] /// is null then the dropdown button will be disabled, final ValueChanged onChanged; @@ -114,38 +114,34 @@ class GFDropdown extends StatefulWidget { class _GFDropdownState extends State { @override - Widget build(BuildContext context) { - return Card( + Widget build(BuildContext context) => Card( child: Container( - padding: widget.padding, - decoration: BoxDecoration( - borderRadius: widget.borderRadius, - border: Border.all( - color: widget.borderColor != null - ? widget.borderColor - : Colors.white)), - child: DropdownButton( - - items: widget.items, - selectedItemBuilder: widget.selectedItemBuilder, - value: widget.value, - hint: widget.hint, - disabledHint: widget.disabledHint, - onChanged: widget.onChanged == null ? null : widget.onChanged, - onTap: widget.onTap, - elevation: widget.elevation, - style: widget.style, - icon: widget.icon, - iconDisabledColor: widget.iconDisabledColor, - iconEnabledColor: widget.iconEnabledColor, - iconSize: widget.iconSize, - isDense: widget.isDense, - isExpanded: widget.isExpanded, - itemHeight: widget.itemHeight, - focusColor: widget.focusColor, - focusNode: widget.focusNode, - autofocus: widget.autofocus, - dropdownColor: widget.dropdownColor, - ))); - } + padding: widget.padding, + decoration: BoxDecoration( + borderRadius: widget.borderRadius, + border: Border.all(color: widget.borderColor ?? Colors.white)), + child: DropdownButton( + items: widget.items, + selectedItemBuilder: widget.selectedItemBuilder, + value: widget.value, + hint: widget.hint, + disabledHint: widget.disabledHint, + onChanged: widget.onChanged, + onTap: widget.onTap, + elevation: widget.elevation, + style: widget.style, + icon: widget.icon, + iconDisabledColor: widget.iconDisabledColor, + iconEnabledColor: widget.iconEnabledColor, + iconSize: widget.iconSize, + isDense: widget.isDense, + isExpanded: widget.isExpanded, + itemHeight: widget.itemHeight, + focusColor: widget.focusColor, + focusNode: widget.focusNode, + autofocus: widget.autofocus, + dropdownColor: widget.dropdownColor, + ), + ), + ); } diff --git a/lib/components/dropdown/gf_multiselect.dart b/lib/components/dropdown/gf_multiselect.dart new file mode 100644 index 00000000..57ee6b80 --- /dev/null +++ b/lib/components/dropdown/gf_multiselect.dart @@ -0,0 +1,234 @@ +import 'package:flutter/material.dart'; +import 'package:getwidget/getwidget.dart'; + +class GFMultiSelect extends StatefulWidget { + /// + const GFMultiSelect({ + this.titleText, + this.selectedTextStyle = + const TextStyle(fontSize: 16, fontWeight: FontWeight.w500), + this.color, + this.avatar, + this.padding = const EdgeInsets.all(0), + this.margin = const EdgeInsets.all(5), + this.size = GFSize.MEDIUM, + this.type = GFCheckboxType.basic, + this.checkColor = GFColors.WHITE, + this.activebgColor = GFColors.WHITE, + this.inactivebgColor = GFColors.WHITE, + this.activeBorderColor = GFColors.WHITE, + this.inactiveBorderColor = GFColors.WHITE, + this.items, + this.submitbutton, + this.expandedicon = Icons.keyboard_arrow_down, + this.collapsedicon = Icons.keyboard_arrow_up, + this.dropdownbgColor = Colors.white, + this.activeIcon = const Icon( + Icons.check, + size: 20, + color: GFColors.DARK, + ), + this.inactiveIcon, + this.custombgColor = GFColors.SUCCESS, + this.selected = false, + Key key, + }) : assert(selected != null), + super(key: key); + + ///type of [String] used to pass text, alternative to title property and gets higher priority than title + final String titleText; + + /// The GFListTile's background color. Can be given [Color] or [GFColors] + final Color color; + + /// type of [Widget] or [GFAvatar] used to create rounded user profile + final Widget avatar; + + /// defines the margin of GFListTile + final EdgeInsets margin; + + /// defines the padding of GFListTile + final EdgeInsets padding; + + /// type of [GFCheckboxType] which is of four type is basic, sqaure, circular and custom + final GFCheckboxType type; + + /// type of [double] which is GFSize ie, small, medium and large and can use any double value + final double size; + + /// type pf [Color] used to change the checkcolor when the checkbox is active + final Color checkColor; + + /// type of [Color] used to change the backgroundColor of the active checkbox + final Color activebgColor; + + /// type of [Color] used to change the backgroundColor of the inactive checkbox + final Color inactivebgColor; + + /// type of [Color] used to change the border color of the active checkbox + final Color activeBorderColor; + + /// type of [Color] used to change the border color of the inactive checkbox + final Color inactiveBorderColor; + + /// Called when the user checks or unchecks the checkbox. + // final ValueChanged onChanged; + + ///Used to set the current state of the checkbox + // final bool value; + + ///type of Widget used to change the checkbox's active icon + final Widget activeIcon; + + ///type of [Widget] used to change the checkbox's inactive icon + final Widget inactiveIcon; + + /// type of [Color] used to change the background color of the custom active checkbox only + final Color custombgColor; + + /// To have the list tile appear selected when the checkbox is checked, pass the same value to both. + /// Normally, this property is left to its default value, false. + final bool selected; + + final List items; + + final Widget submitbutton; + + final Color dropdownbgColor; + + final TextStyle selectedTextStyle; + + final IconData expandedicon; + + final IconData collapsedicon; + + @override + _GFMultiSelectState createState() => _GFMultiSelectState(); +} + +class _GFMultiSelectState extends State { + bool check = true; + bool isdrop = false; + bool check1 = false; + + final _controller = TextEditingController(); + + final List _selectedTitles = []; + + void _onItemSelect(bool selected, String title) { + if (selected == true) { + setState(() { + _selectedTitles.add(title); + }); + } else { + setState(() { + _selectedTitles.remove(title); + }); + } + } + + @override + void dispose() { + if (_controller != null) { + _controller.dispose(); + } + super.dispose(); + } + + @override + Widget build(BuildContext context) => Column( + children: [ + InkWell( + onTap: () { + setState(() { + isdrop = !isdrop; + }); + }, + child: Container( + + // height: 40, + width: MediaQuery.of(context).size.width, + decoration: const BoxDecoration( + border: + Border(bottom: BorderSide(color: Colors.black12))), + child: Container( + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Expanded( + child: Container( + padding: const EdgeInsets.only(bottom: 10), + child: Text(_selectedTitles.join(' , ').toString(), + style: widget.selectedTextStyle), + )), + Icon( + !isdrop ? widget.expandedicon : widget.collapsedicon, + color: Colors.black87, + size: 30, + ), + ], + ), + ))), + isdrop + ? Container( + decoration: BoxDecoration( + color: widget.dropdownbgColor, + boxShadow: const [ + BoxShadow( + color: Colors.black12, + blurRadius: 3, + ) + ], + ), + height: 300, + child: SingleChildScrollView( + child: Column( + children: [ + Column( + children: List.generate( + widget.items.length, + (index) => GFCheckboxListTile( + value: _selectedTitles + .contains(widget.items[index]), + onChanged: (bool selected) { + _controller.text; + print(selected); + _onItemSelect( + selected, widget.items[index]); + }, + selected: widget.selected, + avatar: widget.avatar, + titleText: widget.items[index], + color: widget.color, + padding: widget.padding, + margin: widget.margin, + size: widget.size, + activebgColor: widget.activebgColor, + inactiveIcon: widget.inactiveIcon, + activeBorderColor: + widget.activeBorderColor, + inactivebgColor: widget.inactivebgColor, + activeIcon: widget.activeIcon, + inactiveBorderColor: + widget.inactiveBorderColor, + custombgColor: widget.custombgColor, + checkColor: widget.checkColor, + type: widget.type, + ))), + GFButton( + onPressed: () { + setState(() { + isdrop = !isdrop; + }); + }, + child: widget.submitbutton, + ) + ], + ), + ), + ) + : Container(), + ], + ); +} diff --git a/lib/components/dropdown/multilevel.dart b/lib/components/dropdown/multilevel.dart deleted file mode 100644 index 1ab11566..00000000 --- a/lib/components/dropdown/multilevel.dart +++ /dev/null @@ -1,236 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:getwidget/getwidget.dart'; - -class GFMultilevelDropdown extends StatefulWidget { - const GFMultilevelDropdown({ - this.titleText, - this.selectedTextStyle = - const TextStyle(fontSize: 16, fontWeight: FontWeight.w500), - this.color, - this.avatar, - this.padding = const EdgeInsets.all(0), - this.margin = const EdgeInsets.all(5), - this.size = GFSize.MEDIUM, - this.type = GFCheckboxType.basic, - this.checkColor = GFColors.WHITE, - this.activebgColor = GFColors.WHITE, - this.inactivebgColor = GFColors.WHITE, - this.activeBorderColor = GFColors.WHITE, - this.inactiveBorderColor = GFColors.WHITE, - this.items, - this.submitbutton, - this.expandedicon = Icons.keyboard_arrow_down, - this.collapsedicon = Icons.keyboard_arrow_up, - this.dropdownbgColor = Colors.white, - this.activeIcon = const Icon( - Icons.check, - size: 20, - color: GFColors.DARK, - ), - this.inactiveIcon, - this.custombgColor = GFColors.SUCCESS, - this.selected = false, - Key key, - }) : assert(selected != null), - super(key: key); - - ///type of [String] used to pass text, alternative to title property and gets higher priority than title - final String titleText; - - /// The GFListTile's background color. Can be given [Color] or [GFColors] - final Color color; - - /// type of [Widget] or [GFAvatar] used to create rounded user profile - final Widget avatar; - - /// defines the margin of GFListTile - final EdgeInsets margin; - - /// defines the padding of GFListTile - final EdgeInsets padding; - - /// type of [GFCheckboxType] which is of four type is basic, sqaure, circular and custom - final GFCheckboxType type; - - /// type of [double] which is GFSize ie, small, medium and large and can use any double value - final double size; - - /// type pf [Color] used to change the checkcolor when the checkbox is active - final Color checkColor; - - /// type of [Color] used to change the backgroundColor of the active checkbox - final Color activebgColor; - - /// type of [Color] used to change the backgroundColor of the inactive checkbox - final Color inactivebgColor; - - /// type of [Color] used to change the border color of the active checkbox - final Color activeBorderColor; - - /// type of [Color] used to change the border color of the inactive checkbox - final Color inactiveBorderColor; - - /// Called when the user checks or unchecks the checkbox. - // final ValueChanged onChanged; - - ///Used to set the current state of the checkbox - // final bool value; - - ///type of Widget used to change the checkbox's active icon - final Widget activeIcon; - - ///type of [Widget] used to change the checkbox's inactive icon - final Widget inactiveIcon; - - /// type of [Color] used to change the background color of the custom active checkbox only - final Color custombgColor; - - /// To have the list tile appear selected when the checkbox is checked, pass the same value to both. - /// Normally, this property is left to its default value, false. - final bool selected; - - final List items; - - final Widget submitbutton; - - final Color dropdownbgColor; - - final TextStyle selectedTextStyle; - - final IconData expandedicon; - - final IconData collapsedicon; - - @override - _GFMultilevelDropdownState createState() => _GFMultilevelDropdownState(); -} - -class _GFMultilevelDropdownState extends State { - bool check = true; - bool isdrop = false; - bool check1 = false; - - final _controller = TextEditingController(); - - List _selecteCategorys = List(); - - void initState() { - super.initState(); - setState(() {}); - // if (widget.items != null) { - // _selecteCategorys.addAll(widget.items); - // } - } - - void _onCategorySelected(bool selected, category_id) { - if (selected == true) { - setState(() { - _selecteCategorys.add(category_id); - }); - } else { - setState(() { - _selecteCategorys.remove(category_id); - }); - } - } - - @override - void dispose() { - _controller.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - return Column( - children: [ - InkWell( - onTap: () { - setState(() { - isdrop = !isdrop; - }); - }, - child: Container( - - // height: 40, - width: MediaQuery.of(context).size.width, - decoration: BoxDecoration( - border: Border(bottom: BorderSide(color: Colors.black12))), - child: Container( - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Expanded( - child: Container( - padding: EdgeInsets.only(bottom: 10), - child: Text(_selecteCategorys.join(' , ').toString(), - style: widget.selectedTextStyle), - )), - Icon( - !isdrop ? widget.expandedicon : widget.collapsedicon, - color: Colors.black87, - size: 30.0, - ), - ], - ), - ))), - isdrop - ? Container( - decoration: BoxDecoration( - color: widget.dropdownbgColor, - boxShadow: [ - BoxShadow( - color: Colors.black12, - blurRadius: 3.0, - ) - ], - ), - height: 300, - - child: SingleChildScrollView( - child: Column(children: [ - Column( - children: List.generate(widget.items.length, (index) { - return GFCheckboxListTile( - value: _selecteCategorys.contains(widget.items[index]), - onChanged: (bool selected) { - _controller.text; - print(selected); - _onCategorySelected(selected, widget.items[index]); - }, - selected: widget.selected, - avatar: widget.avatar, - titleText: widget.items[index], - color: widget.color, - padding: widget.padding, - margin: widget.margin, - size: widget.size, - activebgColor: widget.activebgColor, - inactiveIcon: widget.inactiveIcon, - activeBorderColor: widget.activeBorderColor, - inactivebgColor: widget.inactivebgColor, - activeIcon: widget.activeIcon, - inactiveBorderColor: widget.inactiveBorderColor, - custombgColor: widget.custombgColor, - checkColor: widget.checkColor, - type: widget.type, - ); - })), - GFButton( - padding: EdgeInsets.all(0), - onPressed: () { - setState(() { - isdrop = !isdrop; - }); - - print(_selecteCategorys); - }, - child: widget.submitbutton, - ) - ]))) - : Container(), - ], - ); - } -} diff --git a/lib/components/floating_widget/gf_floating_widget.dart b/lib/components/floating_widget/gf_floating_widget.dart index c72368e4..9d0d55b6 100644 --- a/lib/components/floating_widget/gf_floating_widget.dart +++ b/lib/components/floating_widget/gf_floating_widget.dart @@ -61,26 +61,23 @@ class _GFFloatingWidgetState extends State { child: widget.body ?? Container(), ), Positioned( - child: Container( - height: MediaQuery.of(context).size.height, - width: MediaQuery.of(context).size.width, - color: widget.showblurness - ? widget.blurnessColor ?? Colors.black54 - : null, - child: Stack( - children: [ - Positioned( - top: widget.verticalPosition != null - ? widget.verticalPosition - : 0.0, - left: widget.horizontalPosition != null - ? widget.horizontalPosition - : 0.0, - child: widget.child ?? Container(), - ) - ], + child: Container( + height: MediaQuery.of(context).size.height, + width: MediaQuery.of(context).size.width, + color: widget.showblurness + ? widget.blurnessColor ?? Colors.black54 + : null, + child: Stack( + children: [ + Positioned( + top: widget.verticalPosition ?? 0.0, + left: widget.horizontalPosition ?? 0.0, + child: widget.child ?? Container(), + ) + ], + ), ), - )) + ) ], ); } diff --git a/lib/components/intro_screen/gf_intro_screen.dart b/lib/components/intro_screen/gf_intro_screen.dart index fabda1b8..1d3f8ba9 100644 --- a/lib/components/intro_screen/gf_intro_screen.dart +++ b/lib/components/intro_screen/gf_intro_screen.dart @@ -3,6 +3,7 @@ import 'package:flutter/material.dart'; import 'package:getwidget/getwidget.dart'; class GFIntroScreen extends StatefulWidget { + /// Presents informative screens to users with various posibilities in customization. const GFIntroScreen({ Key key, @required this.pageController, @@ -114,7 +115,7 @@ class GFIntroScreen extends StatefulWidget { final EdgeInsets navigationBarMargin; /// defines [GFIntroScreenBottomNavigationBar] color - final dynamic navigationBarColor; + final Color navigationBarColor; /// defines the shape of [GFIntroScreenBottomNavigationBar] final ShapeBorder navigationBarShape; @@ -183,7 +184,7 @@ class GFIntroScreen extends StatefulWidget { final double dividerThickness; /// defines divider color - final dynamic dividerColor; + final Color dividerColor; /// defines pagination shape final ShapeBorder dotShape; diff --git a/lib/components/intro_screen/gf_intro_screen_bottom_navigation_bar.dart b/lib/components/intro_screen/gf_intro_screen_bottom_navigation_bar.dart index 79e0588f..6361c960 100644 --- a/lib/components/intro_screen/gf_intro_screen_bottom_navigation_bar.dart +++ b/lib/components/intro_screen/gf_intro_screen_bottom_navigation_bar.dart @@ -82,7 +82,7 @@ class GFIntroScreenBottomNavigationBar extends StatefulWidget { final EdgeInsets navigationBarMargin; /// defines [GFIntroScreenBottomNavigationBar] color - final dynamic navigationBarColor; + final Color navigationBarColor; /// defines the shape of [GFIntroScreenBottomNavigationBar] final ShapeBorder navigationBarShape; @@ -151,7 +151,7 @@ class GFIntroScreenBottomNavigationBar extends StatefulWidget { final double dividerThickness; /// defines divider color - final dynamic dividerColor; + final Color dividerColor; /// defines pagination shape final ShapeBorder dotShape; @@ -199,6 +199,14 @@ class _GFIntroScreenBottomNavigationBarState super.initState(); } + @override + void dispose() { + if (_pageController != null) { + _pageController.dispose(); + } + super.dispose(); + } + void onForwardButton() { widget.pageController.nextPage( duration: const Duration(milliseconds: 500), curve: Curves.linear); diff --git a/lib/components/list_tile/gf_list_tile.dart b/lib/components/list_tile/gf_list_tile.dart index 0c535fe3..5b08e13e 100644 --- a/lib/components/list_tile/gf_list_tile.dart +++ b/lib/components/list_tile/gf_list_tile.dart @@ -107,7 +107,7 @@ class GFListTile extends StatelessWidget { selected: selected, enabled: enabled, child: Container( -// constraints: const BoxConstraints(minHeight: 50), + // constraints: const BoxConstraints(minHeight: 50), padding: padding, margin: margin, decoration: BoxDecoration( diff --git a/lib/components/loader/gf_loader.dart b/lib/components/loader/gf_loader.dart index 769e6426..c47ba463 100644 --- a/lib/components/loader/gf_loader.dart +++ b/lib/components/loader/gf_loader.dart @@ -3,6 +3,7 @@ import 'package:flutter/material.dart'; import 'package:getwidget/getwidget.dart'; class GFLoader extends StatefulWidget { + /// [GFLoader] shows differnt type of loaders with different customization options. const GFLoader( {Key key, this.loaderColorOne = Colors.redAccent, @@ -66,51 +67,25 @@ class _GFLoaderState extends State Animation loaderanimation2; Animation loaderanimation3; AnimationController controller; + Interval interval = const Interval(0.1, 0.81, curve: Curves.linear); @override void initState() { - super.initState(); - controller = AnimationController(duration: widget.duration, vsync: this); - loaderanimation1 = Tween(begin: 0, end: 1).animate( - CurvedAnimation( - parent: controller, - curve: const Interval( - 0, - 0.71, - curve: Curves.linear, - ), - ), + CurvedAnimation(parent: controller, curve: interval), ); - loaderanimation2 = Tween(begin: 0, end: 1).animate( - CurvedAnimation( - parent: controller, - curve: const Interval( - 0.1, - 0.81, - curve: Curves.linear, - ), - ), + CurvedAnimation(parent: controller, curve: interval), ); - loaderanimation3 = Tween(begin: 0, end: 1).animate( - CurvedAnimation( - parent: controller, - curve: const Interval( - 0.2, - 0.91, - curve: Curves.linear, - ), - ), + CurvedAnimation(parent: controller, curve: interval), ); - controller.addListener(() { setState(() {}); }); - controller.repeat(); + super.initState(); } @override @@ -129,7 +104,7 @@ class _GFLoaderState extends State child: CircularProgressIndicator( valueColor: widget.androidLoaderColor, strokeWidth: widget.loaderstrokeWidth, -// value: 20, + // value: 20, ), )) : widget.type == GFLoaderType.ios @@ -172,7 +147,6 @@ class _GFLoaderState extends State color: widget.loaderColorTwo, type: widget.type, icon: widget.loaderIconTwo, -// ), ), ), @@ -190,7 +164,6 @@ class _GFLoaderState extends State color: widget.loaderColorThree, type: widget.type, icon: widget.loaderIconThree, -// ), ), ), @@ -200,7 +173,9 @@ class _GFLoaderState extends State @override void dispose() { - controller.dispose(); + if (controller != null) { + controller.dispose(); + } super.dispose(); } } @@ -215,7 +190,6 @@ class Loader extends StatelessWidget { this.size, this.child}) : super(key: key); - final double radius; final Color color; final GFLoaderType type; @@ -225,15 +199,16 @@ class Loader extends StatelessWidget { @override Widget build(BuildContext context) => Center( - child: type == GFLoaderType.custom - ? Container(child: child != null ? child : icon ?? Container()) - : Container( - width: radius, - height: radius, - decoration: BoxDecoration( - color: color, - shape: type == GFLoaderType.circle - ? BoxShape.circle - : BoxShape.rectangle), - )); + child: type == GFLoaderType.custom + ? Container(child: child != null ? child : icon ?? Container()) + : Container( + width: radius, + height: radius, + decoration: BoxDecoration( + color: color, + shape: type == GFLoaderType.circle + ? BoxShape.circle + : BoxShape.rectangle), + ), + ); } diff --git a/lib/components/progress_bar/gf_progress_bar.dart b/lib/components/progress_bar/gf_progress_bar.dart index dc6e55ad..3b2c09fd 100644 --- a/lib/components/progress_bar/gf_progress_bar.dart +++ b/lib/components/progress_bar/gf_progress_bar.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:getwidget/getwidget.dart'; class GFProgressBar extends StatefulWidget { + /// Shows progress as a completed and remaining percentage in bar of given state GFProgressBar({ Key key, this.percentage = 0.2, @@ -33,7 +34,6 @@ class GFProgressBar extends StatefulWidget { throw ArgumentError( ' linearGradient and progressBarColor cannot be given'); } - assert(circleStartAngle >= 0.0); if (percentage < 0.0 || percentage > 1.0) { throw Exception('Percentage value must be be tween 0.0 and 1.0'); @@ -276,7 +276,6 @@ class _GFProgressBarState extends State if (widget.trailing != null) { item.add(widget.trailing); } - return widget.type == GFProgressType.linear ? Material( color: Colors.transparent, @@ -334,7 +333,6 @@ class LinearPainter extends CustomPainter { _paintBackground.strokeCap = StrokeCap.round; } } - final Paint _paintBackground = Paint(); final Paint _paintLine = Paint(); final double circleWidth; @@ -353,11 +351,9 @@ class LinearPainter extends CustomPainter { final start = Offset(0, size.height / 2); final end = Offset(size.width, size.height / 2); canvas.drawLine(start, end, _paintBackground); - if (mask != null) { _paintLine.maskFilter = mask; } - if (fromRightToLeft) { final xProgress = size.width - size.width * progress; if (linearGradient != null) { @@ -416,7 +412,6 @@ class CirclePainter extends CustomPainter { _paintBackground.color = backgroundColor; _paintBackground.style = PaintingStyle.stroke; _paintBackground.strokeWidth = circleWidth; - _paintLine.color = progressBarColor; _paintLine.style = PaintingStyle.stroke; _paintLine.strokeWidth = circleWidth; @@ -444,7 +439,6 @@ class CirclePainter extends CustomPainter { void paint(Canvas canvas, Size size) { final child = Offset(size.width / 2, size.height / 2); canvas.drawCircle(child, radius, _paintBackground); - if (mask != null) { _paintLine.maskFilter = mask; } @@ -456,11 +450,8 @@ class CirclePainter extends CustomPainter { ), ); } - final double fixedStartAngle = circleStartAngle; - const double circleStartAngleFixedMargin = 1; - if (reverse) { final start = radians(360 * circleStartAngleFixedMargin - 90.0 + fixedStartAngle); diff --git a/lib/components/radio/gf_radio.dart b/lib/components/radio/gf_radio.dart index 5573c48d..6bd558d5 100644 --- a/lib/components/radio/gf_radio.dart +++ b/lib/components/radio/gf_radio.dart @@ -5,6 +5,7 @@ import 'package:flutter/rendering.dart'; import 'package:flutter/widgets.dart'; class GFRadio extends StatefulWidget { + /// [GFRadio] is one type of selection indicator in a list of options. const GFRadio( {Key key, @required this.value, @@ -22,11 +23,7 @@ class GFRadio extends StatefulWidget { size: 20, color: GFColors.DARK, ), - this.inactiveIcon = const Icon( - Icons.close, - size: 20, - color: GFColors.DARK, - ), + this.inactiveIcon, this.custombgColor = GFColors.SUCCESS, this.autofocus = false, this.focusNode, @@ -95,7 +92,6 @@ class _GFRadioState extends State> with TickerProviderStateMixin { T groupValue; void onStatusChange() { - print('wer ${widget.value == widget.groupValue}'); groupValue = widget.value; _handleChanged(widget.value == groupValue); } @@ -112,10 +108,7 @@ class _GFRadioState extends State> with TickerProviderStateMixin { @override Widget build(BuildContext context) { -// print('gr ${widget.value} ${widget.groupValue}'); selected = widget.value == widget.groupValue; -// print('sel $selected'); - return InkWell( enableFeedback: enabled, onTap: onStatusChange, diff --git a/lib/components/radio_list_tile/gf_radio_list_tile.dart b/lib/components/radio_list_tile/gf_radio_list_tile.dart index c6464d78..f4f09fb8 100644 --- a/lib/components/radio_list_tile/gf_radio_list_tile.dart +++ b/lib/components/radio_list_tile/gf_radio_list_tile.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:getwidget/getwidget.dart'; class GFRadioListTile extends StatelessWidget { + /// [GFRadioListTile] is a list title of with [GFRadio] in it. const GFRadioListTile({ Key key, @required this.value, @@ -14,16 +15,13 @@ class GFRadioListTile extends StatelessWidget { this.inactivebgColor = GFColors.WHITE, this.activeBorderColor = GFColors.DARK, this.inactiveBorderColor = GFColors.DARK, + this.position = GFPosition.end, this.activeIcon = const Icon( Icons.check, size: 20, color: GFColors.DARK, ), - this.inactiveIcon = const Icon( - Icons.close, - size: 20, - color: GFColors.DARK, - ), + this.inactiveIcon, this.custombgColor = GFColors.SUCCESS, this.autofocus = false, this.focusNode, @@ -59,7 +57,7 @@ class GFRadioListTile extends StatelessWidget { /// The GFListTile's background color. Can be given [Color] or [GFColors] final Color color; - /// type of [Widget] or [GFAvatar] used to create rounded user profile + /// If position is start Checkbox will come instead of avatar, type of [Widget] or [GFAvatar] used to create rounded user profile final Widget avatar; /// The title to display inside the [GFListTile]. see [Text] @@ -71,7 +69,7 @@ class GFRadioListTile extends StatelessWidget { /// The description to display inside the [GFListTile]. see [Text] final Widget description; - /// The icon to display inside the [GFListTile]. see [Icon] + /// If position is end Checkbox will come instead of icon, The icon to display inside the [GFListTile]. see [Icon] final Widget icon; /// defines the margin of GFListTile @@ -92,6 +90,9 @@ class GFRadioListTile extends StatelessWidget { /// Inoperative if [enabled] is false. final GestureTapCallback onTap; + /// Position allows user to set position of [GFCheckbox] based on given [GFPosition] + final GFPosition position; + /// Called when the user long-presses on this list tile. /// /// Inoperative if [enabled] is false. @@ -152,8 +153,7 @@ class GFRadioListTile extends StatelessWidget { /// The value represented by this radio button. final T value; - /// The currently selected value for a group of radio buttons. Radio button is considered selected if its [value] matches the - /// [groupValue]. + /// The currently selected value for a group of radio buttons. Radio button is considered selected if its [value] matches the [groupValue]. final T groupValue; /// sets the radio value @@ -163,45 +163,51 @@ class GFRadioListTile extends StatelessWidget { bool get checked => value == groupValue; @override - Widget build(BuildContext context) => MergeSemantics( - child: GFListTile( - autofocus: autofocus, - enabled: onChanged != null, - onTap: onChanged != null - ? () { - if (toggleable && checked) { - onChanged(null); - return; - } - if (!checked) { - onChanged(value); - } + Widget build(BuildContext context) { + final GFRadio radio = GFRadio( + onChanged: onChanged, + value: value, + groupValue: groupValue, + size: size, + type: type, + radioColor: radioColor, + activebgColor: activebgColor, + inactiveIcon: inactiveIcon, + activeBorderColor: activeBorderColor, + inactivebgColor: inactivebgColor, + activeIcon: activeIcon, + inactiveBorderColor: inactiveBorderColor, + custombgColor: custombgColor, + toggleable: toggleable, + ); + return MergeSemantics( + child: GFListTile( + autofocus: autofocus, + enabled: onChanged != null, + focusNode: focusNode, + onTap: onChanged != null + ? () { + if (toggleable && checked) { + onChanged(null); + return; + } + if (!checked) { + onChanged(value); } - : null, - selected: selected, - avatar: avatar, - titleText: titleText, - subTitle: subTitle, - subtitleText: subtitleText, - description: description, - color: color, - padding: padding, - margin: margin, - title: title, - icon: GFRadio( - autofocus: autofocus, - onChanged: onChanged, - value: value, - groupValue: groupValue, - size: size, - activebgColor: activebgColor, - inactiveIcon: inactiveIcon, - activeBorderColor: activeBorderColor, - inactivebgColor: inactivebgColor, - activeIcon: activeIcon, - inactiveBorderColor: inactiveBorderColor, - custombgColor: custombgColor, - ), - ), - ); + } + : null, + selected: selected, + avatar: position == GFPosition.start ? radio : avatar, + titleText: titleText, + subTitle: subTitle, + subtitleText: subtitleText, + description: description, + color: color, + padding: padding, + margin: margin, + title: title, + icon: position == GFPosition.end ? radio : icon, + ), + ); + } } diff --git a/lib/components/rating/gf_rating.dart b/lib/components/rating/gf_rating.dart index d6de70cb..48f68962 100644 --- a/lib/components/rating/gf_rating.dart +++ b/lib/components/rating/gf_rating.dart @@ -4,6 +4,7 @@ import 'package:getwidget/getwidget.dart'; typedef RatingChangeCallback = void Function(double rating); class GFRating extends StatefulWidget { + /// [GFRating] to show ratings with many custimazation options. const GFRating({ this.itemCount = 5, this.spacing = 0.0, diff --git a/lib/components/shimmer/gf_shimmer.dart b/lib/components/shimmer/gf_shimmer.dart index 40acda88..8fb31cb5 100644 --- a/lib/components/shimmer/gf_shimmer.dart +++ b/lib/components/shimmer/gf_shimmer.dart @@ -3,6 +3,7 @@ import 'package:flutter/rendering.dart'; import 'package:getwidget/getwidget.dart'; class GFShimmer extends StatefulWidget { + /// [GFShimmer] shows shimmer effect. const GFShimmer({ Key key, @required this.child, @@ -45,12 +46,12 @@ class GFShimmer extends StatefulWidget { /// Defines the main color of the [child]'s shimmer effect. /// Child [Widget] takes main color, only if [showGradient] is false. /// Default [showGradient] will be false. - final dynamic mainColor; + final Color mainColor; /// defines the secondary color of the [child]'s shimmer effect. /// Child [Widget] takes secondary color, only if [showGradient] is false. /// Default [showGradient] will be false. - final dynamic secondaryColor; + final Color secondaryColor; @override _GFShimmerState createState() => _GFShimmerState(); @@ -125,7 +126,9 @@ class _GFShimmerState extends State @override void dispose() { - _controller.dispose(); + if (_controller != null) { + _controller.dispose(); + } super.dispose(); } } diff --git a/lib/components/sticky_header/gf_sticky_header.dart b/lib/components/sticky_header/gf_sticky_header.dart index a18e2008..e0bbb6ad 100644 --- a/lib/components/sticky_header/gf_sticky_header.dart +++ b/lib/components/sticky_header/gf_sticky_header.dart @@ -2,12 +2,10 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter/widgets.dart'; -import 'package:meta/meta.dart'; import 'package:getwidget/getwidget.dart'; -/// Place this widget inside a [ListView], [GridView], [CustomScrollView], [SingleChildScrollView] or similar. - class GFStickyHeader extends MultiChildRenderObjectWidget { + /// Place this widget inside a [ListView], [GridView], [CustomScrollView], [SingleChildScrollView] or similar. GFStickyHeader( {Key key, @required this.stickyContent, diff --git a/lib/components/sticky_header/gf_sticky_header_builder.dart b/lib/components/sticky_header/gf_sticky_header_builder.dart index 22c337cd..4ac3992d 100644 --- a/lib/components/sticky_header/gf_sticky_header_builder.dart +++ b/lib/components/sticky_header/gf_sticky_header_builder.dart @@ -2,11 +2,12 @@ import 'package:flutter/material.dart'; import 'package:getwidget/getwidget.dart'; typedef StickyHeaderWidgetBuilder = Widget Function( - BuildContext context, double stuckValue); - -/// Place this widget inside a [ListView], [GridView], [CustomScrollView], [SingleChildScrollView] or similar. + BuildContext context, + double stuckValue, +); class GFStickyHeaderBuilder extends StatefulWidget { + /// Place this widget inside a [ListView], [GridView], [CustomScrollView], [SingleChildScrollView] or similar. /// Constructs a new [GFStickyHeaderBuilder] widget. const GFStickyHeaderBuilder({ Key key, diff --git a/lib/components/sticky_header/render_gf_sticky_header.dart b/lib/components/sticky_header/render_gf_sticky_header.dart index 24d3d0d9..58b890ec 100644 --- a/lib/components/sticky_header/render_gf_sticky_header.dart +++ b/lib/components/sticky_header/render_gf_sticky_header.dart @@ -132,10 +132,8 @@ class RenderGFStickyHeader extends RenderBox assert(childCount == 2); _stickyContentBody.layout(constraints.loosen(), parentUsesSize: true); _contentBody.layout(constraints.loosen(), parentUsesSize: true); - final stickyContentBodyHeight = _stickyContentBody.size.height; final contentBodyHeight = _contentBody.size.height; - final height = max( constraints.minHeight, _enableHeaderOverlap @@ -145,20 +143,15 @@ class RenderGFStickyHeader extends RenderBox size = Size( constraints.constrainWidth(width), constraints.constrainHeight(height)); - final double stickyContentBodyOffset = getHeaderTileStuckOffset(); - assert(constraints != null); double crossSize = 0; double allottedSize = 0; RenderBox child = firstChild; - // ignore: unused_local_variable - int totalChildren = 0; while (child != null) { // ignore: avoid_as final FlexParentData childParentData = child.parentData as FlexParentData; - totalChildren++; final int flex = _getFlex(child); if (flex > 0) { } else { diff --git a/lib/components/tabs/gf_segment_tabs.dart b/lib/components/tabs/gf_segment_tabs.dart index 1f57d51b..e5adde9b 100644 --- a/lib/components/tabs/gf_segment_tabs.dart +++ b/lib/components/tabs/gf_segment_tabs.dart @@ -11,8 +11,8 @@ class GFSegmentTabs extends StatefulWidget { /// [GFSegmentTabs] are best used as an alternative for [GFTabBar]. const GFSegmentTabs( {Key key, -// this.initialIndex = 0, @required this.length, + // this.initialIndex = 0, this.height, this.width, this.border, @@ -31,13 +31,13 @@ class GFSegmentTabs extends StatefulWidget { this.tabs, this.tabController}) : assert(length != null && length >= 0), -// assert(initialIndex != null && -// initialIndex >= 0 && -// (length == 0 || initialIndex < length)), + // assert(initialIndex != null && + // initialIndex >= 0 && + // (length == 0 || initialIndex < length)), super(key: key); -// /// The initial index of the selected tab. Defaults to zero. -// final int initialIndex; + // /// The initial index of the selected tab. Defaults to zero. + // final int initialIndex; /// The total number of tabs. Typically greater than one. Must match [TabBar.tabs]'s and /// [TabBarView.children]'s length. @@ -178,7 +178,7 @@ class _GFSegmentTabsState extends State { borderRadius: widget.borderRadius ?? BorderRadius.circular(2), ), child: DefaultTabController( -// initialIndex: widget.initialIndex, + // initialIndex: widget.initialIndex, length: widget.length, child: Material( borderRadius: widget.borderRadius ?? BorderRadius.circular(2), diff --git a/lib/components/tabs/gf_tabbar.dart b/lib/components/tabs/gf_tabbar.dart index 24b22655..1e856bd0 100644 --- a/lib/components/tabs/gf_tabbar.dart +++ b/lib/components/tabs/gf_tabbar.dart @@ -9,15 +9,13 @@ import 'package:flutter/foundation.dart'; /// /// Typically created as the [AppBar.bottom] part of an [AppBar] and in /// conjunction with a [TabBarView]. - class GFTabBar extends StatefulWidget { /// Creates a material design tab bar. - /// /// The [tabs] argument must not be null and its length must match the [controller]'s /// [TabController.length]. const GFTabBar({ Key key, -// this.initialIndex = 0, + // this.initialIndex = 0, @required this.length, this.isScrollable = false, this.tabBarHeight, @@ -37,13 +35,13 @@ class GFTabBar extends StatefulWidget { this.shape, }) : assert(length != null && length >= 0), assert(isScrollable != null), -// assert(initialIndex != null && -// initialIndex >= 0 && -// (length == 0 || initialIndex < length)), + // assert(initialIndex != null && + // initialIndex >= 0 && + // (length == 0 || initialIndex < length)), super(key: key); -// /// The initial index of the selected tab. Defaults to zero. -// final int initialIndex; + // /// The initial index of the selected tab. Defaults to zero. + // final int initialIndex; /// The total number of tabs. Typically greater than one. Must match [TabBar.tabs]'s and /// [TabBarView.children]'s length. diff --git a/lib/components/tabs/gf_tabbar_view.dart b/lib/components/tabs/gf_tabbar_view.dart index b09ae692..a4e6959c 100644 --- a/lib/components/tabs/gf_tabbar_view.dart +++ b/lib/components/tabs/gf_tabbar_view.dart @@ -5,14 +5,10 @@ import 'package:flutter/widgets.dart'; import 'package:flutter/gestures.dart' show DragStartBehavior; import 'package:getwidget/getwidget.dart'; -/// A page view that displays the widget which corresponds to the currently -/// selected tab. -/// +/// A page view that displays the widget which corresponds to the currently selected tab. /// This widget is typically used in conjunction with a [GFTabBar] or [GFSegmentTabs]. -/// class GFTabBarView extends StatefulWidget { /// Creates a page view with one child per tab. - /// /// The length of [children] must be the same as the [controller]'s length. const GFTabBarView({ Key key, @@ -29,19 +25,15 @@ class GFTabBarView extends StatefulWidget { final TabController controller; /// One widget per tab. - /// /// Its length must match the length of the [GFTabBar.tabs] /// list, as well as the [controller]'s [TabController.length]. final List children; /// How the page view should respond to user input. - /// /// For example, determines how the page view continues to animate after the /// user stops dragging the page view. - /// /// The physics are modified to snap to page boundaries using /// [PageScrollPhysics] prior to being used. - /// /// Defaults to matching platform conventions. final ScrollPhysics physics; @@ -84,7 +76,6 @@ class _GFTabBarViewState extends State { } return true; }()); - if (newController == _controller) { return; } @@ -141,7 +132,6 @@ class _GFTabBarViewState extends State { if (_warpUnderwayCount > 0 || !_controller.indexIsChanging) { return; } // This widget is driving the controller's animation. - if (_controller.index != _currentIndex) { _currentIndex = _controller.index; _warpToCurrentIndex(); diff --git a/lib/components/text_field/gf_text_field.dart b/lib/components/text_field/gf_text_field.dart index df2876ad..3a99a4fe 100644 --- a/lib/components/text_field/gf_text_field.dart +++ b/lib/components/text_field/gf_text_field.dart @@ -1,247 +1,244 @@ - - -import 'package:flutter/services.dart'; -import 'package:flutter/widgets.dart'; -import 'package:flutter/material.dart'; - - -export 'package:flutter/services.dart' show SmartQuotesType, SmartDashesType; - -class GFTextField extends FormField { - GFTextField({ - Key key, - this.controller, - String initialValue, - FocusNode focusNode, - InputDecoration decoration = const InputDecoration(), - TextInputType keyboardType, - TextCapitalization textCapitalization = TextCapitalization.none, - TextInputAction textInputAction, - TextStyle style, - StrutStyle strutStyle, - TextDirection textDirection, - TextAlign textAlign = TextAlign.start, - TextAlignVertical textAlignVertical, - bool autofocus = false, - bool readOnly = false, - ToolbarOptions toolbarOptions, - bool showCursor, - String obscuringCharacter = '•', - bool obscureText = false, - bool autocorrect = true, - SmartDashesType smartDashesType, - SmartQuotesType smartQuotesType, - bool enableSuggestions = true, - bool autovalidate = false, - bool maxLengthEnforced = true, - int maxLines = 1, - int minLines, - bool expands = false, - int maxLength, - ValueChanged onChanged, - GestureTapCallback onTap, - VoidCallback onEditingComplete, - ValueChanged onFieldSubmitted, - FormFieldSetter onSaved, - FormFieldValidator validator, - List inputFormatters, - bool enabled, - double cursorWidth = 2.0, - double cursorHeight, - Radius cursorRadius, - Color cursorColor, - Color color, - Radius borderradius, - Brightness keyboardAppearance, - EdgeInsets scrollPadding = const EdgeInsets.all(20.0), - bool enableInteractiveSelection = true, - InputCounterWidgetBuilder buildCounter, - ScrollPhysics scrollPhysics, - Iterable autofillHints, - AutovalidateMode autovalidateMode, - }) : assert(initialValue == null || controller == null), - assert(textAlign != null), - assert(autofocus != null), - assert(readOnly != null), - assert(obscuringCharacter != null && obscuringCharacter.length == 1), - assert(obscureText != null), - assert(autocorrect != null), - assert(enableSuggestions != null), - assert(autovalidate != null), - assert( - autovalidate == false || - autovalidate == true && autovalidateMode == null, - 'autovalidate and autovalidateMode should not be used together.'), - assert(maxLengthEnforced != null), - assert(scrollPadding != null), - assert(maxLines == null || maxLines > 0), - assert(minLines == null || minLines > 0), - assert( - (maxLines == null) || (minLines == null) || (maxLines >= minLines), - "minLines can't be greater than maxLines", - ), - assert(expands != null), - assert( - !expands || (maxLines == null && minLines == null), - 'minLines and maxLines must be null when expands is true.', - ), - assert(!obscureText || maxLines == 1, - 'Obscured fields cannot be multiline.'), - assert(maxLength == null || maxLength > 0), - assert(enableInteractiveSelection != null), - super( - key: key, - initialValue: - controller != null ? controller.text : (initialValue ?? ''), - onSaved: onSaved, - validator: validator, - enabled: enabled ?? decoration?.enabled ?? true, - autovalidateMode: autovalidate - ? AutovalidateMode.always - : (autovalidateMode ?? AutovalidateMode.disabled), - builder: (FormFieldState field) { - final _GFTextFieldState state = field as _GFTextFieldState; - final InputDecoration effectiveDecoration = (decoration ?? - const InputDecoration()) - .applyDefaults(Theme.of(field.context).inputDecorationTheme); - void onChangedHandler(String value) { - if (onChanged != null) { - onChanged(value); - } - field.didChange(value); - } - - return Container( - decoration: BoxDecoration(border: Border.all(color: color)), - child: TextField( - controller: state._effectiveController, - focusNode: focusNode, - decoration: - effectiveDecoration.copyWith(errorText: field.errorText) != - null - ? decoration - : color, - keyboardType: keyboardType, - textInputAction: textInputAction, - style: style, - strutStyle: strutStyle, - textAlign: textAlign, - textAlignVertical: textAlignVertical, - textDirection: textDirection, - textCapitalization: textCapitalization, - autofocus: autofocus, - toolbarOptions: toolbarOptions, - readOnly: readOnly, - showCursor: showCursor, - obscuringCharacter: obscuringCharacter, - obscureText: obscureText, - autocorrect: autocorrect, - smartDashesType: smartDashesType ?? - (obscureText - ? SmartDashesType.disabled - : SmartDashesType.enabled), - smartQuotesType: smartQuotesType ?? - (obscureText - ? SmartQuotesType.disabled - : SmartQuotesType.enabled), - enableSuggestions: enableSuggestions, - maxLengthEnforced: maxLengthEnforced, - maxLines: maxLines, - minLines: minLines, - expands: expands, - maxLength: maxLength, - onChanged: onChangedHandler, - onTap: onTap, - onEditingComplete: onEditingComplete, - onSubmitted: onFieldSubmitted, - inputFormatters: inputFormatters, - enabled: enabled ?? decoration?.enabled ?? true, - cursorWidth: cursorWidth, - cursorHeight: cursorHeight, - cursorRadius: cursorRadius, - cursorColor: cursorColor, - scrollPadding: scrollPadding, - scrollPhysics: scrollPhysics, - keyboardAppearance: keyboardAppearance, - enableInteractiveSelection: enableInteractiveSelection, - buildCounter: buildCounter, - autofillHints: autofillHints, - ), - ); - }, - ); - final TextEditingController controller; - - @override - _GFTextFieldState createState() => _GFTextFieldState(); -} - -class _GFTextFieldState extends FormFieldState { - TextEditingController _controller; - - TextEditingController get _effectiveController => - widget.controller ?? _controller; - - @override - GFTextField get widget => super.widget as GFTextField; - - @override - void initState() { - super.initState(); - if (widget.controller == null) { - _controller = TextEditingController(text: widget.initialValue); - } else { - widget.controller.addListener(_handleControllerChanged); - } - } - - @override - void didUpdateWidget(GFTextField oldWidget) { - super.didUpdateWidget(oldWidget); - if (widget.controller != oldWidget.controller) { - oldWidget.controller?.removeListener(_handleControllerChanged); - widget.controller?.addListener(_handleControllerChanged); - - if (oldWidget.controller != null && widget.controller == null) - _controller = - TextEditingController.fromValue(oldWidget.controller.value); - if (widget.controller != null) { - setValue(widget.controller.text); - if (oldWidget.controller == null) _controller = null; - } - } - } - - @override - void dispose() { - widget.controller?.removeListener(_handleControllerChanged); - super.dispose(); - } - - @override - void didChange(String value) { - super.didChange(value); - - if (_effectiveController.text != value) _effectiveController.text = value; - } - - @override - void reset() { - super.reset(); - setState(() { - _effectiveController.text = widget.initialValue; - }); - } - - void _handleControllerChanged() { - // Suppress changes that originated from within this class. - // - // In the case where a controller has been passed in to this widget, we - // register this change listener. In these cases, we'll also receive change - // notifications for changes originating from within this class -- for - // example, the reset() method. In such cases, the FormField value will - // already have been set. - if (_effectiveController.text != value) - didChange(_effectiveController.text); - } -} +// import 'package:flutter/services.dart'; +// import 'package:flutter/widgets.dart'; +// import 'package:flutter/material.dart'; + +// export 'package:flutter/services.dart' show SmartQuotesType, SmartDashesType; + +// class GFTextField extends FormField { +// GFTextField({ +// Key key, +// this.controller, +// String initialValue, +// FocusNode focusNode, +// InputDecoration decoration = const InputDecoration(), +// TextInputType keyboardType, +// TextCapitalization textCapitalization = TextCapitalization.none, +// TextInputAction textInputAction, +// TextStyle style, +// StrutStyle strutStyle, +// TextDirection textDirection, +// TextAlign textAlign = TextAlign.start, +// TextAlignVertical textAlignVertical, +// bool autofocus = false, +// bool readOnly = false, +// ToolbarOptions toolbarOptions, +// bool showCursor, +// String obscuringCharacter = '•', +// bool obscureText = false, +// bool autocorrect = true, +// SmartDashesType smartDashesType, +// SmartQuotesType smartQuotesType, +// bool enableSuggestions = true, +// bool autovalidate = false, +// bool maxLengthEnforced = true, +// int maxLines = 1, +// int minLines, +// bool expands = false, +// int maxLength, +// ValueChanged onChanged, +// GestureTapCallback onTap, +// VoidCallback onEditingComplete, +// ValueChanged onFieldSubmitted, +// FormFieldSetter onSaved, +// FormFieldValidator validator, +// List inputFormatters, +// bool enabled, +// double cursorWidth = 2.0, +// double cursorHeight, +// Radius cursorRadius, +// Color cursorColor, +// Color color, +// Radius borderradius, +// Brightness keyboardAppearance, +// EdgeInsets scrollPadding = const EdgeInsets.all(20.0), +// bool enableInteractiveSelection = true, +// InputCounterWidgetBuilder buildCounter, +// ScrollPhysics scrollPhysics, +// Iterable autofillHints, +// AutovalidateMode autovalidateMode, +// }) : assert(initialValue == null || controller == null), +// assert(textAlign != null), +// assert(autofocus != null), +// assert(readOnly != null), +// assert(obscuringCharacter != null && obscuringCharacter.length == 1), +// assert(obscureText != null), +// assert(autocorrect != null), +// assert(enableSuggestions != null), +// assert(autovalidate != null), +// assert( +// autovalidate == false || +// autovalidate == true && autovalidateMode == null, +// 'autovalidate and autovalidateMode should not be used together.'), +// assert(maxLengthEnforced != null), +// assert(scrollPadding != null), +// assert(maxLines == null || maxLines > 0), +// assert(minLines == null || minLines > 0), +// assert( +// (maxLines == null) || (minLines == null) || (maxLines >= minLines), +// "minLines can't be greater than maxLines", +// ), +// assert(expands != null), +// assert( +// !expands || (maxLines == null && minLines == null), +// 'minLines and maxLines must be null when expands is true.', +// ), +// assert(!obscureText || maxLines == 1, +// 'Obscured fields cannot be multiline.'), +// assert(maxLength == null || maxLength > 0), +// assert(enableInteractiveSelection != null), +// super( +// key: key, +// initialValue: +// controller != null ? controller.text : (initialValue ?? ''), +// onSaved: onSaved, +// validator: validator, +// enabled: enabled ?? decoration?.enabled ?? true, +// autovalidateMode: autovalidate +// ? AutovalidateMode.always +// : (autovalidateMode ?? AutovalidateMode.disabled), +// builder: (FormFieldState field) { +// final _GFTextFieldState state = field as _GFTextFieldState; +// final InputDecoration effectiveDecoration = (decoration ?? +// const InputDecoration()) +// .applyDefaults(Theme.of(field.context).inputDecorationTheme); +// void onChangedHandler(String value) { +// if (onChanged != null) { +// onChanged(value); +// } +// field.didChange(value); +// } + +// return Container( +// decoration: BoxDecoration(border: Border.all(color: color)), +// child: TextField( +// controller: state._effectiveController, +// focusNode: focusNode, +// decoration: +// effectiveDecoration.copyWith(errorText: field.errorText) != +// null +// ? decoration +// : color, +// keyboardType: keyboardType, +// textInputAction: textInputAction, +// style: style, +// strutStyle: strutStyle, +// textAlign: textAlign, +// textAlignVertical: textAlignVertical, +// textDirection: textDirection, +// textCapitalization: textCapitalization, +// autofocus: autofocus, +// toolbarOptions: toolbarOptions, +// readOnly: readOnly, +// showCursor: showCursor, +// obscuringCharacter: obscuringCharacter, +// obscureText: obscureText, +// autocorrect: autocorrect, +// smartDashesType: smartDashesType ?? +// (obscureText +// ? SmartDashesType.disabled +// : SmartDashesType.enabled), +// smartQuotesType: smartQuotesType ?? +// (obscureText +// ? SmartQuotesType.disabled +// : SmartQuotesType.enabled), +// enableSuggestions: enableSuggestions, +// maxLengthEnforced: maxLengthEnforced, +// maxLines: maxLines, +// minLines: minLines, +// expands: expands, +// maxLength: maxLength, +// onChanged: onChangedHandler, +// onTap: onTap, +// onEditingComplete: onEditingComplete, +// onSubmitted: onFieldSubmitted, +// inputFormatters: inputFormatters, +// enabled: enabled ?? decoration?.enabled ?? true, +// cursorWidth: cursorWidth, +// cursorHeight: cursorHeight, +// cursorRadius: cursorRadius, +// cursorColor: cursorColor, +// scrollPadding: scrollPadding, +// scrollPhysics: scrollPhysics, +// keyboardAppearance: keyboardAppearance, +// enableInteractiveSelection: enableInteractiveSelection, +// buildCounter: buildCounter, +// autofillHints: autofillHints, +// ), +// ); +// }, +// ); +// final TextEditingController controller; + +// @override +// _GFTextFieldState createState() => _GFTextFieldState(); +// } + +// class _GFTextFieldState extends FormFieldState { +// TextEditingController _controller; + +// TextEditingController get _effectiveController => +// widget.controller ?? _controller; + +// @override +// GFTextField get widget => super.widget as GFTextField; + +// @override +// void initState() { +// super.initState(); +// if (widget.controller == null) { +// _controller = TextEditingController(text: widget.initialValue); +// } else { +// widget.controller.addListener(_handleControllerChanged); +// } +// } + +// @override +// void didUpdateWidget(GFTextField oldWidget) { +// super.didUpdateWidget(oldWidget); +// if (widget.controller != oldWidget.controller) { +// oldWidget.controller?.removeListener(_handleControllerChanged); +// widget.controller?.addListener(_handleControllerChanged); + +// if (oldWidget.controller != null && widget.controller == null) +// _controller = +// TextEditingController.fromValue(oldWidget.controller.value); +// if (widget.controller != null) { +// setValue(widget.controller.text); +// if (oldWidget.controller == null) _controller = null; +// } +// } +// } + +// @override +// void dispose() { +// widget.controller?.removeListener(_handleControllerChanged); +// super.dispose(); +// } + +// @override +// void didChange(String value) { +// super.didChange(value); + +// if (_effectiveController.text != value) _effectiveController.text = value; +// } + +// @override +// void reset() { +// super.reset(); +// setState(() { +// _effectiveController.text = widget.initialValue; +// }); +// } + +// void _handleControllerChanged() { +// // Suppress changes that originated from within this class. +// // +// // In the case where a controller has been passed in to this widget, we +// // register this change listener. In these cases, we'll also receive change +// // notifications for changes originating from within this class -- for +// // example, the reset() method. In such cases, the FormField value will +// // already have been set. +// if (_effectiveController.text != value) +// didChange(_effectiveController.text); +// } +// } diff --git a/lib/components/toast/gf_toast.dart b/lib/components/toast/gf_toast.dart index cb53d23e..94a3db0c 100644 --- a/lib/components/toast/gf_toast.dart +++ b/lib/components/toast/gf_toast.dart @@ -110,7 +110,6 @@ class _GFToastState extends State with TickerProviderStateMixin { void dispose() { animationController.dispose(); fadeanimationController.dispose(); - super.dispose(); } @@ -171,5 +170,6 @@ class _GFToastState extends State with TickerProviderStateMixin { ), ), ], - )); + ), + ); } diff --git a/lib/getwidget.dart b/lib/getwidget.dart index 23926ca7..bd0a7242 100644 --- a/lib/getwidget.dart +++ b/lib/getwidget.dart @@ -22,6 +22,8 @@ export 'package:getwidget/components/checkbox/gf_checkbox.dart'; export 'package:getwidget/components/checkbox_list_tile/gf_checkbox_list_tile.dart'; export 'package:getwidget/components/drawer/gf_drawer.dart'; export 'package:getwidget/components/drawer/gf_drawer_header.dart'; +// export 'package:getwidget/components/dropdown/gf_dropdown.dart'; +// export 'package:getwidget/components/dropdown/gf_multiselect.dart'; export 'package:getwidget/components/floating_widget/gf_floating_widget.dart'; export 'package:getwidget/components/image/gf_image_overlay.dart'; export 'package:getwidget/components/intro_screen/gf_intro_screen_bottom_navigation_bar.dart'; @@ -45,8 +47,6 @@ export 'package:getwidget/components/tabs/gf_tabs.dart'; export 'package:getwidget/components/toast/gf_toast.dart'; export 'package:getwidget/components/toggle/gf_toggle.dart'; export 'package:getwidget/components/typography/gf_typography.dart'; -export 'package:getwidget/components/dropdown/gf_dropdown.dart'; -export 'package:getwidget/components/dropdown/multilevel.dart'; export 'colors/gf_color.dart'; export 'direction/gf_shimmer_direction.dart'; diff --git a/lib/position/gf_position.dart b/lib/position/gf_position.dart index 43a249ce..c9f0857f 100644 --- a/lib/position/gf_position.dart +++ b/lib/position/gf_position.dart @@ -5,5 +5,5 @@ enum GFPosition { start, /// [GFPosition.end] is used to place icon, badges to end of the GFButton and GFButtonBadge - end + end, } diff --git a/lib/types/gf_alert_type.dart b/lib/types/gf_alert_type.dart index 8c3480ab..391f5ae3 100644 --- a/lib/types/gf_alert_type.dart +++ b/lib/types/gf_alert_type.dart @@ -1 +1,5 @@ -enum GFAlertType { basic, rounded, fullWidth } +enum GFAlertType { + basic, + rounded, + fullWidth, +} diff --git a/lib/types/gf_animation_type.dart b/lib/types/gf_animation_type.dart index 7a97b55e..cb2d0302 100644 --- a/lib/types/gf_animation_type.dart +++ b/lib/types/gf_animation_type.dart @@ -5,5 +5,5 @@ enum GFAnimationType { rotateTransition, scaleTransition, slideTransition, - textStyle + textStyle, } diff --git a/lib/types/gf_border_type.dart b/lib/types/gf_border_type.dart index bea0b2a9..42fb56cc 100644 --- a/lib/types/gf_border_type.dart +++ b/lib/types/gf_border_type.dart @@ -1 +1,6 @@ -enum GFBorderType { Circle, RRect, Rect, Oval } +enum GFBorderType { + circle, + rRect, + rect, + oval, +} diff --git a/lib/types/gf_button_type.dart b/lib/types/gf_button_type.dart index 1e363aa0..12a2f6a2 100644 --- a/lib/types/gf_button_type.dart +++ b/lib/types/gf_button_type.dart @@ -10,5 +10,5 @@ enum GFButtonType { outline2x, /// Type [GFButtonType.transparent], used for widget with fill color with Colors.transparent - transparent + transparent, } diff --git a/lib/types/gf_checkbox_type.dart b/lib/types/gf_checkbox_type.dart index 2f15b89d..39035e0f 100644 --- a/lib/types/gf_checkbox_type.dart +++ b/lib/types/gf_checkbox_type.dart @@ -1 +1,6 @@ -enum GFCheckboxType { basic, circle, square, custom } +enum GFCheckboxType { + basic, + circle, + square, + custom, +} diff --git a/lib/types/gf_radio_type.dart b/lib/types/gf_radio_type.dart index 61fab9b0..e1547b42 100644 --- a/lib/types/gf_radio_type.dart +++ b/lib/types/gf_radio_type.dart @@ -1 +1,6 @@ -enum GFRadioType { basic, square, custom, blunt } +enum GFRadioType { + basic, + square, + custom, + blunt, +} diff --git a/lib/types/gf_toast_type.dart b/lib/types/gf_toast_type.dart index 4dcad3df..7810c207 100644 --- a/lib/types/gf_toast_type.dart +++ b/lib/types/gf_toast_type.dart @@ -1 +1,5 @@ -enum GFToastType { basic, rounded, fullWidth } +enum GFToastType { + basic, + rounded, + fullWidth, +} diff --git a/lib/types/gf_toggle_type.dart b/lib/types/gf_toggle_type.dart index 01eb7d68..866ebb8f 100644 --- a/lib/types/gf_toggle_type.dart +++ b/lib/types/gf_toggle_type.dart @@ -10,5 +10,5 @@ enum GFToggleType { ios, /// [GFToggleType.square] is used for square shape of GFToggle - square + square, } diff --git a/lib/types/gf_typography_type.dart b/lib/types/gf_typography_type.dart index bd48332f..bf479f78 100644 --- a/lib/types/gf_typography_type.dart +++ b/lib/types/gf_typography_type.dart @@ -16,5 +16,5 @@ enum GFTypographyType { typo5, /// [GFTypographyType.typo6] type used for title widget with fontSize = 13.0 - typo6 + typo6, } diff --git a/pubspec.lock b/pubspec.lock index 3485d141..b308ac32 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,49 +7,49 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.5.0-nullsafety" + version: "2.5.0-nullsafety.1" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "2.1.0-nullsafety" + version: "2.1.0-nullsafety.1" characters: dependency: transitive description: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.1.0-nullsafety.2" + version: "1.1.0-nullsafety.3" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.2.0-nullsafety" + version: "1.2.0-nullsafety.1" clock: dependency: transitive description: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.1.0-nullsafety" + version: "1.1.0-nullsafety.1" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.15.0-nullsafety.2" + version: "1.15.0-nullsafety.3" fake_async: dependency: transitive description: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.1.0-nullsafety" + version: "1.2.0-nullsafety.1" flutter: dependency: "direct main" description: flutter @@ -66,21 +66,21 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.10-nullsafety" + version: "0.12.10-nullsafety.1" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.2" + version: "1.3.0-nullsafety.3" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.0-nullsafety" + version: "1.8.0-nullsafety.1" sky_engine: dependency: transitive description: flutter @@ -92,55 +92,55 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.0-nullsafety" + version: "1.8.0-nullsafety.2" stack_trace: dependency: transitive description: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.10.0-nullsafety" + version: "1.10.0-nullsafety.1" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.dartlang.org" source: hosted - version: "2.1.0-nullsafety" + version: "2.1.0-nullsafety.1" string_scanner: dependency: transitive description: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.1.0-nullsafety" + version: "1.1.0-nullsafety.1" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.2.0-nullsafety" + version: "1.2.0-nullsafety.1" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.19-nullsafety" + version: "0.2.19-nullsafety.2" typed_data: dependency: transitive description: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.2" + version: "1.3.0-nullsafety.3" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.0-nullsafety.2" + version: "2.1.0-nullsafety.3" sdks: - dart: ">=2.10.0-0.0.dev <2.10.0" + dart: ">=2.10.0-110 <2.11.0" diff --git a/pubspec.yaml b/pubspec.yaml index 41fbd5a0..43a330e6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: getwidget description: GetWidget is open source libraries that come with pre-build 1000+ UI components. It makes development faster & more enjoyable. You can customize the component as per your need. -version: 1.1.3 +version: 1.2.2 homepage: https://github.com/ionicfirebaseapp/getwidget environment: @@ -15,4 +15,4 @@ dev_dependencies: sdk: flutter flutter: - uses-material-design: true \ No newline at end of file + uses-material-design: true