123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183 |
- import 'package:farmer_client/widgets/DefaultButton.dart';
- import 'package:flutter/material.dart';
- import 'package:flutter_screenutil/flutter_screenutil.dart';
- import 'package:fluttertoast/fluttertoast.dart';
- import 'package:get/get.dart';
-
- import '../../models/entities/OrderInfoModel.dart';
- import '../../services/orderAPI.dart';
- import '../../widgets/OrderInfoCard.dart';
- import '../../widgets/layout/BasicPage.dart';
-
- // class OrderContentInfo {
- // String title;
- // Color styleColor;
- // StyleObj ({ required this.title, required this.styleColor});
- // }
-
-
-
- class OrderPageInfo extends BasicPage {
- String id = '';
- String orderStateText = '';
- late Color orderStateColor;
-
- final orderInfoContent = Rx<OrderInfoModel>(OrderInfoModel());
-
- // orderStates
-
- @override
- void beforeShow() {
- // TODO: implement beforeShow
- super.beforeShow();
- if (Get.arguments['id'] != null) {
- id = Get.arguments['id'];
-
- orderStateText = Get.arguments['title'];
- orderStateColor = Get.arguments['styleColor'];
-
- orderInfo(id).then((value) {
- orderInfoContent.value = OrderInfoModel.fromJson(value);
- });
- }
- }
-
- @override
- Widget builder(BuildContext context) {
- naviTitle = '订单详情';
-
- return Column(
- children: [
- Obx(() =>
- OrderInfoCard(
- item: orderInfoContent.value,
- orderStateText: orderStateText,
- orderStateColor: orderStateColor
- ),
- ),
- _BottomWidget()
- // orderStateText=='已完成'? Text('')
- // :orderStateText== '进行中' ?Text('')
- // :orderStateText=='待评价'? DefaultButton(
- // color: const Color(0xffffffff),
- // backColor: const Color(0xFFFF703B),
- // width: 300.w,
- // height: 49.h,
- // text: '评价',
- // onPressed: () {
- // Fluttertoast.showToast(msg: '评价成功!');
- // Get.offAllNamed('/');
- // },
- // margin: const EdgeInsets.all(0),
- // fontSize: 20.sp,
- // radius: 24.5.w,
- // )
- // :orderStateText=='待作业'?DefaultButton(
- // color: const Color(0xffffffff),
- // backColor: const Color(0xFFFF703B),
- // width: 300.w,
- // height: 49.h,
- // text: '退单',
- // onPressed: () {
- // Fluttertoast.showToast(msg: '评价成功!');
- // Get.offAllNamed('/');
- // },
- // margin: const EdgeInsets.all(0),
- // fontSize: 20.sp,
- // radius: 24.5.w,
- // )
- // :orderStateText=='待付款'?_BottomWidget
- // :orderStateText=='已退单'?Text('')
- // :orderStateText=='退单申请中'?DefaultButton(
- // color: const Color(0xffffffff),
- // backColor: const Color(0xFFFF703B),
- // width: 300.w,
- // height: 49.h,
- // text: orderStateText,
- // onPressed: () {
- // Fluttertoast.showToast(msg: '评价成功!');
- // Get.offAllNamed('/');
- // },
- // margin: const EdgeInsets.all(0),
- // fontSize: 20.sp,
- // radius: 24.5.w,
- // ):Text(''),
-
- // Spacer(),
- ],
- );
- }
- }
-
- class _BottomWidget extends StatelessWidget {
- const _BottomWidget({Key? key}) : super(key: key);
-
- @override
- Widget build(BuildContext context) {
-
- return Container(
- height: 100.w,
- alignment: Alignment.bottomCenter,
- margin: EdgeInsets.fromLTRB(15.w, 0, 15.w, 50.h),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Container(
- width: 150.w,
- height: 49.h,
- margin: EdgeInsets.fromLTRB(0, 30.w, 0, 30.w),
- alignment: Alignment.bottomCenter,
- child: SizedBox(
- width: 150.w,
- height: 49.h,
- child: ElevatedButton(
- onPressed: () {
- Get.back();
- },
- child: const Text(
- "取消",
- style: TextStyle(
- fontSize: 18,
- color: Color(0xFFFF703B),
- fontWeight: FontWeight.bold),
- ),
- style: ButtonStyle(
- side: MaterialStateProperty.all(
- BorderSide(width: 1, color: Color(0xFFFF703B))), //边框
- elevation: MaterialStateProperty.all(0),
- backgroundColor: MaterialStateProperty.all(Colors.white),
- shape: MaterialStateProperty.all(
- RoundedRectangleBorder(
- borderRadius:
- BorderRadius.all(Radius.circular(24.4))),
- ),
- ),
- ),
- ),
- ),
- Container(
- margin: EdgeInsets.fromLTRB(0, 30.w, 0, 30.w),
- alignment: Alignment.bottomCenter,
- child: DefaultButton(
- color: const Color(0xffffffff),
- backColor: const Color(0xFFFF703B),
- width: 150.w,
- height: 49.h,
- text: '支付',
- onPressed: () {
- Fluttertoast.showToast(msg: '支付成功!');
- Get.offAllNamed('/');
- },
- margin: const EdgeInsets.all(0),
- fontSize: 20.sp,
- radius: 24.5.w,
- ),
- ),
- ],
- ),
- );
- }
- }
-
-
|