mirror of
https://github.com/inventree/inventree-app.git
synced 2026-07-09 06:11:29 +00:00
349a8e0ef5
* Updated dashboard - Display "outstanding" badges - Display "overdue" badges - Pull-to-refresh * Remove dead code * Refactor app colors * Add "pending shipments" icon * Remove custom spinner * Refactor error dialog * Updated redirect after login * Refactor login/account pages - Better UX and confirmation messages * Refactor API error messages * Improve token management - Secure storage - Handle session expiry - Per-profile HTTPS certificate checks * Improved error messages
106 lines
2.9 KiB
Dart
106 lines
2.9 KiB
Dart
import "package:flutter/material.dart";
|
|
import "package:flutter_tabler_icons/flutter_tabler_icons.dart";
|
|
|
|
import "package:inventree/l10.dart";
|
|
import "package:inventree/preferences.dart";
|
|
|
|
class InvenTreePartSettingsWidget extends StatefulWidget {
|
|
@override
|
|
_InvenTreePartSettingsState createState() => _InvenTreePartSettingsState();
|
|
}
|
|
|
|
class _InvenTreePartSettingsState extends State<InvenTreePartSettingsWidget> {
|
|
_InvenTreePartSettingsState();
|
|
|
|
bool partShowBom = true;
|
|
bool partShowPricing = true;
|
|
bool partShowRequirements = false;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
|
|
loadSettings();
|
|
}
|
|
|
|
Future<void> loadSettings() async {
|
|
partShowBom = await InvenTreeSettingsManager().getBool(
|
|
INV_PART_SHOW_BOM,
|
|
true,
|
|
);
|
|
partShowPricing = await InvenTreeSettingsManager().getBool(
|
|
INV_PART_SHOW_PRICING,
|
|
true,
|
|
);
|
|
partShowRequirements = await InvenTreeSettingsManager().getBool(
|
|
INV_PART_SHOW_REQUIREMENTS,
|
|
false,
|
|
);
|
|
|
|
if (mounted) {
|
|
setState(() {});
|
|
}
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(title: Text(L10().partSettings)),
|
|
body: Container(
|
|
child: ListView(
|
|
children: [
|
|
ListTile(
|
|
title: Text(L10().bom),
|
|
subtitle: Text(L10().bomEnable),
|
|
leading: Icon(TablerIcons.list),
|
|
trailing: Switch(
|
|
value: partShowBom,
|
|
onChanged: (bool value) {
|
|
InvenTreeSettingsManager().setValue(INV_PART_SHOW_BOM, value);
|
|
setState(() {
|
|
partShowBom = value;
|
|
});
|
|
},
|
|
),
|
|
),
|
|
ListTile(
|
|
title: Text(L10().partPricing),
|
|
subtitle: Text(L10().partPricingSettingDetail),
|
|
leading: Icon(TablerIcons.currency_dollar),
|
|
trailing: Switch(
|
|
value: partShowPricing,
|
|
onChanged: (bool value) {
|
|
InvenTreeSettingsManager().setValue(
|
|
INV_PART_SHOW_PRICING,
|
|
value,
|
|
);
|
|
setState(() {
|
|
partShowPricing = value;
|
|
});
|
|
},
|
|
),
|
|
),
|
|
ListTile(
|
|
title: Text(L10().partRequirements),
|
|
subtitle: Text(L10().partRequirementsSettingDetail),
|
|
leading: Icon(TablerIcons.list),
|
|
trailing: Switch(
|
|
value: partShowRequirements,
|
|
onChanged: (bool value) {
|
|
InvenTreeSettingsManager().setValue(
|
|
INV_PART_SHOW_REQUIREMENTS,
|
|
value,
|
|
);
|
|
setState(() {
|
|
partShowRequirements = value;
|
|
});
|
|
},
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|