/*
 * @Author: XianKaiQun
 * @Date: 2020-04-24 16:10:35
 * @LastEditors  : WuWei
 * @LastEditTime : 2023-03-30 15:00:19
 * @Descripttion: 计划任务详情-入口页
 */

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

part 'components/desc.dart';
part 'components/files.dart';
part 'components/info.dart';

class PlanDetailPage extends StatelessWidget {
  const PlanDetailPage({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return MultiProvider(
      providers: [
        ChangeNotifierProvider(
          create: (_) => PlanTaskDetailStore(context),
          lazy: false,
        )
      ],
      child: _PageView(),
    );
  }
}

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

class _PageViewState extends State<_PageView> {
  PlanTaskDetailStore get store => Provider.of(context, listen: false);

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    final store = Provider.of<PlanTaskDetailStore>(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(
        key: store.detailScrollviewKey,
        onInit: () => store.getData(),
        onRefresh: () => store.getData(),
        slivers: <Widget>[
          _DescComponent(),
          _BuildInfo(),
        ],
      ),
    );
  }
}
