unselected_options.dart 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. import 'package:flutter/material.dart';
  2. import 'package:liftmanager/internal/maintenance/model/maintenance_options_item.dart';
  3. import 'package:liftmanager/res/colors.dart';
  4. import 'package:liftmanager/utils/theme_utils.dart';
  5. import 'package:liftmanager/widgets/options_item.dart';
  6. class UnSelectedOptions extends StatefulWidget {
  7. List<MaintenanceOptionsItem> mList;
  8. int groupValue = 1;
  9. UnSelectedOptions(this.mList);
  10. @override
  11. State<StatefulWidget> createState() {
  12. return MRDialogState();
  13. }
  14. }
  15. class MRDialogState extends State<UnSelectedOptions> {
  16. ///评价方式
  17. void updateGroupValue(int v) {
  18. setState(() {
  19. widget.groupValue = v;
  20. });
  21. }
  22. void allSelectedAction() {
  23. for (int i = 0; i < widget.mList.length; i++) {
  24. widget.mList[i].status = 1;
  25. }
  26. setState(() {});
  27. }
  28. @override
  29. Widget build(BuildContext context) {
  30. bool isDark = ThemeUtils.isDark(context);
  31. return Container(
  32. color: isDark?Colours.dark_bg_gray:Colors.white,
  33. width: 295,
  34. height: 380,
  35. child: Column(
  36. children: <Widget>[
  37. Row(
  38. children: <Widget>[
  39. Expanded(
  40. flex: 1,
  41. child: Text('以下选项未被选择',
  42. style: TextStyle(
  43. fontSize: 14,
  44. color: Color(0xFF1A1A1A),
  45. fontWeight: FontWeight.w500)),
  46. ),
  47. GestureDetector(
  48. onTap: () {
  49. allSelectedAction();
  50. },
  51. child: Text(
  52. "全选",
  53. style: TextStyle(
  54. fontSize: 14,
  55. color: Colours.app_main,
  56. fontWeight: FontWeight.w500),
  57. ),
  58. ),
  59. SizedBox(
  60. width: 5,
  61. ),
  62. ],
  63. ),
  64. SizedBox(
  65. height: 10,
  66. ),
  67. Container(
  68. padding: EdgeInsets.only(top: 10, bottom: 10),
  69. decoration: BoxDecoration(
  70. color: isDark?Colours.dark_bg_gray:Colors.white,
  71. borderRadius: BorderRadius.circular(3),
  72. border: Border.all(width: 0.5, color: Color(0xFFE5E5E5))),
  73. height: 306,
  74. child: ListView.separated(
  75. shrinkWrap: true,
  76. scrollDirection: Axis.vertical,
  77. itemBuilder: (context, index) => OptionsItem(
  78. title: "${widget.mList[index].item}",
  79. content: "${widget.mList[index].content}",
  80. value: widget.mList[index].status,
  81. onTap: (s) {
  82. print("${s}");
  83. setState(() {
  84. widget.mList[index].status = s;
  85. });
  86. },
  87. ),
  88. separatorBuilder: (BuildContext context, int index) {
  89. return Container(
  90. height: 0.5,
  91. color: Color(0xFFF5F5F5),
  92. );
  93. },
  94. physics: AlwaysScrollableScrollPhysics(),
  95. itemCount: widget.mList.length,
  96. ),
  97. ),
  98. ],
  99. ),
  100. );
  101. }
  102. }