|
|
|
|
@ -32,6 +32,11 @@ class _MoviesScreenState extends State<MoviesScreen> {
|
|
|
|
|
List<GridColumn> _columns = [];
|
|
|
|
|
late List<Movie> _moviesList;
|
|
|
|
|
|
|
|
|
|
String searchText = '';
|
|
|
|
|
bool showInit = false;
|
|
|
|
|
bool showProg = false;
|
|
|
|
|
bool showDone = false;
|
|
|
|
|
|
|
|
|
|
Logger logger = getLogger();
|
|
|
|
|
|
|
|
|
|
Future<List<Movie>> generateMovieList() async {
|
|
|
|
|
@ -139,12 +144,17 @@ class _MoviesScreenState extends State<MoviesScreen> {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<void> showMovieDetails(int index) async {
|
|
|
|
|
List<DataGridCell<dynamic>> cells =
|
|
|
|
|
movieDataSource.effectiveRows.elementAt(index).getCells();
|
|
|
|
|
DataGridRow row = movieDataSource.effectiveRows.elementAt(index);
|
|
|
|
|
List<DataGridCell<dynamic>> cells = row.getCells();
|
|
|
|
|
|
|
|
|
|
String movieID = cells[MovieColumn.movieID].value.toString();
|
|
|
|
|
bool found = false;
|
|
|
|
|
int movieIndex;
|
|
|
|
|
int realIndex;
|
|
|
|
|
|
|
|
|
|
movieDataSource.clearFilters();
|
|
|
|
|
|
|
|
|
|
realIndex = movieDataSource.rows.indexOf(row);
|
|
|
|
|
|
|
|
|
|
for (movieIndex = 0; movieIndex < _moviesList.length; movieIndex++) {
|
|
|
|
|
if (_moviesList[movieIndex].movieID == int.parse(movieID)) {
|
|
|
|
|
@ -167,7 +177,7 @@ class _MoviesScreenState extends State<MoviesScreen> {
|
|
|
|
|
_moviesList[movieIndex].state = m.state;
|
|
|
|
|
Movie e = _moviesList[movieIndex];
|
|
|
|
|
|
|
|
|
|
movieDataSource._movieDataGridRows[index] = DataGridRow(cells: [
|
|
|
|
|
movieDataSource._movieDataGridRows[realIndex] = DataGridRow(cells: [
|
|
|
|
|
DataGridCell<int>(columnName: 'movieID', value: e.movieID),
|
|
|
|
|
DataGridCell<int>(columnName: 'state', value: e.state),
|
|
|
|
|
DataGridCell<String>(
|
|
|
|
|
@ -180,23 +190,37 @@ class _MoviesScreenState extends State<MoviesScreen> {
|
|
|
|
|
DataGridCell<String>(columnName: 'overview', value: e.overview),
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
movieDataSource.updateDataGridSource(
|
|
|
|
|
rowColumnIndex: RowColumnIndex(index, 0));
|
|
|
|
|
movieDataSource.updateDataGridSource(
|
|
|
|
|
rowColumnIndex: RowColumnIndex(index, 1));
|
|
|
|
|
movieDataSource.updateDataGridSource(
|
|
|
|
|
rowColumnIndex: RowColumnIndex(index, 2));
|
|
|
|
|
movieDataSource.updateDataGridSource(
|
|
|
|
|
rowColumnIndex: RowColumnIndex(index, 3));
|
|
|
|
|
movieDataSource.updateDataGridSource(
|
|
|
|
|
rowColumnIndex: RowColumnIndex(index, 4));
|
|
|
|
|
movieDataSource.updateDataGridSource(
|
|
|
|
|
rowColumnIndex: RowColumnIndex(index, 5));
|
|
|
|
|
for (int i = 0; i < _columns.length; i++) {
|
|
|
|
|
movieDataSource.updateDataGridSource(
|
|
|
|
|
rowColumnIndex: RowColumnIndex(realIndex, i));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// movieDataSource.updateDataGridSource(
|
|
|
|
|
// rowColumnIndex: RowColumnIndex(realIndex, 0));
|
|
|
|
|
// movieDataSource.updateDataGridSource(
|
|
|
|
|
// rowColumnIndex: RowColumnIndex(realIndex, 1));
|
|
|
|
|
// movieDataSource.updateDataGridSource(
|
|
|
|
|
// rowColumnIndex: RowColumnIndex(realIndex, 2));
|
|
|
|
|
// movieDataSource.updateDataGridSource(
|
|
|
|
|
// rowColumnIndex: RowColumnIndex(realIndex, 3));
|
|
|
|
|
// movieDataSource.updateDataGridSource(
|
|
|
|
|
// rowColumnIndex: RowColumnIndex(realIndex, 4));
|
|
|
|
|
// movieDataSource.updateDataGridSource(
|
|
|
|
|
// rowColumnIndex: RowColumnIndex(realIndex, 5));
|
|
|
|
|
} 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() {
|
|
|
|
|
movieDataSource.clearFilters();
|
|
|
|
|
|
|
|
|
|
if (showInit)
|
|
|
|
|
@ -230,7 +254,7 @@ class _MoviesScreenState extends State<MoviesScreen> {
|
|
|
|
|
'movieTitle',
|
|
|
|
|
FilterCondition(
|
|
|
|
|
type: FilterType.beginsWith,
|
|
|
|
|
value: text,
|
|
|
|
|
value: searchText,
|
|
|
|
|
filterOperator: FilterOperator.and,
|
|
|
|
|
filterBehavior: FilterBehavior.stringDataType,
|
|
|
|
|
));
|
|
|
|
|
|