/*
 * @Author       : WuWei
 * @LastEditors  : WuWei
 * @Date         : 2023-05-12 15:08:22
 * @LastEditTime : 2023-05-12 17:03:07
 * @Description  : Do not edit
 */
/*
 * @Author: XianKaiQun
 * @Date: 2020-07-29 11:48:41
 * @LastEditors: XianKaiQun
 * @LastEditTime: 2020-09-18 15:24:46
 * @Description: 
 */
import 'package:flutter/material.dart';
import 'package:qrcode_package/src/view_models/private_repair_detail_store.dart';
import 'package:wisdom_cli/wisdom_cli.dart';

part 'components/desc_list.dart';
part 'components/record_list.dart';

class RepairDetailPage extends StatelessWidget {
  const RepairDetailPage({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return ChangeNotifierProvider(
      create: (providerContext) =>
          PrivateRepairDetailStore(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> {
  PrivateRepairDetailStore get store => Provider.of(context, listen: false);
  @override
  Widget build(BuildContext context) {
    final colorScheme = WTheme.of(context).colorScheme;
    final theme = Theme.of(context);
    final textTheme = theme.textTheme;
    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: WisScrollView(
        onInit: () => store.getData(),
        onRefresh: () => store.getData(),
        slivers: <Widget>[
          Consumer<PrivateRepairDetailStore>(
            builder: (ctx, store, child) {
              return Wisdom.column(
                padding: EdgeInsets.fromLTRB(15.pt, 15.pt, 15.pt, 0),
                margin: EdgeInsets.symmetric(horizontal: 15.pt),
                crossAxisAlignment: CrossAxisAlignment.stretch,
                children: <Widget>[
                  Text('${store.data?.name ?? ''}',
                      style: textTheme.titleMedium!.copyWith(
                        fontWeight: FontWeight.bold,
                      )),
                  Divider(height: 30.pt),
                ],
              ).asSliver();
            },
          ),
          _DescListComponent(),
          _RecordListComponent(),
        ],
      ),
    );
  }
}
