/*
 * @Author: XianKaiQun
 * @Date: 2020-09-04 09:52:13
 * @LastEditors: ChenYaJin
 * @LastEditTime: 2023-03-27 18:03:54
 * @Description: 
 */
import 'package:app_package/app_package.dart';
import 'package:face_package/src/assets.gen.dart';
import 'package:face_package/src/models/door_group.dart';
import 'package:face_package/src/view_models/private_detail_store.dart';
import 'package:flutter/material.dart';
import 'package:wisdom_cli/wisdom_cli.dart';

part 'components/desc.dart';
part 'components/table.dart';
part 'components/pass_card.dart';
part 'components/modify.dart';

part 'components/button_bar.dart';

class DetailPage extends StatelessWidget {
  const DetailPage({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return ChangeNotifierProvider(
      create: (providerContext) => PrivateDetailStore(context, providerContext),
      lazy: false,
      child: Theme(
        data: Theme.of(context).copyWith(
          inputDecorationTheme: InputDecorationTheme(
            border: InputBorder.none,
            isCollapsed: false,
            isDense: true,
            contentPadding: EdgeInsets.symmetric(vertical: 15.pt),
          ),
        ),
        child: _PageView(),
      ),
    );
  }
}

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

class _PageViewState extends State<_PageView> {
  PrivateDetailStore get store => Provider.of(context, listen: false);
  @override
  Widget build(BuildContext context) {
    final colorScheme = WTheme.of(context).colorScheme;
    return Scaffold(
      appBar: WAppBar(
        iconTheme: IconThemeData(
          color: colorScheme.mainTitle,
          size: 19.pt,
        ),
        backgroundColor: Colors.white,
        brightness: Brightness.light,
        title: WisText('通行证详情',
            size: 19.pt, weight: FontWeight.w600, color: colorScheme.mainTitle),
      ),
      body: WisScrollView(
        onInit: () => store.initData(),
        slivers: <Widget>[
          _DescComponent(),
          _TableComponent(),
          _ModifyComponent(),
          _PassCardListComponent(),
          _ButtonBarComponent(),
        ],
      ),
    );
  }
}
