import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:keyboard_actions/keyboard_actions.dart';
import 'package:liftmanager/common/common.dart';
import 'package:liftmanager/internal/project/model/project_list_entity.dart';
import 'package:liftmanager/res/resources.dart';
import 'package:liftmanager/widgets/app_bar.dart';
import 'package:liftmanager/widgets/click_item.dart';

class HeavyCreatePage extends StatefulWidget{
  @override
  State<StatefulWidget> createState() {
    return HeavyCreateState();
  }
}

class HeavyCreateState extends State<HeavyCreatePage>{
  ProjectListItem item;
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: MyAppBar(
        centerTitle: "创建大修单",
        actions: <Widget>[
          FlatButton(
            child: Text("保存"),
            textColor: Colours.dark_text,
            highlightColor: Colors.transparent,
            onPressed: () {

            },
          )
        ],
      ),
      body: SafeArea(
        child: Column(
          children: <Widget>[
            Expanded(
              flex: 1,
              child: defaultTargetPlatform == TargetPlatform.iOS
                  ? FormKeyboardActions(child: _buildBody())
                  : SingleChildScrollView(child: _buildBody()),
            )
          ],
        ),
      ),
    );

  }
  _buildBody(){
    return Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: <Widget>[
        ClickItem(
          title: "项目名称",
          content: "${item?.projectName}",
        ),
        ClickItem(
          title: "项目用途",
          content: "${Constant.projectUsageText[item?.projectUsage]}",
        ),
        ClickItem(
          title: "项目地址",
          content: "${item?.address}",
        ),
        ClickItem(
          title: "项目台量",
          content: "${item?.actualNum}",
        ),
        ClickItem(
          title: "行政区域",
          content: "${item?.province}-${item?.city}-${item?.district}",
        ),
        ClickItem(
          title: "区域",
          content: "${item?.areaName}",
        ),
        ClickItem(
          title: "区域主管",
          content: "${item?.areaDirector}",
        ),
        ClickItem(
          title: "文员",
          content: "${item?.clerkName}",
        ),
        ClickItem(
          title: "大修开始时间",
          content: "${item?.startDate}",
        ),

        ClickItem(
          title: "大修结束时间",
          content: "${item?.endDate}",
        ),

        ClickItem(
          title: "备注",
          content: "",
        ),

        ClickItem(
          title: "甲方公司",
          content: "${item?.companyName}",
        ),

        ClickItem(
          title: "甲方联系人",
          content: "${item?.companyContact}",
        ),
        ClickItem(
          title: "甲方联系人电话",
          content: "${item?.telephone}",
        ),
        ClickItem(
          title: "维保人员",
          content: "",
          onTap: (){

          },
        )
      ],
    );
  }
}