common_view.dart 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. import 'package:electronic_assistant/data/bean/agenda_list_all_bean.dart';
  2. import 'package:electronic_assistant/data/bean/talk_info.dart';
  3. import 'package:electronic_assistant/dialog/rename_dialog.dart';
  4. import 'package:electronic_assistant/utils/expand.dart';
  5. import 'package:flutter/cupertino.dart';
  6. import 'package:flutter/material.dart';
  7. import 'package:flutter_screenutil/flutter_screenutil.dart';
  8. import 'package:get/get.dart';
  9. import '../../data/bean/agenda.dart';
  10. import '../../resource/assets.gen.dart';
  11. import '../../resource/colors.gen.dart';
  12. import '../../resource/string.gen.dart';
  13. Widget getTalkLoadingView() {
  14. return SizedBox(
  15. width: double.infinity,
  16. child: Column(
  17. children: [
  18. SizedBox(height: 138.h),
  19. SizedBox(
  20. width: 100.w,
  21. height: 100.w,
  22. child: Assets.anim.talkAnalyse.image()),
  23. SizedBox(height: 12.h),
  24. Text(StringName.talkAnalyzing.tr,
  25. style:
  26. TextStyle(fontSize: 14.sp, color: ColorName.secondaryTextColor))
  27. ],
  28. ),
  29. );
  30. }
  31. Widget getTalkFailView() {
  32. return SizedBox(
  33. width: double.infinity,
  34. child: Column(
  35. children: [
  36. SizedBox(height: 111.h),
  37. SizedBox(
  38. width: 100.w,
  39. height: 100.w,
  40. child: Assets.images.iconTalkAnalyseFail.image()),
  41. SizedBox(height: 4.h),
  42. Text(StringName.talkAnalyseFail.tr,
  43. style:
  44. TextStyle(fontSize: 15.sp, color: ColorName.primaryTextColor)),
  45. SizedBox(height: 2.h),
  46. ],
  47. ),
  48. );
  49. }
  50. Widget getTodoItemView(AgendaListAllBean agenda) {
  51. return Container(
  52. decoration: BoxDecoration(
  53. color: ColorName.colorPrimary,
  54. borderRadius: BorderRadius.circular(6),
  55. ),
  56. child: Builder(builder: (context) {
  57. return Theme(
  58. data: Theme.of(context).copyWith(
  59. splashFactory: NoSplash.splashFactory,
  60. ),
  61. child: Container(
  62. margin: EdgeInsets.only(left: 4.w),
  63. decoration: BoxDecoration(
  64. color: "#F6F5F8".toColor(),
  65. borderRadius: const BorderRadius.only(
  66. topRight: Radius.circular(6),
  67. bottomRight: Radius.circular(6),
  68. ),
  69. ),
  70. child: ExpansionTile(
  71. onExpansionChanged: (value) {
  72. agenda.isExpanded.value = value;
  73. },
  74. shape: RoundedRectangleBorder(
  75. borderRadius: BorderRadius.circular(4.0),
  76. side: const BorderSide(color: Colors.transparent),
  77. ),
  78. collapsedShape: RoundedRectangleBorder(
  79. borderRadius: BorderRadius.circular(4.0),
  80. side: const BorderSide(color: Colors.transparent),
  81. ),
  82. minTileHeight: 46.h,
  83. showTrailingIcon: false,
  84. childrenPadding: EdgeInsets.zero,
  85. tilePadding: EdgeInsets.zero,
  86. title: Row(
  87. children: [
  88. SizedBox(width: 12.w),
  89. Text(agenda.name.orEmpty,
  90. style: TextStyle(
  91. fontSize: 15.sp,
  92. color: ColorName.primaryTextColor,
  93. fontWeight: FontWeight.bold)),
  94. const Spacer(),
  95. Obx(() {
  96. return Row(
  97. children: [
  98. Text(
  99. '${agenda.list?.length}${StringName.talkTodoItem.tr}',
  100. style: TextStyle(
  101. fontSize: 15.sp,
  102. color: ColorName.secondaryTextColor),
  103. ),
  104. SizedBox(width: 3.w),
  105. SizedBox(
  106. width: 16.w,
  107. height: 16.w,
  108. child: agenda.isExpanded.value
  109. ? Assets.images.iconTalkExpand.image()
  110. : Assets.images.iconTalkCollapse.image()),
  111. ],
  112. );
  113. }),
  114. SizedBox(width: 12.w),
  115. ],
  116. ),
  117. children: getTalkAgendaList(agenda.list),
  118. ),
  119. ),
  120. );
  121. }),
  122. );
  123. }
  124. List<Widget> getTalkAgendaList(List<Agenda>? list) {
  125. return list?.map((agenda) {
  126. return Padding(
  127. padding:
  128. EdgeInsets.only(left: 12.w, right: 12.w, top: 2.h, bottom: 10.h),
  129. child: buildTalkNormalAgendaItem(agenda),
  130. );
  131. }).toList() ??
  132. [];
  133. }
  134. Widget buildTalkNormalAgendaItem(Agenda agenda) {
  135. return Row(
  136. crossAxisAlignment: CrossAxisAlignment.start,
  137. children: [
  138. Container(
  139. width: 8.w,
  140. height: 8.w,
  141. margin: EdgeInsets.only(top: 7.h),
  142. decoration: BoxDecoration(
  143. color: ColorName.colorPrimary.withOpacity(0.5),
  144. shape: BoxShape.circle,
  145. ),
  146. ),
  147. SizedBox(width: 4.w),
  148. Expanded(
  149. child: Text(agenda.content.orEmpty,
  150. style:
  151. TextStyle(fontSize: 14.sp, color: ColorName.primaryTextColor)),
  152. )
  153. ],
  154. );
  155. }