import 'package:flutter/cupertino.dart';

class NewsfeedPostPageState {
  //表单的校验与数据
  final Map<String, Map<String, dynamic>> formData;
  // 选择的图片
  final List<String> imgList;

  //表单的错误信息展示
  String? mindFieldErrorText;

  NewsfeedPostPageState({
    formData,
    required this.imgList,
    this.mindFieldErrorText,
  }): formData = formData ?? {
    'mind': {
      'value': '',
      'controller': TextEditingController(),
      'hintText': 'What\'s on your mind?',
      'focusNode': FocusNode(),
      'obsecure': false,
    }
  };

  NewsfeedPostPageState copyWith({
    Map<String, Map<String, dynamic>>? formData,
    List<String>? imgList,
    String? mindFieldErrorText,
  }) {
    return NewsfeedPostPageState(
      formData: formData ?? this.formData,
      imgList: imgList ?? this.imgList,
      mindFieldErrorText: mindFieldErrorText ?? this.mindFieldErrorText,
    );
  }

}