Skip to content

Commit b249d3b

Browse files
authored
Merge pull request #21 from deepikahr/drawer
GFButton outline color changed and GSShapes changed
2 parents 24f6947 + 5fbe2d5 commit b249d3b

File tree

14 files changed

+237
-244
lines changed

14 files changed

+237
-244
lines changed

example/lib/main.dart

Lines changed: 162 additions & 170 deletions
Large diffs are not rendered by default.

lib/components/avatar/gf_avatar.dart

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import 'package:flutter/widgets.dart';
22
import 'package:flutter/material.dart';
3-
import 'package:ui_kit/shape/gf_shape.dart';
3+
import 'package:ui_kit/shape/gf_avatar_shape.dart';
44
import 'package:ui_kit/size/gf_size.dart';
55

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

31-
/// shape of avatar [GFShape] i.e, standard, pills, square
32-
final GFShape shape;
31+
/// shape of avatar [GFAvatarShape] i.e, standard, pills, square
32+
final GFAvatarShape shape;
3333

3434
/// border radius to give extra radius for avatar square or standard shape
3535
final BorderRadius borderRadius;
@@ -59,7 +59,7 @@ class GFAvatar extends StatelessWidget {
5959
this.minRadius,
6060
this.maxRadius,
6161
this.borderRadius,
62-
this.shape = GFShape.pills,
62+
this.shape = GFAvatarShape.circle,
6363
this.size = GFSize.medium})
6464
: assert(radius == null || (minRadius == null && maxRadius == null)),
6565
super(key: key);
@@ -97,11 +97,11 @@ class GFAvatar extends StatelessWidget {
9797
}
9898

9999
BoxShape get _avatarShape {
100-
if (shape == GFShape.pills) {
100+
if (shape == GFAvatarShape.circle) {
101101
return BoxShape.circle;
102-
} else if (shape == GFShape.square) {
102+
} else if (shape == GFAvatarShape.square) {
103103
return BoxShape.rectangle;
104-
} else if (shape == GFShape.standard) {
104+
} else if (shape == GFAvatarShape.standard) {
105105
return BoxShape.rectangle;
106106
} else {
107107
return BoxShape.rectangle;
@@ -151,7 +151,7 @@ class GFAvatar extends StatelessWidget {
151151
? DecorationImage(image: backgroundImage, fit: BoxFit.cover)
152152
: null,
153153
shape: _avatarShape,
154-
borderRadius: shape == GFShape.standard && borderRadius == null
154+
borderRadius: shape == GFAvatarShape.standard && borderRadius == null
155155
? BorderRadius.circular(10.0)
156156
: borderRadius,
157157
),

lib/components/badge/gf_badge.dart

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import 'package:flutter/material.dart';
2-
import 'package:ui_kit/shape/gf_shape.dart';
2+
import 'package:ui_kit/shape/gf_badge_shape.dart';
33
import 'package:ui_kit/size/gf_size.dart';
44
import 'package:ui_kit/colors/gf_color.dart';
55

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

13-
/// Counter type of [GFShape] i.e, standard, pills, square,
14-
final GFShape shape;
13+
/// Counter type of [GFBadgeShape] i.e, standard, pills, square,
14+
final GFBadgeShape shape;
1515

1616
/// Pass [GFColor] or [Color]
1717
final dynamic color;
@@ -36,7 +36,7 @@ class GFBadge extends StatefulWidget {
3636
Key key,
3737
this.textStyle,
3838
this.borderShape,
39-
this.shape = GFShape.standard,
39+
this.shape = GFBadgeShape.standard,
4040
this.color = GFColor.secondary,
4141
this.textColor = GFColor.dark,
4242
this.size = GFSize.medium,
@@ -54,7 +54,7 @@ class _GFBadgeState extends State<GFBadge> {
5454
Color color;
5555
Color textColor;
5656
Widget child;
57-
GFShape counterShape;
57+
GFBadgeShape counterShape;
5858
GFSize size;
5959
double height;
6060
double width;
@@ -81,16 +81,16 @@ class _GFBadgeState extends State<GFBadge> {
8181

8282
ShapeBorder shape;
8383

84-
if (this.counterShape == GFShape.pills) {
84+
if (this.counterShape == GFBadgeShape.pills) {
8585
shape = RoundedRectangleBorder(
8686
borderRadius: BorderRadius.circular(50.0), side: shapeBorder);
87-
} else if (this.counterShape == GFShape.square) {
87+
} else if (this.counterShape == GFBadgeShape.square) {
8888
shape = RoundedRectangleBorder(
8989
borderRadius: BorderRadius.circular(0.0), side: shapeBorder);
90-
} else if (this.counterShape == GFShape.standard) {
90+
} else if (this.counterShape == GFBadgeShape.standard) {
9191
shape = RoundedRectangleBorder(
9292
borderRadius: BorderRadius.circular(5.0), side: shapeBorder);
93-
} else if (this.counterShape == GFShape.circle) {
93+
} else if (this.counterShape == GFBadgeShape.circle) {
9494
shape = RoundedRectangleBorder(
9595
borderRadius: BorderRadius.circular(100.0), side: shapeBorder);
9696
} else {
@@ -118,7 +118,7 @@ class _GFBadgeState extends State<GFBadge> {
118118

119119
return Container(
120120
height: this.height,
121-
width: this.counterShape == GFShape.circle ? this.height : this.width,
121+
width: this.counterShape == GFBadgeShape.circle ? this.height : this.width,
122122
child: Material(
123123
textStyle: this.textColor != null
124124
? TextStyle(color: this.textColor, fontSize: this.fontSize)

lib/components/badge/gf_button_badge.dart

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
import 'package:flutter/material.dart';
2-
import 'package:ui_kit/shape/gf_shape.dart';
2+
import 'package:ui_kit/shape/gf_badge_shape.dart';
3+
import 'package:ui_kit/shape/gf_badge_shape.dart';
4+
import 'package:ui_kit/shape/gf_badge_shape.dart';
5+
import 'package:ui_kit/shape/gf_badge_shape.dart';
6+
import 'package:ui_kit/shape/gf_button_shape.dart';
37
import 'package:ui_kit/size/gf_size.dart';
48
import 'package:ui_kit/types/gf_type.dart';
59
import 'package:ui_kit/position/gf_position.dart';
@@ -25,8 +29,8 @@ class GFButtonBadge extends StatefulWidget {
2529
/// Badge type of [GFType] i.e, solid, outline, transparent
2630
final GFType type;
2731

28-
/// Badge type of [GFShape] i.e, standard, pills, square
29-
final GFShape shape;
32+
/// Badge type of [GFBadgeShape] i.e, standard, pills, square
33+
final GFButtonShape shape;
3034

3135
/// Pass [GFColor] or [Color]
3236
final dynamic color;
@@ -54,7 +58,7 @@ class GFButtonBadge extends StatefulWidget {
5458
this.padding = const EdgeInsets.symmetric(horizontal: 8.0),
5559
this.borderShape,
5660
this.type = GFType.solid,
57-
this.shape = GFShape.standard,
61+
this.shape = GFButtonShape.standard,
5862
this.color = GFColor.primary,
5963
this.textColor = GFColor.dark,
6064
this.position = GFPosition.end,
@@ -77,7 +81,7 @@ class _GFButtonBadgeState extends State<GFButtonBadge> {
7781
Widget icon;
7882
Function onPressed;
7983
GFType type;
80-
GFShape shape;
84+
GFButtonShape shape;
8185
double size;
8286
GFPosition position;
8387

lib/components/badge/gf_icon_badge.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import 'package:flutter/material.dart';
2-
import 'package:ui_kit/shape/gf_shape.dart';
2+
import 'package:ui_kit/shape/gf_badge_shape.dart';
33
import 'package:ui_kit/types/gf_type.dart';
44
import 'package:ui_kit/position/gf_position.dart';
55

@@ -37,7 +37,7 @@ class _GFIconBadgesState extends State<GFIconBadges> {
3737
Widget icon;
3838
Function onPressed;
3939
GFType type;
40-
GFShape shape;
40+
GFBadgeShape shape;
4141
GFPosition position;
4242

4343
@override

lib/components/button/gf_button.dart

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import 'package:flutter/gestures.dart';
44
import 'package:flutter/rendering.dart';
55
import 'package:flutter/widgets.dart';
66
import 'package:flutter/material.dart';
7-
import 'package:ui_kit/shape/gf_shape.dart';
7+
import 'package:ui_kit/shape/gf_button_shape.dart';
88
import 'package:ui_kit/size/gf_size.dart';
99
import 'package:ui_kit/types/gf_type.dart';
1010
import 'package:ui_kit/position/gf_position.dart';
@@ -87,8 +87,8 @@ class GFButton extends StatefulWidget {
8787
/// Button type of [GFType] i.e, solid, outline, dashed
8888
final GFType type;
8989

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

9393
/// Pass [GFColor] or [Color]
9494
final dynamic color;
@@ -175,9 +175,9 @@ class GFButton extends StatefulWidget {
175175
MaterialTapTargetSize materialTapTargetSize,
176176
this.child,
177177
this.type = GFType.solid,
178-
this.shape = GFShape.standard,
178+
this.shape = GFButtonShape.standard,
179179
this.color = GFColor.primary,
180-
this.textColor = GFColor.dark,
180+
this.textColor,
181181
this.position = GFPosition.start,
182182
this.size = GFSize.medium,
183183
this.borderSide,
@@ -213,16 +213,18 @@ class _GFButtonState extends State<GFButton> {
213213
Widget icon;
214214
Function onPressed;
215215
GFType type;
216-
GFShape shape;
216+
GFButtonShape shape;
217217
double size;
218218
GFPosition position;
219219
BoxShadow boxShadow;
220220
final Set<MaterialState> _states = <MaterialState>{};
221221

222222
@override
223223
void initState() {
224+
225+
print('ccccccccccc ${widget.textColor}');
224226
this.color = getGFColor(widget.color);
225-
this.textColor = getGFColor(widget.textColor);
227+
this.textColor = widget.type == GFType.outline && widget.textColor == null ? this.color : widget.textColor == null ? getGFColor(GFColor.dark) : getGFColor(widget.textColor);
226228
this.child = widget.text != null ? Text(widget.text) : widget.child;
227229
this.icon = widget.icon;
228230
this.onPressed = widget.onPressed;
@@ -312,7 +314,7 @@ class _GFButtonState extends State<GFButton> {
312314
final Color themeColor =
313315
Theme.of(context).colorScheme.onSurface.withOpacity(0.12);
314316
final BorderSide outlineBorder = BorderSide(
315-
color: widget.borderSide == null ? themeColor : widget.borderSide.color,
317+
color: this.color == null ? themeColor : widget.borderSide == null ? this.color : widget.borderSide.color,
316318
width: widget.borderSide?.width ?? 1.0,
317319
);
318320

@@ -340,13 +342,13 @@ class _GFButtonState extends State<GFButton> {
340342

341343

342344

343-
if (this.shape == GFShape.pills) {
345+
if (this.shape == GFButtonShape.pills) {
344346
shape = RoundedRectangleBorder(
345347
borderRadius: BorderRadius.circular(50.0), side: shapeBorder);
346-
} else if (this.shape == GFShape.square) {
348+
} else if (this.shape == GFButtonShape.square) {
347349
shape = RoundedRectangleBorder(
348350
borderRadius: BorderRadius.circular(0.0), side: shapeBorder);
349-
} else if (this.shape == GFShape.standard) {
351+
} else if (this.shape == GFButtonShape.standard) {
350352
shape = RoundedRectangleBorder(
351353
borderRadius: BorderRadius.circular(5.0), side: shapeBorder);
352354
} else {
@@ -361,8 +363,8 @@ class _GFButtonState extends State<GFButton> {
361363
}else{
362364
return BoxDecoration(
363365
color: widget.type == GFType.transparent || widget.type == GFType.outline ? Colors.transparent : this.color,
364-
borderRadius: widget.shape == GFShape.pills ? BorderRadius.circular(50.0) :
365-
widget.shape == GFShape.standard ? BorderRadius.circular(5.0) : BorderRadius.zero,
366+
borderRadius: widget.shape == GFButtonShape.pills ? BorderRadius.circular(50.0) :
367+
widget.shape == GFButtonShape.standard ? BorderRadius.circular(5.0) : BorderRadius.zero,
366368
boxShadow: [
367369
widget.boxShadow == null && widget.buttonBoxShadow == true ? BoxShadow(
368370
color: themeColor,
@@ -643,8 +645,8 @@ class _RenderInputPadding extends RenderShiftedBox {
643645
// /// Button type of [GFType] i.e, solid, outline, dashed
644646
// final GFType type;
645647
//
646-
// /// Button type of [GFShape] i.e, standard, pills, square, shadow, icons
647-
// final GFShape shape;
648+
// /// Button type of [GFButtonShape] i.e, standard, pills, square, shadow, icons
649+
// final GFButtonShape shape;
648650
//
649651
// /// Pass [GFColor] or [Color]
650652
// final dynamic color;
@@ -712,7 +714,7 @@ class _RenderInputPadding extends RenderShiftedBox {
712714
// MaterialTapTargetSize materialTapTargetSize,
713715
// this.child,
714716
// this.type,
715-
// this.shape = GFShape.standard,
717+
// this.shape = GFButtonShape.standard,
716718
// this.color,
717719
// this.textColor = GFColor.dark,
718720
// this.position = GFPosition.start,
@@ -748,7 +750,7 @@ class _RenderInputPadding extends RenderShiftedBox {
748750
// Widget icon;
749751
// Function onPressed;
750752
// GFType type;
751-
// GFShape shape;
753+
// GFButtonShape shape;
752754
// double size;
753755
// GFPosition position;
754756
// BoxShadow boxShadow;
@@ -889,13 +891,13 @@ class _RenderInputPadding extends RenderShiftedBox {
889891
//
890892
// ShapeBorder shape;
891893
//
892-
// if (this.shape == GFShape.pills) {
894+
// if (this.shape == GFButtonShape.pills) {
893895
// shape = RoundedRectangleBorder(
894896
// borderRadius: BorderRadius.circular(50.0), side: shapeBorder);
895-
// } else if (this.shape == GFShape.square) {
897+
// } else if (this.shape == GFButtonShape.square) {
896898
// shape = RoundedRectangleBorder(
897899
// borderRadius: BorderRadius.circular(0.0), side: shapeBorder);
898-
// } else if (this.shape == GFShape.standard) {
900+
// } else if (this.shape == GFButtonShape.standard) {
899901
// shape = RoundedRectangleBorder(
900902
// borderRadius: BorderRadius.circular(5.0), side: shapeBorder);
901903
// } else {
@@ -937,8 +939,8 @@ class _RenderInputPadding extends RenderShiftedBox {
937939
// constraints: this.icon == null ? BoxConstraints(minHeight: 26.0, minWidth: 88.0) :
938940
// BoxConstraints(minHeight: 26.0, minWidth: 98.0),
939941
// decoration: BoxDecoration(
940-
// borderRadius: widget.shape == GFShape.pills ? BorderRadius.circular(50.0) :
941-
// widget.shape == GFShape.standard ? BorderRadius.circular(5.0) : BorderRadius.zero,
942+
// borderRadius: widget.shape == GFButtonShape.pills ? BorderRadius.circular(50.0) :
943+
// widget.shape == GFButtonShape.standard ? BorderRadius.circular(5.0) : BorderRadius.zero,
942944
// boxShadow: [
943945
// widget.boxShadow == null && widget.buttonBoxShadow == true ? BoxShadow(
944946
// color: widget.color.withOpacity(0.4),

0 commit comments

Comments
 (0)