Skip to content

Commit ee489ab

Browse files
Sandip KakadiyaSandip Kakadiya
authored andcommitted
radio, radiotile, rating, sticky header changes & review
1 parent 154d789 commit ee489ab

File tree

14 files changed

+38
-58
lines changed

14 files changed

+38
-58
lines changed

lib/components/checkbox/gf_checkbox.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class GFCheckbox extends StatefulWidget {
1919
size: 20,
2020
color: GFColors.WHITE,
2121
),
22-
this.inactiveIcon = const Icon(Icons.close),
22+
this.inactiveIcon,
2323
this.custombgColor = GFColors.SUCCESS,
2424
this.autofocus = false,
2525
this.focusNode})

lib/components/checkbox_list_tile/gf_checkbox_list_tile.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class GFCheckboxListTile extends StatelessWidget {
2929
size: 20,
3030
color: GFColors.WHITE,
3131
),
32-
this.inactiveIcon = const Icon(Icons.close),
32+
this.inactiveIcon,
3333
this.custombgColor = GFColors.SUCCESS,
3434
this.position = GFPosition.end,
3535
this.selected = false,

lib/components/radio/gf_radio.dart

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,7 @@ class GFRadio<T> extends StatefulWidget {
2323
size: 20,
2424
color: GFColors.DARK,
2525
),
26-
this.inactiveIcon = const Icon(
27-
Icons.close,
28-
size: 20,
29-
color: GFColors.DARK,
30-
),
26+
this.inactiveIcon,
3127
this.custombgColor = GFColors.SUCCESS,
3228
this.autofocus = false,
3329
this.focusNode,

lib/components/radio_list_tile/gf_radio_list_tile.dart

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
22
import 'package:getwidget/getwidget.dart';
33

44
class GFRadioListTile<T> extends StatelessWidget {
5+
/// [GFRadioListTile] is a list title of with [GFRadio] in it.
56
const GFRadioListTile({
67
Key key,
78
@required this.value,
@@ -20,11 +21,7 @@ class GFRadioListTile<T> extends StatelessWidget {
2021
size: 20,
2122
color: GFColors.DARK,
2223
),
23-
this.inactiveIcon = const Icon(
24-
Icons.close,
25-
size: 20,
26-
color: GFColors.DARK,
27-
),
24+
this.inactiveIcon,
2825
this.custombgColor = GFColors.SUCCESS,
2926
this.autofocus = false,
3027
this.focusNode,
@@ -156,8 +153,7 @@ class GFRadioListTile<T> extends StatelessWidget {
156153
/// The value represented by this radio button.
157154
final T value;
158155

159-
/// The currently selected value for a group of radio buttons. Radio button is considered selected if its [value] matches the
160-
/// [groupValue].
156+
/// The currently selected value for a group of radio buttons. Radio button is considered selected if its [value] matches the [groupValue].
161157
final T groupValue;
162158

163159
/// sets the radio value
@@ -168,24 +164,27 @@ class GFRadioListTile<T> extends StatelessWidget {
168164

169165
@override
170166
Widget build(BuildContext context) {
171-
GFRadio radio = GFRadio(
172-
autofocus: autofocus,
167+
final GFRadio radio = GFRadio(
173168
onChanged: onChanged,
174169
value: value,
175170
groupValue: groupValue,
176171
size: size,
172+
type: type,
173+
radioColor: radioColor,
177174
activebgColor: activebgColor,
178175
inactiveIcon: inactiveIcon,
179176
activeBorderColor: activeBorderColor,
180177
inactivebgColor: inactivebgColor,
181178
activeIcon: activeIcon,
182179
inactiveBorderColor: inactiveBorderColor,
183180
custombgColor: custombgColor,
181+
toggleable: toggleable,
184182
);
185183
return MergeSemantics(
186184
child: GFListTile(
187185
autofocus: autofocus,
188186
enabled: onChanged != null,
187+
focusNode: focusNode,
189188
onTap: onChanged != null
190189
? () {
191190
if (toggleable && checked) {

lib/components/rating/gf_rating.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import 'package:getwidget/getwidget.dart';
44
typedef RatingChangeCallback = void Function(double rating);
55

66
class GFRating extends StatefulWidget {
7+
/// [GFRating] to show ratings with many custimazation options.
78
const GFRating({
89
this.itemCount = 5,
910
this.spacing = 0.0,

lib/components/shimmer/gf_shimmer.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import 'package:flutter/rendering.dart';
33
import 'package:getwidget/getwidget.dart';
44

55
class GFShimmer extends StatefulWidget {
6+
/// [GFShimmer] shows shimmer effect.
67
const GFShimmer({
78
Key key,
89
@required this.child,
@@ -125,7 +126,9 @@ class _GFShimmerState extends State<GFShimmer>
125126

126127
@override
127128
void dispose() {
128-
_controller.dispose();
129+
if (_controller != null) {
130+
_controller.dispose();
131+
}
129132
super.dispose();
130133
}
131134
}

lib/components/sticky_header/gf_sticky_header.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ import 'package:flutter/widgets.dart';
55
import 'package:meta/meta.dart';
66
import 'package:getwidget/getwidget.dart';
77

8-
/// Place this widget inside a [ListView], [GridView], [CustomScrollView], [SingleChildScrollView] or similar.
9-
108
class GFStickyHeader extends MultiChildRenderObjectWidget {
9+
/// Place this widget inside a [ListView], [GridView], [CustomScrollView], [SingleChildScrollView] or similar.
1110
GFStickyHeader(
1211
{Key key,
1312
@required this.stickyContent,

lib/components/sticky_header/gf_sticky_header_builder.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ import 'package:flutter/material.dart';
22
import 'package:getwidget/getwidget.dart';
33

44
typedef StickyHeaderWidgetBuilder = Widget Function(
5-
BuildContext context, double stuckValue);
6-
7-
/// Place this widget inside a [ListView], [GridView], [CustomScrollView], [SingleChildScrollView] or similar.
5+
BuildContext context,
6+
double stuckValue,
7+
);
88

99
class GFStickyHeaderBuilder extends StatefulWidget {
10+
/// Place this widget inside a [ListView], [GridView], [CustomScrollView], [SingleChildScrollView] or similar.
1011
/// Constructs a new [GFStickyHeaderBuilder] widget.
1112
const GFStickyHeaderBuilder({
1213
Key key,

lib/components/sticky_header/render_gf_sticky_header.dart

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,8 @@ class RenderGFStickyHeader extends RenderBox
132132
assert(childCount == 2);
133133
_stickyContentBody.layout(constraints.loosen(), parentUsesSize: true);
134134
_contentBody.layout(constraints.loosen(), parentUsesSize: true);
135-
136135
final stickyContentBodyHeight = _stickyContentBody.size.height;
137136
final contentBodyHeight = _contentBody.size.height;
138-
139137
final height = max(
140138
constraints.minHeight,
141139
_enableHeaderOverlap
@@ -145,20 +143,15 @@ class RenderGFStickyHeader extends RenderBox
145143

146144
size = Size(
147145
constraints.constrainWidth(width), constraints.constrainHeight(height));
148-
149146
final double stickyContentBodyOffset = getHeaderTileStuckOffset();
150-
151147
assert(constraints != null);
152148

153149
double crossSize = 0;
154150
double allottedSize = 0;
155151
RenderBox child = firstChild;
156-
// ignore: unused_local_variable
157-
int totalChildren = 0;
158152
while (child != null) {
159153
// ignore: avoid_as
160154
final FlexParentData childParentData = child.parentData as FlexParentData;
161-
totalChildren++;
162155
final int flex = _getFlex(child);
163156
if (flex > 0) {
164157
} else {

lib/components/tabs/gf_segment_tabs.dart

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ class GFSegmentTabs extends StatefulWidget {
1111
/// [GFSegmentTabs] are best used as an alternative for [GFTabBar].
1212
const GFSegmentTabs(
1313
{Key key,
14-
// this.initialIndex = 0,
1514
@required this.length,
15+
// this.initialIndex = 0,
1616
this.height,
1717
this.width,
1818
this.border,
@@ -31,13 +31,13 @@ class GFSegmentTabs extends StatefulWidget {
3131
this.tabs,
3232
this.tabController})
3333
: assert(length != null && length >= 0),
34-
// assert(initialIndex != null &&
35-
// initialIndex >= 0 &&
36-
// (length == 0 || initialIndex < length)),
34+
// assert(initialIndex != null &&
35+
// initialIndex >= 0 &&
36+
// (length == 0 || initialIndex < length)),
3737
super(key: key);
3838

39-
// /// The initial index of the selected tab. Defaults to zero.
40-
// final int initialIndex;
39+
// /// The initial index of the selected tab. Defaults to zero.
40+
// final int initialIndex;
4141

4242
/// The total number of tabs. Typically greater than one. Must match [TabBar.tabs]'s and
4343
/// [TabBarView.children]'s length.
@@ -178,7 +178,7 @@ class _GFSegmentTabsState extends State<GFSegmentTabs> {
178178
borderRadius: widget.borderRadius ?? BorderRadius.circular(2),
179179
),
180180
child: DefaultTabController(
181-
// initialIndex: widget.initialIndex,
181+
// initialIndex: widget.initialIndex,
182182
length: widget.length,
183183
child: Material(
184184
borderRadius: widget.borderRadius ?? BorderRadius.circular(2),

0 commit comments

Comments
 (0)