/*
 * @Author: XianKaiQun
 * @Date: 2020-07-29 11:45:05
 * @LastEditors: ,: XianKaiQun
 * @LastEditTime: ,: 2020-10-20 11:08:20
 * @Description: 
 */
import 'package:app_package/app_package.dart';
import 'package:flutter/material.dart';
import 'package:qrcode_package/src/view_models/private_repair_maintain_store.dart';
import 'package:wisdom_cli/wisdom_cli.dart';

part 'components/desc.dart';
part 'components/form.dart';

///设备维修表单页

class RepairMaintainPage extends StatelessWidget {
  const RepairMaintainPage({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return ChangeNotifierProvider(
      create: (providerContext) =>
          PrivateRepairMaintainStore(context, providerContext),
      child: _PageView(),
      lazy: false,
    );
  }
}

class _PageView extends StatefulWidget {
  _PageView({Key? key}) : super(key: key);
  @override
  _PageViewState createState() => _PageViewState();
}

class _PageViewState extends State<_PageView> {
  PrivateRepairMaintainStore get store => Provider.of(context, listen: false);
  @override
  Widget build(BuildContext context) {
    final colorScheme = WTheme.of(context).colorScheme;
    return Scaffold(
      appBar: WAppBar(
        brightness: Brightness.light,
        iconTheme: IconThemeData(
          color: colorScheme.mainTitle,
          size: 19.pt,
        ),
        backgroundColor: Colors.white,
        title: WisText('维修',
            size: 19.pt, weight: FontWeight.w600, color: colorScheme.mainTitle),
      ),
      body: WisForm(
        formKey: null,
        child: WisScrollView(
          onInit: () => store.getDetail(),
          slivers: <Widget>[
            _DescComponent(),
            _FormComponent(),
            WLoadingButton(
              onPressed: () => store.submit(),
              margin: EdgeInsets.all(15.pt),
              height: 44.pt,
              child: Text('完成'),
            ).asSliver(),
          ],
        ),
      ),
    );
  }
}
