import 'package:circle_app/router/app_routers.dart';
import 'package:circle_app/util/util.dart';
import 'package:get/get.dart';
import 'package:image_picker/image_picker.dart';

import 'state.dart';

class Complete_materialLogic extends GetxController {
  final Complete_materialState state = Complete_materialState();
  final ImagePicker _picker = ImagePicker();

  Future getImageFile() async {
    try {
      final XFile? pickedFile = await _picker.pickImage(
        source: ImageSource.gallery,
      );
      // setState(() {
      //   _setImageFileListFromFile(pickedFile);
      // });
    } catch (e) {
      // setState(() {
      //   _pickImageError = e;
      // });
    }
  }

  checkInfo() {
    if (state.textEditingController.text.isEmpty) {
      showToast('请输入您的昵称');
    } else if (state.sex.isEmpty) {
      showToast('请选择您的属性');
    } else if (state.age.isEmpty) {
      showToast('请选择您的年龄');
    } else if (state.role.isEmpty) {
      showToast('请选择您的角色');
    } else if (state.role.isEmpty) {
      showToast('请选择您的角色');
    } else if (state.orientation.isEmpty) {
      showToast('请选择您的取向');
    }else if (state.interest.isEmpty) {
      showToast('请选择您的兴趣');
    } else if (state.descEditingController.text.isEmpty) {
      showToast('请输入您的交友宣言');
    }
  }

  pushHome() {
    Get.toNamed(AppRoutes.Home);
  }
}
