1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- import 'package:flutter/material.dart';
- import 'package:fluttertoast/fluttertoast.dart';
- import 'package:sport/bean/feed_back.dart';
- import 'package:sport/services/api/inject_api.dart';
- import 'package:sport/utils/toast.dart';
- class FeedBackModel extends ChangeNotifier with InjectLoginApi {
- FeedTypeInfo data;
- FeedBackInfo feedBackInfo;
- Future getFeedBackTypes() async {
- FeedTypeInfo _feedTypeInfo = await loginApi.getFeedBackTypes();
- if (_feedTypeInfo.code != 0) {
- // Fluttertoast.showToast(
- // msg: "${_feedTypeInfo.msg}",
- // toastLength: Toast.LENGTH_SHORT,
- // gravity: ToastGravity.CENTER,
- // backgroundColor: Colors.white,
- // textColor: Colors.black,
- // fontSize: 13.0);
- }
- data = _feedTypeInfo;
- notifyListeners();
- return _feedTypeInfo;
- }
- Future<FeedBackInfo> getFeedBackInfo(
- {int typeId, int groupId, int limit}) async {
- FeedBackInfo _feedBackInfo = await loginApi.getFeedBackChats(
- typeId: typeId, groupId: groupId, limit: limit);
- feedBackInfo = _feedBackInfo;
- notifyListeners();
- return _feedBackInfo;
- }
- Future postFeedback(int typeId, String content) async {
- var data = await loginApi.postFeedBack(typeId, content);
- print(data);
- if (data['code'] != 0) {
- ToastUtil.show(data.msg);
- // Fluttertoast.showToast(
- // msg: "${data.msg}",
- // toastLength: Toast.LENGTH_SHORT,
- // gravity: ToastGravity.CENTER,
- // backgroundColor: Colors.white,
- // textColor: Colors.black,
- // fontSize: 13.0);
- }else{
- ToastUtil.show("感谢你的建议,我们会第一时间解决");
- // Fluttertoast.showToast(
- // msg: "感谢你的建议,我们会第一时间解决",
- // toastLength: Toast.LENGTH_SHORT,
- // gravity: ToastGravity.CENTER,
- // backgroundColor: Colors.white,
- // textColor: Colors.black,
- // fontSize: 13.0);
- }
- notifyListeners();
- return data;
- }
- }
|