2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-04-28 05:26:47 +00:00

Adds skeleton for "app settings" view

This commit is contained in:
Oliver Walters 2021-03-02 22:57:45 +11:00
parent a5406734eb
commit 194be50337
4 changed files with 90 additions and 9 deletions

View File

@ -10,6 +10,7 @@
- Any "unauthorized" actions are now not displayed - Any "unauthorized" actions are now not displayed
- Uses server-side pagination, providing a significant increase in UI performance - Uses server-side pagination, providing a significant increase in UI performance
- Adds audio feedback for server errors and barcode scanning - Adds audio feedback for server errors and barcode scanning
- Adds "app settings" view
### 0.1.2 - February 2021 ### 0.1.2 - February 2021
--- ---

View File

@ -0,0 +1,73 @@
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
class InvenTreeAppSettingsWidget extends StatefulWidget {
@override
_InvenTreeAppSettingsState createState() => _InvenTreeAppSettingsState();
}
class _InvenTreeAppSettingsState extends State<InvenTreeAppSettingsWidget> {
final GlobalKey<_InvenTreeAppSettingsState> _settingsKey = GlobalKey<_InvenTreeAppSettingsState>();
_InvenTreeAppSettingsState() {
}
bool a = false;
@override
Widget build(BuildContext context) {
return Scaffold(
key: _settingsKey,
appBar: AppBar(
title: Text(I18N.of(context).appSettings),
),
body: Container(
child: ListView(
children: [
ListTile(
title: Text(
"Sounds",
style: TextStyle(fontWeight: FontWeight.bold),
),
leading: FaIcon(FontAwesomeIcons.volumeUp),
),
ListTile(
title: Text("Server Error"),
subtitle: Text("Play audible tone on server error"),
leading: FaIcon(FontAwesomeIcons.server),
trailing: Switch(
value: false,
onChanged: (value) {
setState(() {
// TODO
});
},
),
),
ListTile(
title: Text("Barcode Tones"),
subtitle: Text("Play audible tones for barcode actions"),
leading: FaIcon(FontAwesomeIcons.qrcode),
trailing: Switch(
value: a,
onChanged: (value) {
setState(() {
a = value;
});
},
),
),
Divider(height: 1),
]
)
)
);
}
}

View File

@ -53,7 +53,7 @@ class _InvenTreeLoginSettingsState extends State<InvenTreeLoginSettingsWidget> {
} }
showFormDialog( showFormDialog(
I18N.of(context).profileAdd, createNew ? I18N.of(context).profileAdd : I18N.of(context).profileEdit,
key: _addProfileKey, key: _addProfileKey,
callback: () { callback: () {
if (createNew) { if (createNew) {
@ -237,8 +237,6 @@ class _InvenTreeLoginSettingsState extends State<InvenTreeLoginSettingsWidget> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final Size screenSize = MediaQuery.of(context).size;
List<Widget> children = []; List<Widget> children = [];
if (profiles != null && profiles.length > 0) { if (profiles != null && profiles.length > 0) {
@ -268,7 +266,7 @@ class _InvenTreeLoginSettingsState extends State<InvenTreeLoginSettingsWidget> {
Navigator.of(context).pop(); Navigator.of(context).pop();
_selectProfile(context, profile); _selectProfile(context, profile);
}, },
child: Text(I18N.of(context).profileSelect), child: Text(I18N.of(context).profileConnect),
), ),
SimpleDialogOption( SimpleDialogOption(
onPressed: () { onPressed: () {

View File

@ -1,4 +1,5 @@
import 'package:InvenTree/settings/about.dart'; import 'package:InvenTree/settings/about.dart';
import 'package:InvenTree/settings/app_settings.dart';
import 'package:InvenTree/settings/login.dart'; import 'package:InvenTree/settings/login.dart';
import 'package:InvenTree/user_profile.dart'; import 'package:InvenTree/user_profile.dart';
@ -39,11 +40,17 @@ class _InvenTreeSettingsState extends State<InvenTreeSettingsWidget> {
context: context, context: context,
tiles: <Widget>[ tiles: <Widget>[
ListTile( ListTile(
title: Text(I18N.of(context).profile), title: Text(I18N.of(context).server),
subtitle: Text("Configure user profile settings"), subtitle: Text("Configure server settings"),
leading: FaIcon(FontAwesomeIcons.user), leading: FaIcon(FontAwesomeIcons.server),
onTap: _editServerSettings, onTap: _editServerSettings,
), ),
ListTile(
leading: FaIcon(FontAwesomeIcons.cogs),
title: Text(I18N.of(context).appSettings),
subtitle: Text(I18N.of(context).appSettingsDetails),
onTap: _editAppSettings,
),
ListTile( ListTile(
title: Text(I18N.of(context).about), title: Text(I18N.of(context).about),
subtitle: Text(I18N.of(context).appDetails), subtitle: Text(I18N.of(context).appDetails),
@ -76,11 +83,13 @@ class _InvenTreeSettingsState extends State<InvenTreeSettingsWidget> {
void _editServerSettings() async { void _editServerSettings() async {
List<UserProfile> profiles = await UserProfileDBManager().getAllProfiles();
Navigator.push(context, MaterialPageRoute(builder: (context) => InvenTreeLoginSettingsWidget())); Navigator.push(context, MaterialPageRoute(builder: (context) => InvenTreeLoginSettingsWidget()));
} }
void _editAppSettings() async {
Navigator.push(context, MaterialPageRoute(builder: (context) => InvenTreeAppSettingsWidget()));
}
void _about() async { void _about() async {
PackageInfo.fromPlatform().then((PackageInfo info) { PackageInfo.fromPlatform().then((PackageInfo info) {