diff --git a/lib/components/dlForm.dart b/lib/components/dlForm.dart index 2ac92aa..ba0e948 100644 --- a/lib/components/dlForm.dart +++ b/lib/components/dlForm.dart @@ -15,7 +15,8 @@ class DlForm extends StatelessWidget { child: Form(child: LayoutBuilder( builder: (BuildContext context, BoxConstraints constraints) { debugPrint('Max width: ${constraints.maxWidth}'); - if (constraints.maxWidth < 720) { + debugPrint('Max height: ${MediaQuery.of(context).size.height}'); + if (constraints.maxWidth < 320) { return Column( children: [ Row(children: [ @@ -23,11 +24,26 @@ class DlForm extends StatelessWidget { ]), Row(children: [ Expanded(flex: 1, child: DropdownFormat()), + ]), + Row(children: [ Expanded(flex: 1, child: SubmitButton()), ]), DebugDlFormState(), ], ); + } else if (constraints.maxWidth < 720) { + return Column( + children: [ + Row(children: [ + UrlTextField(), + ]), + Row(children: [ + Expanded(flex: 1, child: DropdownFormat()), + Expanded(flex: 2, child: SubmitButton()), + ]), + DebugDlFormState(), + ], + ); } else { return Column( children: [ diff --git a/lib/components/formComponents/submitButton.dart b/lib/components/formComponents/submitButton.dart index c8b9a58..9de4138 100644 --- a/lib/components/formComponents/submitButton.dart +++ b/lib/components/formComponents/submitButton.dart @@ -17,24 +17,27 @@ class _SubmitButtonState extends State { @override Widget build(BuildContext context) { var dlForm = context.watch(); - return MouseRegion( - cursor: SystemMouseCursors.click, - child: GestureDetector( - onTap: () { - dlForm.download(); - }, - child: InkWell( - onHover: (hovering) { - setState(() => isHovering = hovering); + return ConstrainedBox( + constraints: BoxConstraints.tightFor(width: 200), + child: MouseRegion( + cursor: SystemMouseCursors.click, + child: GestureDetector( + onTap: () { + dlForm.download(); }, - child: Container( - padding: - const EdgeInsets.symmetric(horizontal: 80, vertical: 14), - decoration: BoxDecoration( - color: isHovering ? colorDarkRed : colorMainRed, + child: InkWell( + onHover: (hovering) { + debugPrint('Hovering: $hovering'); + setState(() => isHovering = hovering); + }, + child: Container( + padding: const EdgeInsets.symmetric(vertical: 14), + decoration: BoxDecoration( + color: isHovering ? colorDarkRed : colorMainRed, + ), + child: const Text('Ok', textAlign: TextAlign.center).tr(), ), - child: const Text('Ok').tr(), - ), - ))); + ))), + ); } } diff --git a/lib/screens/home.dart b/lib/screens/home.dart index 94e7ac4..5c4ece2 100644 --- a/lib/screens/home.dart +++ b/lib/screens/home.dart @@ -13,15 +13,24 @@ class Home extends StatelessWidget { title: Text('home').tr(), ), body: Center( - child: Column( - children: [ - SizedBox(height: 10), - Text('home_intro').tr(), - SizedBox(height: 10), - Padding( - padding: EdgeInsets.symmetric(horizontal: 20), - child: DlForm()) - ], + child: Container( + constraints: BoxConstraints.expand(), + decoration: BoxDecoration( + image: DecorationImage( + image: AssetImage("assets/images/wallpaper.webp"), + fit: BoxFit.cover, + ), + ), + child: Column( + children: [ + SizedBox(height: 10), + Text('home_intro').tr(), + SizedBox(height: 10), + Padding( + padding: EdgeInsets.symmetric(horizontal: 20), + child: DlForm()) + ], + ), ), )); } diff --git a/lib/states/dlFormState.dart b/lib/states/dlFormState.dart index a32a7fe..7a78e39 100644 --- a/lib/states/dlFormState.dart +++ b/lib/states/dlFormState.dart @@ -38,12 +38,13 @@ class DlFormState extends ChangeNotifier { }); var ytDlpPath = tempFile.path; - var command = url.trim(); + var command = + '${url.trim()} --sub-langs "all,-live_chat" --embed-subs --embed-thumbnail --embed-metadata --output temp.mp4'; var shell = Shell(); debugPrint('Running $ytDlpPath $command'); var results = await shell.run(''' - pwd + dir $ytDlpPath $command '''); } diff --git a/pubspec.yaml b/pubspec.yaml index 7ffb6a5..508b2f6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -31,6 +31,7 @@ flutter: assets: - lib/translations/ + - assets/images/ - assets/executable/ flutter_intl: enabled: true