import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:get/get.dart';
import 'package:worker_client/models/entities/Order.dart';
import 'package:worker_client/services/order.dart';
import 'package:worker_client/widgets/MyCard/index.dart';
import 'package:worker_client/widgets/layout/BasicPage.dart';

class OrderDetail extends BasicPage {
  final order = Rx<OrderModel>(OrderModel());
  @override
  void beforeShow() {
    super.beforeShow();
    if (Get.arguments != null) {
      //请求详情接口
      getOrderDetail(Get.arguments['id'].toString())
          .then((value) => {order(OrderModel.fromJson(value))});
    }
  }

  @override
  Widget builder(BuildContext context) {
    naviTitle = '详情';
    return Container(
      alignment: Alignment.topCenter,
      child: Column(
        children: [
          Obx(
            () => MyCard(
              item: order(),
              job: false,
              detail: true,
              onClick: () {},
              buttomText: '',
            ),
          ),
        ],
      ),
    );
  }
}
