Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
332 changes: 162 additions & 170 deletions example/lib/main.dart

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions lib/components/avatar/gf_avatar.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:flutter/widgets.dart';
import 'package:flutter/material.dart';
import 'package:ui_kit/shape/gf_shape.dart';
import 'package:ui_kit/shape/gf_avatar_shape.dart';
import 'package:ui_kit/size/gf_size.dart';

class GFAvatar extends StatelessWidget {
Expand Down Expand Up @@ -28,8 +28,8 @@ class GFAvatar extends StatelessWidget {
/// size of avatar like [double] or [GFSize] i.e, 1.2, small, medium, large etc.
final GFSize size;

/// shape of avatar [GFShape] i.e, standard, pills, square
final GFShape shape;
/// shape of avatar [GFAvatarShape] i.e, standard, pills, square
final GFAvatarShape shape;

/// border radius to give extra radius for avatar square or standard shape
final BorderRadius borderRadius;
Expand Down Expand Up @@ -59,7 +59,7 @@ class GFAvatar extends StatelessWidget {
this.minRadius,
this.maxRadius,
this.borderRadius,
this.shape = GFShape.pills,
this.shape = GFAvatarShape.circle,
this.size = GFSize.medium})
: assert(radius == null || (minRadius == null && maxRadius == null)),
super(key: key);
Expand Down Expand Up @@ -97,11 +97,11 @@ class GFAvatar extends StatelessWidget {
}

BoxShape get _avatarShape {
if (shape == GFShape.pills) {
if (shape == GFAvatarShape.circle) {
return BoxShape.circle;
} else if (shape == GFShape.square) {
} else if (shape == GFAvatarShape.square) {
return BoxShape.rectangle;
} else if (shape == GFShape.standard) {
} else if (shape == GFAvatarShape.standard) {
return BoxShape.rectangle;
} else {
return BoxShape.rectangle;
Expand Down Expand Up @@ -151,7 +151,7 @@ class GFAvatar extends StatelessWidget {
? DecorationImage(image: backgroundImage, fit: BoxFit.cover)
: null,
shape: _avatarShape,
borderRadius: shape == GFShape.standard && borderRadius == null
borderRadius: shape == GFAvatarShape.standard && borderRadius == null
? BorderRadius.circular(10.0)
: borderRadius,
),
Expand Down
20 changes: 10 additions & 10 deletions lib/components/badge/gf_badge.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:flutter/material.dart';
import 'package:ui_kit/shape/gf_shape.dart';
import 'package:ui_kit/shape/gf_badge_shape.dart';
import 'package:ui_kit/size/gf_size.dart';
import 'package:ui_kit/colors/gf_color.dart';

Expand All @@ -10,8 +10,8 @@ class GFBadge extends StatefulWidget {
/// Typically the counter button's shape.
final ShapeBorder borderShape;

/// Counter type of [GFShape] i.e, standard, pills, square,
final GFShape shape;
/// Counter type of [GFBadgeShape] i.e, standard, pills, square,
final GFBadgeShape shape;

/// Pass [GFColor] or [Color]
final dynamic color;
Expand All @@ -36,7 +36,7 @@ class GFBadge extends StatefulWidget {
Key key,
this.textStyle,
this.borderShape,
this.shape = GFShape.standard,
this.shape = GFBadgeShape.standard,
this.color = GFColor.secondary,
this.textColor = GFColor.dark,
this.size = GFSize.medium,
Expand All @@ -54,7 +54,7 @@ class _GFBadgeState extends State<GFBadge> {
Color color;
Color textColor;
Widget child;
GFShape counterShape;
GFBadgeShape counterShape;
GFSize size;
double height;
double width;
Expand All @@ -81,16 +81,16 @@ class _GFBadgeState extends State<GFBadge> {

ShapeBorder shape;

if (this.counterShape == GFShape.pills) {
if (this.counterShape == GFBadgeShape.pills) {
shape = RoundedRectangleBorder(
borderRadius: BorderRadius.circular(50.0), side: shapeBorder);
} else if (this.counterShape == GFShape.square) {
} else if (this.counterShape == GFBadgeShape.square) {
shape = RoundedRectangleBorder(
borderRadius: BorderRadius.circular(0.0), side: shapeBorder);
} else if (this.counterShape == GFShape.standard) {
} else if (this.counterShape == GFBadgeShape.standard) {
shape = RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5.0), side: shapeBorder);
} else if (this.counterShape == GFShape.circle) {
} else if (this.counterShape == GFBadgeShape.circle) {
shape = RoundedRectangleBorder(
borderRadius: BorderRadius.circular(100.0), side: shapeBorder);
} else {
Expand Down Expand Up @@ -118,7 +118,7 @@ class _GFBadgeState extends State<GFBadge> {

return Container(
height: this.height,
width: this.counterShape == GFShape.circle ? this.height : this.width,
width: this.counterShape == GFBadgeShape.circle ? this.height : this.width,
child: Material(
textStyle: this.textColor != null
? TextStyle(color: this.textColor, fontSize: this.fontSize)
Expand Down
14 changes: 9 additions & 5 deletions lib/components/badge/gf_button_badge.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import 'package:flutter/material.dart';
import 'package:ui_kit/shape/gf_shape.dart';
import 'package:ui_kit/shape/gf_badge_shape.dart';
import 'package:ui_kit/shape/gf_badge_shape.dart';
import 'package:ui_kit/shape/gf_badge_shape.dart';
import 'package:ui_kit/shape/gf_badge_shape.dart';
import 'package:ui_kit/shape/gf_button_shape.dart';
import 'package:ui_kit/size/gf_size.dart';
import 'package:ui_kit/types/gf_type.dart';
import 'package:ui_kit/position/gf_position.dart';
Expand All @@ -25,8 +29,8 @@ class GFButtonBadge extends StatefulWidget {
/// Badge type of [GFType] i.e, solid, outline, transparent
final GFType type;

/// Badge type of [GFShape] i.e, standard, pills, square
final GFShape shape;
/// Badge type of [GFBadgeShape] i.e, standard, pills, square
final GFButtonShape shape;

/// Pass [GFColor] or [Color]
final dynamic color;
Expand Down Expand Up @@ -54,7 +58,7 @@ class GFButtonBadge extends StatefulWidget {
this.padding = const EdgeInsets.symmetric(horizontal: 8.0),
this.borderShape,
this.type = GFType.solid,
this.shape = GFShape.standard,
this.shape = GFButtonShape.standard,
this.color = GFColor.primary,
this.textColor = GFColor.dark,
this.position = GFPosition.end,
Expand All @@ -77,7 +81,7 @@ class _GFButtonBadgeState extends State<GFButtonBadge> {
Widget icon;
Function onPressed;
GFType type;
GFShape shape;
GFButtonShape shape;
double size;
GFPosition position;

Expand Down
4 changes: 2 additions & 2 deletions lib/components/badge/gf_icon_badge.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:flutter/material.dart';
import 'package:ui_kit/shape/gf_shape.dart';
import 'package:ui_kit/shape/gf_badge_shape.dart';
import 'package:ui_kit/types/gf_type.dart';
import 'package:ui_kit/position/gf_position.dart';

Expand Down Expand Up @@ -37,7 +37,7 @@ class _GFIconBadgesState extends State<GFIconBadges> {
Widget icon;
Function onPressed;
GFType type;
GFShape shape;
GFBadgeShape shape;
GFPosition position;

@override
Expand Down
46 changes: 24 additions & 22 deletions lib/components/button/gf_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:flutter/gestures.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter/material.dart';
import 'package:ui_kit/shape/gf_shape.dart';
import 'package:ui_kit/shape/gf_button_shape.dart';
import 'package:ui_kit/size/gf_size.dart';
import 'package:ui_kit/types/gf_type.dart';
import 'package:ui_kit/position/gf_position.dart';
Expand Down Expand Up @@ -87,8 +87,8 @@ class GFButton extends StatefulWidget {
/// Button type of [GFType] i.e, solid, outline, dashed
final GFType type;

/// Button type of [GFShape] i.e, standard, pills, square, shadow, icons
final GFShape shape;
/// Button type of [GFButtonShape] i.e, standard, pills, square, shadow, icons
final GFButtonShape shape;

/// Pass [GFColor] or [Color]
final dynamic color;
Expand Down Expand Up @@ -175,9 +175,9 @@ class GFButton extends StatefulWidget {
MaterialTapTargetSize materialTapTargetSize,
this.child,
this.type = GFType.solid,
this.shape = GFShape.standard,
this.shape = GFButtonShape.standard,
this.color = GFColor.primary,
this.textColor = GFColor.dark,
this.textColor,
this.position = GFPosition.start,
this.size = GFSize.medium,
this.borderSide,
Expand Down Expand Up @@ -213,16 +213,18 @@ class _GFButtonState extends State<GFButton> {
Widget icon;
Function onPressed;
GFType type;
GFShape shape;
GFButtonShape shape;
double size;
GFPosition position;
BoxShadow boxShadow;
final Set<MaterialState> _states = <MaterialState>{};

@override
void initState() {

print('ccccccccccc ${widget.textColor}');
this.color = getGFColor(widget.color);
this.textColor = getGFColor(widget.textColor);
this.textColor = widget.type == GFType.outline && widget.textColor == null ? this.color : widget.textColor == null ? getGFColor(GFColor.dark) : getGFColor(widget.textColor);
this.child = widget.text != null ? Text(widget.text) : widget.child;
this.icon = widget.icon;
this.onPressed = widget.onPressed;
Expand Down Expand Up @@ -312,7 +314,7 @@ class _GFButtonState extends State<GFButton> {
final Color themeColor =
Theme.of(context).colorScheme.onSurface.withOpacity(0.12);
final BorderSide outlineBorder = BorderSide(
color: widget.borderSide == null ? themeColor : widget.borderSide.color,
color: this.color == null ? themeColor : widget.borderSide == null ? this.color : widget.borderSide.color,
width: widget.borderSide?.width ?? 1.0,
);

Expand Down Expand Up @@ -340,13 +342,13 @@ class _GFButtonState extends State<GFButton> {



if (this.shape == GFShape.pills) {
if (this.shape == GFButtonShape.pills) {
shape = RoundedRectangleBorder(
borderRadius: BorderRadius.circular(50.0), side: shapeBorder);
} else if (this.shape == GFShape.square) {
} else if (this.shape == GFButtonShape.square) {
shape = RoundedRectangleBorder(
borderRadius: BorderRadius.circular(0.0), side: shapeBorder);
} else if (this.shape == GFShape.standard) {
} else if (this.shape == GFButtonShape.standard) {
shape = RoundedRectangleBorder(
borderRadius: BorderRadius.circular(5.0), side: shapeBorder);
} else {
Expand All @@ -361,8 +363,8 @@ class _GFButtonState extends State<GFButton> {
}else{
return BoxDecoration(
color: widget.type == GFType.transparent || widget.type == GFType.outline ? Colors.transparent : this.color,
borderRadius: widget.shape == GFShape.pills ? BorderRadius.circular(50.0) :
widget.shape == GFShape.standard ? BorderRadius.circular(5.0) : BorderRadius.zero,
borderRadius: widget.shape == GFButtonShape.pills ? BorderRadius.circular(50.0) :
widget.shape == GFButtonShape.standard ? BorderRadius.circular(5.0) : BorderRadius.zero,
boxShadow: [
widget.boxShadow == null && widget.buttonBoxShadow == true ? BoxShadow(
color: themeColor,
Expand Down Expand Up @@ -643,8 +645,8 @@ class _RenderInputPadding extends RenderShiftedBox {
// /// Button type of [GFType] i.e, solid, outline, dashed
// final GFType type;
//
// /// Button type of [GFShape] i.e, standard, pills, square, shadow, icons
// final GFShape shape;
// /// Button type of [GFButtonShape] i.e, standard, pills, square, shadow, icons
// final GFButtonShape shape;
//
// /// Pass [GFColor] or [Color]
// final dynamic color;
Expand Down Expand Up @@ -712,7 +714,7 @@ class _RenderInputPadding extends RenderShiftedBox {
// MaterialTapTargetSize materialTapTargetSize,
// this.child,
// this.type,
// this.shape = GFShape.standard,
// this.shape = GFButtonShape.standard,
// this.color,
// this.textColor = GFColor.dark,
// this.position = GFPosition.start,
Expand Down Expand Up @@ -748,7 +750,7 @@ class _RenderInputPadding extends RenderShiftedBox {
// Widget icon;
// Function onPressed;
// GFType type;
// GFShape shape;
// GFButtonShape shape;
// double size;
// GFPosition position;
// BoxShadow boxShadow;
Expand Down Expand Up @@ -889,13 +891,13 @@ class _RenderInputPadding extends RenderShiftedBox {
//
// ShapeBorder shape;
//
// if (this.shape == GFShape.pills) {
// if (this.shape == GFButtonShape.pills) {
// shape = RoundedRectangleBorder(
// borderRadius: BorderRadius.circular(50.0), side: shapeBorder);
// } else if (this.shape == GFShape.square) {
// } else if (this.shape == GFButtonShape.square) {
// shape = RoundedRectangleBorder(
// borderRadius: BorderRadius.circular(0.0), side: shapeBorder);
// } else if (this.shape == GFShape.standard) {
// } else if (this.shape == GFButtonShape.standard) {
// shape = RoundedRectangleBorder(
// borderRadius: BorderRadius.circular(5.0), side: shapeBorder);
// } else {
Expand Down Expand Up @@ -937,8 +939,8 @@ class _RenderInputPadding extends RenderShiftedBox {
// constraints: this.icon == null ? BoxConstraints(minHeight: 26.0, minWidth: 88.0) :
// BoxConstraints(minHeight: 26.0, minWidth: 98.0),
// decoration: BoxDecoration(
// borderRadius: widget.shape == GFShape.pills ? BorderRadius.circular(50.0) :
// widget.shape == GFShape.standard ? BorderRadius.circular(5.0) : BorderRadius.zero,
// borderRadius: widget.shape == GFButtonShape.pills ? BorderRadius.circular(50.0) :
// widget.shape == GFButtonShape.standard ? BorderRadius.circular(5.0) : BorderRadius.zero,
// boxShadow: [
// widget.boxShadow == null && widget.buttonBoxShadow == true ? BoxShadow(
// color: widget.color.withOpacity(0.4),
Expand Down
Loading