diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b6ff8dc..76fd3434 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,33 @@ # Changelog +## 1.0.0 - 2020-01-20 + +### Added +* Stable version release +* code refectoring +* this release includes following stable components + - GFAvatar + - GFButton + - GFIconButton + - GFButtonBar + - GFBadge + - GFButtonBadge + - GFIconBadge + - GFCard + - GFCarousel + - GFImageOverlay + - GFListTile + - GFTabs + - GFTypography + + +## 1.0.0-dev.9 - 2020-01-17 + +### Added +* Added library exports for commonly used files. + + ## 1.0.0-dev.8 - 2020-01-16 ### Fixed diff --git a/README.md b/README.md index 487a20d7..37adbfb2 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ +[![pub package](https://img.shields.io/pub/v/getflutter.svg)](https://pub.dartlang.org/packages/getflutter) + +

Get Flutter diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml index 15c1ba65..334d1b95 100644 --- a/example/android/app/src/main/AndroidManifest.xml +++ b/example/android/app/src/main/AndroidManifest.xml @@ -7,7 +7,7 @@ FlutterApplication and put your custom class here. --> + + #19CA4B + \ No newline at end of file diff --git a/example/ios/Runner/Assets.xcassets/Contents.json b/example/ios/Runner/Assets.xcassets/Contents.json new file mode 100644 index 00000000..0bedcf2f --- /dev/null +++ b/example/ios/Runner/Assets.xcassets/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "LaunchImage.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/example/ios/Runner/Assets.xcassets/LaunchImage.png b/example/ios/Runner/Assets.xcassets/LaunchImage.png new file mode 100644 index 00000000..9da19eac Binary files /dev/null and b/example/ios/Runner/Assets.xcassets/LaunchImage.png differ diff --git a/example/ios/Runner/Assets.xcassets/LaunchImage@2x.png b/example/ios/Runner/Assets.xcassets/LaunchImage@2x.png new file mode 100644 index 00000000..9da19eac Binary files /dev/null and b/example/ios/Runner/Assets.xcassets/LaunchImage@2x.png differ diff --git a/example/ios/Runner/Assets.xcassets/LaunchImage@3x.png b/example/ios/Runner/Assets.xcassets/LaunchImage@3x.png new file mode 100644 index 00000000..9da19eac Binary files /dev/null and b/example/ios/Runner/Assets.xcassets/LaunchImage@3x.png differ diff --git a/example/ios/Runner/Assets.xcassets/README.md b/example/ios/Runner/Assets.xcassets/README.md new file mode 100644 index 00000000..89c2725b --- /dev/null +++ b/example/ios/Runner/Assets.xcassets/README.md @@ -0,0 +1,5 @@ +# Launch Screen Assets + +You can customize the launch screen with your own desired assets by replacing the image files in this directory. + +You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. \ No newline at end of file diff --git a/example/ios/Runner/Info.plist b/example/ios/Runner/Info.plist index 2ea12e65..2fcbb3fb 100644 --- a/example/ios/Runner/Info.plist +++ b/example/ios/Runner/Info.plist @@ -11,7 +11,7 @@ CFBundleInfoDictionaryVersion 6.0 CFBundleName - getflutter_example + GetFlutter CFBundlePackageType APPL CFBundleShortVersionString diff --git a/example/lib/main.dart b/example/lib/main.dart index 4cfbcf93..27bac5cb 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -7,7 +7,7 @@ import 'package:getflutter/components/badge/gf_badge.dart'; // import 'package:getflutter/components/list/gf_list.dart'; import 'package:getflutter/components/tabs/gf_segment_tabs.dart'; import 'package:getflutter/size/gf_size.dart'; -import 'package:getflutter/types/gf_type.dart'; +import 'package:getflutter/types/gf_button_type.dart'; import 'package:getflutter/shape/gf_button_shape.dart'; import 'package:getflutter/shape/gf_badge_shape.dart'; import 'package:flutter/cupertino.dart'; @@ -181,7 +181,20 @@ class _MyHomePageState extends State type: GFTypographyType.typo6, ), SizedBox( - height: 10, + height: 20, + ), + GFButtonBar( + children: [ + GFButton(), + GFButton(), + GFButton(), + GFButton(), + GFButton(), + GFButton(), + ], + ), + SizedBox( + height: 20, ), GFToast( text: 'Happy New Year', @@ -190,7 +203,7 @@ class _MyHomePageState extends State print("dfr"); }, text: 'OK', - type: GFType.outline, + type: GFButtonType.outline, color: GFColor.warning, ), ), @@ -216,7 +229,7 @@ class _MyHomePageState extends State print("df"); }, text: 'OK', - type: GFType.outline, + type: GFButtonType.outline, color: GFColor.warning, ), ) @@ -233,7 +246,7 @@ class _MyHomePageState extends State }); }, text: 'Click to View the toast', - type: GFType.outline, + type: GFButtonType.outline, color: GFColor.warning, ), ) @@ -492,7 +505,7 @@ class _MyHomePageState extends State // showDivider: false, // icon: GFIconButton( // onPressed: null, -// type: GFType.transparent, +// type: GFButtonType.transparent, // icon: Icon(Icons.favorite_border), // ), // ), @@ -562,7 +575,7 @@ class _MyHomePageState extends State //// color: GFColor.success, //// textColor: GFColor.dark, //// shape: GFButtonShape.pills, -//// type: GFType.outline2x, +//// type: GFButtonType.outline2x, //// size: GFSize.small, // icon: GFBadge( // child: Text("12"), @@ -588,7 +601,7 @@ class _MyHomePageState extends State ////// textColor: GFColor.white, ////// textStyle: TextStyle(fontWeight: FontWeight.w500, fontSize: 8.0), //// ), -// type: GFType.outline2x, +// type: GFButtonType.outline2x, // shape: GFButtonShape.pills, //// blockButton: true, // fullWidthButton: true, @@ -612,7 +625,7 @@ class _MyHomePageState extends State // hoverColor: GFColor.dark, color: GFColor.secondary, // focusColor: GFColor.danger, - type: GFType.solid, + type: GFButtonType.solid, shape: GFButtonShape.pills, buttonBoxShadow: true, // boxShadow: BoxShadow( @@ -636,7 +649,7 @@ class _MyHomePageState extends State // onPressed: null, // icon: Icon(Icons.ac_unit,), //// iconSize: 12.0, -// type: GFType.solid, +// type: GFButtonType.solid, //// shape: GFButtonShape.pills, //// size: GFSize.large, // buttonBoxShadow: true, @@ -824,7 +837,7 @@ class _MyHomePageState extends State // icon: GFIconButton( // onPressed: null, // icon: Icon(Icons.favorite_border), -// type: GFType.transparent, +// type: GFButtonType.transparent, // ), // ), // content: Text( @@ -839,13 +852,13 @@ class _MyHomePageState extends State //// onPressed: null, //// child: Text("favorite"), //// icon: Icon(Icons.favorite_border), -//// type: GFType.transparent, +//// type: GFButtonType.transparent, //// ), //// GFButton( //// onPressed: null, //// child: Text("share"), //// icon: Icon(Icons.share), -//// type: GFType.outline, +//// type: GFButtonType.outline, //// ), //// ], //// ), @@ -858,7 +871,7 @@ class _MyHomePageState extends State // onPressed: null, // child: Text("like"), // icon: Icon(Icons.favorite_border), -// type: GFType.transparent, +// type: GFButtonType.transparent, // ), // GFButton( // onPressed: null, @@ -869,7 +882,7 @@ class _MyHomePageState extends State // onPressed: (){}, // child: Text("share"), // icon: Icon(Icons.share), -// type: GFType.outline, +// type: GFButtonType.outline, // ), // ], // ), @@ -883,7 +896,7 @@ class _MyHomePageState extends State // subTitle: Text('subtitle'), // icon: GFIconButton( // onPressed: null, -// type: GFType.transparent, +// type: GFButtonType.transparent, // icon: Icon(Icons.favorite_border), // ), // ), @@ -1021,7 +1034,7 @@ class _MyHomePageState extends State // onPressed: (){}, // icon: Icon(Icons.ac_unit), //// iconSize: 12.0, -//// type: GFType.solid, +//// type: GFButtonType.solid, //// shape: GFIconButtonShape.pills, //// size: GFSize.large, //// buttonBoxShadow: true, @@ -1047,7 +1060,7 @@ class _MyHomePageState extends State // ), // // GFButton( -// type: GFType.outline, +// type: GFButtonType.outline, // shape: GFButtonShape.pills, // text: 'goodies', // icon: Icon(Icons.share), diff --git a/example/pubspec.lock b/example/pubspec.lock index cbece1ef..c583984a 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -80,7 +80,7 @@ packages: path: ".." relative: true source: path - version: "1.0.0-dev.8" + version: "1.0.0" image: dependency: transitive description: diff --git a/example/pubspec.yaml b/example/pubspec.yaml index c4708b13..d940393a 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -1,5 +1,5 @@ name: example -description: A new Flutter project. +description: GetFlutter Demo app version: 1.0.0+1 diff --git a/lib/colors/gf_color.dart b/lib/colors/gf_color.dart index ba9d651c..8b77a3f1 100644 --- a/lib/colors/gf_color.dart +++ b/lib/colors/gf_color.dart @@ -15,64 +15,66 @@ enum GFColor { transparent } -const PRIMARY = Color(0xff3880FF); -const SECONDARY = Color(0xffAA66CC); -const SUCCESS = Color(0xff10DC60); -const INFO = Color(0xff33B5E5); -const WARNING = Color(0xffFFBB33); -const DANGER = Color(0xffF04141); -const LIGHT = Color(0xffE0E0E0); -const DARK = Color(0xff222428); -const WHITE = Color(0xffffffff); -const FOCUS = Color(0xff434054); -const ALT = Color(0xff794c8a); -const TRANSPARENT = Colors.transparent; +class GFColors { + static const Color PRIMARY = Color(0xff3880FF); + static const Color SECONDARY = Color(0xffAA66CC); + static const Color SUCCESS = Color(0xff10DC60); + static const Color INFO = Color(0xff33B5E5); + static const Color WARNING = Color(0xffFFBB33); + static const Color DANGER = Color(0xffF04141); + static const Color LIGHT = Color(0xffE0E0E0); + static const Color DARK = Color(0xff222428); + static const Color WHITE = Color(0xffffffff); + static const Color FOCUS = Color(0xff434054); + static const Color ALT = Color(0xff794c8a); + static const Color TRANSPARENT = Colors.transparent; -/// Pass [GFColor] or [Color] -Color getGFColor(dynamic color) { - if (color is Color) { - return color; - } else { - switch (color) { - case GFColor.primary: - return PRIMARY; - break; - case GFColor.secondary: - return SECONDARY; - break; - case GFColor.success: - return SUCCESS; - break; - case GFColor.warning: - return WARNING; - break; - case GFColor.info: - return INFO; - break; - case GFColor.danger: - return DANGER; - break; - case GFColor.focus: - return FOCUS; - break; - case GFColor.alt: - return ALT; - break; - case GFColor.light: - return LIGHT; - break; - case GFColor.dark: - return DARK; - break; - case GFColor.white: - return WHITE; - break; - case GFColor.transparent: - return TRANSPARENT; - break; - default: - return null; - break; + /// Pass [GFColor] or [Color] + static Color getGFColor(dynamic color) { + if (color is Color) { + return color; + } else { + switch (color) { + case GFColor.primary: + return PRIMARY; + break; + case GFColor.secondary: + return SECONDARY; + break; + case GFColor.success: + return SUCCESS; + break; + case GFColor.warning: + return WARNING; + break; + case GFColor.info: + return INFO; + break; + case GFColor.danger: + return DANGER; + break; + case GFColor.focus: + return FOCUS; + break; + case GFColor.alt: + return ALT; + break; + case GFColor.light: + return LIGHT; + break; + case GFColor.dark: + return DARK; + break; + case GFColor.white: + return WHITE; + break; + case GFColor.transparent: + return TRANSPARENT; + break; + default: + return null; + break; + } } } } diff --git a/lib/components/avatar/gf_avatar.dart b/lib/components/avatar/gf_avatar.dart index 1b969e3d..9a9c0bec 100644 --- a/lib/components/avatar/gf_avatar.dart +++ b/lib/components/avatar/gf_avatar.dart @@ -28,7 +28,7 @@ class GFAvatar extends StatelessWidget { /// The maximum size of the avatar, expressed as the radius (half the diameter). final double maxRadius; - /// size of avatar like [GFSize] i.e, 1.2, small, medium, large etc. + /// size of avatar. use [GFSize] or [double] i.e, 1.2, small, medium, large etc. final dynamic size; /// shape of avatar [GFAvatarShape] i.e, standard, circle, square @@ -59,7 +59,7 @@ class GFAvatar extends StatelessWidget { double get _minDiameter { if (radius == null && minRadius == null && maxRadius == null) { - return 1.5 * getGFSize(size); + return 1.5 * GFSizesClass.getGFSize(size); } else { return 2.0 * (radius ?? minRadius ?? 0); } @@ -67,7 +67,7 @@ class GFAvatar extends StatelessWidget { double get _maxDiameter { if (radius == null && minRadius == null && maxRadius == null) { - return 1.5 * getGFSize(size); + return 1.5 * GFSizesClass.getGFSize(size); } else { return 2.0 * (radius ?? maxRadius ?? 0); } @@ -87,8 +87,8 @@ class GFAvatar extends StatelessWidget { @override Widget build(BuildContext context) { - Color backgroundColor = getGFColor(this.backgroundColor); - Color foregroundColor = getGFColor(this.foregroundColor); + Color backgroundColor = GFColors.getGFColor(this.backgroundColor); + Color foregroundColor = GFColors.getGFColor(this.foregroundColor); assert(debugCheckHasMediaQuery(context)); final ThemeData theme = Theme.of(context); TextStyle textStyle = diff --git a/lib/components/badge/gf_badge.dart b/lib/components/badge/gf_badge.dart index 3802d2e9..1c27b5b6 100644 --- a/lib/components/badge/gf_badge.dart +++ b/lib/components/badge/gf_badge.dart @@ -2,9 +2,6 @@ import 'package:flutter/material.dart'; import 'package:getflutter/shape/gf_badge_shape.dart'; import 'package:getflutter/size/gf_size.dart'; import 'package:getflutter/colors/gf_color.dart'; -export 'package:getflutter/shape/gf_badge_shape.dart'; -export 'package:getflutter/size/gf_size.dart'; -export 'package:getflutter/colors/gf_color.dart'; class GFBadge extends StatefulWidget { /// The border side for the badge's [Material]. @@ -20,7 +17,7 @@ class GFBadge extends StatefulWidget { final dynamic color; /// size of [double] or [GFSize] i.e, 1.2, small, medium, large etc. - final GFSize size; + final dynamic size; /// child of type [Widget] is alternative to child. text will get priority over child final Widget child; @@ -58,18 +55,18 @@ class _GFBadgeState extends State { Color textColor; Widget child; GFBadgeShape counterShape; - GFSize size; + double size; double height; double width; double fontSize; @override void initState() { - this.color = getGFColor(widget.color); - this.textColor = getGFColor(widget.textColor); + this.color = GFColors.getGFColor(widget.color); + this.textColor = GFColors.getGFColor(widget.textColor); this.child = widget.text != null ? Text(widget.text ?? '') : widget.child; this.counterShape = widget.shape; - this.size = widget.size; + this.size = GFSizesClass.getGFSize(widget.size); super.initState(); } @@ -101,23 +98,22 @@ class _GFBadgeState extends State { borderRadius: BorderRadius.circular(5.0), side: shapeBorder); } - if (this.size == GFSize.small) { - this.height = getGFSize(this.size) * 0.56; - this.width = getGFSize(this.size) * 0.75; - this.fontSize = getGFSize(this.size) * 0.31; - } else if (this.size == GFSize.medium) { - this.height = getGFSize(this.size) * 0.5; - this.width = getGFSize(this.size) * 0.65; - this.fontSize = getGFSize(this.size) * 0.3; - this.fontSize = 12.0; - } else if (this.size == GFSize.large) { - this.height = getGFSize(this.size) * 0.428; - this.width = getGFSize(this.size) * 0.535; - this.fontSize = getGFSize(this.size) * 0.214; + if (widget.size == GFSize.small) { + this.height = this.size * 0.56; + this.width = this.size * 0.73; + this.fontSize = this.size * 0.31; + } else if (widget.size == GFSize.medium) { + this.height = this.size * 0.58; + this.width = this.size * 0.76; + this.fontSize = this.size * 0.34; + } else if (widget.size == GFSize.large) { + this.height = this.size * 0.6; + this.width = this.size * 0.79; + this.fontSize = this.size * 0.37; } else { - this.height = getGFSize(this.size) * 0.56; - this.width = getGFSize(this.size) * 0.75; - this.fontSize = getGFSize(this.size) * 0.31; + this.height = this.size * 0.58; + this.width = this.size * 0.76; + this.fontSize = this.size * 0.34; } return Container( diff --git a/lib/components/badge/gf_button_badge.dart b/lib/components/badge/gf_button_badge.dart index 49de906f..107cb5e6 100644 --- a/lib/components/badge/gf_button_badge.dart +++ b/lib/components/badge/gf_button_badge.dart @@ -5,14 +5,9 @@ import 'package:flutter/material.dart'; import 'package:getflutter/components/button/gf_button.dart'; import 'package:getflutter/shape/gf_button_shape.dart'; import 'package:getflutter/size/gf_size.dart'; -import 'package:getflutter/types/gf_type.dart'; +import 'package:getflutter/types/gf_button_type.dart'; import 'package:getflutter/position/gf_position.dart'; import 'package:getflutter/colors/gf_color.dart'; -export 'package:getflutter/position/gf_position.dart'; -export 'package:getflutter/shape/gf_button_shape.dart'; -export 'package:getflutter/size/gf_size.dart'; -export 'package:getflutter/types/gf_type.dart'; -export 'package:getflutter/colors/gf_color.dart'; class GFButtonBadge extends GFButton { /// Called when the button is tapped or otherwise activated. @@ -84,8 +79,8 @@ class GFButtonBadge extends GFButton { /// {@macro flutter.widgets.Clip} final Clip clipBehavior; - /// Button type of [GFType] i.e, solid, outline, outline2x, transparent - final GFType type; + /// Button type of [GFButtonType] i.e, solid, outline, outline2x, transparent + final GFButtonType type; /// Button type of [GFButtonBadgeShape] i.e, standard, pills, square, shadow, icons final GFButtonShape shape; @@ -128,7 +123,7 @@ class GFButtonBadge extends GFButton { /// text of type [String] is alternative to child. text will get priority over child final String text; - /// icon type of [GFIconPosition] i.e, start, end + /// icon type of [GFPosition] i.e, start, end final GFPosition position; /// on true state blockButton gives block size badge @@ -199,7 +194,7 @@ class GFButtonBadge extends GFButton { this.focusNode, this.autofocus = false, MaterialTapTargetSize materialTapTargetSize, - this.type = GFType.solid, + this.type = GFButtonType.solid, this.shape = GFButtonShape.standard, this.color = GFColor.primary, this.textColor, @@ -232,7 +227,7 @@ class GFButtonBadge extends GFButton { return ConstrainedBox( constraints: BoxConstraints(minHeight: 26.0, minWidth: 98.0), child: Container( - height: getGFSize(size), + height: GFSizesClass.getGFSize(size), child: GFButton( onPressed: onPressed, onHighlightChanged: onHighlightChanged, @@ -260,7 +255,7 @@ class GFButtonBadge extends GFButton { color: color, textColor: textColor, position: position, - size: getGFSize(size), + size: GFSizesClass.getGFSize(size), borderSide: borderSide, text: text, icon: icon, diff --git a/lib/components/badge/gf_icon_badge.dart b/lib/components/badge/gf_icon_badge.dart index a7575555..96640b4a 100644 --- a/lib/components/badge/gf_icon_badge.dart +++ b/lib/components/badge/gf_icon_badge.dart @@ -2,8 +2,8 @@ import 'package:flutter/material.dart'; import 'package:getflutter/components/button/gf_icon_button.dart'; class GFIconBadge extends StatefulWidget { - /// child of type [GFIconButton] is used to show icon. - /// Use [Icon] widget for compatibility. + /// child of type [Widget] is used to show icon. + /// Use [GFIconButton] widget for compatibility. final Widget child; /// widget of type [Widget] is used to show counter to the top right corner of child. @@ -27,16 +27,11 @@ class GFIconBadge extends StatefulWidget { } class _GFIconBadgeState extends State { - @override - void initState() { - super.initState(); - } + double size; @override Widget build(BuildContext context) { return Container( - height: 60.0, - width: 60.0, padding: widget.padding, child: Stack( children: [ diff --git a/lib/components/button/gf_button.dart b/lib/components/button/gf_button.dart index d96f9e25..399e0e12 100644 --- a/lib/components/button/gf_button.dart +++ b/lib/components/button/gf_button.dart @@ -6,14 +6,9 @@ import 'package:flutter/widgets.dart'; import 'package:flutter/material.dart'; import 'package:getflutter/shape/gf_button_shape.dart'; import 'package:getflutter/size/gf_size.dart'; -import 'package:getflutter/types/gf_type.dart'; +import 'package:getflutter/types/gf_button_type.dart'; import 'package:getflutter/position/gf_position.dart'; import 'package:getflutter/colors/gf_color.dart'; -export 'package:getflutter/position/gf_position.dart'; -export 'package:getflutter/shape/gf_button_shape.dart'; -export 'package:getflutter/size/gf_size.dart'; -export 'package:getflutter/types/gf_type.dart'; -export 'package:getflutter/colors/gf_color.dart'; class GFButton extends StatefulWidget { /// Called when the button is tapped or otherwise activated. @@ -88,8 +83,8 @@ class GFButton extends StatefulWidget { /// {@macro flutter.widgets.Clip} final Clip clipBehavior; - /// Button type of [GFType] i.e, solid, outline, outline2x, transparent - final GFType type; + /// 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; @@ -135,7 +130,7 @@ class GFButton extends StatefulWidget { /// icon of type [Widget] final Widget icon; - /// icon type of [GFIconPosition] i.e, start, end + /// icon type of [GFPosition] i.e, start, end final GFPosition position; /// on true state blockButton gives block size button @@ -204,7 +199,7 @@ class GFButton extends StatefulWidget { this.autofocus = false, MaterialTapTargetSize materialTapTargetSize, this.child, - this.type = GFType.solid, + this.type = GFButtonType.solid, this.shape = GFButtonShape.standard, this.color = GFColor.primary, this.textColor, @@ -246,7 +241,7 @@ class _GFButtonState extends State { Widget child; Widget icon; Function onPressed; - GFType type; + GFButtonType type; GFButtonShape shape; double size; GFPosition position; @@ -256,17 +251,17 @@ class _GFButtonState extends State { @override void initState() { - this.color = getGFColor(widget.color); - this.textColor = getGFColor(widget.textColor); + this.color = GFColors.getGFColor(widget.color); + this.textColor = GFColors.getGFColor(widget.textColor); this.child = widget.text != null ? Text(widget.text) : widget.child; this.icon = widget.icon; this.onPressed = widget.onPressed; this.type = widget.type; this.shape = widget.shape; - this.size = getGFSize(widget.size); + this.size = GFSizesClass.getGFSize(widget.size); this.position = widget.position; - this.disabledColor = getGFColor(widget.disabledColor); - this.disabledTextColor = getGFColor(widget.disabledTextColor); + this.disabledColor = GFColors.getGFColor(widget.disabledColor); + this.disabledTextColor = GFColors.getGFColor(widget.disabledTextColor); _updateState(MaterialState.disabled, !widget.enabled); super.initState(); @@ -355,8 +350,9 @@ class _GFButtonState extends State { Color getBorderColor() { if (widget.enabled) { - final Color fillColor = - this.color == null ? getGFColor(GFColor.primary) : this.color; + final Color fillColor = this.color == null + ? GFColors.getGFColor(GFColor.primary) + : this.color; if (fillColor != null) return fillColor; } else { if (this.disabledColor != null) @@ -365,13 +361,15 @@ class _GFButtonState extends State { return this.color.withOpacity(0.48); } } - return this.color == null ? getGFColor(GFColor.primary) : this.color; + return this.color == null + ? GFColors.getGFColor(GFColor.primary) + : this.color; } Color getDisabledFillColor() { - if (widget.type == GFType.transparent || - widget.type == GFType.outline || - widget.type == GFType.outline2x) return Colors.transparent; + if (widget.type == GFButtonType.transparent || + widget.type == GFButtonType.outline || + widget.type == GFButtonType.outline2x) return Colors.transparent; if (this.disabledColor != null) return this.disabledColor; else { @@ -380,43 +378,44 @@ class _GFButtonState extends State { } Color getColor() { - if (widget.type == GFType.transparent || - widget.type == GFType.outline || - widget.type == GFType.outline2x) return Colors.transparent; - final Color fillColor = - this.color == null ? getGFColor(GFColor.primary) : this.color; + if (widget.type == GFButtonType.transparent || + widget.type == GFButtonType.outline || + widget.type == GFButtonType.outline2x) return Colors.transparent; + final Color fillColor = this.color == null + ? GFColors.getGFColor(GFColor.primary) + : this.color; return fillColor; } Color getDisabledTextColor() { if (this.disabledTextColor != null) return this.disabledTextColor; - else if (widget.type == GFType.outline || - widget.type == GFType.outline2x || - widget.type == GFType.transparent) { + else if (widget.type == GFButtonType.outline || + widget.type == GFButtonType.outline2x || + widget.type == GFButtonType.transparent) { return this.color; } else { - return getGFColor(GFColor.dark); + return GFColors.getGFColor(GFColor.dark); } } Color getTextColor() { - if (widget.type == GFType.outline || - widget.type == GFType.outline2x || - widget.type == GFType.transparent) { + if (widget.type == GFButtonType.outline || + widget.type == GFButtonType.outline2x || + widget.type == GFButtonType.transparent) { return widget.enabled ? this.textColor == null - ? this.color == getGFColor(GFColor.transparent) - ? getGFColor(GFColor.dark) + ? this.color == GFColors.getGFColor(GFColor.transparent) + ? GFColors.getGFColor(GFColor.dark) : this.color : this.textColor : getDisabledTextColor(); } if (this.textColor == null) { - if (this.color == getGFColor(GFColor.transparent)) { - return getGFColor(GFColor.dark); + if (this.color == GFColors.getGFColor(GFColor.transparent)) { + return GFColors.getGFColor(GFColor.dark); } else { - return getGFColor(GFColor.white); + return GFColors.getGFColor(GFColor.white); } } else { return this.textColor; @@ -434,7 +433,7 @@ class _GFButtonState extends State { ? getBorderColor() : widget.borderSide.color, width: widget.borderSide?.width == null - ? widget.type == GFType.outline2x ? 2.0 : 1.0 + ? widget.type == GFButtonType.outline2x ? 2.0 : 1.0 : widget.borderSide?.width, ); @@ -451,15 +450,15 @@ class _GFButtonState extends State { break; } - final BorderSide shapeBorder = - widget.type == GFType.outline || widget.type == GFType.outline2x - ? outlineBorder - : widget.borderSide != null - ? widget.borderSide - : BorderSide( - color: this.color == null ? themeColor : getBorderColor(), - width: 0.0, - ); + final BorderSide shapeBorder = widget.type == GFButtonType.outline || + widget.type == GFButtonType.outline2x + ? outlineBorder + : widget.borderSide != null + ? widget.borderSide + : BorderSide( + color: this.color == null ? themeColor : getBorderColor(), + width: 0.0, + ); if (this.shape == GFButtonShape.pills) { shape = RoundedRectangleBorder( @@ -476,14 +475,14 @@ class _GFButtonState extends State { } BoxDecoration getBoxShadow() { - if (widget.type != GFType.transparent) { + if (widget.type != GFButtonType.transparent) { if (widget.boxShadow == null && widget.buttonBoxShadow != true) { return null; } else { return BoxDecoration( - color: widget.type == GFType.transparent || - widget.type == GFType.outline || - widget.type == GFType.outline2x + color: widget.type == GFButtonType.transparent || + widget.type == GFButtonType.outline || + widget.type == GFButtonType.outline2x ? Colors.transparent : this.color, borderRadius: widget.shape == GFButtonShape.pills @@ -539,11 +538,11 @@ class _GFButtonState extends State { constraints: this.icon == null ? BoxConstraints(minWidth: 80.0) : BoxConstraints(minWidth: 90.0), - decoration: widget.type == GFType.solid ? getBoxShadow() : null, + decoration: widget.type == GFButtonType.solid ? getBoxShadow() : null, child: Material( elevation: _effectiveElevation, textStyle: widget.textStyle == null ? getTextStyle() : widget.textStyle, - shape: widget.type == GFType.transparent + shape: widget.type == GFButtonType.transparent ? null : widget.borderShape == null ? shape : widget.borderShape, color: widget.enabled ? getColor() : getDisabledFillColor(), @@ -562,11 +561,11 @@ class _GFButtonState extends State { onTap: widget.onPressed, onLongPress: widget.onLongPress, enableFeedback: widget.enableFeedback, - splashColor: getGFColor(widget.splashColor), - highlightColor: getGFColor(widget.highlightColor), - focusColor: getGFColor(widget.focusColor), - hoverColor: getGFColor(widget.hoverColor), - customBorder: widget.type == GFType.transparent + splashColor: GFColors.getGFColor(widget.splashColor), + highlightColor: GFColors.getGFColor(widget.highlightColor), + focusColor: GFColors.getGFColor(widget.focusColor), + hoverColor: GFColors.getGFColor(widget.hoverColor), + customBorder: widget.type == GFButtonType.transparent ? null : widget.borderShape == null ? shape : widget.borderShape, child: IconTheme.merge( diff --git a/lib/components/button/gf_icon_button.dart b/lib/components/button/gf_icon_button.dart index 559f0e30..ef8b2fab 100644 --- a/lib/components/button/gf_icon_button.dart +++ b/lib/components/button/gf_icon_button.dart @@ -4,12 +4,8 @@ import 'package:flutter/widgets.dart'; import 'package:flutter/material.dart'; import 'package:getflutter/shape/gf_icon_button_shape.dart'; import 'package:getflutter/size/gf_size.dart'; -import 'package:getflutter/types/gf_type.dart'; +import 'package:getflutter/types/gf_button_type.dart'; import 'package:getflutter/colors/gf_color.dart'; -export 'package:getflutter/shape/gf_icon_button_shape.dart'; -export 'package:getflutter/size/gf_size.dart'; -export 'package:getflutter/types/gf_type.dart'; -export 'package:getflutter/colors/gf_color.dart'; class GFIconButton extends StatefulWidget { /// The size of the icon inside the button. @@ -30,8 +26,8 @@ class GFIconButton extends StatefulWidget { /// The color for the button's icon when a pointer is hovering over it. final Color hoverColor; - /// Button type of [GFType] i.e, solid, outline, outline2x transparent - final GFType type; + /// Button type of [GFButtonType] i.e, solid, outline, outline2x transparent + final GFButtonType type; /// Button type of [GFIconButtonShape] i.e, standard, pills, square, shadow, icons final GFIconButtonShape shape; @@ -91,7 +87,7 @@ class GFIconButton extends StatefulWidget { this.focusNode, this.autofocus = false, this.tooltip, - this.type = GFType.solid, + this.type = GFButtonType.solid, this.shape = GFIconButtonShape.standard, this.color = GFColor.primary, this.borderShape, @@ -113,7 +109,7 @@ class GFIconButton extends StatefulWidget { class _GFIconButtonState extends State { Color color; Function onPressed; - GFType type; + GFButtonType type; GFIconButtonShape shape; BoxShadow boxShadow; double height; @@ -122,49 +118,67 @@ class _GFIconButtonState extends State { @override void initState() { - this.color = getGFColor(widget.color); + this.color = GFColors.getGFColor(widget.color); this.onPressed = widget.onPressed; this.type = widget.type; this.shape = widget.shape; super.initState(); } - @override - Widget build(BuildContext context) { - assert(debugCheckHasMaterial(context)); - - Color getBorderColor() { - if (widget.onPressed != null) { - return this.color; - } else { - if (widget.disabledColor != null) - return widget.disabledColor; - else { - return this.color.withOpacity(0.48); - } - } - } - - Color getDisabledFillColor() { - if (widget.type == GFType.transparent || - widget.type == GFType.outline || - widget.type == GFType.outline2x) return Colors.transparent; + Color getBorderColor() { + if (widget.onPressed != null) { + return this.color; + } else { if (widget.disabledColor != null) return widget.disabledColor; else { return this.color.withOpacity(0.48); } } + } - Color getColor() { - if (widget.type == GFType.transparent || - widget.type == GFType.outline || - widget.type == GFType.outline2x) - return Colors.transparent; - else { - return this.color; - } + Color getDisabledFillColor() { + if (widget.type == GFButtonType.transparent || + widget.type == GFButtonType.outline || + widget.type == GFButtonType.outline2x) return Colors.transparent; + if (widget.disabledColor != null) + return widget.disabledColor; + else { + return this.color.withOpacity(0.48); + } + } + + Color getColor() { + if (widget.type == GFButtonType.transparent || + widget.type == GFButtonType.outline || + widget.type == GFButtonType.outline2x) + return Colors.transparent; + else { + return this.color; } + } + + Color getIconColor() { + if (widget.type == GFButtonType.transparent || + widget.type == GFButtonType.outline || + widget.type == GFButtonType.outline2x) + return widget.onPressed != null + ? this.color == GFColors.getGFColor(GFColor.transparent) + ? GFColors.getGFColor(GFColor.dark) + : this.color + : this.color.withOpacity(0.48); + else if (this.color == GFColors.getGFColor(GFColor.transparent)) { + return widget.onPressed != null + ? GFColors.getGFColor(GFColor.dark) + : GFColors.getGFColor(GFColor.white); + } else { + return GFColors.getGFColor(GFColor.white); + } + } + + @override + Widget build(BuildContext context) { + assert(debugCheckHasMaterial(context)); final Color themeColor = Theme.of(context).colorScheme.onSurface.withOpacity(0.12); @@ -173,19 +187,19 @@ class _GFIconButtonState extends State { ? getBorderColor() : widget.borderSide.color, width: widget.borderSide?.width == null - ? widget.type == GFType.outline2x ? 2.0 : 1.0 + ? widget.type == GFButtonType.outline2x ? 2.0 : 1.0 : widget.borderSide?.width, ); - final BorderSide shapeBorder = - widget.type == GFType.outline || widget.type == GFType.outline2x - ? outlineBorder - : widget.borderSide != null - ? widget.borderSide - : BorderSide( - color: this.color, - width: 0.0, - ); + final BorderSide shapeBorder = widget.type == GFButtonType.outline || + widget.type == GFButtonType.outline2x + ? outlineBorder + : widget.borderSide != null + ? widget.borderSide + : BorderSide( + color: this.color, + width: 0.0, + ); ShapeBorder shape; @@ -212,32 +226,19 @@ class _GFIconButtonState extends State { this.width = 35.0; this.iconPixel = 18.0; } else if (widget.size == GFSize.large) { + print('her'); this.height = 40.0; this.width = 40.0; this.iconPixel = 18.0; - } - - getIconColor() { - if (widget.type == GFType.transparent || - widget.type == GFType.outline || - widget.type == GFType.outline2x) - return widget.onPressed != null - ? this.color == getGFColor(GFColor.transparent) - ? getGFColor(GFColor.dark) - : this.color - : this.color.withOpacity(0.48); - else if (this.color == getGFColor(GFColor.transparent)) { - return widget.onPressed != null - ? getGFColor(GFColor.dark) - : getGFColor(GFColor.white); - } else { - return getGFColor(GFColor.white); - } + } else { + this.height = 35.0; + this.width = 35.0; + this.iconPixel = 18.0; } Widget result = Container( height: widget.shape == GFIconButtonShape.circle - ? this.height + 6 + ? this.height + 6.0 : this.height, width: widget.shape == GFIconButtonShape.pills ? this.width + 10 @@ -262,7 +263,7 @@ class _GFIconButtonState extends State { } BoxDecoration getBoxShadow() { - if (widget.type != GFType.transparent) { + if (widget.type != GFButtonType.transparent) { if (widget.boxShadow == null && widget.buttonBoxShadow != true) { return null; } else { @@ -316,31 +317,32 @@ class _GFIconButtonState extends State { : widget.shape == GFIconButtonShape.circle ? this.height + 6 : this.width, - decoration: widget.type == GFType.solid ? getBoxShadow() : null, + decoration: + widget.type == GFButtonType.solid ? getBoxShadow() : null, child: Material( - shape: widget.type == GFType.transparent + shape: widget.type == GFButtonType.transparent ? null : widget.borderShape == null ? shape : widget.borderShape, color: widget.onPressed != null ? getColor() : getDisabledFillColor(), - type: widget.type == GFType.transparent + type: widget.type == GFButtonType.transparent ? MaterialType.transparency : MaterialType.button, child: InkResponse( onTap: widget.onPressed, child: result, focusColor: widget.focusColor != null - ? getGFColor(widget.focusColor) + ? GFColors.getGFColor(widget.focusColor) : Theme.of(context).focusColor, hoverColor: widget.hoverColor != null - ? getGFColor(widget.hoverColor) + ? GFColors.getGFColor(widget.hoverColor) : Theme.of(context).hoverColor, highlightColor: widget.highlightColor != null - ? getGFColor(widget.highlightColor) + ? GFColors.getGFColor(widget.highlightColor) : Theme.of(context).highlightColor, splashColor: widget.splashColor != null - ? getGFColor(widget.splashColor) + ? GFColors.getGFColor(widget.splashColor) : Theme.of(context).splashColor, radius: math.max( Material.defaultSplashRadius, diff --git a/lib/components/button/gf_social_button.dart b/lib/components/button/gf_social_button.dart index 80c00461..bef48e38 100644 --- a/lib/components/button/gf_social_button.dart +++ b/lib/components/button/gf_social_button.dart @@ -5,14 +5,9 @@ import 'package:flutter/material.dart'; import 'package:getflutter/components/button/gf_button.dart'; import 'package:getflutter/shape/gf_button_shape.dart'; import 'package:getflutter/size/gf_size.dart'; -import 'package:getflutter/types/gf_type.dart'; +import 'package:getflutter/types/gf_button_type.dart'; import 'package:getflutter/position/gf_position.dart'; import 'package:getflutter/colors/gf_color.dart'; -export 'package:getflutter/position/gf_position.dart'; -export 'package:getflutter/shape/gf_button_shape.dart'; -export 'package:getflutter/size/gf_size.dart'; -export 'package:getflutter/types/gf_type.dart'; -export 'package:getflutter/colors/gf_color.dart'; class GFSocialButton extends GFButton { /// Called when the button is tapped or otherwise activated. @@ -87,8 +82,8 @@ class GFSocialButton extends GFButton { /// {@macro flutter.widgets.Clip} final Clip clipBehavior; - /// Button type of [GFType] i.e, solid, outline, outline2x, transparent - final GFType type; + /// Button type of [GFButtonType] i.e, solid, outline, outline2x, transparent + final GFButtonType type; /// Button type of [GFSocialButtonShape] i.e, standard, pills, square, shadow, icons final GFButtonShape shape; @@ -134,7 +129,7 @@ class GFSocialButton extends GFButton { /// icon of type [Widget] final Widget icon; - /// icon type of [GFIconPosition] i.e, start, end + /// icon type of [GFPosition] i.e, start, end final GFPosition position; /// on true state blockButton gives block size button @@ -203,7 +198,7 @@ class GFSocialButton extends GFButton { this.autofocus = false, MaterialTapTargetSize materialTapTargetSize, this.child, - this.type = GFType.solid, + this.type = GFButtonType.solid, this.shape = GFButtonShape.standard, this.color = GFColor.primary, this.textColor, @@ -255,7 +250,7 @@ class GFSocialButton extends GFButton { focusNode: focusNode, autofocus: autofocus, child: child, - type: GFType.solid, + type: GFButtonType.solid, shape: GFButtonShape.standard, color: GFColor.primary, textColor: textColor, diff --git a/lib/components/card/gf_card.dart b/lib/components/card/gf_card.dart index b4a2fb75..3957bd07 100644 --- a/lib/components/card/gf_card.dart +++ b/lib/components/card/gf_card.dart @@ -4,7 +4,6 @@ import 'package:getflutter/components/button/gf_button_bar.dart'; import 'package:getflutter/components/list_tile/gf_list_tile.dart'; import 'package:getflutter/components/image/gf_image_overlay.dart'; import 'package:getflutter/position/gf_position.dart'; -export 'package:getflutter/position/gf_position.dart'; /// A material design card. A card has slightly rounded corners and a shadow. /// diff --git a/lib/components/list_tile/gf_list_tile.dart b/lib/components/list_tile/gf_list_tile.dart index 19258c96..9e41fd2e 100644 --- a/lib/components/list_tile/gf_list_tile.dart +++ b/lib/components/list_tile/gf_list_tile.dart @@ -10,7 +10,7 @@ class GFListTile extends StatelessWidget { ///type of [String] used to pass text, alternative to subtitle property and gets higher priority than subtitle final String subtitleText; - /// The GFListTile's background color. Can be given [Colors] or [GFColor] + /// The GFListTile's background color. Can be given [Color] or [GFColor] final dynamic color; /// type of [Widget] or [GFAvatar] used to create rounded user profile @@ -69,7 +69,7 @@ class GFListTile extends StatelessWidget { style: TextStyle( fontSize: 17, fontWeight: FontWeight.w500, - color: getGFColor(GFColor.dark)), + color: GFColors.getGFColor(GFColor.dark)), ) : title ?? Container(), subtitleText != null diff --git a/lib/components/tabs/gf_segment_tabs.dart b/lib/components/tabs/gf_segment_tabs.dart index cd33898d..2b798bf0 100644 --- a/lib/components/tabs/gf_segment_tabs.dart +++ b/lib/components/tabs/gf_segment_tabs.dart @@ -175,7 +175,8 @@ class _GFSegmentTabsState extends State { width: widget.width == null ? 240.0 : widget.width, decoration: BoxDecoration( border: widget.border == null - ? Border.all(color: getGFColor(GFColor.primary), width: 1.0) + ? Border.all( + color: GFColors.getGFColor(GFColor.primary), width: 1.0) : widget.border, borderRadius: widget.borderRadius == null ? BorderRadius.circular(2.0) @@ -192,20 +193,20 @@ class _GFSegmentTabsState extends State { color: widget.tabBarColor ?? Colors.transparent, child: TabBar( controller: widget.tabController, - labelColor: widget.labelColor ?? getGFColor(GFColor.white), - unselectedLabelColor: - widget.unselectedLabelColor ?? getGFColor(GFColor.primary), + labelColor: widget.labelColor ?? GFColors.getGFColor(GFColor.white), + unselectedLabelColor: widget.unselectedLabelColor ?? + GFColors.getGFColor(GFColor.primary), labelStyle: widget.labelStyle ?? TextStyle(fontSize: 12.0), unselectedLabelStyle: widget.unselectedLabelStyle ?? TextStyle(fontSize: 12.0), indicatorColor: widget.indicatorColor == null - ? getGFColor(GFColor.primary) + ? GFColors.getGFColor(GFColor.primary) : widget.indicatorColor, indicatorSize: widget.indicatorSize, indicator: widget.indicator == null ? BoxDecoration( color: widget.indicatorColor == null - ? getGFColor(GFColor.primary) + ? GFColors.getGFColor(GFColor.primary) : widget.indicatorColor, border: Border.all( color: widget.indicatorColor == null diff --git a/lib/components/tabs/gf_tabBar.dart b/lib/components/tabs/gf_tabBar.dart index bf9cda40..75eee5ad 100644 --- a/lib/components/tabs/gf_tabBar.dart +++ b/lib/components/tabs/gf_tabBar.dart @@ -168,7 +168,7 @@ class _GFTabBarState extends State { : widget.tabBarHeight, child: Material( type: MaterialType.button, - color: widget.tabBarColor ?? getGFColor(GFColor.primary), + color: widget.tabBarColor ?? GFColors.getGFColor(GFColor.primary), child: TabBar( controller: widget.controller, labelColor: widget.labelColor, diff --git a/lib/components/tabs/gf_tabs.dart b/lib/components/tabs/gf_tabs.dart index a8756c30..439bd556 100644 --- a/lib/components/tabs/gf_tabs.dart +++ b/lib/components/tabs/gf_tabs.dart @@ -192,7 +192,8 @@ class _GFTabsState extends State { length: widget.length, initialIndex: widget.initialIndex, tabBarHeight: widget.tabBarHeight, - tabBarColor: widget.tabBarColor ?? getGFColor(GFColor.primary), + tabBarColor: + widget.tabBarColor ?? GFColors.getGFColor(GFColor.primary), controller: widget.controller, labelColor: widget.labelColor, unselectedLabelColor: widget.unselectedLabelColor, diff --git a/lib/components/toast/gf_toast.dart b/lib/components/toast/gf_toast.dart index 3fc3843c..45a7f13c 100644 --- a/lib/components/toast/gf_toast.dart +++ b/lib/components/toast/gf_toast.dart @@ -83,7 +83,7 @@ class _GFToastState extends State with TickerProviderStateMixin { decoration: BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(3)), color: widget.backgroundColor != null - ? getGFColor(widget.backgroundColor) + ? GFColors.getGFColor(widget.backgroundColor) : Color(0xff323232), ), child: Row( diff --git a/lib/components/toggle/gf_toggle.dart b/lib/components/toggle/gf_toggle.dart index 3afe42eb..1d397cf5 100644 --- a/lib/components/toggle/gf_toggle.dart +++ b/lib/components/toggle/gf_toggle.dart @@ -1,7 +1,6 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import '../../types/gf_toggle_type.dart'; -export '../../types/gf_toggle_type.dart'; +import 'package:getflutter/types/gf_toggle_type.dart'; /// A toggle button allows the user to change a setting between two states. /// diff --git a/lib/components/typography/gf_typography.dart b/lib/components/typography/gf_typography.dart index d510bfc1..98b480f4 100644 --- a/lib/components/typography/gf_typography.dart +++ b/lib/components/typography/gf_typography.dart @@ -1,7 +1,6 @@ import 'package:flutter/material.dart'; import 'package:getflutter/colors/gf_color.dart'; import 'package:getflutter/types/gf_typography_type.dart'; -export 'package:getflutter/types/gf_typography_type.dart'; class GFTypography extends StatelessWidget { /// Creates simple title with underline. Style of title can be changed using [GFTypographyType] @@ -104,7 +103,7 @@ class GFTypography extends StatelessWidget { text, style: TextStyle( color: textColor != null - ? getGFColor(textColor) + ? GFColors.getGFColor(textColor) : backgroundImage != null ? Colors.white : Colors.black, @@ -124,7 +123,7 @@ class GFTypography extends StatelessWidget { height: fontSize / 5, decoration: BoxDecoration( color: dividerColor != null - ? getGFColor(dividerColor) + ? GFColors.getGFColor(dividerColor) : backgroundImage != null ? Colors.white : Colors.black, diff --git a/lib/getflutter.dart b/lib/getflutter.dart new file mode 100644 index 00000000..bf278aab --- /dev/null +++ b/lib/getflutter.dart @@ -0,0 +1,12 @@ +library getflutter; + +export 'colors/gf_color.dart'; +export 'position/gf_position.dart'; +export 'shape/gf_avatar_shape.dart'; +export 'shape/gf_badge_shape.dart'; +export 'shape/gf_button_shape.dart'; +export 'shape/gf_icon_button_shape.dart'; +export 'size/gf_size.dart'; +export 'types/gf_toggle_type.dart'; +export 'types/gf_button_type.dart'; +export 'types/gf_typography_type.dart'; diff --git a/lib/size/gf_size.dart b/lib/size/gf_size.dart index fba39977..96d2bcde 100644 --- a/lib/size/gf_size.dart +++ b/lib/size/gf_size.dart @@ -10,29 +10,30 @@ enum GFSize { large, } -const double SMALL = 30.0; -const double MEDIUM = 35.0; -const double LARGE = 40.0; -//const double BLOCK = 40.0; +class GFSizesClass { + static const double SMALL = 30.0; + static const double MEDIUM = 35.0; + static const double LARGE = 40.0; -/// Pass [GFSize] or [double] -double getGFSize(dynamic size) { - if (size is double) { - return size; - } else { - switch (size) { - case GFSize.small: - return SMALL; - break; - case GFSize.medium: - return MEDIUM; - break; - case GFSize.large: - return LARGE; - break; - default: - return MEDIUM; - break; + /// Pass [GFSize] or [double] + static double getGFSize(dynamic size) { + if (size is double || size is int) { + return double.parse(size.toString()); + } else { + switch (size) { + case GFSize.small: + return SMALL; + break; + case GFSize.medium: + return MEDIUM; + break; + case GFSize.large: + return LARGE; + break; + default: + return MEDIUM; + break; + } } } } diff --git a/lib/types/gf_type.dart b/lib/types/gf_button_type.dart similarity index 96% rename from lib/types/gf_type.dart rename to lib/types/gf_button_type.dart index 88475acf..b634213b 100644 --- a/lib/types/gf_type.dart +++ b/lib/types/gf_button_type.dart @@ -1,5 +1,5 @@ /// [GFType] is used to change the type of widgets -enum GFType { +enum GFButtonType { /// Default type is [GFType.solid], used to fill with color for widget solid, diff --git a/pubspec.yaml b/pubspec.yaml index 18a05613..6fb701da 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: getflutter description: GetFlutter 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.0.0-dev.8 +version: 1.0.0 #author: GetFlutter homepage: https://github.com/ionicfirebaseapp/getflutter