-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Split part settings onto different screen * show_bom setting controls whether BOM information is displayed * linting
- Loading branch information
1 parent
971c6bf
commit efb6fc3
Showing
7 changed files
with
145 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
|
||
import "package:flutter/material.dart"; | ||
import "package:font_awesome_flutter/font_awesome_flutter.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 partShowParameters = true; | ||
bool partShowBom = true; | ||
bool stockShowHistory = false; | ||
|
||
@override | ||
void initState() { | ||
super.initState(); | ||
|
||
loadSettings(); | ||
} | ||
|
||
Future<void> loadSettings() async { | ||
partShowParameters = await InvenTreeSettingsManager().getValue(INV_PART_SHOW_PARAMETERS, true) as bool; | ||
partShowBom = await InvenTreeSettingsManager().getValue(INV_PART_SHOW_BOM, true) as bool; | ||
stockShowHistory = await InvenTreeSettingsManager().getValue(INV_STOCK_SHOW_HISTORY, false) as bool; | ||
|
||
if (mounted) { | ||
setState(() { | ||
}); | ||
} | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
appBar: AppBar(title: Text(L10().part)), | ||
body: Container( | ||
child: ListView( | ||
children: [ | ||
ListTile( | ||
title: Text(L10().parameters), | ||
subtitle: Text(L10().parametersSettingDetail), | ||
leading: FaIcon(FontAwesomeIcons.thList), | ||
trailing: Switch( | ||
value: partShowParameters, | ||
onChanged: (bool value) { | ||
InvenTreeSettingsManager().setValue(INV_PART_SHOW_PARAMETERS, value); | ||
setState(() { | ||
partShowParameters = value; | ||
}); | ||
}, | ||
), | ||
), | ||
ListTile( | ||
title: Text(L10().bom), | ||
subtitle: Text(L10().bomEnable), | ||
leading: FaIcon(FontAwesomeIcons.list), | ||
trailing: Switch( | ||
value: partShowBom, | ||
onChanged: (bool value) { | ||
InvenTreeSettingsManager().setValue(INV_PART_SHOW_BOM, value); | ||
setState(() { | ||
partShowBom = value; | ||
}); | ||
}, | ||
), | ||
), | ||
ListTile( | ||
title: Text(L10().stockItemHistory), | ||
subtitle: Text(L10().stockItemHistoryDetail), | ||
leading: FaIcon(FontAwesomeIcons.history), | ||
trailing: Switch( | ||
value: stockShowHistory, | ||
onChanged: (bool value) { | ||
InvenTreeSettingsManager().setValue(INV_STOCK_SHOW_HISTORY, value); | ||
setState(() { | ||
stockShowHistory = value; | ||
}); | ||
}, | ||
), | ||
), | ||
] | ||
) | ||
) | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters