mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-08-22 22:19:29 +02:00
Updated version, standardized quotes, deleted test_page
This commit is contained in:
@@ -19,7 +19,7 @@ class AddAppPage extends StatefulWidget {
|
||||
class _AddAppPageState extends State<AddAppPage> {
|
||||
bool gettingAppInfo = false;
|
||||
|
||||
String userInput = "";
|
||||
String userInput = '';
|
||||
AppSource? pickedSource;
|
||||
List<String> additionalData = [];
|
||||
bool validAdditionalData = true;
|
||||
@@ -44,19 +44,19 @@ class _AddAppPageState extends State<AddAppPage> {
|
||||
items: [
|
||||
[
|
||||
GeneratedFormItem(
|
||||
label: "App Source Url",
|
||||
label: 'App Source Url',
|
||||
additionalValidators: [
|
||||
(value) {
|
||||
try {
|
||||
sourceProvider
|
||||
.getSource(value ?? "")
|
||||
.getSource(value ?? '')
|
||||
.standardizeURL(
|
||||
makeUrlHttps(
|
||||
value ?? ""));
|
||||
value ?? ''));
|
||||
} catch (e) {
|
||||
return e is String
|
||||
? e
|
||||
: "Error";
|
||||
: 'Error';
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@@ -247,13 +247,13 @@ class AppsPageState extends State<AppsPage> {
|
||||
formInputs.add([
|
||||
GeneratedFormItem(
|
||||
label:
|
||||
"Update ${existingUpdateIdsSelected.length} Apps?",
|
||||
'Update ${existingUpdateIdsSelected.length} Apps?',
|
||||
type: FormItemType.bool)
|
||||
]);
|
||||
formInputs.add([
|
||||
GeneratedFormItem(
|
||||
label:
|
||||
"Install ${newInstallIdsSelected.length} new Apps?",
|
||||
'Install ${newInstallIdsSelected.length} new Apps?',
|
||||
type: FormItemType.bool)
|
||||
]);
|
||||
}
|
||||
@@ -261,13 +261,13 @@ class AppsPageState extends State<AppsPage> {
|
||||
context: context,
|
||||
builder: (BuildContext ctx) {
|
||||
return GeneratedFormModal(
|
||||
title: "Install Selected Apps?",
|
||||
title: 'Install Selected Apps?',
|
||||
message:
|
||||
"${existingUpdateIdsSelected.length} update${existingUpdateIdsSelected.length == 1 ? '' : 's'} and ${newInstallIdsSelected.length} new install${newInstallIdsSelected.length == 1 ? '' : 's'}.",
|
||||
'${existingUpdateIdsSelected.length} update${existingUpdateIdsSelected.length == 1 ? '' : 's'} and ${newInstallIdsSelected.length} new install${newInstallIdsSelected.length == 1 ? '' : 's'}.',
|
||||
items: formInputs,
|
||||
defaultValues: const [
|
||||
"true",
|
||||
"true"
|
||||
'true',
|
||||
'true'
|
||||
],
|
||||
initValid: true,
|
||||
);
|
||||
@@ -275,10 +275,10 @@ class AppsPageState extends State<AppsPage> {
|
||||
if (values != null) {
|
||||
bool shouldInstallUpdates =
|
||||
values.length < 2 ||
|
||||
values[0] == "true";
|
||||
values[0] == 'true';
|
||||
bool shouldInstallNew =
|
||||
values.length < 2 ||
|
||||
values[1] == "true";
|
||||
values[1] == 'true';
|
||||
settingsProvider
|
||||
.getInstallPermission()
|
||||
.then((_) {
|
||||
@@ -323,18 +323,18 @@ class AppsPageState extends State<AppsPage> {
|
||||
items: [
|
||||
[
|
||||
GeneratedFormItem(
|
||||
label: "App Name", required: false),
|
||||
label: 'App Name', required: false),
|
||||
GeneratedFormItem(
|
||||
label: "Author", required: false)
|
||||
label: 'Author', required: false)
|
||||
],
|
||||
[
|
||||
GeneratedFormItem(
|
||||
label: "Up to Date Apps",
|
||||
label: 'Up to Date Apps',
|
||||
type: FormItemType.bool)
|
||||
],
|
||||
[
|
||||
GeneratedFormItem(
|
||||
label: "Non-Installed Apps",
|
||||
label: 'Non-Installed Apps',
|
||||
type: FormItemType.bool)
|
||||
]
|
||||
],
|
||||
@@ -371,8 +371,8 @@ class AppsFilter {
|
||||
late bool includeNonInstalled;
|
||||
|
||||
AppsFilter(
|
||||
{this.nameFilter = "",
|
||||
this.authorFilter = "",
|
||||
{this.nameFilter = '',
|
||||
this.authorFilter = '',
|
||||
this.includeUptodate = true,
|
||||
this.includeNonInstalled = true});
|
||||
|
||||
@@ -380,16 +380,16 @@ class AppsFilter {
|
||||
return [
|
||||
nameFilter,
|
||||
authorFilter,
|
||||
includeUptodate ? "true" : "",
|
||||
includeNonInstalled ? "true" : ""
|
||||
includeUptodate ? 'true' : '',
|
||||
includeNonInstalled ? 'true' : ''
|
||||
];
|
||||
}
|
||||
|
||||
AppsFilter.fromValuesArray(List<String> values) {
|
||||
nameFilter = values[0];
|
||||
authorFilter = values[1];
|
||||
includeUptodate = values[2] == "true";
|
||||
includeNonInstalled = values[3] == "true";
|
||||
includeUptodate = values[2] == 'true';
|
||||
includeNonInstalled = values[3] == 'true';
|
||||
}
|
||||
|
||||
bool isIdenticalTo(AppsFilter other) =>
|
||||
|
@@ -1,53 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:obtainium/components/generated_form.dart';
|
||||
|
||||
class TestPage extends StatefulWidget {
|
||||
const TestPage({super.key});
|
||||
|
||||
@override
|
||||
State<TestPage> createState() => _TestPageState();
|
||||
}
|
||||
|
||||
class _TestPageState extends State<TestPage> {
|
||||
List<String?>? sourceSpecificData;
|
||||
bool valid = false;
|
||||
|
||||
List<List<GeneratedFormItem>> sourceSpecificInputs = [
|
||||
[GeneratedFormItem(label: 'Test Item 1')],
|
||||
[
|
||||
GeneratedFormItem(label: 'Test Item 2', required: false),
|
||||
GeneratedFormItem(label: 'Test Item 3')
|
||||
],
|
||||
[GeneratedFormItem(label: 'Test Item 4', type: FormItemType.bool)]
|
||||
];
|
||||
|
||||
List<String> defaultInputValues = ["ABC"];
|
||||
|
||||
void onSourceSpecificDataChanges(
|
||||
List<String?> valuesFromForm, bool formValid) {
|
||||
setState(() {
|
||||
sourceSpecificData = valuesFromForm;
|
||||
valid = formValid;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text('Test Page')),
|
||||
backgroundColor: Theme.of(context).colorScheme.surface,
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Column(children: [
|
||||
GeneratedForm(
|
||||
items: sourceSpecificInputs,
|
||||
onValueChanges: onSourceSpecificDataChanges,
|
||||
defaultValues: defaultInputValues,
|
||||
),
|
||||
...(sourceSpecificData != null
|
||||
? (sourceSpecificData as List<String?>)
|
||||
.map((e) => Text(e ?? ""))
|
||||
: [Container()])
|
||||
])));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user