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

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

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

class CleanPage extends StatelessWidget {
  const CleanPage({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return ChangeNotifierProvider(
      create: (providerContext) => PrivateCleanStore(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> {
  PrivateCleanStore 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);
    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.getData(),
          slivers: <Widget>[
            _DescComponent(),
            _FormComponent(),
            SliverToBoxAdapter(
              child: WLoadingButton(
                onPressed: () => store.submit(),
                margin: EdgeInsets.all(15.pt),
                height: 44.pt,
                child: Text('完成'),
              ),
            ),
          ],
        ),
      ),
    );
  }
}
