urlModel.dart 665 B

123456789101112131415161718192021222324252627282930313233
  1. import 'package:flutter/material.dart';
  2. import 'package:video/model/video.dart';
  3. class UrlInfo with ChangeNotifier {
  4. int _urlIndex = -1;
  5. String _url = "";
  6. Video _video = Video();
  7. bool _isAdd = false;
  8. int _change = 0;
  9. String get url => _url;
  10. int get urlIndex => _urlIndex;
  11. Video get video => _video;
  12. bool get isAdd => _isAdd;
  13. int get change => _change;
  14. changIndex(int currIndex) {
  15. _urlIndex = currIndex;
  16. notifyListeners();
  17. }
  18. changUrl(String url) {
  19. _url = url;
  20. notifyListeners();
  21. }
  22. changVideo(Video video, bool isAdd) {
  23. _video = video;
  24. _isAdd = isAdd;
  25. _change = _change + 1;
  26. notifyListeners();
  27. }
  28. }