mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-08-16 03:48:08 +02:00
Added category select to add app page
This commit is contained in:
@@ -8,6 +8,7 @@ import 'package:obtainium/custom_errors.dart';
|
|||||||
import 'package:obtainium/main.dart';
|
import 'package:obtainium/main.dart';
|
||||||
import 'package:obtainium/pages/app.dart';
|
import 'package:obtainium/pages/app.dart';
|
||||||
import 'package:obtainium/pages/import_export.dart';
|
import 'package:obtainium/pages/import_export.dart';
|
||||||
|
import 'package:obtainium/pages/settings.dart';
|
||||||
import 'package:obtainium/providers/apps_provider.dart';
|
import 'package:obtainium/providers/apps_provider.dart';
|
||||||
import 'package:obtainium/providers/settings_provider.dart';
|
import 'package:obtainium/providers/settings_provider.dart';
|
||||||
import 'package:obtainium/providers/source_provider.dart';
|
import 'package:obtainium/providers/source_provider.dart';
|
||||||
@@ -29,6 +30,7 @@ class _AddAppPageState extends State<AddAppPage> {
|
|||||||
AppSource? pickedSource;
|
AppSource? pickedSource;
|
||||||
Map<String, dynamic> additionalSettings = {};
|
Map<String, dynamic> additionalSettings = {};
|
||||||
bool additionalSettingsValid = true;
|
bool additionalSettingsValid = true;
|
||||||
|
String? category;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -131,6 +133,9 @@ class _AddAppPageState extends State<AddAppPage> {
|
|||||||
if (app.additionalSettings['trackOnly'] == true) {
|
if (app.additionalSettings['trackOnly'] == true) {
|
||||||
app.installedVersion = app.latestVersion;
|
app.installedVersion = app.latestVersion;
|
||||||
}
|
}
|
||||||
|
if (category != null) {
|
||||||
|
app.category = category;
|
||||||
|
}
|
||||||
await appsProvider.saveApps([app]);
|
await appsProvider.saveApps([app]);
|
||||||
|
|
||||||
return app;
|
return app;
|
||||||
@@ -299,9 +304,7 @@ class _AddAppPageState extends State<AddAppPage> {
|
|||||||
child: Text(tr('search')))
|
child: Text(tr('search')))
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
if (pickedSource != null &&
|
if (pickedSource != null)
|
||||||
(pickedSource!
|
|
||||||
.combinedAppSpecificSettingFormItems.isNotEmpty))
|
|
||||||
Column(
|
Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
children: [
|
children: [
|
||||||
@@ -328,6 +331,21 @@ class _AddAppPageState extends State<AddAppPage> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
Column(
|
||||||
|
children: [
|
||||||
|
const SizedBox(
|
||||||
|
height: 16,
|
||||||
|
),
|
||||||
|
CategoryEditorSelector(
|
||||||
|
alignment: WrapAlignment.start,
|
||||||
|
singleSelect: true,
|
||||||
|
onSelected: (categories) {
|
||||||
|
category = categories.isEmpty
|
||||||
|
? null
|
||||||
|
: categories.first;
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user