Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set Radio button in RadioButtonListTile at the right in flutter

Tags:

flutter

dart

I have the below RadioButtonListTile as the below code:

import 'package:flutter/material.dart';
import 'package:getxflutter/helper/enum.dart';

class DeliveryTypesRadioListTile extends StatelessWidget {
  final dynamic value;
  final dynamic groupValue;
  final Function onChanged;
  final Widget title;
  final Widget subtitle;
  final Color activeColor;

  const DeliveryTypesRadioListTile({
    Key key,
    @required this.value,
    @required this.groupValue,
    @required this.onChanged,
    @required this.title,
    @required this.subtitle,
    @required this.activeColor,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return RadioListTile<Delivery>(
      value: value,
      groupValue: groupValue,
      onChanged: onChanged,
      title: title,
      subtitle: subtitle,
      activeColor: activeColor,
    );
  }
}

and It shows like this picture:

enter image description here

So is it able to make the radio button shows at the right as the below picture:

enter image description here

like image 542
Try to Dev Avatar asked Oct 16 '25 16:10

Try to Dev


1 Answers

Try adding controlAffinity: ListTileControlAffinity.trailing to your RadioListTile

Something like this:

return RadioListTile<Delivery>(
      value: value,
      groupValue: groupValue,
      onChanged: onChanged,
      title: title,
      subtitle: subtitle,
      activeColor: activeColor,
      controlAffinity: ListTileControlAffinity.trailing,
    );
like image 91
kforjan Avatar answered Oct 18 '25 07:10

kforjan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!