@@ -14,6 +14,7 @@ class GFRadioListTile<T> extends StatelessWidget {
1414 this .inactivebgColor = GFColors .WHITE ,
1515 this .activeBorderColor = GFColors .DARK ,
1616 this .inactiveBorderColor = GFColors .DARK ,
17+ this .position = GFPosition .end,
1718 this .activeIcon = const Icon (
1819 Icons .check,
1920 size: 20 ,
@@ -59,7 +60,7 @@ class GFRadioListTile<T> extends StatelessWidget {
5960 /// The GFListTile's background color. Can be given [Color] or [GFColors]
6061 final Color color;
6162
62- /// type of [Widget] or [GFAvatar] used to create rounded user profile
63+ /// If position is start Checkbox will come instead of avatar, type of [Widget] or [GFAvatar] used to create rounded user profile
6364 final Widget avatar;
6465
6566 /// The title to display inside the [GFListTile] . see [Text]
@@ -71,7 +72,7 @@ class GFRadioListTile<T> extends StatelessWidget {
7172 /// The description to display inside the [GFListTile] . see [Text]
7273 final Widget description;
7374
74- /// The icon to display inside the [GFListTile] . see [Icon]
75+ /// If position is end Checkbox will come instead of icon, The icon to display inside the [GFListTile] . see [Icon]
7576 final Widget icon;
7677
7778 /// defines the margin of GFListTile
@@ -92,6 +93,9 @@ class GFRadioListTile<T> extends StatelessWidget {
9293 /// Inoperative if [enabled] is false.
9394 final GestureTapCallback onTap;
9495
96+ /// Position allows user to set position of [GFCheckbox] based on given [GFPosition]
97+ final GFPosition position;
98+
9599 /// Called when the user long-presses on this list tile.
96100 ///
97101 /// Inoperative if [enabled] is false.
@@ -163,45 +167,48 @@ class GFRadioListTile<T> extends StatelessWidget {
163167 bool get checked => value == groupValue;
164168
165169 @override
166- Widget build (BuildContext context) => MergeSemantics (
167- child: GFListTile (
168- autofocus: autofocus,
169- enabled: onChanged != null ,
170- onTap: onChanged != null
171- ? () {
172- if (toggleable && checked) {
173- onChanged (null );
174- return ;
175- }
176- if (! checked) {
177- onChanged (value);
178- }
170+ Widget build (BuildContext context) {
171+ GFRadio radio = GFRadio (
172+ autofocus: autofocus,
173+ onChanged: onChanged,
174+ value: value,
175+ groupValue: groupValue,
176+ size: size,
177+ activebgColor: activebgColor,
178+ inactiveIcon: inactiveIcon,
179+ activeBorderColor: activeBorderColor,
180+ inactivebgColor: inactivebgColor,
181+ activeIcon: activeIcon,
182+ inactiveBorderColor: inactiveBorderColor,
183+ custombgColor: custombgColor,
184+ );
185+ return MergeSemantics (
186+ child: GFListTile (
187+ autofocus: autofocus,
188+ enabled: onChanged != null ,
189+ onTap: onChanged != null
190+ ? () {
191+ if (toggleable && checked) {
192+ onChanged (null );
193+ return ;
194+ }
195+ if (! checked) {
196+ onChanged (value);
179197 }
180- : null ,
181- selected: selected,
182- avatar: avatar,
183- titleText: titleText,
184- subTitle: subTitle,
185- subtitleText: subtitleText,
186- description: description,
187- color: color,
188- padding: padding,
189- margin: margin,
190- title: title,
191- icon: GFRadio (
192- autofocus: autofocus,
193- onChanged: onChanged,
194- value: value,
195- groupValue: groupValue,
196- size: size,
197- activebgColor: activebgColor,
198- inactiveIcon: inactiveIcon,
199- activeBorderColor: activeBorderColor,
200- inactivebgColor: inactivebgColor,
201- activeIcon: activeIcon,
202- inactiveBorderColor: inactiveBorderColor,
203- custombgColor: custombgColor,
204- ),
205- ),
206- );
198+ }
199+ : null ,
200+ selected: selected,
201+ avatar: position == GFPosition .start ? radio : avatar,
202+ titleText: titleText,
203+ subTitle: subTitle,
204+ subtitleText: subtitleText,
205+ description: description,
206+ color: color,
207+ padding: padding,
208+ margin: margin,
209+ title: title,
210+ icon: position == GFPosition .end ? radio : icon,
211+ ),
212+ );
213+ }
207214}
0 commit comments