/*
 * @Author       : WuWei
 * @LastEditors  : WuWei
 * @Date         : 2023-03-23 17:11:18
 * @LastEditTime : 2023-03-30 14:49:33
 * @Description  : Do not edit
 */
/*
 * @Author: XianKaiQun
 * @Date: 2020-07-28 17:44:28
 * @LastEditors: ,: XianKaiQun
 * @LastEditTime: ,: 2020-10-20 11:07:09
 * @Description: 
 */
import 'package:flutter/material.dart';
import 'package:qrcode_package/src/view_models/private_security_list_store.dart';
import 'package:wisdom_cli/wisdom_cli.dart';

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

class SecurityListPage extends StatelessWidget {
  const SecurityListPage({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return ChangeNotifierProvider(
      create: (providerContext) =>
          PrivateSecurityListStore(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> {
  PrivateSecurityListStore get store => Provider.of(context, listen: false);
  @override
  Widget build(BuildContext context) {
    final colorScheme = WTheme.of(context).colorScheme;
    // 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(
        key: store.scrollViewKey,
        onInit: () => store.onInit(),
        onRefresh: () => store.onInit(),
        onLoad: () => store.getList(isLoad: true),
        slivers: <Widget>[
          _DescComponent(),
          SliverToBoxAdapter(
            child: WButton(
              onPressed: () => store.route2Form(),
              margin: EdgeInsets.fromLTRB(15.pt, 15.pt, 15.pt, 0),
              height: 44.pt,
              child: Text('巡逻'),
            ),
          ),
          _ListComponent(),
        ],
      ),
    );
  }
}
