123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314 |
- import 'dart:ui';
- import 'package:cs_resources/generated/assets.dart';
- import 'package:domain/entity/response/job_list_remark_view_entity.dart';
- import 'package:flutter/cupertino.dart';
- import 'package:flutter/material.dart';
- import 'package:flutter/widgets.dart';
- import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
- import 'package:get/get.dart';
- import 'package:plugin_platform/engine/toast/toast_engine.dart';
- import 'package:shared/utils/util.dart';
- import 'package:widgets/ext/ex_widget.dart';
- import 'package:cs_resources/constants/color_constants.dart';
- import 'package:widgets/my_text_view.dart';
- import 'package:widgets/shatter/rating_widget.dart';
- import 'package:widgets/widget_export.dart';
- /**
- * 员工的评价弹窗
- */
- class AppliedStaffReviews extends StatefulWidget {
- JobListRemarkViewEntity appliedReviews;
- void Function(String attitudeRate, String performanceRate, String experienceRate, String groomingRate, String content)? confirmAction;
- AppliedStaffReviews({required this.appliedReviews, this.confirmAction});
- @override
- State<AppliedStaffReviews> createState() => _AppliedStaffReviewsState();
- }
- class _AppliedStaffReviewsState extends State<AppliedStaffReviews> {
- late JobListRemarkViewEntity reviews;
- late String attitudeRate;
- late String groomingRate;
- late String performanceRate;
- late String experienceRate;
- late String content;
- late TextEditingController _controller;
- late FocusNode _focusNode;
- @override
- void initState() {
- super.initState();
- _controller = TextEditingController();
- _focusNode = FocusNode();
- reviews = widget.appliedReviews;
- attitudeRate = reviews.attitudeRate.toString();
- groomingRate = reviews.groomingRate.toString();
- performanceRate = reviews.performanceRate.toString();
- experienceRate = reviews.experienceRate.toString();
- _controller.text = reviews.content ?? "";
- }
- @override
- Widget build(BuildContext context) {
- return Column(
- crossAxisAlignment: CrossAxisAlignment.center,
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- //Title (如果使用 Container 为最外层容器则默认为 match_parent 的效果,除非我们限制宽度和最大高度最小高度)
- Container(
- width: double.infinity,
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: const BorderRadius.all(Radius.circular(15)),
- ),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Center(
- child: MyTextView(
- "Remarks".tr,
- fontSize: 19,
- isFontMedium: true,
- textColor: ColorConstants.black,
- marginTop: 23,
- marginBottom: 19,
- marginLeft: 22,
- marginRight: 22,
- ),
- ),
- MyTextView(
- reviews.memberName ?? "",
- isFontRegular: true,
- textColor: Colors.black,
- marginLeft: 22,
- marginRight: 22,
- fontSize: 17,
- ),
- //态度评分
- Row(
- children: [
- MyTextView(
- "Attitude".tr,
- isFontRegular: true,
- textColor: ColorConstants.black66,
- fontSize: 15,
- ).expanded(),
- RatingWidget(
- nomalImage: Assets.baseServiceRatingUnselected,
- selectImage: Assets.baseServiceRatingSelected,
- size: 21,
- padding: 5,
- selectAble: Utils.isEmpty(reviews.content),
- integerOnly: true,
- value: reviews.attitudeRate,
- onRatingUpdate: (value) {
- attitudeRate = value;
- },
- )
- ],
- ).marginOnly(top: 15, left: 22, right: 22),
- //表现评分
- Row(
- children: [
- MyTextView(
- "Performance".tr,
- isFontRegular: true,
- textColor: ColorConstants.black66,
- fontSize: 15,
- ).expanded(),
- RatingWidget(
- nomalImage: Assets.baseServiceRatingUnselected,
- selectImage: Assets.baseServiceRatingSelected,
- size: 21,
- padding: 5,
- selectAble: Utils.isEmpty(reviews.content),
- integerOnly: true,
- value: reviews.performanceRate,
- onRatingUpdate: (value) {
- performanceRate = value;
- },
- )
- ],
- ).marginOnly(top: 15, left: 22, right: 22),
- //经验评分
- Row(
- children: [
- MyTextView(
- "Experience".tr,
- isFontRegular: true,
- textColor: ColorConstants.black66,
- fontSize: 15,
- ).expanded(),
- RatingWidget(
- nomalImage: Assets.baseServiceRatingUnselected,
- selectImage: Assets.baseServiceRatingSelected,
- size: 21,
- padding: 5,
- selectAble: Utils.isEmpty(reviews.content),
- integerOnly: true,
- value: reviews.experienceRate,
- onRatingUpdate: (value) {
- experienceRate = value;
- },
- )
- ],
- ).marginOnly(top: 15, left: 22, right: 22),
- //着装评分
- Row(
- children: [
- MyTextView(
- "Grooming".tr,
- isFontRegular: true,
- textColor: ColorConstants.black66,
- fontSize: 15,
- ).expanded(),
- RatingWidget(
- nomalImage: Assets.baseServiceRatingUnselected,
- selectImage: Assets.baseServiceRatingSelected,
- size: 21,
- padding: 5,
- selectAble: Utils.isEmpty(reviews.content),
- integerOnly: true,
- value: reviews.groomingRate,
- onRatingUpdate: (value) {
- groomingRate = value;
- },
- )
- ],
- ).marginOnly(top: 15, left: 22, right: 22),
- IgnoreKeyboardDismiss(
- child: Container(
- height: 130,
- margin: EdgeInsets.symmetric(vertical: 19, horizontal: 22),
- padding: EdgeInsets.symmetric(vertical: 15, horizontal: 15),
- decoration: BoxDecoration(
- color: Color(0xFFF0F0F0),
- border: Border.all(
- color: Color(0xFFD8D8D8),
- width: 0.5,
- ),
- ),
- child: TextField(
- cursorColor: ColorConstants.black66,
- cursorWidth: 1.5,
- autofocus: false,
- enabled: Utils.isEmpty(reviews.content),
- focusNode: _focusNode,
- controller: _controller,
- // 装饰
- decoration: InputDecoration(
- isDense: true,
- isCollapsed: true,
- border: InputBorder.none,
- hintText: "Enter...".tr,
- hintStyle: TextStyle(
- color: ColorConstants.black66,
- fontSize: 15.0,
- fontWeight: FontWeight.w400,
- ),
- ),
- style: TextStyle(
- color: ColorConstants.black,
- fontSize: 15.0,
- fontWeight: FontWeight.w400,
- ),
- // 键盘动作右下角图标
- textInputAction: TextInputAction.done,
- onSubmitted: (value) {
- doCallbackAction();
- },
- ),
- ),
- ),
- // 分割线
- Container(
- color: Color(0XFFCECECE),
- height: 0.5,
- ),
- //按钮组
- Row(
- children: [
- Expanded(
- flex: 1,
- child: InkWell(
- onTap: () {
- onCancel();
- },
- child: MyTextView(
- "Cancel".tr,
- fontSize: 17.5,
- isFontMedium: true,
- textAlign: TextAlign.center,
- textColor: Color(0XFF0085C4),
- cornerRadius: 3,
- borderWidth: 1,
- ),
- )),
- Container(
- color: Color(0xff09141F).withOpacity(0.13),
- width: 0.5,
- ),
- Expanded(
- flex: 1,
- child: InkWell(
- onTap: () {
- doCallbackAction();
- },
- child: MyTextView(
- "Submit".tr,
- marginLeft: 10,
- fontSize: 17.5,
- isFontMedium: true,
- textAlign: TextAlign.center,
- textColor: Color(0XFF0085C4),
- cornerRadius: 3,
- ),
- )),
- ],
- ).constrained(height: 46),
- ],
- ),
- ),
- ],
- ).constrained(width: 285);
- }
- //取消弹框
- void onCancel() async {
- SmartDialog.dismiss();
- }
- //执行回调
- void doCallbackAction() {
- _focusNode.unfocus();
- content = _controller.text.toString();
- if (attitudeRate == "0" || experienceRate == "0" || performanceRate == "0" || groomingRate == "0") {
- ToastEngine.show("Rate First");
- return;
- }
- if (Utils.isEmpty(content)) {
- ToastEngine.show("Please Enter Remark".tr);
- return;
- }
- onCancel();
- widget.confirmAction?.call(attitudeRate, performanceRate, experienceRate, groomingRate, content);
- }
- }
|