/*
 * @Author: WuWei
 * @Date: 2020-05-14 17:55:00
 * @LastEditors: XianKaiQun
 * @LastEditTime: 2020-10-28 17:24:19
 * @Description:
 */
import 'package:app_package/app_package.dart';
import 'package:flutter/widgets.dart';
import 'package:news_package/src/impl/industrynew_service_impl.dart';
import 'package:news_package/src/models/industry_news_detail.dart';
import 'package:wisdom_cli/wisdom_cli.dart';

class NewsDetailStore with ChangeNotifier {
  final BuildContext context;
  late Map args;
  NewsDetailStore(this.context) {
    args = ModalRoute.of(context)!.settings.arguments as Map<dynamic, dynamic>? ?? {};
  }

  final scorllViewKey = GlobalKey<WisScrollViewState>();
  final communityGlobalStore = GetIt.I.get<CommunityGlobalStore>();

  ///从储存中取出的当前小区 拿出来可能是空
  CommunityModel? get currentCommunity => communityGlobalStore.data;

  ///详情
  IndustryNewsDetailModel? detail;
  Future getDetail() async {
    var res = await IndustryNewsServiceImpl().getNewsDetail({
      'id': args['id'],
    });
    detail = res.data ?? IndustryNewsDetailModel();
    notifyListeners();
  }
}
