Flutter RadioListTile – A widget that has ListTile and a radio button in a row

Flutter RadioListTile basically contains a single row that has a title, subtitle, and a trailing radio button. It is a ListTile that contains a radio button

‌Flutter RadioListTile Widget

Flutter RadioListTile displays a title, subtitle, or description and a radio button horizontally. It allows the user to choose only one option from the list. The suffix radio button is mainly defined through the trailing parameter.

By default, Flutter RadioListTile can show two lines of text. The title and the subtitle. As the first line of text is not optional but the second line of text or the subtitle is optional. The texture of the leading and trailing widgets can be modified according to the properties given.

So, are you ready to make use of this widget package in the Flutter application? If so, then let’s quickly jump into the usage and the ways a RadioListTile can be modified and used to make user-friendly apps. Here I am going to use an open-source UI Library known as GetWidget to build this RadioListTile widget in Flutter.

GetWidget RadioListTile

GFRadioListtile is a Flutter RadioListTile. In this widget, we can design a title, subtitle, and that has a trailing radio button widget. It has customization options which is an easy way to handle it as per the application and its requirement. The GetWidget RadioListTile displays the list of items in a card fashion.

How to Start:

Now here is the guide about how we should start developing the GFRadioListTile Widget with the use of the GetWidget UI Library.

Getting started will guide you on how to start building a beautiful flutter application with the GetWidget UI library. You have to install the package from pub.dev, import the package in your Flutter project.

Install Package from pub.dev :

https://pub.dev/packages/getwidget

Import full package:

import ‘package:getwidget/getwidget.dart’;

Note: dependencies: getwidget: ^ 2.0.4

Keep playing with the pre-built UI components.

GFRadioListTile is a Flutter RadioBoxListTile that has a list of items wherein the user can check or uncheck only one item in the list at a time. GFRadioBoxListTile can also be positioned right or left of the screen according to the need. The below code gives a simple example with an avatar on the left side as shown in the below image.

import 'package:getwidget/getwidget.dart';
int groupValue = 0;
GFRadioListTile(
  titleText: 'GetWidget Library',
  subTitleText: 'This is a open source UI library.',
  avatar: GFAvatar(
    backgroundImage: AssetImage('Assets image here'),
  ),
  size: 25,
  activeBorderColor: Colors.green,
  focusColor: Colors.green,
  type: GFRadioType.square,
  value: 0,
  groupValue: groupValue,
  onChanged: (value) {
    setState(() {
      groupValue = value;
    });
  },
  inactiveIcon: null,
),
GFRadioListTile(
  titleText: 'GetWidget Library',
  subtitleText: 'This is a open source UI library.',
  avatar: GFAvatar(
    backgroundImage: AssetImage('Assets image here'),
  ),
  size: 25,
  activeBorderColor: Colors.green,
  focusColor: Colors.green,
  type: GFRadioType.square,
  value: 1,
  groupValue: groupValue,
  onChanged: (value) {
    setState(() {
      groupValue = value;
    });
  },
  inactiveIcon: null,
),

GFRadioListTile Custom Properties

The look and feel of the GFRadioListTile can be customized using the GFRadioListTile properties.

NameDescription
typetype of [GFRadioType] which is of four types is basic, suaure, circular, and custom
sizetype of [double] which is GFSize ie, small, medium, and large and can use any double value
radioColortype pf [Color] used to change the checkcolor when the radio button is active
activeBgColortype of [Color] used to change the backgroundColor of the active radio button
inactiveBgColortype of [Color] used to change the backgroundColor of the inactive radio button
activeBorderColortype of [Color] used to change the border color of the active radio button
inactiveBorderColortype of [Color] used to change the border color of the inactive radio button
onChangedCalled when the user checks or unchecks the radio button
positionallows the user to set the position of the radiobutton to start or end
activeIcontype of Widget used to change the radio button’s active icon
inactiveIcontype of [Widget] used to change the radio button’s inactive icon
customBgColortype of [Color] used to change the background color of the custom active radio button only
autofocuson true state, this widget will be selected as the initial focus when no other node in its scope is currently focused
focusNodean optional focus node to use as the focus node for this widget.
valueThe value represented by this radio button.
groupValueThe currently selected value for a group of radio buttons. Radio button is considered selected if its [value] matches the [groupValue].
toggleablesets the radio value
titleTexttype of [String] used to pass text, alternative to title property and gets higher priority than the title
subTitleTexttype of [String] used to pass text, alternative to subtitle property and gets higher priority than the subtitle
colorThe GFListTile’s background color. Can be given [Color] or [GFColors]
avatartype of [Widget] or [GFAvatar] used to create a rounded user profile
titleThe title to display inside the [GFListTile].
subTitleThe subtitle to display inside the [GFListTile].
descriptionThe description to display inside the [GFListTile].
iconThe icon to display inside the [GFListTile].
margindefines the margin of GFListTile
paddingdefines the padding of GFListTile
enabled

Whether this list tile is interactive. If false, this list tile is styled with the disabled color from the current [Theme] and the [onTap] and [onLongPress] callbacks are

inoperative.

onTapCalled when the user taps this list tile. Inoperative if [enabled] is false.
onLongPressCalled when the user long-presses on this list tile. Inoperative if [enabled] is false.
selected

If this tile is also [enabled] then icons and text are rendered with the same color.

By default the selected color is the theme’s primary color. The selected color can be overridden with a [ListTileTheme].

focusColorThe color for the tile’s [Material] when it has the input focus.
hoverColorThe color for the tile’s [Material] when a pointer is hovering over it.

Getting Started
GetWidget is a Flutter open-source library that comes with pre-build 1000+ UI components. The library is built to make flutter development faster and more enjoyable.

How RadioListTile is different from ListTile?

Both ListTile and RadioListTile are having almost similar properties. We mostly use RadioListTile in those sections where we are having a list of options among them we can select one but in the case of ListTile it is not mandatory to use the radio button for any selection, we can simply use this to display any data with a card fashion.

Can we change the background color of RadioListTile?

We can change the background color by using the color property. Also, we can change the active and inactive background colors.

How can we change the position of radio button in RadioListTile?

We can alter the position by using the position property. It can be to either left or right side of the screen.

Flutter Get Widget Docs

Flutter GetWidget Docs
Get Widget is one of the largest Flutter open-source UI Kit libraries for mobile or web apps. It has more than 1000+ pre-built reusable widgets.

Flutter Forum:

if any Find any questions let’s discuss them on Forum.

GetWidget- A Flutter Developer Forum
Flutter largest Open-Source Flutter UI Library with in-built widgets.

GitHub Repository:

Please do appreciate our work through Github start

GitHub – ionicfirebaseapp/getwidget: Most popular and easy to use open source UI library with 1000+ Widgets to build flutter app.
Most popular and easy to use open source UI library with 1000+ Widgets to build flutter app. – GitHub – ionicfirebaseapp/getwidget: Most popular and easy to use open source UI library with 1000+ W…

Conclusion:

Here we discuss, what Flutter RadioListTile Widget is? And how we can use and implement it into our Flutter app through the GetWidget RadioListTile component. Here, there are options to customize the RadioListTile Button.

About Our Team:

We have been working on Flutter since Flutter launched in beta version in 2017. And our team have been putting hundreds and hundreds of hour to experiment and implementation of Flutter. As well as after successful delivery of enterprise and SAAS applications that have been used by more than 500+ businesses around the 119+ countries. Now we are in love with Flutter development and we are very passionate about Flutter development. Now it is something we are trying to give a small contribution to the Flutter Dev Community.