mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-08-01 21:30:16 +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/pages/app.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/settings_provider.dart';
|
||||
import 'package:obtainium/providers/source_provider.dart';
|
||||
@@ -29,6 +30,7 @@ class _AddAppPageState extends State<AddAppPage> {
|
||||
AppSource? pickedSource;
|
||||
Map<String, dynamic> additionalSettings = {};
|
||||
bool additionalSettingsValid = true;
|
||||
String? category;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -131,6 +133,9 @@ class _AddAppPageState extends State<AddAppPage> {
|
||||
if (app.additionalSettings['trackOnly'] == true) {
|
||||
app.installedVersion = app.latestVersion;
|
||||
}
|
||||
if (category != null) {
|
||||
app.category = category;
|
||||
}
|
||||
await appsProvider.saveApps([app]);
|
||||
|
||||
return app;
|
||||
@@ -299,9 +304,7 @@ class _AddAppPageState extends State<AddAppPage> {
|
||||
child: Text(tr('search')))
|
||||
],
|
||||
),
|
||||
if (pickedSource != null &&
|
||||
(pickedSource!
|
||||
.combinedAppSpecificSettingFormItems.isNotEmpty))
|
||||
if (pickedSource != null)
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
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
|
||||
|
Reference in New Issue
Block a user