radio_item.dart 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import 'package:flutter/material.dart';
  2. import 'package:liftmanager/utils/theme_utils.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. bool isDark = ThemeUtils.isDark(context);
  18. return InkWell(
  19. onTap: onTap,
  20. child: Container(
  21. padding: const EdgeInsets.only(left: 15),
  22. constraints: BoxConstraints(
  23. maxHeight: double.infinity,
  24. minHeight: 50.0
  25. ),
  26. width: double.infinity,
  27. decoration: BoxDecoration(
  28. color: isDark?Colors.black:Colors.white,
  29. border: Border(
  30. bottom: Divider.createBorderSide(context, width: 0.6),
  31. )
  32. ),
  33. child: Row(
  34. children: <Widget>[
  35. Expanded(
  36. flex: 1,
  37. child: Padding(
  38. padding: const EdgeInsets.only(right: 5.0),
  39. child: Text(title),
  40. ),
  41. ),
  42. Radio(
  43. value: value,
  44. groupValue: groupValue,
  45. activeColor: Colors.red,
  46. // onChanged: (res){
  47. // print("3333${res}");
  48. // },
  49. )
  50. ],
  51. ),
  52. ),
  53. );
  54. }
  55. }