shop_model.dart 931 B

1234567891011121314151617181920212223242526272829303132
  1. import 'package:flutter/cupertino.dart';
  2. import 'package:sport/bean/user_friend.dart';
  3. import 'package:sport/provider/lib/view_state_list_model.dart';
  4. import 'package:sport/services/api/inject_api.dart';
  5. import 'package:sport/bean/shop.dart';
  6. import 'lib/view_state_model.dart';
  7. import 'lib/view_state_refresh_list_model.dart';
  8. class ShopModel extends ViewStateModel with InjectApi {
  9. ShopIndex shop;
  10. init() async {
  11. ShopIndex shopIndex = (await api.getShopIndex()).data;
  12. // return shopIndex;
  13. shop = shopIndex;
  14. setIdle();
  15. return shop;
  16. }
  17. }
  18. class ScoreModel extends ViewStateRefreshListModel<ScoreListData> with InjectApi{
  19. List<ScoreListData> scoreList;
  20. @override
  21. Future<List<ScoreListData>> loadData({int pageNum}) async{
  22. // TODO: implement loadData
  23. List<ScoreListData> _list = (await api.getScoreIndex()).data.data;
  24. scoreList = _list;
  25. setIdle();
  26. return scoreList;
  27. }
  28. }