movie and tvshow list
This commit is contained in:
@@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"dbProtocol": "http",
|
|
||||||
"dbHost": "192.168.0.70",
|
|
||||||
"dbPath": "/multimedia.php",
|
|
||||||
"dbUser": "",
|
|
||||||
"dbPassword": ""
|
|
||||||
}
|
|
||||||
Binary file not shown.
@@ -1,3 +1,5 @@
|
|||||||
|
import 'dart:ui' as ui;
|
||||||
|
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
@@ -10,10 +12,14 @@ import 'package:syncfusion_flutter_core/theme.dart';
|
|||||||
|
|
||||||
import 'package:multimedia/data/tvshows.dart';
|
import 'package:multimedia/data/tvshows.dart';
|
||||||
|
|
||||||
|
Color _kColorNone = Colors.black;
|
||||||
Color _kColorInit = const Color.fromARGB(255, 192, 192, 192);
|
Color _kColorInit = const Color.fromARGB(255, 192, 192, 192);
|
||||||
Color _kColorProg = const Color.fromARGB(255, 0, 0, 192);
|
Color _kColorProg = const Color.fromARGB(255, 0, 0, 192);
|
||||||
Color _kColorDone = const Color.fromARGB(255, 0, 192, 0);
|
Color _kColorDone = const Color.fromARGB(255, 0, 192, 0);
|
||||||
|
|
||||||
|
double _kStateWidth = 6;
|
||||||
|
double _kStateHeight = 30;
|
||||||
|
|
||||||
class TVShowsScreen extends StatefulWidget {
|
class TVShowsScreen extends StatefulWidget {
|
||||||
const TVShowsScreen({
|
const TVShowsScreen({
|
||||||
super.key,
|
super.key,
|
||||||
@@ -179,7 +185,8 @@ class _TVShowsScreenState extends State<TVShowsScreen> {
|
|||||||
navigationMode: GridNavigationMode.row,
|
navigationMode: GridNavigationMode.row,
|
||||||
columns: _columns,
|
columns: _columns,
|
||||||
controller: _dataGridController,
|
controller: _dataGridController,
|
||||||
columnWidthMode: ColumnWidthMode.fill,
|
columnWidthMode: ColumnWidthMode.auto,
|
||||||
|
columnWidthCalculationRange: ColumnWidthCalculationRange.allRows,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: const Center(
|
: const Center(
|
||||||
@@ -200,16 +207,48 @@ class TVShowDataSource extends DataGridSource {
|
|||||||
buildDataGridRow();
|
buildDataGridRow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String convertState(String state) {
|
||||||
|
List<String> stateList = state.split(',');
|
||||||
|
int maxEpisode = 0;
|
||||||
|
Map stateListMap = {};
|
||||||
|
|
||||||
|
for (var x = 0; x < stateList.length; x++) {
|
||||||
|
List<String> tmp = stateList[x].split('|');
|
||||||
|
stateListMap[tmp[0]] = tmp[1];
|
||||||
|
|
||||||
|
int episode = int.parse(tmp[0]);
|
||||||
|
if (episode > maxEpisode) {
|
||||||
|
maxEpisode = episode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String stateString = "";
|
||||||
|
|
||||||
|
for (int x = 0; x < maxEpisode; x++) {
|
||||||
|
String s = '0';
|
||||||
|
int key = x + 1;
|
||||||
|
|
||||||
|
if (stateListMap.containsKey('$key')) {
|
||||||
|
s = stateListMap['$key'];
|
||||||
|
}
|
||||||
|
|
||||||
|
stateString = stateString + s;
|
||||||
|
}
|
||||||
|
|
||||||
|
return stateString;
|
||||||
|
}
|
||||||
|
|
||||||
List<DataGridCell> setSeasonData(int maxSeason, List<Season> seasonList) {
|
List<DataGridCell> setSeasonData(int maxSeason, List<Season> seasonList) {
|
||||||
List<DataGridCell> dataGridCell = [];
|
List<DataGridCell> dataGridCell = [];
|
||||||
|
int length = seasonList.length;
|
||||||
|
|
||||||
for (int x = 1; x <= maxSeason; x++) {
|
for (int x = 1; x <= maxSeason; x++) {
|
||||||
String status = '';
|
String status = '';
|
||||||
|
|
||||||
if (seasonList.length <= x) {
|
if (x <= length) {
|
||||||
status = seasonList[x].state;
|
status = convertState(seasonList[x - 1].state);
|
||||||
}
|
}
|
||||||
dataGridCell.add(DataGridCell(columnName: 'season$x', value: 'status'));
|
dataGridCell.add(DataGridCell(columnName: 'season$x', value: status));
|
||||||
}
|
}
|
||||||
|
|
||||||
return dataGridCell;
|
return dataGridCell;
|
||||||
@@ -244,6 +283,52 @@ class TVShowDataSource extends DataGridSource {
|
|||||||
@override
|
@override
|
||||||
List<DataGridRow> get rows => _tvshowDataGridRows;
|
List<DataGridRow> get rows => _tvshowDataGridRows;
|
||||||
|
|
||||||
|
void _drawEpisodeState(Canvas c, Paint p, double x, Color color) {
|
||||||
|
Offset p1 = Offset(x + _kStateWidth, 1);
|
||||||
|
Offset p2 = Offset(x + _kStateWidth, _kStateHeight - 1);
|
||||||
|
Rect rect = Rect.fromLTRB(x, 0, x + _kStateWidth, _kStateHeight);
|
||||||
|
p.style = PaintingStyle.fill;
|
||||||
|
p.color = color;
|
||||||
|
c.drawRect(rect, p);
|
||||||
|
p.color = Colors.black;
|
||||||
|
c.drawLine(p1, p2, p);
|
||||||
|
}
|
||||||
|
|
||||||
|
Row generateSeasonState(String state) {
|
||||||
|
if (state.length == 0) {
|
||||||
|
return const Row(
|
||||||
|
children: [Text('')],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Color> stateColor = [];
|
||||||
|
|
||||||
|
for (int x = 0; x < state.length; x++) {
|
||||||
|
Color c = _kColorNone;
|
||||||
|
|
||||||
|
if (state[x] == '1') {
|
||||||
|
c = _kColorInit;
|
||||||
|
} else if (state[x] == '2') {
|
||||||
|
c = _kColorProg;
|
||||||
|
} else if (state[x] == '3') {
|
||||||
|
c = _kColorDone;
|
||||||
|
}
|
||||||
|
|
||||||
|
stateColor.add(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Row(children: <Widget>[
|
||||||
|
...stateColor.map((col) => Text(
|
||||||
|
'1',
|
||||||
|
style: TextStyle(
|
||||||
|
fontFamily: 'geometric',
|
||||||
|
fontSize: 30,
|
||||||
|
color: col,
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
DataGridRowAdapter buildRow(DataGridRow row) {
|
DataGridRowAdapter buildRow(DataGridRow row) {
|
||||||
return DataGridRowAdapter(
|
return DataGridRowAdapter(
|
||||||
@@ -277,10 +362,12 @@ class TVShowDataSource extends DataGridSource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (e.columnName.startsWith('season')) {
|
if (e.columnName.startsWith('season')) {
|
||||||
|
Row row = generateSeasonState(e.value.toString());
|
||||||
|
|
||||||
return Container(
|
return Container(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
padding: EdgeInsets.symmetric(horizontal: 16),
|
padding: EdgeInsets.symmetric(horizontal: 16),
|
||||||
child: Icon(Icons.location_on),
|
child: row,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+7
-2
@@ -65,8 +65,8 @@ flutter:
|
|||||||
uses-material-design: true
|
uses-material-design: true
|
||||||
|
|
||||||
# To add assets to your application, add an assets section, like this:
|
# To add assets to your application, add an assets section, like this:
|
||||||
assets:
|
# assets:
|
||||||
- assets/cfg/config.json
|
# - assets/cfg/config.json
|
||||||
# - images/a_dot_burr.jpeg
|
# - images/a_dot_burr.jpeg
|
||||||
# - images/a_dot_ham.jpeg
|
# - images/a_dot_ham.jpeg
|
||||||
|
|
||||||
@@ -95,3 +95,8 @@ flutter:
|
|||||||
#
|
#
|
||||||
# For details regarding fonts from package dependencies,
|
# For details regarding fonts from package dependencies,
|
||||||
# see https://flutter.dev/custom-fonts/#from-packages
|
# see https://flutter.dev/custom-fonts/#from-packages
|
||||||
|
fonts:
|
||||||
|
- family: geometric
|
||||||
|
fonts:
|
||||||
|
- asset: assets/fonts/geometric.ttf
|
||||||
|
style: normal
|
||||||
Reference in New Issue
Block a user