timeline_page_provider.dart
650 Bytes
import 'package:flutter/material.dart';
class TimelinePageProvider extends ChangeNotifier {
/// Tab的下标
int _index = 0;
int get index => _index;
/// 商品数量
final List<int> _timelineCountList = [0, 0, 0];
List<int> get timelineCountList => _timelineCountList;
/// 选中商品分类下标
int _sortIndex = 0;
int get sortIndex => _sortIndex;
void setSortIndex(int sortIndex) {
_sortIndex = sortIndex;
notifyListeners();
}
void setIndex(int index) {
_index = index;
notifyListeners();
}
void setTimelineCount(int count) {
_timelineCountList[index] = count;
notifyListeners();
}
}