/*
 * @Author       : WuWei
 * @LastEditors  : WuWei
 * @Date         : 2022-11-02 10:26:38
 * @LastEditTime : 2022-12-02 10:28:52
 * @Description  : Do not edit
 */

import 'package:app_package/app_package.dart';
import 'package:flutter/material.dart';
import 'package:qrcode_package/src/view_models/private_repair_store.dart';
import 'package:wisdom_cli/wisdom_cli.dart';

part 'components/polling.dart';
part 'components/repair.dart';
part 'components/maintain.dart';

class RepairPage extends StatelessWidget {
  const RepairPage({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return ChangeNotifierProvider(
      create: (providerContext) => PrivateRepairStore(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> {
  PrivateRepairStore 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: WisTabPage(
        initialIndex: 1,
        tabs: [
          Text('巡检'),
          Text('保养'),
          Text('维修'),
        ],
        views: [
          _PollingComponent(),
          _RepairComponent(),
          _MaintainComponent(),
        ],
      ),
    );
  }
}
