radio_item.dart 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import 'package:flutter/material.dart';
  2. class RadioItem extends StatelessWidget {
  3. const RadioItem({
  4. Key key,
  5. this.onTap,
  6. @required this.title,
  7. @required this.value,
  8. @required this.groupValue,
  9. }): super(key: key);
  10. final GestureTapCallback onTap;
  11. final String title;
  12. final String value;
  13. final String groupValue;
  14. @override
  15. Widget build(BuildContext context) {
  16. return InkWell(
  17. onTap: onTap,
  18. child: Container(
  19. padding: const EdgeInsets.only(left: 15),
  20. constraints: BoxConstraints(
  21. maxHeight: double.infinity,
  22. minHeight: 50.0
  23. ),
  24. width: double.infinity,
  25. decoration: BoxDecoration(
  26. color: Colors.white,
  27. border: Border(
  28. bottom: Divider.createBorderSide(context, width: 0.6),
  29. )
  30. ),
  31. child: Row(
  32. children: <Widget>[
  33. Expanded(
  34. flex: 1,
  35. child: Padding(
  36. padding: const EdgeInsets.only(right: 5.0),
  37. child: Text(title),
  38. ),
  39. ),
  40. Radio(
  41. value: value,
  42. groupValue: groupValue,
  43. activeColor: Colors.red,
  44. // onChanged: (res){
  45. // print("3333${res}");
  46. // },
  47. )
  48. ],
  49. ),
  50. ),
  51. );
  52. }
  53. }