movie and tvshow list

This commit is contained in:
2024-04-02 11:33:47 +02:00
parent cc0fccd76d
commit c8ae86a1df
6 changed files with 145 additions and 29 deletions
+30 -3
View File
@@ -1,6 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:google_fonts/google_fonts.dart'; import 'package:google_fonts/google_fonts.dart';
import 'package:global_configuration/global_configuration.dart';
import 'package:multimedia/widgets/tabsScreen.dart'; import 'package:multimedia/widgets/tabsScreen.dart';
@@ -15,7 +15,35 @@ final theme = ThemeData(
void main() async { void main() async {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
await GlobalConfiguration().loadFromPath('assets/cfg/config.json'); SharedPreferences prefs = await SharedPreferences.getInstance();
String? dbProtocol = prefs.getString('dbProtocol');
String? dbHost = prefs.getString('dbHost');
String? dbPath = prefs.getString('dbPath');
String? dbUser = prefs.getString('dbUser');
String? dbPassword = prefs.getString('dbPassword');
// if (dbProtocol == null) {
// prefs.setString('dbProtocol', 'http');
// }
// if (dbHost == null) {
// prefs.setString('dbHost', '192.168.0.70');
// }
if (dbProtocol == null) {
prefs.setString('dbProtocol', 'https');
}
if (dbHost == null) {
prefs.setString('dbHost', 'api.windesign.at');
}
if (dbPath == null) {
prefs.setString('dbPath', '/multimedia.php');
}
if (dbUser == null) {
prefs.setString('dbUser', '');
}
if (dbPassword == null) {
prefs.setString('dbPassword', '');
}
runApp(const MyApp()); runApp(const MyApp());
} }
@@ -25,7 +53,6 @@ class MyApp extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return MaterialApp( return MaterialApp(
theme: theme, theme: theme,
title: 'Multimedia', title: 'Multimedia',
+10 -5
View File
@@ -1,4 +1,5 @@
import 'dart:convert'; import 'dart:convert';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@@ -7,8 +8,6 @@ import 'package:http/http.dart' as http;
import 'package:syncfusion_flutter_datagrid/datagrid.dart'; import 'package:syncfusion_flutter_datagrid/datagrid.dart';
import 'package:syncfusion_flutter_core/theme.dart'; import 'package:syncfusion_flutter_core/theme.dart';
import 'package:global_configuration/global_configuration.dart';
import 'package:multimedia/data/movies.dart'; import 'package:multimedia/data/movies.dart';
Color _kColorInit = const Color.fromARGB(255, 192, 192, 192); Color _kColorInit = const Color.fromARGB(255, 192, 192, 192);
@@ -30,10 +29,16 @@ class _MoviesScreenState extends State<MoviesScreen> {
List<GridColumn> _columns = []; List<GridColumn> _columns = [];
Future<List<Movie>> generateMovieList() async { Future<List<Movie>> generateMovieList() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
String? dbProtocol = prefs.getString('dbProtocol');
String? dbHost = prefs.getString('dbHost');
String? dbPath = prefs.getString('dbPath');
Uri url = Uri( Uri url = Uri(
scheme: GlobalConfiguration().getValue('dbProtocol'), scheme: dbProtocol,
host: GlobalConfiguration().getValue('dbHost'), host: dbHost,
path: GlobalConfiguration().getValue('dbPath'), path: dbPath,
queryParameters: { queryParameters: {
'module': 'movie', 'module': 'movie',
'function': 'getList', 'function': 'getList',
+27 -5
View File
@@ -1,4 +1,5 @@
import 'dart:convert'; import 'dart:convert';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@@ -7,8 +8,6 @@ import 'package:http/http.dart' as http;
import 'package:syncfusion_flutter_datagrid/datagrid.dart'; import 'package:syncfusion_flutter_datagrid/datagrid.dart';
import 'package:syncfusion_flutter_core/theme.dart'; import 'package:syncfusion_flutter_core/theme.dart';
import 'package:global_configuration/global_configuration.dart';
import 'package:multimedia/data/tvshows.dart'; import 'package:multimedia/data/tvshows.dart';
Color _kColorInit = const Color.fromARGB(255, 192, 192, 192); Color _kColorInit = const Color.fromARGB(255, 192, 192, 192);
@@ -30,10 +29,18 @@ class _TVShowsScreenState extends State<TVShowsScreen> {
List<GridColumn> _columns = []; List<GridColumn> _columns = [];
Future<List<TVShow>> generateTVShowList() async { Future<List<TVShow>> generateTVShowList() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
String? dbProtocol = prefs.getString('dbProtocol');
String? dbHost = prefs.getString('dbHost');
String? dbPath = prefs.getString('dbPath');
print(dbHost);
Uri url = Uri( Uri url = Uri(
scheme: GlobalConfiguration().getValue('dbProtocol'), scheme: dbProtocol,
host: GlobalConfiguration().getValue('dbHost'), host: dbHost,
path: GlobalConfiguration().getValue('dbPath'), path: dbPath,
queryParameters: { queryParameters: {
'module': 'tvshow', 'module': 'tvshow',
'function': 'getList', 'function': 'getList',
@@ -110,6 +117,13 @@ class _TVShowsScreenState extends State<TVShowsScreen> {
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: const Text('Resolution'))), child: const Text('Resolution'))),
GridColumn(
columnName: 'season1',
columnWidthMode: ColumnWidthMode.auto,
label: Container(
padding: const EdgeInsets.all(8.0),
alignment: Alignment.centerLeft,
child: const Text('Season 1'))),
]; ];
} }
@@ -173,6 +187,7 @@ class TVShowDataSource extends DataGridSource {
value: DateFormat('yyyy-MM-dd').format(e.firstAired)), value: DateFormat('yyyy-MM-dd').format(e.firstAired)),
DataGridCell<String>( DataGridCell<String>(
columnName: 'resolution', value: e.resolution), columnName: 'resolution', value: e.resolution),
DataGridCell(columnName: 'season1', value: ''),
])) ]))
.toList(); .toList();
} }
@@ -216,6 +231,13 @@ class TVShowDataSource extends DataGridSource {
} }
} }
// if (e.columnName.startsWith('season')) {
// return Container(
// alignment: Alignment.center,
// padding: EdgeInsets.symmetric(horizontal: 16),
// child: Icon(Icons.location_on),
// );
// }
return Container( return Container(
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
@@ -6,7 +6,9 @@ import FlutterMacOS
import Foundation import Foundation
import path_provider_foundation import path_provider_foundation
import shared_preferences_foundation
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
} }
+75 -14
View File
@@ -73,6 +73,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.2" version: "2.1.2"
file:
dependency: transitive
description:
name: file
sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c"
url: "https://pub.dev"
source: hosted
version: "7.0.0"
flutter: flutter:
dependency: "direct main" dependency: "direct main"
description: flutter description: flutter
@@ -91,14 +99,11 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
global_configuration: flutter_web_plugins:
dependency: "direct main" dependency: transitive
description: description: flutter
name: global_configuration source: sdk
sha256: "432cfe858cfad7263b5cd51b1d342865a3983c400185f3839cc63b4b20702f66" version: "0.0.0"
url: "https://pub.dev"
source: hosted
version: "2.0.0"
google_fonts: google_fonts:
dependency: "direct main" dependency: "direct main"
description: description:
@@ -259,6 +264,62 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.8" version: "2.1.8"
shared_preferences:
dependency: "direct main"
description:
name: shared_preferences
sha256: "81429e4481e1ccfb51ede496e916348668fd0921627779233bd24cc3ff6abd02"
url: "https://pub.dev"
source: hosted
version: "2.2.2"
shared_preferences_android:
dependency: transitive
description:
name: shared_preferences_android
sha256: "8568a389334b6e83415b6aae55378e158fbc2314e074983362d20c562780fb06"
url: "https://pub.dev"
source: hosted
version: "2.2.1"
shared_preferences_foundation:
dependency: transitive
description:
name: shared_preferences_foundation
sha256: "7708d83064f38060c7b39db12aefe449cb8cdc031d6062280087bc4cdb988f5c"
url: "https://pub.dev"
source: hosted
version: "2.3.5"
shared_preferences_linux:
dependency: transitive
description:
name: shared_preferences_linux
sha256: "9f2cbcf46d4270ea8be39fa156d86379077c8a5228d9dfdb1164ae0bb93f1faa"
url: "https://pub.dev"
source: hosted
version: "2.3.2"
shared_preferences_platform_interface:
dependency: transitive
description:
name: shared_preferences_platform_interface
sha256: "22e2ecac9419b4246d7c22bfbbda589e3acf5c0351137d87dd2939d984d37c3b"
url: "https://pub.dev"
source: hosted
version: "2.3.2"
shared_preferences_web:
dependency: transitive
description:
name: shared_preferences_web
sha256: "9aee1089b36bd2aafe06582b7d7817fd317ef05fc30e6ba14bff247d0933042a"
url: "https://pub.dev"
source: hosted
version: "2.3.0"
shared_preferences_windows:
dependency: transitive
description:
name: shared_preferences_windows
sha256: "841ad54f3c8381c480d0c9b508b89a34036f512482c407e6df7a9c4aa2ef8f59"
url: "https://pub.dev"
source: hosted
version: "2.3.2"
sky_engine: sky_engine:
dependency: transitive dependency: transitive
description: flutter description: flutter
@@ -300,18 +361,18 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
name: syncfusion_flutter_core name: syncfusion_flutter_core
sha256: d098e3cf5ee0c5a37b083f2efdb7c6bdfaabf871f68758bb491b10b61b3dd0d7 sha256: "9fae07d8d1f1f66c61ad40cce8f85c02b8a3506ff0c3eae8ace0fd1d504b1ea5"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "25.1.37" version: "25.1.38"
syncfusion_flutter_datagrid: syncfusion_flutter_datagrid:
dependency: "direct main" dependency: "direct main"
description: description:
name: syncfusion_flutter_datagrid name: syncfusion_flutter_datagrid
sha256: "4edf6a41ab6bc398a79a0a29aa67a3fca53dab492d6c844f4c28a94c030f1785" sha256: "261587a0a673c5a38f46a48b1279ce24755c08645115021efc439483b583a2af"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "25.1.37" version: "25.1.38"
term_glyph: term_glyph:
dependency: transitive dependency: transitive
description: description:
@@ -364,10 +425,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: win32 name: win32
sha256: "8cb58b45c47dcb42ab3651533626161d6b67a2921917d8d429791f76972b3480" sha256: "0a989dc7ca2bb51eac91e8fd00851297cfffd641aa7538b165c62637ca0eaa4a"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "5.3.0" version: "5.4.0"
xdg_directories: xdg_directories:
dependency: transitive dependency: transitive
description: description:
+1 -2
View File
@@ -40,8 +40,7 @@ dependencies:
intl: ^0.19.0 intl: ^0.19.0
syncfusion_flutter_core: ^25.1.37 syncfusion_flutter_core: ^25.1.37
google_fonts: ^6.2.1 google_fonts: ^6.2.1
global_configuration: ^2.0.0 shared_preferences: ^2.2.2
#global_configuration: ^2.0.0
dev_dependencies: dev_dependencies:
flutter_test: flutter_test: