import 'package:electronic_assistant/data/bean/agenda_list_all_bean.dart'; import 'package:electronic_assistant/utils/expand.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import '../../data/bean/agenda.dart'; import '../../resource/assets.gen.dart'; import '../../resource/colors.gen.dart'; import '../../resource/string.gen.dart'; Widget getTalkLoadingView() { return SizedBox( width: double.infinity, child: Column( children: [ SizedBox(height: 138.h), SizedBox( width: 100.w, height: 100.w, child: Assets.anim.talkAnalyse.image()), SizedBox(height: 12.h), Text(StringName.talkAnalyzing.tr, style: TextStyle(fontSize: 14.sp, color: ColorName.secondaryTextColor)) ], ), ); } Widget getTalkFailView() { return SizedBox( width: double.infinity, child: Column( children: [ SizedBox(height: 111.h), SizedBox( width: 100.w, height: 100.w, child: Assets.images.iconTalkAnalyseFail.image()), SizedBox(height: 4.h), Text(StringName.talkAnalyseFail.tr, style: TextStyle(fontSize: 15.sp, color: ColorName.primaryTextColor)), SizedBox(height: 2.h), ], ), ); } typedef TodoItemBuilder = List Function(List? list); Widget getTodoItemView(AgendaListAllBean agenda, TodoItemBuilder builder) { return Container( decoration: BoxDecoration( color: ColorName.colorPrimary, borderRadius: BorderRadius.circular(6), ), child: Builder(builder: (context) { return Theme( data: Theme.of(context).copyWith( splashFactory: NoSplash.splashFactory, ), child: Container( margin: EdgeInsets.only(left: 4.w), decoration: BoxDecoration( color: "#F6F5F8".toColor(), borderRadius: const BorderRadius.only( topRight: Radius.circular(6), bottomRight: Radius.circular(6), ), ), child: ExpansionTile( onExpansionChanged: (value) { agenda.isExpanded.value = value; }, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(4.0), side: const BorderSide(color: Colors.transparent), ), collapsedShape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(4.0), side: const BorderSide(color: Colors.transparent), ), minTileHeight: 46.h, showTrailingIcon: false, childrenPadding: EdgeInsets.zero, tilePadding: EdgeInsets.zero, title: Row( children: [ SizedBox(width: 12.w), Text(agenda.name.orEmpty, style: TextStyle( fontSize: 15.sp, color: ColorName.primaryTextColor, fontWeight: FontWeight.bold)), const Spacer(), Obx(() { return Row( children: [ Text( '${agenda.list?.length}${StringName.talkTodoItem.tr}', style: TextStyle( fontSize: 15.sp, color: ColorName.secondaryTextColor), ), SizedBox(width: 3.w), SizedBox( width: 16.w, height: 16.w, child: agenda.isExpanded.value ? Assets.images.iconTalkExpand.image() : Assets.images.iconTalkCollapse.image()), ], ); }), SizedBox(width: 12.w), ], ), children: builder(agenda.list), ), ), ); }), ); } typedef TodoItemClick = void Function(Agenda? agenda); List getTalkAgendaSettingList(List? list, {TodoItemClick? itemClick}) { return list?.map((agenda) { return Padding( padding: EdgeInsets.only(left: 12.w, right: 12.w, top: 2.h, bottom: 10.h), child: Row( crossAxisAlignment: CrossAxisAlignment.center, children: [ Expanded( child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( width: 8.w, height: 8.w, margin: EdgeInsets.only(top: 7.h), decoration: BoxDecoration( color: ColorName.colorPrimary.withOpacity(0.5), shape: BoxShape.circle, ), ), SizedBox(width: 4.w), Expanded( child: Text(agenda.content.orEmpty, style: TextStyle( fontSize: 14.sp, color: ColorName.primaryTextColor)), ), ]), ), SizedBox(width: 20.w), GestureDetector( onTap: () { itemClick?.call(agenda); }, child: Obx(() { return Container( decoration: BoxDecoration( color: agenda.isSetMine.value ? "#E7E9F6".toColor() : ColorName.colorPrimary, borderRadius: BorderRadius.circular(6), ), padding: EdgeInsets.symmetric(horizontal: 9.w, vertical: 5.w), child: Text( agenda.isSetMine.value ? StringName.talkTodoCancelMine.tr : StringName.talkTodoSetMine.tr, style: TextStyle( fontSize: 13.sp, color: agenda.isSetMine.value ? ColorName.colorPrimary : Colors.white), ), ); }), ) ], ), ); }).toList() ?? []; } List getTalkAgendaNormalList(List? list) { return list?.map((agenda) { return Padding( padding: EdgeInsets.only(left: 12.w, right: 12.w, top: 2.h, bottom: 10.h), child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( width: 8.w, height: 8.w, margin: EdgeInsets.only(top: 7.h), decoration: BoxDecoration( color: ColorName.colorPrimary.withOpacity(0.5), shape: BoxShape.circle, ), ), SizedBox(width: 4.w), Expanded( child: Text(agenda.content.orEmpty, style: TextStyle( fontSize: 14.sp, color: ColorName.primaryTextColor)), ), ], ), ); }).toList() ?? []; }