mirror of
https://github.com/inventree/inventree-app.git
synced 2025-04-27 21:16:48 +00:00
* Embed device platform information into token request * Remove username and password from userProfile * Display icon to show if profile has associated user token * Remove username / password from login settings screen * Refactor login procedure around token auth * Refactoring * Add profile login screen - Username / password values are not stored - Just to fetch api token * Login with basic auth * Pass profile to API when connecting * Remove _BASE_URL accessor - Fixes URL caching bug * Add more context to login screen * Add helper functions for unit tests - Change default port to 8000 (makes testing easier with local inventree instance) * api.dart handles basic auth now * fix api_test.dart * Further test improvements * linting fixes * Provide feedback when login fails * More linting * Record user details on login, and display in "about" widget * Fix string lookup * Add extra debug * Fix auth values * Fix user profile test
100 lines
3.5 KiB
Dart
100 lines
3.5 KiB
Dart
import "package:flutter/material.dart";
|
|
import "package:font_awesome_flutter/font_awesome_flutter.dart";
|
|
import "package:package_info_plus/package_info_plus.dart";
|
|
|
|
import "package:inventree/app_colors.dart";
|
|
import "package:inventree/l10.dart";
|
|
|
|
import "package:inventree/settings/about.dart";
|
|
import "package:inventree/settings/app_settings.dart";
|
|
import "package:inventree/settings/barcode_settings.dart";
|
|
import "package:inventree/settings/home_settings.dart";
|
|
import "package:inventree/settings/select_server.dart";
|
|
import "package:inventree/settings/part_settings.dart";
|
|
|
|
|
|
// InvenTree settings view
|
|
class InvenTreeSettingsWidget extends StatefulWidget {
|
|
|
|
@override
|
|
_InvenTreeSettingsState createState() => _InvenTreeSettingsState();
|
|
|
|
}
|
|
|
|
|
|
class _InvenTreeSettingsState extends State<InvenTreeSettingsWidget> {
|
|
|
|
final _scaffoldKey = GlobalKey<ScaffoldState>();
|
|
|
|
/*
|
|
* Load "About" widget
|
|
*/
|
|
Future<void> _about() async {
|
|
PackageInfo.fromPlatform().then((PackageInfo info) {
|
|
Navigator.push(context,
|
|
MaterialPageRoute(builder: (context) => InvenTreeAboutWidget(info)));
|
|
});
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
key: _scaffoldKey,
|
|
appBar: AppBar(
|
|
title: Text(L10().settings),
|
|
),
|
|
body: Center(
|
|
child: ListView(
|
|
children: [
|
|
ListTile(
|
|
title: Text(L10().server),
|
|
subtitle: Text(L10().configureServer),
|
|
leading: FaIcon(FontAwesomeIcons.server, color: COLOR_ACTION),
|
|
onTap: () {
|
|
Navigator.push(context, MaterialPageRoute(builder: (context) => InvenTreeSelectServerWidget()));
|
|
},
|
|
),
|
|
ListTile(
|
|
title: Text(L10().appSettings),
|
|
subtitle: Text(L10().appSettingsDetails),
|
|
leading: FaIcon(FontAwesomeIcons.gears, color: COLOR_ACTION),
|
|
onTap: () {
|
|
Navigator.push(context, MaterialPageRoute(builder: (context) => InvenTreeAppSettingsWidget()));
|
|
}
|
|
),
|
|
ListTile(
|
|
title: Text(L10().homeScreen),
|
|
subtitle: Text(L10().homeScreenSettings),
|
|
leading: FaIcon(FontAwesomeIcons.house, color: COLOR_ACTION),
|
|
onTap: () {
|
|
Navigator.push(context, MaterialPageRoute(builder: (context) => HomeScreenSettingsWidget()));
|
|
}
|
|
),
|
|
ListTile(
|
|
title: Text(L10().barcodes),
|
|
subtitle: Text(L10().barcodeSettings),
|
|
leading: FaIcon(FontAwesomeIcons.barcode, color: COLOR_ACTION),
|
|
onTap: () {
|
|
Navigator.push(context, MaterialPageRoute(builder: (context) => InvenTreeBarcodeSettingsWidget()));
|
|
}
|
|
),
|
|
ListTile(
|
|
title: Text(L10().part),
|
|
subtitle: Text(L10().partSettings),
|
|
leading: FaIcon(FontAwesomeIcons.shapes, color: COLOR_ACTION),
|
|
onTap: () {
|
|
Navigator.push(context, MaterialPageRoute(builder: (context) => InvenTreePartSettingsWidget()));
|
|
}
|
|
),
|
|
Divider(),
|
|
ListTile(
|
|
title: Text(L10().about),
|
|
leading: FaIcon(FontAwesomeIcons.circleInfo, color: COLOR_ACTION),
|
|
onTap: _about,
|
|
)
|
|
]
|
|
)
|
|
)
|
|
);
|
|
}
|
|
} |