/*
 * @Author       : WuWei
 * @LastEditors  : WuWei
 * @Date         : 2023-07-20 10:38:06
 * @LastEditTime : 2023-07-20 10:40:16
 * @Description  : Do not edit
 */

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 SassNewsDetailStore with ChangeNotifier {
  final BuildContext context;
  late Map args;
  SassNewsDetailStore(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().getNewsDetailV2({
      'id': args['id'],
    });
    detail = res.data ?? IndustryNewsDetailModel();
    notifyListeners();
  }
}
