/*
 * @Author       : WuWei
 * @LastEditors  : WuWei
 * @Date         : 2021-07-13 09:03:28
 * @LastEditTime : 2022-01-19 16:26:58
 * @Description  : Do not edit
 */
import 'package:flutter/material.dart';
import 'package:wisdom_cli/wisdom_cli.dart';
import '../service/community_service.dart';
import '../service/impl/community_impl.dart';
import '../models/community_detail_models.dart';

class PrivateCommunityDetailStore with ChangeNotifier {
  final BuildContext context, providerContext;
  late Map<String, dynamic> routingArgs;
  PrivateCommunityDetailStore(this.context, this.providerContext) {
    routingArgs =
        (ModalRoute.of(context)?.settings.arguments ??
            new Map<String, dynamic>()) as Map<String, dynamic>? ??
            {};
  }

  final CommunityService _communityService = CommunityServiceImpl();

  final scorllViewListKey = GlobalKey<WisScrollViewState>();

  CommunityDetailModel? communityDetail;

  String? communityContent;

  Future getDetail() async {
    if (routingArgs['id'] == null) {
      WToastUtil.show('详情id不可为空，重新试试哦~');
      return;
    }
    var res = await _communityService.getCommunityDetail({
      'communityId': routingArgs['id'],
    });

    communityDetail = res.data;

    notifyListeners();
  }
}
