add movie(s)
This commit is contained in:
@@ -335,8 +335,7 @@ class _MoviesScreenState extends State<MoviesScreen> {
|
||||
}
|
||||
|
||||
void addMovieToList(Movie movie) {
|
||||
String movieTitle = movie.movieTitle.toUpperCase();
|
||||
|
||||
String movieTitle = movie.movieTitle.toUpperCase().replaceAll('Ä', 'a').replaceAll('Ö', 'ö').replaceAll('Ü', 'ü').replaceAll('ß', 'ss');
|
||||
_moviesList.add(movie);
|
||||
|
||||
DataGridRow newRow = DataGridRow(cells: [
|
||||
@@ -356,21 +355,20 @@ class _MoviesScreenState extends State<MoviesScreen> {
|
||||
for (int i = 0; i < movieDataSource._movieDataGridRows.length; i++) {
|
||||
DataGridRow tmpRow = movieDataSource._movieDataGridRows[i];
|
||||
List<DataGridCell> tmpCells = tmpRow.getCells();
|
||||
String tmpTitle = tmpCells[3].value.toString();
|
||||
String tmpTitle = tmpCells[3].value.toString().toUpperCase().replaceAll('Ä', 'a').replaceAll('Ö', 'ö').replaceAll('Ü', 'ü').replaceAll('ß', 'ss');
|
||||
|
||||
if (tmpTitle.toUpperCase().compareTo(movieTitle) >= 0) {
|
||||
rowNum = i;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (rowNum == -1) {
|
||||
rowNum = movieDataSource._movieDataGridRows.length;
|
||||
}
|
||||
|
||||
movieDataSource._movieDataGridRows.insert(rowNum, newRow);
|
||||
movieDataSource.updateDataGrid();
|
||||
movieDataSource.rows.insert(rowNum, newRow);
|
||||
movieDataSource.notifyListeners();
|
||||
}
|
||||
|
||||
void addMovieFinished() {}
|
||||
@@ -398,6 +396,13 @@ class MovieDataSource extends DataGridSource {
|
||||
buildDataGridRow();
|
||||
}
|
||||
|
||||
void addDataGridRow(DataGridRow newRow) {
|
||||
rows.add(newRow);
|
||||
|
||||
// To refresh the DataGrid based on CRUD operation.
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
Logger logger = getLogger();
|
||||
|
||||
void buildDataGridRow() {
|
||||
|
||||
Reference in New Issue
Block a user