mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-10-25 11:53:45 +02:00
App name now editable on App page
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:obtainium/components/generated_form.dart';
|
||||||
import 'package:obtainium/components/generated_form_modal.dart';
|
import 'package:obtainium/components/generated_form_modal.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';
|
||||||
@@ -213,20 +214,35 @@ class _AppPageState extends State<AppPage> {
|
|||||||
onPressed: app?.downloadProgress != null
|
onPressed: app?.downloadProgress != null
|
||||||
? null
|
? null
|
||||||
: () {
|
: () {
|
||||||
showDialog(
|
showDialog<List<String>>(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (BuildContext ctx) {
|
builder: (BuildContext ctx) {
|
||||||
return GeneratedFormModal(
|
return GeneratedFormModal(
|
||||||
title: 'Additional Options',
|
title: 'Additional Options',
|
||||||
items: source
|
items: [
|
||||||
.additionalDataFormItems,
|
...source
|
||||||
|
.additionalDataFormItems,
|
||||||
|
[
|
||||||
|
GeneratedFormItem(
|
||||||
|
label: 'App Name',
|
||||||
|
required: true)
|
||||||
|
]
|
||||||
|
],
|
||||||
defaultValues: app != null
|
defaultValues: app != null
|
||||||
? app.app.additionalData
|
? [
|
||||||
: source
|
...app
|
||||||
.additionalDataDefaults);
|
.app.additionalData,
|
||||||
|
app.app.name
|
||||||
|
]
|
||||||
|
: [
|
||||||
|
...source
|
||||||
|
.additionalDataDefaults
|
||||||
|
]);
|
||||||
}).then((values) {
|
}).then((values) {
|
||||||
if (app != null && values != null) {
|
if (app != null && values != null) {
|
||||||
var changedApp = app.app;
|
var changedApp = app.app;
|
||||||
|
var name = values.removeLast();
|
||||||
|
changedApp.name = name;
|
||||||
changedApp.additionalData = values;
|
changedApp.additionalData = values;
|
||||||
appsProvider.saveApps([changedApp]);
|
appsProvider.saveApps([changedApp]);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user