From 61b8d3e0e9445cb612c017f78441d8e67ffa74c1 Mon Sep 17 00:00:00 2001 From: Herwig Birke Date: Thu, 17 Apr 2025 08:57:22 +0200 Subject: [PATCH] add movie(s) --- lib/widgets/movies/list_screen.dart | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/lib/widgets/movies/list_screen.dart b/lib/widgets/movies/list_screen.dart index b34d188..99ba193 100644 --- a/lib/widgets/movies/list_screen.dart +++ b/lib/widgets/movies/list_screen.dart @@ -335,8 +335,7 @@ class _MoviesScreenState extends State { } 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 { for (int i = 0; i < movieDataSource._movieDataGridRows.length; i++) { DataGridRow tmpRow = movieDataSource._movieDataGridRows[i]; List 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() {