Skip to content

Commit 8b37f48

Browse files
authored
Merge pull request #33 from ionicfirebaseapp/master
master pull
2 parents b387ae3 + e8ec143 commit 8b37f48

File tree

10 files changed

+2528
-80
lines changed

10 files changed

+2528
-80
lines changed

example/lib/main_temp.dart

Lines changed: 1428 additions & 0 deletions
Large diffs are not rendered by default.

lib/components/badge/gf_badge.dart

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,16 @@ class _GFBadgeState extends State<GFBadge> {
6868
super.initState();
6969
}
7070

71+
@override
72+
void didUpdateWidget(GFBadge oldWidget) {
73+
color = widget.color;
74+
textColor = widget.textColor;
75+
child = widget.text != null ? Text(widget.text ?? '') : widget.child;
76+
counterShape = widget.shape;
77+
size = widget.size;
78+
super.didUpdateWidget(oldWidget);
79+
}
80+
7181
@override
7282
Widget build(BuildContext context) {
7383
final BorderSide shapeBorder = widget.border != null

lib/components/badge/gf_button_badge.dart

Lines changed: 96 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import 'package:flutter/widgets.dart';
44
import 'package:flutter/material.dart';
55
import 'package:getflutter/getflutter.dart';
66

7-
class GFButtonBadge extends GFButton {
7+
class GFButtonBadge extends StatefulWidget {
88
/// Create badges badges of all types. check out [GFIconButton] for icon badges, and [GFBadge] for badges
99
const GFButtonBadge({
1010
Key key,
@@ -58,15 +58,17 @@ class GFButtonBadge extends GFButton {
5858
assert(animationDuration != null),
5959
assert(clipBehavior != null),
6060
assert(autofocus != null),
61-
super(key: key, onPressed: onPressed);
61+
super(
62+
key: key,
63+
);
6264

6365
/// Called when the button is tapped or otherwise activated.
6466
final VoidCallback onPressed;
6567

6668
/// Called by the underlying [InkWell] widget's InkWell.onHighlightChanged callback.
6769
final ValueChanged<bool> onHighlightChanged;
6870

69-
/// Defines the default text style, with [Material.textStyle], for the button's [child].
71+
/// Defines the default text style, with [Material.textStyle], for the button's child.
7072
final TextStyle textStyle;
7173

7274
/// The border side for the badge's [Material].
@@ -102,7 +104,7 @@ class GFButtonBadge extends GFButton {
102104
/// The elevation for the badge's [Material] when the badge is not [enabled].
103105
final double disabledElevation;
104106

105-
/// The internal padding for the badge's [child].
107+
/// The internal padding for the badge's child.
106108
final EdgeInsetsGeometry padding;
107109

108110
/// Defines the badge's size.
@@ -219,48 +221,104 @@ class GFButtonBadge extends GFButton {
219221
/// Can be used to display GFBadge, [Icons] inside badge design
220222
final Widget icon;
221223

224+
@override
225+
_GFButtonBadgeState createState() => _GFButtonBadgeState();
226+
}
227+
228+
class _GFButtonBadgeState extends State<GFButtonBadge> {
229+
@override
222230
Widget build(BuildContext context) => ConstrainedBox(
223231
constraints: const BoxConstraints(
224232
minHeight: 26,
225233
minWidth: 98,
226234
),
227235
child: Container(
228-
height: size,
236+
height: widget.size,
229237
child: GFButton(
230-
onPressed: onPressed,
231-
onHighlightChanged: onHighlightChanged,
232-
textStyle: textStyle,
233-
boxShadow: boxShadow,
234-
buttonBoxShadow: badgeBoxShadow,
235-
focusColor: focusColor,
236-
hoverColor: hoverColor,
237-
highlightColor: highlightColor,
238-
splashColor: splashColor,
239-
elevation: elevation,
240-
focusElevation: focusElevation,
241-
hoverElevation: hoverElevation,
242-
highlightElevation: highlightElevation,
243-
disabledElevation: disabledElevation,
244-
constraints: constraints,
245-
borderShape: borderShape,
246-
animationDuration: animationDuration,
247-
clipBehavior: clipBehavior,
248-
focusNode: focusNode,
249-
autofocus: autofocus,
250-
type: type,
251-
shape: shape,
252-
color: color,
253-
textColor: textColor,
254-
position: position,
255-
size: size,
256-
borderSide: borderSide,
257-
text: text,
258-
icon: icon,
259-
blockButton: blockButton,
260-
fullWidthButton: fullWidthButton,
261-
disabledColor: disabledTextColor,
262-
disabledTextColor: disabledColor,
238+
onPressed: widget.onPressed,
239+
onHighlightChanged: widget.onHighlightChanged,
240+
textStyle: widget.textStyle,
241+
boxShadow: widget.boxShadow,
242+
buttonBoxShadow: widget.badgeBoxShadow,
243+
focusColor: widget.focusColor,
244+
hoverColor: widget.hoverColor,
245+
highlightColor: widget.highlightColor,
246+
splashColor: widget.splashColor,
247+
elevation: widget.elevation,
248+
focusElevation: widget.focusElevation,
249+
hoverElevation: widget.hoverElevation,
250+
highlightElevation: widget.highlightElevation,
251+
disabledElevation: widget.disabledElevation,
252+
constraints: widget.constraints,
253+
borderShape: widget.borderShape,
254+
animationDuration: widget.animationDuration,
255+
clipBehavior: widget.clipBehavior,
256+
focusNode: widget.focusNode,
257+
autofocus: widget.autofocus,
258+
type: widget.type,
259+
shape: widget.shape,
260+
color: widget.color,
261+
textColor: widget.textColor,
262+
position: widget.position,
263+
size: widget.size,
264+
borderSide: widget.borderSide,
265+
text: widget.text,
266+
icon: widget.icon,
267+
blockButton: widget.blockButton,
268+
fullWidthButton: widget.fullWidthButton,
269+
disabledColor: widget.disabledTextColor,
270+
disabledTextColor: widget.disabledColor,
263271
),
264272
),
265273
);
266274
}
275+
276+
//
277+
//class GFButtonBadge extends GFButton {
278+
//
279+
//
280+
// Widget build(BuildContext context) => ConstrainedBox(
281+
// constraints: const BoxConstraints(
282+
// minHeight: 26,
283+
// minWidth: 98,
284+
// ),
285+
// child: Container(
286+
// height: size,
287+
// child: GFButton(
288+
// onPressed: onPressed,
289+
// onHighlightChanged: onHighlightChanged,
290+
// textStyle: textStyle,
291+
// boxShadow: boxShadow,
292+
// buttonBoxShadow: badgeBoxShadow,
293+
// focusColor: focusColor,
294+
// hoverColor: hoverColor,
295+
// highlightColor: highlightColor,
296+
// splashColor: splashColor,
297+
// elevation: elevation,
298+
// focusElevation: focusElevation,
299+
// hoverElevation: hoverElevation,
300+
// highlightElevation: highlightElevation,
301+
// disabledElevation: disabledElevation,
302+
// constraints: constraints,
303+
// borderShape: borderShape,
304+
// animationDuration: animationDuration,
305+
// clipBehavior: clipBehavior,
306+
// focusNode: focusNode,
307+
// autofocus: autofocus,
308+
// type: type,
309+
// shape: shape,
310+
// color: color,
311+
// textColor: textColor,
312+
// position: position,
313+
// size: size,
314+
// borderSide: borderSide,
315+
// text: text,
316+
// icon: icon,
317+
// blockButton: blockButton,
318+
// fullWidthButton: fullWidthButton,
319+
// disabledColor: disabledTextColor,
320+
// disabledTextColor: disabledColor,
321+
// ),
322+
// ),
323+
// );
324+
//}

0 commit comments

Comments
 (0)