2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-06-12 10:15:32 +00:00

Reorganize settings:

- Add new setting to disable error uploading
- Move "about" info to a separate view
This commit is contained in:
Oliver
2022-01-09 22:22:08 +11:00
parent 27da8b2820
commit f1a46be417
8 changed files with 270 additions and 161 deletions

View File

@ -19,13 +19,6 @@ class _InvenTreeAppSettingsState extends State<InvenTreeAppSettingsWidget> {
final GlobalKey<_InvenTreeAppSettingsState> _settingsKey = GlobalKey<_InvenTreeAppSettingsState>();
// Home screen settings
bool homeShowSubscribed = true;
bool homeShowPo = true;
bool homeShowSuppliers = true;
bool homeShowManufacturers = true;
bool homeShowCustomers = true;
// Sound settings
bool barcodeSounds = true;
bool serverSounds = true;
@ -36,6 +29,8 @@ class _InvenTreeAppSettingsState extends State<InvenTreeAppSettingsWidget> {
// Stock settings
bool stockSublocation = false;
bool reportErrors = true;
@override
void initState() {
super.initState();
@ -47,12 +42,6 @@ class _InvenTreeAppSettingsState extends State<InvenTreeAppSettingsWidget> {
// Load initial settings
homeShowSubscribed = await InvenTreeSettingsManager().getValue(INV_HOME_SHOW_SUBSCRIBED, true) as bool;
homeShowPo = await InvenTreeSettingsManager().getValue(INV_HOME_SHOW_PO, true) as bool;
homeShowManufacturers = await InvenTreeSettingsManager().getValue(INV_HOME_SHOW_MANUFACTURERS, true) as bool;
homeShowCustomers = await InvenTreeSettingsManager().getValue(INV_HOME_SHOW_CUSTOMERS, true) as bool;
homeShowSuppliers = await InvenTreeSettingsManager().getValue(INV_HOME_SHOW_SUPPLIERS, true) as bool;
barcodeSounds = await InvenTreeSettingsManager().getValue(INV_SOUNDS_BARCODE, true) as bool;
serverSounds = await InvenTreeSettingsManager().getValue(INV_SOUNDS_SERVER, true) as bool;
@ -60,6 +49,8 @@ class _InvenTreeAppSettingsState extends State<InvenTreeAppSettingsWidget> {
stockSublocation = await InvenTreeSettingsManager().getValue(INV_STOCK_SUBLOCATION, true) as bool;
reportErrors = await InvenTreeSettingsManager().getValue(INV_REPORT_ERRORS, true) as bool;
setState(() {
});
}
@ -75,90 +66,12 @@ class _InvenTreeAppSettingsState extends State<InvenTreeAppSettingsWidget> {
body: Container(
child: ListView(
children: [
/* Home Screen Settings */
ListTile(
title: Text(
L10().homeScreen,
style: TextStyle(fontWeight: FontWeight.bold)
),
),
ListTile(
title: Text(L10().homeShowSubscribed),
subtitle: Text(L10().homeShowSubscribedDescription),
leading: FaIcon(FontAwesomeIcons.bell),
trailing: Switch(
value: homeShowSubscribed,
onChanged: (bool value) {
InvenTreeSettingsManager().setValue(INV_HOME_SHOW_SUBSCRIBED, value);
setState(() {
homeShowSubscribed = value;
});
},
)
),
ListTile(
title: Text(L10().homeShowPo),
subtitle: Text(L10().homeShowPoDescription),
leading: FaIcon(FontAwesomeIcons.shoppingCart),
trailing: Switch(
value: homeShowPo,
onChanged: (bool value) {
InvenTreeSettingsManager().setValue(INV_HOME_SHOW_PO, value);
setState(() {
homeShowPo = value;
});
},
),
),
ListTile(
title: Text(L10().homeShowSuppliers),
subtitle: Text(L10().homeShowSuppliersDescription),
leading: FaIcon(FontAwesomeIcons.building),
trailing: Switch(
value: homeShowSuppliers,
onChanged: (bool value) {
InvenTreeSettingsManager().setValue(INV_HOME_SHOW_SUPPLIERS, value);
setState(() {
homeShowSuppliers = value;
});
},
),
),
ListTile(
title: Text(L10().homeShowManufacturers),
subtitle: Text(L10().homeShowManufacturersDescription),
leading: FaIcon(FontAwesomeIcons.industry),
trailing: Switch(
value: homeShowManufacturers,
onChanged: (bool value) {
InvenTreeSettingsManager().setValue(INV_HOME_SHOW_MANUFACTURERS, value);
setState(() {
homeShowManufacturers = value;
});
},
),
),
ListTile(
title: Text(L10().homeShowCustomers),
subtitle: Text(L10().homeShowCustomersDescription),
leading: FaIcon(FontAwesomeIcons.userTie),
trailing: Switch(
value: homeShowCustomers,
onChanged: (bool value) {
InvenTreeSettingsManager().setValue(INV_HOME_SHOW_CUSTOMERS, value);
setState(() {
homeShowCustomers = value;
});
},
),
),
/* Part Settings */
Divider(height: 3),
ListTile(
title: Text(
L10().parts,
style: TextStyle(fontWeight: FontWeight.bold),
),
leading: FaIcon(FontAwesomeIcons.shapes),
),
ListTile(
title: Text(L10().includeSubcategories),
@ -180,6 +93,7 @@ class _InvenTreeAppSettingsState extends State<InvenTreeAppSettingsWidget> {
title: Text(L10().stock,
style: TextStyle(fontWeight: FontWeight.bold),
),
leading: FaIcon(FontAwesomeIcons.boxes),
),
ListTile(
title: Text(L10().includeSublocations),
@ -233,6 +147,27 @@ class _InvenTreeAppSettingsState extends State<InvenTreeAppSettingsWidget> {
),
),
Divider(height: 1),
ListTile(
title: Text(
L10().errorReporting,
style: TextStyle(fontWeight: FontWeight.bold),
),
leading: FaIcon(FontAwesomeIcons.bug),
),
ListTile(
title: Text(L10().errorReportUpload),
subtitle: Text(L10().errorReportUploadDetails),
leading: FaIcon(FontAwesomeIcons.cloudUploadAlt),
trailing: Switch(
value: reportErrors,
onChanged: (bool value) {
InvenTreeSettingsManager().setValue(INV_REPORT_ERRORS, value);
setState(() {
reportErrors = value;
});
},
),
),
]
)
)