[ui] basic responsive
This commit is contained in:
parent
5a951403cd
commit
3503f37134
|
|
@ -15,7 +15,8 @@ class DlForm extends StatelessWidget {
|
||||||
child: Form(child: LayoutBuilder(
|
child: Form(child: LayoutBuilder(
|
||||||
builder: (BuildContext context, BoxConstraints constraints) {
|
builder: (BuildContext context, BoxConstraints constraints) {
|
||||||
debugPrint('Max width: ${constraints.maxWidth}');
|
debugPrint('Max width: ${constraints.maxWidth}');
|
||||||
if (constraints.maxWidth < 720) {
|
debugPrint('Max height: ${MediaQuery.of(context).size.height}');
|
||||||
|
if (constraints.maxWidth < 320) {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
Row(children: <Widget>[
|
Row(children: <Widget>[
|
||||||
|
|
@ -23,11 +24,26 @@ class DlForm extends StatelessWidget {
|
||||||
]),
|
]),
|
||||||
Row(children: <Widget>[
|
Row(children: <Widget>[
|
||||||
Expanded(flex: 1, child: DropdownFormat()),
|
Expanded(flex: 1, child: DropdownFormat()),
|
||||||
|
]),
|
||||||
|
Row(children: <Widget>[
|
||||||
Expanded(flex: 1, child: SubmitButton()),
|
Expanded(flex: 1, child: SubmitButton()),
|
||||||
]),
|
]),
|
||||||
DebugDlFormState(),
|
DebugDlFormState(),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
} else if (constraints.maxWidth < 720) {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
Row(children: <Widget>[
|
||||||
|
UrlTextField(),
|
||||||
|
]),
|
||||||
|
Row(children: <Widget>[
|
||||||
|
Expanded(flex: 1, child: DropdownFormat()),
|
||||||
|
Expanded(flex: 2, child: SubmitButton()),
|
||||||
|
]),
|
||||||
|
DebugDlFormState(),
|
||||||
|
],
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,9 @@ class _SubmitButtonState extends State<SubmitButton> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
var dlForm = context.watch<DlFormState>();
|
var dlForm = context.watch<DlFormState>();
|
||||||
return MouseRegion(
|
return ConstrainedBox(
|
||||||
|
constraints: BoxConstraints.tightFor(width: 200),
|
||||||
|
child: MouseRegion(
|
||||||
cursor: SystemMouseCursors.click,
|
cursor: SystemMouseCursors.click,
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
|
@ -25,16 +27,17 @@ class _SubmitButtonState extends State<SubmitButton> {
|
||||||
},
|
},
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onHover: (hovering) {
|
onHover: (hovering) {
|
||||||
|
debugPrint('Hovering: $hovering');
|
||||||
setState(() => isHovering = hovering);
|
setState(() => isHovering = hovering);
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
padding:
|
padding: const EdgeInsets.symmetric(vertical: 14),
|
||||||
const EdgeInsets.symmetric(horizontal: 80, vertical: 14),
|
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: isHovering ? colorDarkRed : colorMainRed,
|
color: isHovering ? colorDarkRed : colorMainRed,
|
||||||
),
|
),
|
||||||
child: const Text('Ok').tr(),
|
child: const Text('Ok', textAlign: TextAlign.center).tr(),
|
||||||
),
|
),
|
||||||
)));
|
))),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,14 @@ class Home extends StatelessWidget {
|
||||||
title: Text('home').tr(),
|
title: Text('home').tr(),
|
||||||
),
|
),
|
||||||
body: Center(
|
body: Center(
|
||||||
|
child: Container(
|
||||||
|
constraints: BoxConstraints.expand(),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
image: DecorationImage(
|
||||||
|
image: AssetImage("assets/images/wallpaper.webp"),
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
),
|
||||||
|
),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
SizedBox(height: 10),
|
SizedBox(height: 10),
|
||||||
|
|
@ -23,6 +31,7 @@ class Home extends StatelessWidget {
|
||||||
child: DlForm())
|
child: DlForm())
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,12 +38,13 @@ class DlFormState extends ChangeNotifier {
|
||||||
});
|
});
|
||||||
|
|
||||||
var ytDlpPath = tempFile.path;
|
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();
|
var shell = Shell();
|
||||||
|
|
||||||
debugPrint('Running $ytDlpPath $command');
|
debugPrint('Running $ytDlpPath $command');
|
||||||
var results = await shell.run('''
|
var results = await shell.run('''
|
||||||
pwd
|
dir
|
||||||
$ytDlpPath $command
|
$ytDlpPath $command
|
||||||
''');
|
''');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ flutter:
|
||||||
|
|
||||||
assets:
|
assets:
|
||||||
- lib/translations/
|
- lib/translations/
|
||||||
|
- assets/images/
|
||||||
- assets/executable/
|
- assets/executable/
|
||||||
flutter_intl:
|
flutter_intl:
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue