Skip to content

Commit f2da2e7

Browse files
committed
GFRadioListTile tested
1 parent 916e8f1 commit f2da2e7

File tree

1 file changed

+160
-26
lines changed

1 file changed

+160
-26
lines changed

lib/components/radio_list_tile/gf_radio_list_tile.dart

Lines changed: 160 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,170 @@ import 'package:getwidget/getwidget.dart';
44
class GFRadioListTile<T> extends StatelessWidget {
55
const GFRadioListTile({
66
Key key,
7-
@required this.value,
8-
@required this.groupValue,
9-
@required this.onChanged,
10-
this.size = GFSize.SMALL,
11-
this.type = GFRadioType.basic,
12-
this.radioColor = GFColors.SUCCESS,
13-
this.activebgColor = GFColors.WHITE,
14-
this.inactivebgColor = GFColors.WHITE,
15-
this.activeBorderColor = GFColors.DARK,
16-
this.inactiveBorderColor = GFColors.DARK,
17-
this.activeIcon = const Icon(
18-
Icons.check,
19-
size: 20,
20-
color: GFColors.DARK,
21-
),
22-
this.inactiveIcon = const Icon(
23-
Icons.close,
24-
size: 20,
25-
color: GFColors.DARK,
26-
),
27-
this.custombgColor = GFColors.SUCCESS,
28-
this.autofocus = false,
29-
this.focusNode,
30-
this.toggleable = false
7+
@required this.value,
8+
@required this.groupValue,
9+
@required this.onChanged,
10+
this.size = GFSize.SMALL,
11+
this.type = GFRadioType.basic,
12+
this.radioColor = GFColors.SUCCESS,
13+
this.activebgColor = GFColors.WHITE,
14+
this.inactivebgColor = GFColors.WHITE,
15+
this.activeBorderColor = GFColors.DARK,
16+
this.inactiveBorderColor = GFColors.DARK,
17+
this.activeIcon = const Icon(
18+
Icons.check,
19+
size: 20,
20+
color: GFColors.DARK,
21+
),
22+
this.inactiveIcon = const Icon(
23+
Icons.close,
24+
size: 20,
25+
color: GFColors.DARK,
26+
),
27+
this.custombgColor = GFColors.SUCCESS,
28+
this.autofocus = false,
29+
this.focusNode,
30+
this.toggleable = false,
31+
this.titleText,
32+
this.subtitleText,
33+
this.color,
34+
this.avatar,
35+
this.title,
36+
this.subTitle,
37+
this.description,
38+
this.icon,
39+
this.padding = const EdgeInsets.all(8),
40+
this.margin = const EdgeInsets.all(16),
41+
this.enabled = true,
42+
this.onTap,
43+
this.onLongPress,
44+
this.selected = false,
45+
this.focusColor,
46+
this.hoverColor,
3147
})
3248
: assert(autofocus != null),
33-
assert(toggleable != null),
34-
super(key: key);
49+
assert(toggleable != null),
50+
assert(enabled != null),
51+
assert(selected != null),
52+
super(key: key);
53+
54+
///type of [String] used to pass text, alternative to title property and gets higher priority than title
55+
final String titleText;
56+
57+
///type of [String] used to pass text, alternative to subtitle property and gets higher priority than subtitle
58+
final String subtitleText;
59+
60+
/// The GFListTile's background color. Can be given [Color] or [GFColors]
61+
final Color color;
62+
63+
/// type of [Widget] or [GFAvatar] used to create rounded user profile
64+
final Widget avatar;
65+
66+
/// The title to display inside the [GFListTile]. see [Text]
67+
final Widget title;
68+
69+
/// The subTitle to display inside the [GFListTile]. see [Text]
70+
final Widget subTitle;
71+
72+
/// The description to display inside the [GFListTile]. see [Text]
73+
final Widget description;
74+
75+
/// The icon to display inside the [GFListTile]. see [Icon]
76+
final Widget icon;
77+
78+
/// defines the margin of GFListTile
79+
final EdgeInsets margin;
80+
81+
/// defines the padding of GFListTile
82+
final EdgeInsets padding;
83+
84+
/// Whether this list tile is interactive.
85+
///
86+
/// If false, this list tile is styled with the disabled color from the
87+
/// current [Theme] and the [onTap] and [onLongPress] callbacks are
88+
/// inoperative.
89+
final bool enabled;
90+
91+
/// Called when the user taps this list tile.
92+
///
93+
/// Inoperative if [enabled] is false.
94+
final GestureTapCallback onTap;
95+
96+
/// Called when the user long-presses on this list tile.
97+
///
98+
/// Inoperative if [enabled] is false.
99+
final GestureLongPressCallback onLongPress;
100+
101+
/// If this tile is also [enabled] then icons and text are rendered with the same color.
102+
///
103+
/// By default the selected color is the theme's primary color. The selected color
104+
/// can be overridden with a [ListTileTheme].
105+
final bool selected;
106+
107+
/// The color for the tile's [Material] when it has the input focus.
108+
final Color focusColor;
109+
110+
/// The color for the tile's [Material] when a pointer is hovering over it.
111+
final Color hoverColor;
112+
113+
/// {@macro flutter.widgets.Focus.focusNode}
114+
final FocusNode focusNode;
115+
116+
/// {@macro flutter.widgets.Focus.autofocus}
117+
final bool autofocus;
118+
119+
/// type of [GFRadioType] which is of four type is basic, sqaure, circular and custom
120+
final GFRadioType type;
121+
122+
/// type of [double] which is GFSize ie, small, medium and large and can use any double value
123+
final double size;
124+
125+
/// type pf [Color] used to change the checkcolor when the checkbox is active
126+
final Color radioColor;
127+
128+
/// type of [Color] used to change the backgroundColor of the active checkbox
129+
final Color activebgColor;
130+
131+
/// type of [Color] used to change the backgroundColor of the inactive checkbox
132+
final Color inactivebgColor;
35133

134+
/// type of [Color] used to change the border color of the active checkbox
135+
final Color activeBorderColor;
136+
137+
/// type of [Color] used to change the border color of the inactive checkbox
138+
final Color inactiveBorderColor;
139+
140+
/// Called when the user checks or unchecks the checkbox.
141+
final ValueChanged<T> onChanged;
142+
143+
// ///Used to set the current state of the checkbox
144+
// final bool value;
145+
//
146+
// /// The currently selected value for a group of radio buttons.
147+
// ///
148+
// /// This radio button is considered selected if its [value] matches the
149+
// /// [groupValue].
150+
// final bool groupValue;
151+
152+
///type of Widget used to change the checkbox's active icon
153+
final Widget activeIcon;
154+
155+
///type of [Widget] used to change the checkbox's inactive icon
156+
final Widget inactiveIcon;
157+
158+
/// type of [Color] used to change the background color of the custom active checkbox only
159+
final Color custombgColor;
160+
161+
/// The value represented by this radio button.
162+
final T value;
163+
164+
/// The currently selected value for a group of radio buttons.
165+
///
166+
/// This radio button is considered selected if its [value] matches the
167+
/// [groupValue].
168+
final T groupValue;
36169

170+
final bool toggleable;
37171

38172
/// Whether this radio button is checked.
39173
///

0 commit comments

Comments
 (0)