movie and tvshow list

This commit is contained in:
2024-04-25 16:43:44 +02:00
parent 76d2ffc771
commit 0096fcbb99
16 changed files with 1749 additions and 222 deletions
+22 -1
View File
@@ -241,6 +241,10 @@ class TVShowDetailsScreen extends StatelessWidget {
);
}
bool save() {
return true;
}
@override
Widget build(BuildContext context) {
String url = 'http://image.tmdb.org/t/p/original${tvShow.backdropPath}';
@@ -249,7 +253,24 @@ class TVShowDetailsScreen extends StatelessWidget {
return Scaffold(
appBar: AppBar(
title: Text("${tvShow.seriesName} ($firstAiredYear)"),
),
actions: [
IconButton(
icon: const Icon(Icons.check_circle_outline),
tooltip: 'Save changes',
onPressed: () {
if (save()) {
Navigator.pop(context);
}
},
),
IconButton(
icon: const Icon(Icons.highlight_off),
tooltip: 'Revert changes',
onPressed: () {
Navigator.pop(context);
},
),
], ),
body: Stack(children: [
Container(
decoration: BoxDecoration(
+122 -122
View File
@@ -70,7 +70,7 @@ class _TVShowsScreenState extends State<TVShowsScreen> {
}
List<TVShow> _tvshows =
await tvshowList.map<TVShow>((json) => TVShow.fromJson(json)).toList();
await tvshowList.map<TVShow>((json) => TVShow.fromJson(json)).toList();
tvshowDataSource = TVShowDataSource(_tvshows, maxSeason);
List<EpisodeCount> _episodecount = await episodeList
@@ -186,7 +186,7 @@ class _TVShowsScreenState extends State<TVShowsScreen> {
void showTVShowDetails(int index) {
List<DataGridCell<dynamic>> cells =
tvshowDataSource.effectiveRows.elementAt(index).getCells();
tvshowDataSource.effectiveRows.elementAt(index).getCells();
String seriesID = cells[TVShowColumn.seriesID].value.toString();
bool found = false;
@@ -216,42 +216,42 @@ class _TVShowsScreenState extends State<TVShowsScreen> {
builder: (context, data) {
return data.hasData
? SfDataGridTheme(
data: const SfDataGridThemeData(
headerColor: Color(0xff009889),
),
child: SfDataGrid(
source: tvshowDataSource,
selectionMode: SelectionMode.single,
navigationMode: GridNavigationMode.row,
columns: _columns,
controller: _dataGridController,
columnWidthMode: ColumnWidthMode.auto,
columnWidthCalculationRange:
ColumnWidthCalculationRange.allRows,
onCellTap: (DataGridCellTapDetails details) {
int index = details.rowColumnIndex.rowIndex - 1;
if (index < 0) {
return;
}
showTVShowDetails(index);
},
onCellDoubleTap: (DataGridCellDoubleTapDetails details) {
print(details.rowColumnIndex);
},
onCellLongPress: (DataGridCellLongPressDetails details) {
print(details.rowColumnIndex);
},
onCellSecondaryTap: (DataGridCellTapDetails details) {
print(details.rowColumnIndex);
},
),
)
data: const SfDataGridThemeData(
headerColor: Color(0xff009889),
),
child: SfDataGrid(
source: tvshowDataSource,
selectionMode: SelectionMode.single,
navigationMode: GridNavigationMode.row,
columns: _columns,
controller: _dataGridController,
columnWidthMode: ColumnWidthMode.auto,
columnWidthCalculationRange:
ColumnWidthCalculationRange.allRows,
onCellTap: (DataGridCellTapDetails details) {
int index = details.rowColumnIndex.rowIndex - 1;
if (index < 0) {
return;
}
showTVShowDetails(index);
},
onCellDoubleTap: (DataGridCellDoubleTapDetails details) {
print(details.rowColumnIndex);
},
onCellLongPress: (DataGridCellLongPressDetails details) {
print(details.rowColumnIndex);
},
onCellSecondaryTap: (DataGridCellTapDetails details) {
print(details.rowColumnIndex);
},
),
)
: const Center(
child: CircularProgressIndicator(
strokeWidth: 2,
value: 0.8,
),
);
child: CircularProgressIndicator(
strokeWidth: 2,
value: 0.8,
),
);
},
),
);
@@ -314,24 +314,24 @@ class TVShowDataSource extends DataGridSource {
void buildDataGridRow() {
_tvshowDataGridRows = tvshows
.map<DataGridRow>((e) => DataGridRow(cells: [
DataGridCell<int>(columnName: 'seriesID', value: e.seriesID),
DataGridCell<int>(
columnName: 'seriesState', value: e.seriesState),
DataGridCell<String>(columnName: 'status', value: e.status),
DataGridCell<int>(
columnName: 'cliffhanger', value: e.cliffhanger),
DataGridCell<String>(
columnName: 'backdropPath', value: e.backdropPath),
DataGridCell<String>(columnName: 'overview', value: e.overview),
DataGridCell<String>(
columnName: 'seriesName', value: e.seriesName),
DataGridCell<String>(
columnName: 'firstAired',
value: DateFormat('yyyy-MM-dd').format(e.firstAired)),
DataGridCell<String>(
columnName: 'resolution', value: e.resolution),
...setSeasonData(maxSeason, e.seasonStatus),
]))
DataGridCell<int>(columnName: 'seriesID', value: e.seriesID),
DataGridCell<int>(
columnName: 'seriesState', value: e.seriesState),
DataGridCell<String>(columnName: 'status', value: e.status),
DataGridCell<int>(
columnName: 'cliffhanger', value: e.cliffhanger),
DataGridCell<String>(
columnName: 'backdropPath', value: e.backdropPath),
DataGridCell<String>(columnName: 'overview', value: e.overview),
DataGridCell<String>(
columnName: 'seriesName', value: e.seriesName),
DataGridCell<String>(
columnName: 'firstAired',
value: DateFormat('yyyy-MM-dd').format(e.firstAired)),
DataGridCell<String>(
columnName: 'resolution', value: e.resolution),
...setSeasonData(maxSeason, e.seasonStatus),
]))
.toList();
}
@@ -368,13 +368,13 @@ class TVShowDataSource extends DataGridSource {
return Row(children: <Widget>[
...stateColor.map((col) => Text(
'1',
style: TextStyle(
fontFamily: 'geometric',
fontSize: 30,
color: col,
),
)),
'1',
style: TextStyle(
fontFamily: 'geometric',
fontSize: 30,
color: col,
),
)),
]);
}
@@ -382,74 +382,74 @@ class TVShowDataSource extends DataGridSource {
DataGridRowAdapter buildRow(DataGridRow row) {
return DataGridRowAdapter(
cells: row.getCells().map<Widget>((e) {
Color colorBG = Colors.white;
Color colorFG = Colors.black;
FontWeight fontWeight = FontWeight.normal;
FontStyle fontStyle = FontStyle.normal;
Color colorBG = Colors.white;
Color colorFG = Colors.black;
FontWeight fontWeight = FontWeight.normal;
FontStyle fontStyle = FontStyle.normal;
if (e.columnName == 'seriesName') {
int seriesState =
row.getCells().toList()[TVShowColumn.seriesState].value;
String status = row.getCells().toList()[TVShowColumn.state].value;
int cliffhanger =
row.getCells().toList()[TVShowColumn.cliffhanger].value;
if (e.columnName == 'seriesName') {
int seriesState =
row.getCells().toList()[TVShowColumn.seriesState].value;
String status = row.getCells().toList()[TVShowColumn.state].value;
int cliffhanger =
row.getCells().toList()[TVShowColumn.cliffhanger].value;
if (seriesState == 1) {
colorBG = StateColor.init;
} else if (seriesState == 2) {
colorBG = StateColor.prog;
colorFG = Colors.white;
} else {
colorBG = StateColor.done;
}
if (seriesState == 1) {
colorBG = StateColor.init;
} else if (seriesState == 2) {
colorBG = StateColor.prog;
colorFG = Colors.white;
} else {
colorBG = StateColor.done;
}
if (cliffhanger == 1) {
fontStyle = FontStyle.italic;
}
if (cliffhanger == 1) {
fontStyle = FontStyle.italic;
}
if (status == 'In Production' || status == 'Returning Series') {
fontWeight = FontWeight.bold;
}
}
if (status == 'In Production' || status == 'Returning Series') {
fontWeight = FontWeight.bold;
}
}
if (e.columnName.startsWith('season')) {
Row row = generateSeasonState(e.value.toString());
if (e.columnName.startsWith('season')) {
Row row = generateSeasonState(e.value.toString());
return Container(
alignment: Alignment.center,
padding: const EdgeInsets.symmetric(horizontal: 16),
child: row,
);
}
return Container(
alignment: Alignment.center,
padding: const EdgeInsets.symmetric(horizontal: 16),
child: row,
);
}
if (e.columnName.startsWith('seriesName')) {
return Container(
alignment: Alignment.centerLeft,
padding: const EdgeInsets.all(8.0),
color: colorBG,
child: Text(
e.value.toString(),
style: TextStyle(
color: colorFG,
fontWeight: fontWeight,
fontStyle: fontStyle,
),
),
);
}
return Container(
alignment: Alignment.centerLeft,
padding: const EdgeInsets.all(8.0),
child: Text(
e.value.toString(),
style: TextStyle(
fontWeight: fontWeight,
fontStyle: fontStyle,
),
if (e.columnName.startsWith('seriesName')) {
return Container(
alignment: Alignment.centerLeft,
padding: const EdgeInsets.all(8.0),
color: colorBG,
child: Text(
e.value.toString(),
style: TextStyle(
color: colorFG,
fontWeight: fontWeight,
fontStyle: fontStyle,
),
);
}).toList());
),
);
}
return Container(
alignment: Alignment.centerLeft,
padding: const EdgeInsets.all(8.0),
child: Text(
e.value.toString(),
style: TextStyle(
fontWeight: fontWeight,
fontStyle: fontStyle,
),
),
);
}).toList());
}
void updateDataGrid() {