radio_item.dart 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. import 'package:flutter/material.dart';
  2. import 'package:liftmanager/widgets/load_image.dart';
  3. class RadioItem extends StatelessWidget {
  4. const RadioItem({
  5. Key key,
  6. this.onTap,
  7. @required this.title,
  8. @required this.value,
  9. @required this.groupValue,
  10. }): super(key: key);
  11. final GestureTapCallback onTap;
  12. final String title;
  13. final String value;
  14. final String groupValue;
  15. @override
  16. Widget build(BuildContext context) {
  17. return InkWell(
  18. onTap: onTap,
  19. child: Container(
  20. padding: const EdgeInsets.only(left: 15),
  21. constraints: BoxConstraints(
  22. maxHeight: double.infinity,
  23. minHeight: 50.0
  24. ),
  25. width: double.infinity,
  26. decoration: BoxDecoration(
  27. color: Colors.white,
  28. border: Border(
  29. bottom: Divider.createBorderSide(context, width: 0.6),
  30. )
  31. ),
  32. child: Row(
  33. children: <Widget>[
  34. Expanded(
  35. flex: 1,
  36. child: Padding(
  37. padding: const EdgeInsets.only(right: 5.0),
  38. child: Text(title),
  39. ),
  40. ),
  41. value == groupValue
  42. ? LoadAssetImage(
  43. "icon_check_selected",
  44. width: 17,
  45. height: 17,
  46. )
  47. : LoadAssetImage(
  48. "icon_check_defult",
  49. width: 17,
  50. height: 17,
  51. ),
  52. SizedBox(width: 10,)
  53. // value == groupValue
  54. // ? Image.asset("(点击后的图片)", width: 15, height: 15)
  55. // : Image.asset("(未点击的图片)",width: 15, height: 15)
  56. // Radio(
  57. // value: value,
  58. // groupValue: groupValue,
  59. // activeColor: Colors.red,
  60. // focusColor:Colors.red,
  61. // // onChanged: (res){
  62. // // print("3333${res}");
  63. // // },
  64. // )
  65. ],
  66. ),
  67. ),
  68. );
  69. }
  70. }