mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-08-13 10:28:10 +02:00
Allow any source to be overridden (#1420)
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
import 'package:easy_localization/easy_localization.dart';
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:obtainium/app_sources/html.dart';
|
|
||||||
import 'package:obtainium/components/custom_app_bar.dart';
|
import 'package:obtainium/components/custom_app_bar.dart';
|
||||||
import 'package:obtainium/components/generated_form.dart';
|
import 'package:obtainium/components/generated_form.dart';
|
||||||
import 'package:obtainium/components/generated_form_modal.dart';
|
import 'package:obtainium/components/generated_form_modal.dart';
|
||||||
@@ -62,18 +61,6 @@ class AddAppPageState extends State<AddAppPage> {
|
|||||||
var prevHost = pickedSource?.hosts.isNotEmpty == true
|
var prevHost = pickedSource?.hosts.isNotEmpty == true
|
||||||
? pickedSource?.hosts[0]
|
? pickedSource?.hosts[0]
|
||||||
: null;
|
: null;
|
||||||
try {
|
|
||||||
var naturalSource =
|
|
||||||
valid ? sourceProvider.getSource(userInput) : null;
|
|
||||||
if (naturalSource != null &&
|
|
||||||
naturalSource.runtimeType.toString() !=
|
|
||||||
HTML().runtimeType.toString()) {
|
|
||||||
// If input has changed to match a regular source, reset the override
|
|
||||||
pickedSourceOverride = null;
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
// ignore
|
|
||||||
}
|
|
||||||
var source = valid
|
var source = valid
|
||||||
? sourceProvider.getSource(userInput,
|
? sourceProvider.getSource(userInput,
|
||||||
overrideSource: pickedSourceOverride)
|
overrideSource: pickedSourceOverride)
|
||||||
@@ -361,8 +348,9 @@ class AddAppPageState extends State<AddAppPage> {
|
|||||||
[
|
[
|
||||||
GeneratedFormDropdown(
|
GeneratedFormDropdown(
|
||||||
'overrideSource',
|
'overrideSource',
|
||||||
defaultValue: HTML().runtimeType.toString(),
|
defaultValue: '',
|
||||||
[
|
[
|
||||||
|
MapEntry('', tr('none')),
|
||||||
...sourceProvider.sources.map(
|
...sourceProvider.sources.map(
|
||||||
(s) => MapEntry(s.runtimeType.toString(), s.name))
|
(s) => MapEntry(s.runtimeType.toString(), s.name))
|
||||||
],
|
],
|
||||||
@@ -577,11 +565,7 @@ class AddAppPageState extends State<AddAppPage> {
|
|||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 16,
|
height: 16,
|
||||||
),
|
),
|
||||||
if (pickedSourceOverride != null ||
|
if (pickedSource != null) getHTMLSourceOverrideDropdown(),
|
||||||
(pickedSource != null &&
|
|
||||||
pickedSource.runtimeType.toString() ==
|
|
||||||
HTML().runtimeType.toString()))
|
|
||||||
getHTMLSourceOverrideDropdown(),
|
|
||||||
if (shouldShowSearchBar()) getSearchBarRow(),
|
if (shouldShowSearchBar()) getSearchBarRow(),
|
||||||
if (pickedSource != null)
|
if (pickedSource != null)
|
||||||
FutureBuilder(
|
FutureBuilder(
|
||||||
|
Reference in New Issue
Block a user