filter_box
This commit is contained in:
@@ -82,6 +82,13 @@ class _TVShowsScreenState extends State<TVShowsScreen> {
|
||||
late bool initDone = false;
|
||||
late List<TVShow> _tvshowsList;
|
||||
|
||||
String searchText = '';
|
||||
bool showInit = false;
|
||||
bool showProg = false;
|
||||
bool showDone = false;
|
||||
|
||||
Logger logger = getLogger();
|
||||
|
||||
Future<List<TVShow>> generateTVShowList() async {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
|
||||
@@ -241,12 +248,18 @@ class _TVShowsScreenState extends State<TVShowsScreen> {
|
||||
}
|
||||
|
||||
Future<void> showTVShowDetails(int index) async {
|
||||
DataGridRow row = tvshowDataSource.effectiveRows.elementAt(index);
|
||||
List<DataGridCell<dynamic>> cells =
|
||||
tvshowDataSource.effectiveRows.elementAt(index).getCells();
|
||||
row.getCells();
|
||||
|
||||
String seriesID = cells[TVShowColumn.seriesID].value.toString();
|
||||
bool found = false;
|
||||
int tvShowIndex;
|
||||
int realIndex;
|
||||
|
||||
tvshowDataSource.clearFilters();
|
||||
|
||||
realIndex = tvshowDataSource.rows.indexOf(row);
|
||||
|
||||
for (tvShowIndex = 0; tvShowIndex < _tvshowsList.length; tvShowIndex++) {
|
||||
if (_tvshowsList[tvShowIndex].seriesID == int.parse(seriesID)) {
|
||||
@@ -272,7 +285,7 @@ class _TVShowsScreenState extends State<TVShowsScreen> {
|
||||
_tvshowsList[tvShowIndex].seriesState = t.seriesState;
|
||||
TVShow e = _tvshowsList[tvShowIndex];
|
||||
|
||||
tvshowDataSource._tvshowDataGridRows[index] = DataGridRow(cells: [
|
||||
tvshowDataSource._tvshowDataGridRows[realIndex] = DataGridRow(cells: [
|
||||
DataGridCell<int>(columnName: 'seriesID', value: e.seriesID),
|
||||
DataGridCell<int>(columnName: 'seriesState', value: e.seriesState),
|
||||
DataGridCell<String>(columnName: 'status', value: e.status),
|
||||
@@ -290,13 +303,22 @@ class _TVShowsScreenState extends State<TVShowsScreen> {
|
||||
|
||||
for (int i = 0; i < _columns.length; i++) {
|
||||
tvshowDataSource.updateDataGridSource(
|
||||
rowColumnIndex: RowColumnIndex(index, i));
|
||||
rowColumnIndex: RowColumnIndex(realIndex, i));
|
||||
}
|
||||
} else {}
|
||||
filter();
|
||||
}
|
||||
}
|
||||
|
||||
void setFilter(String text, bool showInit, bool showProg, bool showDone) {
|
||||
void setFilter(String text, bool sInit, bool sProg, bool sDone) {
|
||||
searchText = text;
|
||||
showInit = sInit;
|
||||
showProg = sProg;
|
||||
showDone = sDone;
|
||||
filter();
|
||||
}
|
||||
|
||||
void filter() {
|
||||
tvshowDataSource.clearFilters();
|
||||
|
||||
if (showInit)
|
||||
@@ -330,7 +352,7 @@ class _TVShowsScreenState extends State<TVShowsScreen> {
|
||||
'seriesName',
|
||||
FilterCondition(
|
||||
type: FilterType.beginsWith,
|
||||
value: text,
|
||||
value: searchText,
|
||||
filterOperator: FilterOperator.and,
|
||||
filterBehavior: FilterBehavior.stringDataType,
|
||||
));
|
||||
|
||||
Reference in New Issue
Block a user