提交 047a73da authored 作者: maodou's avatar maodou

订单评价

上级 54488db0
...@@ -3,10 +3,11 @@ part of user_order_evaluate; ...@@ -3,10 +3,11 @@ part of user_order_evaluate;
/// 订单评价 /// 订单评价
class UserOrderEvaluateController extends GetxController { class UserOrderEvaluateController extends GetxController {
OrderInfoModel orderInfoModel; late OrderInfoModel orderInfoModel = OrderInfoModel();
String orderNum; String orderNum;
UserOrderEvaluateController(this.orderNum,this.orderInfoModel); // 已完成订单 UserOrderEvaluateController(this.orderNum); // 已完成订单
final TextEditingController commentsInput = TextEditingController();
final FocusNode _focusNode = FocusNode();
// 按钮是否可用 // 按钮是否可用
bool _enable = false; bool _enable = false;
bool get enable => _enable; bool get enable => _enable;
...@@ -33,8 +34,8 @@ class UserOrderEvaluateController extends GetxController { ...@@ -33,8 +34,8 @@ class UserOrderEvaluateController extends GetxController {
} }
} }
void setCanClick(num double){ void setCanClick({num double=0}){
if (double > 0){ if (double > 0 || commentsInput.text!=''){
_enable = true; _enable = true;
} }
else{ else{
...@@ -42,4 +43,11 @@ class UserOrderEvaluateController extends GetxController { ...@@ -42,4 +43,11 @@ class UserOrderEvaluateController extends GetxController {
} }
update(); update();
} }
@override
void onClose() {
commentsInput.dispose();
_focusNode.dispose();
super.onClose();
}
} }
...@@ -433,4 +433,159 @@ class CustomInputSearch extends StatelessWidget { ...@@ -433,4 +433,159 @@ class CustomInputSearch extends StatelessWidget {
} }
} }
class CustomInputCommands extends StatelessWidget {
final TextEditingController? controller;
final String? label;
final String? helper;
final String? hintText;
final String? error;
final bool required;
final bool readOnly;
final bool obscureText;
final Widget? iconData;
final int? minLines;
final int? maxLines;
final void Function()? onTap;
final void Function()? onIcon;
final ValueChanged<String>? onChanged;
final InputDecoration decoration;
final TextInputType? keyboardType;
final bool autofocus;
final FocusNode focusNode;
final List<TextInputFormatter>? inputFormatters;
const CustomInputCommands({
Key? key,
this.controller,
this.label,
this.helper,
this.hintText,
this.error,
this.required = false,
this.readOnly = false,
this.obscureText = false,
this.onTap,
this.onIcon,
this.iconData,
this.onChanged,
this.decoration = const InputDecoration(),
this.minLines,
this.maxLines = 1,
this.keyboardType,
this.autofocus = false,
this.inputFormatters,
required this.focusNode,
}) : super(key: key);
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final decorationTheme = theme.inputDecorationTheme;
return Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
if (label != null || required)
Padding(
padding: EdgeInsets.symmetric(
horizontal: (decorationTheme.contentPadding?.horizontal ?? 0) / 2,
vertical: 10.w,
).copyWith(top: 0),
child: RichText(
text: TextSpan(
text: label,
style: decorationTheme.labelStyle,
children: [
if (required)
TextSpan(
text: label != null ? ' *' : '*',
style: const TextStyle(color: AppTheme.error),
),
],
),
),
),
DecoratedBox(
decoration: const BoxDecoration(
boxShadow: [
// BoxShadow(
// color: theme.colorScheme.shadow,
// offset: Offset(0, 20.w),
// blurRadius: 10.w,
// spreadRadius: -10.w,
// ),
],
),
child: TextField(
focusNode: focusNode,
autofocus: autofocus,
controller: controller,
readOnly: readOnly,
onTap: onTap,
obscureText: obscureText,
onChanged: onChanged,
minLines: minLines,
maxLines: maxLines,
inputFormatters: inputFormatters,
keyboardType: keyboardType,
style: TextStyle(
// fontFamily: 'Sans',
fontSize: 15.w,
height: 1.2,
// fontWeight: FontWeight.w600,
),
decoration: decoration.copyWith(
hintText: hintText,
hintStyle: const TextStyle(fontWeight: FontWeight.normal,color: Colours.c9,fontSize: 13),
suffixIconConstraints: const BoxConstraints(),
suffixIcon: _suffixIcon(decorationTheme),
),
),
),
AnimatedSize(
duration: const Duration(milliseconds: 180),
alignment: Alignment.topCenter,
child: error != null
? Padding(
padding: EdgeInsets.only(top: 10.w),
// child: CustomAlert.error(
// size: CustomAlertSize.mini,
// text: Text(error!),
// ),
)
: const SizedBox.shrink(),
),
if (helper != null)
Padding(
padding: EdgeInsets.symmetric(
horizontal: (decorationTheme.contentPadding?.horizontal ?? 0) / 2,
vertical: 10.w,
).copyWith(bottom: 0),
child: Text(
helper!,
style: decorationTheme.helperStyle,
),
)
],
);
}
Widget? _suffixIcon(InputDecorationTheme decorationTheme) {
if (iconData == null) return null;
return Padding(
padding: EdgeInsetsDirectional.only(
end: (decorationTheme.contentPadding?.horizontal ?? 0) / 2,
),
child: GestureDetector(
onTap: onIcon,
child: SizedBox(
width: 24,
height: 24,
child: iconData,
)
),
);
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论