2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-06-13 18:55:34 +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

@ -1,6 +1,7 @@
import "package:inventree/app_colors.dart";
import "package:inventree/settings/about.dart";
import "package:inventree/settings/app_settings.dart";
import 'package:inventree/settings/home_settings.dart';
import "package:inventree/settings/login.dart";
import "package:flutter/material.dart";
@ -24,8 +25,6 @@ class _InvenTreeSettingsState extends State<InvenTreeSettingsWidget> {
final _scaffoldKey = GlobalKey<ScaffoldState>();
final String docsUrl = "https://inventree.readthedocs.io/en/latest/app/app/";
@override
Widget build(BuildContext context) {
return Scaffold(
@ -44,46 +43,18 @@ class _InvenTreeSettingsState extends State<InvenTreeSettingsWidget> {
leading: FaIcon(FontAwesomeIcons.server, color: COLOR_CLICK),
onTap: _editServerSettings,
),
ListTile(
title: Text(L10().homeScreen),
subtitle: Text(L10().homeScreenSettings),
leading: FaIcon(FontAwesomeIcons.home, color: COLOR_CLICK),
onTap: _editHomeScreenSettings,
),
ListTile(
title: Text(L10().appSettings),
subtitle: Text(L10().appSettingsDetails),
leading: FaIcon(FontAwesomeIcons.cogs, color: COLOR_CLICK),
onTap: _editAppSettings,
),
ListTile(
title: Text(L10().about),
subtitle: Text(L10().appDetails),
leading: FaIcon(FontAwesomeIcons.infoCircle, color: COLOR_CLICK),
onTap: _about,
),
ListTile(
title: Text(L10().documentation),
subtitle: Text("https://inventree.readthedocs.io"),
leading: FaIcon(FontAwesomeIcons.book, color: COLOR_CLICK),
onTap: () {
_openDocs();
},
),
ListTile(
title: Text(L10().translate),
subtitle: Text(L10().translateHelp),
leading: FaIcon(FontAwesomeIcons.language, color: COLOR_CLICK),
onTap: () {
_translate();
}
),
ListTile(
title: Text(L10().reportBug),
subtitle: Text(L10().reportBugDescription),
leading: FaIcon(FontAwesomeIcons.bug, color: COLOR_CLICK),
onTap: () {
_reportBug(context);
},
),
]
).toList()
)
@ -91,45 +62,17 @@ class _InvenTreeSettingsState extends State<InvenTreeSettingsWidget> {
);
}
Future <void> _openDocs() async {
if (await canLaunch(docsUrl)) {
await launch(docsUrl);
}
}
Future <void> _translate() async {
const String url = "https://crowdin.com/project/inventree";
if (await canLaunch(url)) {
await launch(url);
}
}
Future <void> _editServerSettings() async {
Navigator.push(context, MaterialPageRoute(builder: (context) => InvenTreeLoginSettingsWidget()));
}
Future<void> _editHomeScreenSettings() async {
Navigator.push(context, MaterialPageRoute(builder: (context) => HomeScreenSettingsWidget()));
}
Future <void> _editAppSettings() async {
Navigator.push(context, MaterialPageRoute(builder: (context) => InvenTreeAppSettingsWidget()));
}
Future <void> _about() async {
PackageInfo.fromPlatform().then((PackageInfo info) {
Navigator.push(context,
MaterialPageRoute(builder: (context) => InvenTreeAboutWidget(info)));
});
}
Future <void> _reportBug(BuildContext context) async {
const String url = "https://github.com/inventree/InvenTree/issues/new?assignees=&labels=app%2C+bug&title=%5BApp%5D+Enter+bug+description";
if (await canLaunch(url)) {
await launch(url);
}
}
}