/*
 * @Author: XianKaiQun
 * @Date: 2020-07-29 09:04:31
 * @LastEditors  : WuWei
 * @LastEditTime : 2021-07-22 10:59:00
 * @Description: 
 */
import 'package:app_package/app_package.dart';
import 'package:flutter/material.dart';
import 'package:qrcode_package/src/view_models/private_clean_detail_store.dart';
import 'package:wisdom_cli/wisdom_cli.dart';

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

class CleanDetailPage extends StatelessWidget {
  const CleanDetailPage({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return ChangeNotifierProvider(
      create: (providerContext) =>
          PrivateCleanDetailStore(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> {
  PrivateCleanDetailStore get store => Provider.of(context, listen: false);
  @override
  Widget build(BuildContext context) {
    final style = WTheme.of(context);
    final colorScheme = style.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>[
          _DescComponent(),
          _OptionComponent(),
          _FormComponent(),
          _AntiCheatingComponent(),
        ],
      ),
    );
  }
}
