170 lines
4.9 KiB
Dart
170 lines
4.9 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import 'package:multimedia/constants.dart';
|
|
import 'package:multimedia/widgets/tvshows/details/settings_box_download_link.dart';
|
|
import 'package:multimedia/widgets/tvshows/details/settings_box_local_path.dart';
|
|
import 'package:multimedia/widgets/tvshows/details/settings_box_resolution.dart';
|
|
import 'package:multimedia/widgets/tvshows/details/settings_box_cliffhanger.dart';
|
|
|
|
// ignore: must_be_immutable
|
|
class TVShowDetailsSettingsBox extends StatelessWidget {
|
|
TVShowDetailsSettingsBox({
|
|
super.key,
|
|
required this.downloadLink,
|
|
required this.localPath,
|
|
required this.resolution,
|
|
required this.cliffhanger,
|
|
required this.settingsChanged,
|
|
});
|
|
|
|
String downloadLink;
|
|
String localPath;
|
|
String resolution;
|
|
int cliffhanger;
|
|
|
|
final Function(String downloadLink, String localPath, String resolution,
|
|
int cliffhanger) settingsChanged;
|
|
|
|
void downloadLinkChanged(String downloadLink) {
|
|
this.downloadLink = downloadLink;
|
|
settingsChanged(downloadLink, localPath, resolution, cliffhanger);
|
|
}
|
|
|
|
void localPathChanged(String localPath) {
|
|
this.localPath = localPath;
|
|
settingsChanged(downloadLink, localPath, resolution, cliffhanger);
|
|
}
|
|
|
|
void resolutionChanged(String resolution) {
|
|
this.resolution = resolution;
|
|
settingsChanged(downloadLink, localPath, resolution, cliffhanger);
|
|
}
|
|
|
|
void cliffhangerChanged(int cliffhanger) {
|
|
this.cliffhanger = cliffhanger;
|
|
settingsChanged(downloadLink, localPath, resolution, cliffhanger);
|
|
}
|
|
|
|
Widget generateInputs(BuildContext context) {
|
|
double width = MediaQuery.of(context).size.width;
|
|
|
|
if (width < 1000) {
|
|
return Table(
|
|
columnWidths: const {
|
|
0: IntrinsicColumnWidth(),
|
|
1: IntrinsicColumnWidth(),
|
|
},
|
|
children: [
|
|
TableRow(
|
|
children: [
|
|
TVShowDetailsSettingsBoxDownloadLink(
|
|
downloadLink: downloadLink,
|
|
downloadLinkChanged: downloadLinkChanged,
|
|
),
|
|
TVShowDetailsSettingsBoxResolution(
|
|
resolution: resolution,
|
|
resolutionChanged: resolutionChanged,
|
|
),
|
|
],
|
|
),
|
|
TableRow(
|
|
children: [
|
|
TVShowDetailsSettingsBoxLocalPath(
|
|
localPath: localPath,
|
|
localPathChanged: localPathChanged,
|
|
),
|
|
TVShowDetailsSettingsBoxCliffhanger(
|
|
cliffhanger: cliffhanger,
|
|
cliffhangerChanged: cliffhangerChanged,
|
|
),
|
|
],
|
|
),
|
|
],
|
|
);
|
|
}
|
|
|
|
return Table(
|
|
columnWidths: const {
|
|
0: IntrinsicColumnWidth(),
|
|
1: IntrinsicColumnWidth(),
|
|
2: IntrinsicColumnWidth(),
|
|
3: IntrinsicColumnWidth(),
|
|
},
|
|
children: [
|
|
TableRow(
|
|
children: [
|
|
TVShowDetailsSettingsBoxDownloadLink(
|
|
downloadLink: downloadLink,
|
|
downloadLinkChanged: downloadLinkChanged,
|
|
),
|
|
TVShowDetailsSettingsBoxLocalPath(
|
|
localPath: localPath,
|
|
localPathChanged: localPathChanged,
|
|
),
|
|
TVShowDetailsSettingsBoxResolution(
|
|
resolution: resolution,
|
|
resolutionChanged: resolutionChanged,
|
|
),
|
|
TVShowDetailsSettingsBoxCliffhanger(
|
|
cliffhanger: cliffhanger,
|
|
cliffhangerChanged: cliffhangerChanged,
|
|
),
|
|
],
|
|
),
|
|
],
|
|
);
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
decoration: BoxDecoration(
|
|
color: BoxColor.backgroundColor,
|
|
borderRadius: const BorderRadius.all(
|
|
Radius.circular(10.0),
|
|
),
|
|
),
|
|
child: Column(
|
|
children: [
|
|
Padding(
|
|
padding: const EdgeInsets.only(
|
|
left: 5.0,
|
|
right: 5.0,
|
|
top: 10.0,
|
|
bottom: 5.0,
|
|
),
|
|
child: Container(
|
|
decoration: BoxDecoration(
|
|
color: BoxColor.titleBackgroundColor,
|
|
borderRadius: const BorderRadius.all(
|
|
Radius.circular(10.0),
|
|
),
|
|
),
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
children: [
|
|
Text(
|
|
'Settings',
|
|
style: TextStyle(
|
|
fontWeight: FontWeight.bold,
|
|
color: BoxColor.titleColor),
|
|
textAlign: TextAlign.center,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
Container(
|
|
alignment: Alignment.centerLeft,
|
|
child: SingleChildScrollView(
|
|
scrollDirection: Axis.horizontal,
|
|
child: generateInputs(context),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|