/*
 * @Author: XianKaiQun
 * @Date: 2020-08-17 09:51:28
 * @LastEditors: XianKaiQun
 * @LastEditTime: 2020-08-19 11:04:42
 * @Description: 
 */
import 'package:flutter/material.dart';
import 'package:receipt_package/src/view_models/private_pledge_detail_store.dart';
import 'package:wisdom_cli/wisdom_cli.dart';

part 'components/card.dart';

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