mirror of
https://github.com/inventree/inventree-app.git
synced 2025-04-28 13:36:50 +00:00
Merge branch 'i18n'
This commit is contained in:
commit
cfb3dd6506
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[submodule "lib/l10n"]
|
||||||
|
path = lib/l10n
|
||||||
|
url = https://github.com/inventree/inventree-app-i18n
|
@ -4,6 +4,13 @@
|
|||||||
<dict>
|
<dict>
|
||||||
<key>CFBundleDevelopmentRegion</key>
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
<string>en</string>
|
<string>en</string>
|
||||||
|
<key>CFBundleLocalizations</key>
|
||||||
|
<array>
|
||||||
|
<string>en</string>
|
||||||
|
<string>de</string>
|
||||||
|
<string>fr</string>
|
||||||
|
<string>it</string>
|
||||||
|
</array>
|
||||||
<key>CFBundleExecutable</key>
|
<key>CFBundleExecutable</key>
|
||||||
<string>$(EXECUTABLE_NAME)</string>
|
<string>$(EXECUTABLE_NAME)</string>
|
||||||
<key>CFBundleIdentifier</key>
|
<key>CFBundleIdentifier</key>
|
||||||
|
4
l10n.yaml
Normal file
4
l10n.yaml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
arb-dir: lib/l10n
|
||||||
|
template-arb-file: app_en.arb
|
||||||
|
output-localization-file: app_localizations.dart
|
||||||
|
output-class: I18N
|
@ -1,122 +1,78 @@
|
|||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
// ignore_for_file: non_constant_identifier_names
|
// ignore_for_file: non_constant_identifier_names
|
||||||
// ignore_for_file: camel_case_types
|
// ignore_for_file: camel_case_types
|
||||||
// ignore_for_file: prefer_single_quotes
|
// ignore_for_file: prefer_single_quotes
|
||||||
|
|
||||||
//This file is automatically generated. DO NOT EDIT, all your changes would be lost.
|
//This file is automatically generated. DO NOT EDIT, all your changes would be lost.
|
||||||
|
|
||||||
class S implements WidgetsLocalizations {
|
class S implements WidgetsLocalizations {
|
||||||
const S();
|
const S();
|
||||||
|
|
||||||
static const GeneratedLocalizationsDelegate delegate =
|
static const GeneratedLocalizationsDelegate delegate =
|
||||||
GeneratedLocalizationsDelegate();
|
const GeneratedLocalizationsDelegate();
|
||||||
|
|
||||||
static S of(BuildContext context) => Localizations.of<S>(context, S);
|
static S of(BuildContext context) =>
|
||||||
|
Localizations.of<S>(context, WidgetsLocalizations);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
TextDirection get textDirection => TextDirection.ltr;
|
TextDirection get textDirection => TextDirection.ltr;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class $en extends S {
|
class en extends S {
|
||||||
const $en();
|
const en();
|
||||||
}
|
}
|
||||||
|
|
||||||
class GeneratedLocalizationsDelegate extends LocalizationsDelegate<S> {
|
|
||||||
|
class GeneratedLocalizationsDelegate extends LocalizationsDelegate<WidgetsLocalizations> {
|
||||||
const GeneratedLocalizationsDelegate();
|
const GeneratedLocalizationsDelegate();
|
||||||
|
|
||||||
List<Locale> get supportedLocales {
|
List<Locale> get supportedLocales {
|
||||||
return const <Locale>[
|
return const <Locale>[
|
||||||
Locale("en", ""),
|
|
||||||
|
const Locale("en", ""),
|
||||||
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
LocaleListResolutionCallback listResolution({Locale fallback, bool withCountry = true}) {
|
LocaleResolutionCallback resolution({Locale fallback}) {
|
||||||
return (List<Locale> locales, Iterable<Locale> supported) {
|
|
||||||
if (locales == null || locales.isEmpty) {
|
|
||||||
return fallback ?? supported.first;
|
|
||||||
} else {
|
|
||||||
return _resolve(locales.first, fallback, supported, withCountry);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
LocaleResolutionCallback resolution({Locale fallback, bool withCountry = true}) {
|
|
||||||
return (Locale locale, Iterable<Locale> supported) {
|
return (Locale locale, Iterable<Locale> supported) {
|
||||||
return _resolve(locale, fallback, supported, withCountry);
|
final Locale languageLocale = new Locale(locale.languageCode, "");
|
||||||
};
|
if (supported.contains(locale))
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<S> load(Locale locale) {
|
|
||||||
final String lang = getLang(locale);
|
|
||||||
if (lang != null) {
|
|
||||||
switch (lang) {
|
|
||||||
case "en":
|
|
||||||
return SynchronousFuture<S>(const $en());
|
|
||||||
default:
|
|
||||||
// NO-OP.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return SynchronousFuture<S>(const S());
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool isSupported(Locale locale) => _isSupported(locale, true);
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool shouldReload(GeneratedLocalizationsDelegate old) => false;
|
|
||||||
|
|
||||||
///
|
|
||||||
/// Internal method to resolve a locale from a list of locales.
|
|
||||||
///
|
|
||||||
Locale _resolve(Locale locale, Locale fallback, Iterable<Locale> supported, bool withCountry) {
|
|
||||||
if (locale == null || !_isSupported(locale, withCountry)) {
|
|
||||||
return fallback ?? supported.first;
|
|
||||||
}
|
|
||||||
|
|
||||||
final Locale languageLocale = Locale(locale.languageCode, "");
|
|
||||||
if (supported.contains(locale)) {
|
|
||||||
return locale;
|
return locale;
|
||||||
} else if (supported.contains(languageLocale)) {
|
else if (supported.contains(languageLocale))
|
||||||
return languageLocale;
|
return languageLocale;
|
||||||
} else {
|
else {
|
||||||
final Locale fallbackLocale = fallback ?? supported.first;
|
final Locale fallbackLocale = fallback ?? supported.first;
|
||||||
return fallbackLocale;
|
return fallbackLocale;
|
||||||
}
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
@override
|
||||||
/// Returns true if the specified locale is supported, false otherwise.
|
Future<WidgetsLocalizations> load(Locale locale) {
|
||||||
///
|
final String lang = getLang(locale);
|
||||||
bool _isSupported(Locale locale, bool withCountry) {
|
switch (lang) {
|
||||||
if (locale != null) {
|
|
||||||
for (Locale supportedLocale in supportedLocales) {
|
|
||||||
// Language must always match both locales.
|
|
||||||
if (supportedLocale.languageCode != locale.languageCode) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If country code matches, return this locale.
|
case "en":
|
||||||
if (supportedLocale.countryCode == locale.countryCode) {
|
return new SynchronousFuture<WidgetsLocalizations>(const en());
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If no country requirement is requested, check if this locale has no country.
|
default:
|
||||||
if (true != withCountry && (supportedLocale.countryCode == null || supportedLocale.countryCode.isEmpty)) {
|
return new SynchronousFuture<WidgetsLocalizations>(const S());
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String getLang(Locale l) => l == null
|
@override
|
||||||
? null
|
bool isSupported(Locale locale) => supportedLocales.contains(locale);
|
||||||
: l.countryCode != null && l.countryCode.isEmpty
|
|
||||||
|
@override
|
||||||
|
bool shouldReload(GeneratedLocalizationsDelegate old) => false;
|
||||||
|
}
|
||||||
|
|
||||||
|
String getLang(Locale l) => l.countryCode != null && l.countryCode.isEmpty
|
||||||
? l.languageCode
|
? l.languageCode
|
||||||
: l.toString();
|
: l.toString();
|
||||||
|
1
lib/l10n
Submodule
1
lib/l10n
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 6b50ee704cacfb3d9b45d89de31b1ce05e94959a
|
367
lib/main.dart
367
lib/main.dart
@ -1,19 +1,12 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:InvenTree/widget/category_display.dart';
|
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||||
import 'package:InvenTree/widget/company_list.dart';
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
import 'package:InvenTree/widget/location_display.dart';
|
|
||||||
import 'package:InvenTree/widget/search.dart';
|
import 'package:InvenTree/widget/home.dart';
|
||||||
import 'package:InvenTree/widget/drawer.dart';
|
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
|
||||||
|
|
||||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
|
||||||
|
|
||||||
import 'barcode.dart';
|
|
||||||
|
|
||||||
import 'api.dart';
|
|
||||||
import 'dsn.dart';
|
import 'dsn.dart';
|
||||||
import 'preferences.dart';
|
import 'preferences.dart';
|
||||||
|
|
||||||
@ -71,348 +64,24 @@ class InvenTreeApp extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
title: 'InvenTree',
|
onGenerateTitle: (BuildContext context) => I18N.of(context).appTitle,
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
primarySwatch: Colors.lightBlue,
|
primarySwatch: Colors.lightBlue,
|
||||||
secondaryHeaderColor: Colors.blueGrey,
|
secondaryHeaderColor: Colors.blueGrey,
|
||||||
),
|
),
|
||||||
home: MyHomePage(title: 'InvenTree'),
|
home: InvenTreeHomePage(),
|
||||||
);
|
localizationsDelegates: [
|
||||||
}
|
I18N.delegate,
|
||||||
}
|
GlobalMaterialLocalizations.delegate,
|
||||||
|
GlobalWidgetsLocalizations.delegate,
|
||||||
|
GlobalCupertinoLocalizations.delegate,
|
||||||
class MyHomePage extends StatefulWidget {
|
],
|
||||||
MyHomePage({Key key, this.title}) : super(key: key);
|
supportedLocales: [
|
||||||
|
const Locale('en', ''), // English, no country code
|
||||||
|
const Locale('de', ''),
|
||||||
// This widget is the home page of your application. It is stateful, meaning
|
const Locale('fr', ''),
|
||||||
// that it has a State object (defined below) that contains fields that affect
|
const Locale('it', ''),
|
||||||
// how it looks.
|
],
|
||||||
|
|
||||||
// This class is the configuration for the state. It holds the values (in this
|
|
||||||
// case the title) provided by the parent (in this case the App widget) and
|
|
||||||
// used by the build method of the State. Fields in a Widget subclass are
|
|
||||||
// always marked "final".
|
|
||||||
|
|
||||||
final String title;
|
|
||||||
|
|
||||||
@override
|
|
||||||
_MyHomePageState createState() => _MyHomePageState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _MyHomePageState extends State<MyHomePage> {
|
|
||||||
|
|
||||||
_MyHomePageState() : super() {
|
|
||||||
_checkServerConnection();
|
|
||||||
}
|
|
||||||
|
|
||||||
String _serverAddress = "";
|
|
||||||
|
|
||||||
String _serverStatus = "Connecting to server";
|
|
||||||
|
|
||||||
String _serverMessage = "";
|
|
||||||
|
|
||||||
bool _serverConnection = false;
|
|
||||||
|
|
||||||
FaIcon _serverIcon = new FaIcon(FontAwesomeIcons.spinner);
|
|
||||||
|
|
||||||
Color _serverStatusColor = Color.fromARGB(255, 50, 50, 250);
|
|
||||||
|
|
||||||
void onConnectSuccess(String msg) {
|
|
||||||
_serverConnection = true;
|
|
||||||
_serverMessage = msg;
|
|
||||||
_serverStatus = "Connected to $_serverAddress";
|
|
||||||
_serverStatusColor = Color.fromARGB(255, 50, 250, 50);
|
|
||||||
_serverIcon = new FaIcon(FontAwesomeIcons.checkCircle, color: _serverStatusColor);
|
|
||||||
|
|
||||||
setState(() {});
|
|
||||||
}
|
|
||||||
|
|
||||||
void onConnectFailure(String msg) {
|
|
||||||
_serverConnection = false;
|
|
||||||
_serverMessage = msg;
|
|
||||||
_serverStatus = "Could not connect to $_serverAddress";
|
|
||||||
_serverStatusColor = Color.fromARGB(255, 250, 50, 50);
|
|
||||||
_serverIcon = new FaIcon(FontAwesomeIcons.timesCircle, color: _serverStatusColor);
|
|
||||||
|
|
||||||
setState(() {});
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Test the server connection
|
|
||||||
*/
|
|
||||||
void _checkServerConnection() async {
|
|
||||||
|
|
||||||
var prefs = await SharedPreferences.getInstance();
|
|
||||||
|
|
||||||
_serverAddress = prefs.getString("server");
|
|
||||||
|
|
||||||
// Reset the connection status variables
|
|
||||||
_serverStatus = "Connecting to server";
|
|
||||||
_serverMessage = "";
|
|
||||||
_serverConnection = false;
|
|
||||||
_serverIcon = new FaIcon(FontAwesomeIcons.spinner);
|
|
||||||
_serverStatusColor = Color.fromARGB(255, 50, 50, 250);
|
|
||||||
|
|
||||||
InvenTreeAPI().connect().then((bool result) {
|
|
||||||
|
|
||||||
if (result) {
|
|
||||||
onConnectSuccess("");
|
|
||||||
} else {
|
|
||||||
onConnectFailure("Could not connect to server");
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
// Update widget state
|
|
||||||
setState(() {});
|
|
||||||
}
|
|
||||||
|
|
||||||
void _search() {
|
|
||||||
if (!InvenTreeAPI().checkConnection(context)) return;
|
|
||||||
|
|
||||||
Navigator.push(context, MaterialPageRoute(builder: (context) => SearchWidget()));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void _scan() {
|
|
||||||
if (!InvenTreeAPI().checkConnection(context)) return;
|
|
||||||
|
|
||||||
scanQrCode(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
void _parts() {
|
|
||||||
if (!InvenTreeAPI().checkConnection(context)) return;
|
|
||||||
|
|
||||||
Navigator.push(context, MaterialPageRoute(builder: (context) => CategoryDisplayWidget(null)));
|
|
||||||
}
|
|
||||||
|
|
||||||
void _stock() {
|
|
||||||
if (!InvenTreeAPI().checkConnection(context)) return;
|
|
||||||
|
|
||||||
Navigator.push(context, MaterialPageRoute(builder: (context) => LocationDisplayWidget(null)));
|
|
||||||
}
|
|
||||||
|
|
||||||
void _suppliers() {
|
|
||||||
if (!InvenTreeAPI().checkConnection(context)) return;
|
|
||||||
|
|
||||||
Navigator.push(context, MaterialPageRoute(builder: (context) => SupplierListWidget()));
|
|
||||||
}
|
|
||||||
|
|
||||||
void _manufacturers() {
|
|
||||||
if (!InvenTreeAPI().checkConnection(context)) return;
|
|
||||||
|
|
||||||
Navigator.push(context, MaterialPageRoute(builder: (context) => ManufacturerListWidget()));
|
|
||||||
}
|
|
||||||
|
|
||||||
void _customers() {
|
|
||||||
if (!InvenTreeAPI().checkConnection(context)) return;
|
|
||||||
|
|
||||||
Navigator.push(context, MaterialPageRoute(builder: (context) => CustomerListWidget()));
|
|
||||||
}
|
|
||||||
|
|
||||||
void _unsupported() {
|
|
||||||
showDialog(
|
|
||||||
context: context,
|
|
||||||
child: new SimpleDialog(
|
|
||||||
title: new Text("Unsupported"),
|
|
||||||
children: <Widget>[
|
|
||||||
ListTile(
|
|
||||||
title: Text("This feature is not yet supported"),
|
|
||||||
subtitle: Text("It will be supported in an upcoming release"),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
// This method is rerun every time setState is called, for instance as done
|
|
||||||
// by the _incrementCounter method above.
|
|
||||||
//
|
|
||||||
// The Flutter framework has been optimized to make rerunning build methods
|
|
||||||
// fast, so that you can just rebuild anything that needs updating rather
|
|
||||||
// than having to individually change instances of widgets.
|
|
||||||
return Scaffold(
|
|
||||||
appBar: AppBar(
|
|
||||||
// Here we take the value from the MyHomePage object that was created by
|
|
||||||
// the App.build method, and use it to set our appbar title.
|
|
||||||
title: Text(widget.title),
|
|
||||||
actions: <Widget>[
|
|
||||||
/*
|
|
||||||
IconButton(
|
|
||||||
icon: FaIcon(FontAwesomeIcons.search),
|
|
||||||
tooltip: 'Search',
|
|
||||||
onPressed: _search,
|
|
||||||
),
|
|
||||||
*/
|
|
||||||
],
|
|
||||||
),
|
|
||||||
drawer: new InvenTreeDrawer(context),
|
|
||||||
body: Center(
|
|
||||||
// Center is a layout widget. It takes a single child and positions it
|
|
||||||
// in the middle of the parent.
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: (<Widget>[
|
|
||||||
Spacer(),
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
||||||
children: <Widget>[
|
|
||||||
/*
|
|
||||||
Column(
|
|
||||||
children: <Widget>[
|
|
||||||
|
|
||||||
IconButton(
|
|
||||||
icon: new FaIcon(FontAwesomeIcons.search),
|
|
||||||
tooltip: 'Search',
|
|
||||||
onPressed: _search,
|
|
||||||
),
|
|
||||||
Text("Search"),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
*/
|
|
||||||
Column(
|
|
||||||
children: <Widget>[
|
|
||||||
IconButton(
|
|
||||||
icon: new FaIcon(FontAwesomeIcons.barcode),
|
|
||||||
tooltip: 'Scan Barcode',
|
|
||||||
onPressed: _scan,
|
|
||||||
),
|
|
||||||
Text("Scan Barcode"),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Spacer(),
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
||||||
children: <Widget>[
|
|
||||||
Column(
|
|
||||||
children: <Widget>[
|
|
||||||
IconButton(
|
|
||||||
icon: new FaIcon(FontAwesomeIcons.shapes),
|
|
||||||
tooltip: 'Parts',
|
|
||||||
onPressed: _parts,
|
|
||||||
),
|
|
||||||
Text("Parts"),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Column(
|
|
||||||
children: <Widget>[
|
|
||||||
IconButton(
|
|
||||||
icon: new FaIcon(FontAwesomeIcons.boxes),
|
|
||||||
tooltip: 'Stock',
|
|
||||||
onPressed: _stock,
|
|
||||||
),
|
|
||||||
Text('Stock'),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Spacer(),
|
|
||||||
// TODO - Re-add these when the features actually do something..
|
|
||||||
/*
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
||||||
children: <Widget>[
|
|
||||||
Column(
|
|
||||||
children: <Widget>[
|
|
||||||
IconButton(
|
|
||||||
icon: new FaIcon(FontAwesomeIcons.building),
|
|
||||||
tooltip: "Suppliers",
|
|
||||||
onPressed: _suppliers,
|
|
||||||
),
|
|
||||||
Text("Suppliers"),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Column(
|
|
||||||
children: <Widget>[
|
|
||||||
IconButton(
|
|
||||||
icon: FaIcon(FontAwesomeIcons.industry),
|
|
||||||
tooltip: "Manufacturers",
|
|
||||||
onPressed: _manufacturers,
|
|
||||||
),
|
|
||||||
Text("Manufacturers")
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Column(
|
|
||||||
children: <Widget>[
|
|
||||||
IconButton(
|
|
||||||
icon: FaIcon(FontAwesomeIcons.userTie),
|
|
||||||
tooltip: "Customers",
|
|
||||||
onPressed: _customers,
|
|
||||||
),
|
|
||||||
Text("Customers"),
|
|
||||||
]
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Spacer(),
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
||||||
children: <Widget>[
|
|
||||||
Column(
|
|
||||||
children: <Widget>[
|
|
||||||
IconButton(
|
|
||||||
icon: new FaIcon(FontAwesomeIcons.tools),
|
|
||||||
tooltip: "Build",
|
|
||||||
onPressed: _unsupported,
|
|
||||||
),
|
|
||||||
Text("Build"),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Column(
|
|
||||||
children: <Widget>[
|
|
||||||
IconButton(
|
|
||||||
icon: new FaIcon(FontAwesomeIcons.shoppingCart),
|
|
||||||
tooltip: "Order",
|
|
||||||
onPressed: _unsupported,
|
|
||||||
),
|
|
||||||
Text("Order"),
|
|
||||||
]
|
|
||||||
),
|
|
||||||
Column(
|
|
||||||
children: <Widget>[
|
|
||||||
IconButton(
|
|
||||||
icon: new FaIcon(FontAwesomeIcons.truck),
|
|
||||||
tooltip: "Ship",
|
|
||||||
onPressed: _unsupported,
|
|
||||||
),
|
|
||||||
Text("Ship"),
|
|
||||||
]
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Spacer(),
|
|
||||||
*/
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
children: <Widget>[
|
|
||||||
Expanded(
|
|
||||||
child: ListTile(
|
|
||||||
title: Text("$_serverStatus",
|
|
||||||
style: TextStyle(color: _serverStatusColor),
|
|
||||||
),
|
|
||||||
subtitle: Text("$_serverMessage",
|
|
||||||
style: TextStyle(color: _serverStatusColor),
|
|
||||||
),
|
|
||||||
leading: _serverIcon,
|
|
||||||
onTap: () {
|
|
||||||
if (!_serverConnection) {
|
|
||||||
_checkServerConnection();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
]),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -3,6 +3,8 @@ import 'package:InvenTree/api.dart';
|
|||||||
import 'package:InvenTree/inventree/part.dart';
|
import 'package:InvenTree/inventree/part.dart';
|
||||||
import 'package:InvenTree/preferences.dart';
|
import 'package:InvenTree/preferences.dart';
|
||||||
|
|
||||||
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
|
|
||||||
import 'package:InvenTree/widget/part_detail.dart';
|
import 'package:InvenTree/widget/part_detail.dart';
|
||||||
import 'package:InvenTree/widget/drawer.dart';
|
import 'package:InvenTree/widget/drawer.dart';
|
||||||
import 'package:InvenTree/widget/refreshable_state.dart';
|
import 'package:InvenTree/widget/refreshable_state.dart';
|
||||||
@ -19,8 +21,6 @@ class CategoryDisplayWidget extends StatefulWidget {
|
|||||||
|
|
||||||
final InvenTreePartCategory category;
|
final InvenTreePartCategory category;
|
||||||
|
|
||||||
final String title = "Category";
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_CategoryDisplayState createState() => _CategoryDisplayState(category);
|
_CategoryDisplayState createState() => _CategoryDisplayState(category);
|
||||||
}
|
}
|
||||||
@ -29,14 +29,14 @@ class CategoryDisplayWidget extends StatefulWidget {
|
|||||||
class _CategoryDisplayState extends RefreshableState<CategoryDisplayWidget> {
|
class _CategoryDisplayState extends RefreshableState<CategoryDisplayWidget> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String getAppBarTitle(BuildContext context) { return "Part Category"; }
|
String getAppBarTitle(BuildContext context) => I18N.of(context).partCategory;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<Widget> getAppBarActions(BuildContext context) {
|
List<Widget> getAppBarActions(BuildContext context) {
|
||||||
return <Widget>[
|
return <Widget>[
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: FaIcon(FontAwesomeIcons.edit),
|
icon: FaIcon(FontAwesomeIcons.edit),
|
||||||
tooltip: 'Edit',
|
tooltip: I18N.of(context).edit,
|
||||||
onPressed: null,
|
onPressed: null,
|
||||||
)
|
)
|
||||||
];
|
];
|
||||||
@ -94,7 +94,7 @@ class _CategoryDisplayState extends RefreshableState<CategoryDisplayWidget> {
|
|||||||
if (category == null) {
|
if (category == null) {
|
||||||
return Card(
|
return Card(
|
||||||
child: ListTile(
|
child: ListTile(
|
||||||
title: Text("Part Categories"),
|
title: Text(I18N.of(context).partCategories),
|
||||||
subtitle: Text("Top level part category"),
|
subtitle: Text("Top level part category"),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -107,7 +107,7 @@ class _CategoryDisplayState extends RefreshableState<CategoryDisplayWidget> {
|
|||||||
subtitle: Text("${category.description}"),
|
subtitle: Text("${category.description}"),
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
title: Text("Parent Category"),
|
title: Text(I18N.of(context).parentCategory),
|
||||||
subtitle: Text("${category.parentpathstring}"),
|
subtitle: Text("${category.parentpathstring}"),
|
||||||
leading: FaIcon(FontAwesomeIcons.sitemap),
|
leading: FaIcon(FontAwesomeIcons.sitemap),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
@ -154,7 +154,7 @@ class _CategoryDisplayState extends RefreshableState<CategoryDisplayWidget> {
|
|||||||
ExpansionPanel(
|
ExpansionPanel(
|
||||||
headerBuilder: (BuildContext context, bool isExpanded) {
|
headerBuilder: (BuildContext context, bool isExpanded) {
|
||||||
return ListTile(
|
return ListTile(
|
||||||
title: Text("Subcategories"),
|
title: Text(I18N.of(context).subcategories),
|
||||||
leading: FaIcon(FontAwesomeIcons.stream),
|
leading: FaIcon(FontAwesomeIcons.stream),
|
||||||
trailing: Text("${_subcategories.length}"),
|
trailing: Text("${_subcategories.length}"),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
@ -173,7 +173,7 @@ class _CategoryDisplayState extends RefreshableState<CategoryDisplayWidget> {
|
|||||||
ExpansionPanel(
|
ExpansionPanel(
|
||||||
headerBuilder: (BuildContext context, bool isExpanded) {
|
headerBuilder: (BuildContext context, bool isExpanded) {
|
||||||
return ListTile(
|
return ListTile(
|
||||||
title: Text("Parts"),
|
title: Text(I18N.of(context).parts),
|
||||||
leading: FaIcon(FontAwesomeIcons.shapes),
|
leading: FaIcon(FontAwesomeIcons.shapes),
|
||||||
trailing: Text("${_parts.length}"),
|
trailing: Text("${_parts.length}"),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
@ -8,6 +8,7 @@ import 'package:InvenTree/widget/refreshable_state.dart';
|
|||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
|
|
||||||
class CompanyDetailWidget extends StatefulWidget {
|
class CompanyDetailWidget extends StatefulWidget {
|
||||||
|
|
||||||
@ -28,7 +29,7 @@ class _CompanyDetailState extends RefreshableState<CompanyDetailWidget> {
|
|||||||
final _editCompanyKey = GlobalKey<FormState>();
|
final _editCompanyKey = GlobalKey<FormState>();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String getAppBarTitle(BuildContext context) { return "Company"; }
|
String getAppBarTitle(BuildContext context) => I18N.of(context).company;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> request(BuildContext context) async {
|
Future<void> request(BuildContext context) async {
|
||||||
@ -54,17 +55,17 @@ class _CompanyDetailState extends RefreshableState<CompanyDetailWidget> {
|
|||||||
var _description;
|
var _description;
|
||||||
var _website;
|
var _website;
|
||||||
|
|
||||||
showFormDialog(context, "Edit Company",
|
showFormDialog(context, I18N.of(context).edit,
|
||||||
key: _editCompanyKey,
|
key: _editCompanyKey,
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
FlatButton(
|
FlatButton(
|
||||||
child: Text("Cancel"),
|
child: Text(I18N.of(context).cancel),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
FlatButton(
|
FlatButton(
|
||||||
child: Text("Save"),
|
child: Text(I18N.of(context).save),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
if (_editCompanyKey.currentState.validate()) {
|
if (_editCompanyKey.currentState.validate()) {
|
||||||
_editCompanyKey.currentState.save();
|
_editCompanyKey.currentState.save();
|
||||||
@ -80,21 +81,21 @@ class _CompanyDetailState extends RefreshableState<CompanyDetailWidget> {
|
|||||||
],
|
],
|
||||||
fields: <Widget>[
|
fields: <Widget>[
|
||||||
StringField(
|
StringField(
|
||||||
label: "Company Name",
|
label: I18N.of(context).name,
|
||||||
initial: company.name,
|
initial: company.name,
|
||||||
onSaved: (value) {
|
onSaved: (value) {
|
||||||
_name = value;
|
_name = value;
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
StringField(
|
StringField(
|
||||||
label: "Company Description",
|
label: I18N.of(context).description,
|
||||||
initial: company.description,
|
initial: company.description,
|
||||||
onSaved: (value) {
|
onSaved: (value) {
|
||||||
_description = value;
|
_description = value;
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
StringField(
|
StringField(
|
||||||
label: "Website",
|
label: I18N.of(context).website,
|
||||||
initial: company.website,
|
initial: company.website,
|
||||||
allowEmpty: true,
|
allowEmpty: true,
|
||||||
onSaved: (value) {
|
onSaved: (value) {
|
||||||
@ -192,7 +193,7 @@ class _CompanyDetailState extends RefreshableState<CompanyDetailWidget> {
|
|||||||
|
|
||||||
if (company.notes.isNotEmpty) {
|
if (company.notes.isNotEmpty) {
|
||||||
tiles.add(ListTile(
|
tiles.add(ListTile(
|
||||||
title: Text("Notes"),
|
title: Text(I18N.of(context).notes),
|
||||||
leading: FaIcon(FontAwesomeIcons.stickyNote),
|
leading: FaIcon(FontAwesomeIcons.stickyNote),
|
||||||
onTap: null,
|
onTap: null,
|
||||||
));
|
));
|
||||||
|
@ -3,6 +3,8 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
import 'package:image_picker/image_picker.dart';
|
import 'package:image_picker/image_picker.dart';
|
||||||
|
|
||||||
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
@ -44,12 +46,12 @@ class ImagePickerField extends FormField<File> {
|
|||||||
field.didChange(image);
|
field.didChange(image);
|
||||||
}
|
}
|
||||||
|
|
||||||
ImagePickerField({String label = "Attach Image", Function onSaved, bool required = false}) :
|
ImagePickerField(BuildContext context, {String label = "Attach Image", Function onSaved, bool required = false}) :
|
||||||
super(
|
super(
|
||||||
onSaved: onSaved,
|
onSaved: onSaved,
|
||||||
validator: (File img) {
|
validator: (File img) {
|
||||||
if (required && (img == null)) {
|
if (required && (img == null)) {
|
||||||
return "Required";
|
return I18N.of(context).required;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
337
lib/widget/home.dart
Normal file
337
lib/widget/home.dart
Normal file
@ -0,0 +1,337 @@
|
|||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
|
|
||||||
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
|
||||||
|
import 'package:InvenTree/barcode.dart';
|
||||||
|
import 'package:InvenTree/api.dart';
|
||||||
|
|
||||||
|
import 'package:InvenTree/widget/category_display.dart';
|
||||||
|
import 'package:InvenTree/widget/company_list.dart';
|
||||||
|
import 'package:InvenTree/widget/location_display.dart';
|
||||||
|
import 'package:InvenTree/widget/search.dart';
|
||||||
|
import 'package:InvenTree/widget/drawer.dart';
|
||||||
|
|
||||||
|
class InvenTreeHomePage extends StatefulWidget {
|
||||||
|
InvenTreeHomePage({Key key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_InvenTreeHomePageState createState() => _InvenTreeHomePageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
|
||||||
|
|
||||||
|
_InvenTreeHomePageState() : super() {
|
||||||
|
_checkServerConnection();
|
||||||
|
}
|
||||||
|
|
||||||
|
String _serverAddress = "";
|
||||||
|
|
||||||
|
String _serverStatus = "Connecting to server";
|
||||||
|
|
||||||
|
String _serverMessage = "";
|
||||||
|
|
||||||
|
bool _serverConnection = false;
|
||||||
|
|
||||||
|
FaIcon _serverIcon = new FaIcon(FontAwesomeIcons.spinner);
|
||||||
|
|
||||||
|
Color _serverStatusColor = Color.fromARGB(255, 50, 50, 250);
|
||||||
|
|
||||||
|
void onConnectSuccess(String msg) {
|
||||||
|
_serverConnection = true;
|
||||||
|
_serverMessage = msg;
|
||||||
|
_serverStatus = "Connected to $_serverAddress";
|
||||||
|
_serverStatusColor = Color.fromARGB(255, 50, 250, 50);
|
||||||
|
_serverIcon = new FaIcon(FontAwesomeIcons.checkCircle, color: _serverStatusColor);
|
||||||
|
|
||||||
|
setState(() {});
|
||||||
|
}
|
||||||
|
|
||||||
|
void onConnectFailure(String msg) {
|
||||||
|
_serverConnection = false;
|
||||||
|
_serverMessage = msg;
|
||||||
|
_serverStatus = "Could not connect to $_serverAddress";
|
||||||
|
_serverStatusColor = Color.fromARGB(255, 250, 50, 50);
|
||||||
|
_serverIcon = new FaIcon(FontAwesomeIcons.timesCircle, color: _serverStatusColor);
|
||||||
|
|
||||||
|
setState(() {});
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Test the server connection
|
||||||
|
*/
|
||||||
|
void _checkServerConnection() async {
|
||||||
|
|
||||||
|
var prefs = await SharedPreferences.getInstance();
|
||||||
|
|
||||||
|
_serverAddress = prefs.getString("server");
|
||||||
|
|
||||||
|
// Reset the connection status variables
|
||||||
|
_serverStatus = "Connecting to server";
|
||||||
|
_serverMessage = "";
|
||||||
|
_serverConnection = false;
|
||||||
|
_serverIcon = new FaIcon(FontAwesomeIcons.spinner);
|
||||||
|
_serverStatusColor = Color.fromARGB(255, 50, 50, 250);
|
||||||
|
|
||||||
|
InvenTreeAPI().connect().then((bool result) {
|
||||||
|
|
||||||
|
if (result) {
|
||||||
|
onConnectSuccess("");
|
||||||
|
} else {
|
||||||
|
onConnectFailure("Could not connect to server");
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
// Update widget state
|
||||||
|
setState(() {});
|
||||||
|
}
|
||||||
|
|
||||||
|
void _search() {
|
||||||
|
if (!InvenTreeAPI().checkConnection(context)) return;
|
||||||
|
|
||||||
|
Navigator.push(context, MaterialPageRoute(builder: (context) => SearchWidget()));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void _scan() {
|
||||||
|
if (!InvenTreeAPI().checkConnection(context)) return;
|
||||||
|
|
||||||
|
scanQrCode(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
void _parts() {
|
||||||
|
if (!InvenTreeAPI().checkConnection(context)) return;
|
||||||
|
|
||||||
|
Navigator.push(context, MaterialPageRoute(builder: (context) => CategoryDisplayWidget(null)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void _stock() {
|
||||||
|
if (!InvenTreeAPI().checkConnection(context)) return;
|
||||||
|
|
||||||
|
Navigator.push(context, MaterialPageRoute(builder: (context) => LocationDisplayWidget(null)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void _suppliers() {
|
||||||
|
if (!InvenTreeAPI().checkConnection(context)) return;
|
||||||
|
|
||||||
|
Navigator.push(context, MaterialPageRoute(builder: (context) => SupplierListWidget()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void _manufacturers() {
|
||||||
|
if (!InvenTreeAPI().checkConnection(context)) return;
|
||||||
|
|
||||||
|
Navigator.push(context, MaterialPageRoute(builder: (context) => ManufacturerListWidget()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void _customers() {
|
||||||
|
if (!InvenTreeAPI().checkConnection(context)) return;
|
||||||
|
|
||||||
|
Navigator.push(context, MaterialPageRoute(builder: (context) => CustomerListWidget()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void _unsupported() {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
child: new SimpleDialog(
|
||||||
|
title: new Text("Unsupported"),
|
||||||
|
children: <Widget>[
|
||||||
|
ListTile(
|
||||||
|
title: Text("This feature is not yet supported"),
|
||||||
|
subtitle: Text("It will be supported in an upcoming release"),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
// This method is rerun every time setState is called, for instance as done
|
||||||
|
// by the _incrementCounter method above.
|
||||||
|
//
|
||||||
|
// The Flutter framework has been optimized to make rerunning build methods
|
||||||
|
// fast, so that you can just rebuild anything that needs updating rather
|
||||||
|
// than having to individually change instances of widgets.
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
title: Text(I18N.of(context).appTitle),
|
||||||
|
actions: <Widget>[
|
||||||
|
/*
|
||||||
|
IconButton(
|
||||||
|
icon: FaIcon(FontAwesomeIcons.search),
|
||||||
|
tooltip: 'Search',
|
||||||
|
onPressed: _search,
|
||||||
|
),
|
||||||
|
*/
|
||||||
|
],
|
||||||
|
),
|
||||||
|
drawer: new InvenTreeDrawer(context),
|
||||||
|
body: Center(
|
||||||
|
// Center is a layout widget. It takes a single child and positions it
|
||||||
|
// in the middle of the parent.
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: (<Widget>[
|
||||||
|
Spacer(),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
|
children: <Widget>[
|
||||||
|
/*
|
||||||
|
Column(
|
||||||
|
children: <Widget>[
|
||||||
|
|
||||||
|
IconButton(
|
||||||
|
icon: new FaIcon(FontAwesomeIcons.search),
|
||||||
|
tooltip: 'Search',
|
||||||
|
onPressed: _search,
|
||||||
|
),
|
||||||
|
Text("Search"),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
*/
|
||||||
|
Column(
|
||||||
|
children: <Widget>[
|
||||||
|
IconButton(
|
||||||
|
icon: new FaIcon(FontAwesomeIcons.barcode),
|
||||||
|
tooltip: I18N.of(context).scanBarcode,
|
||||||
|
onPressed: _scan,
|
||||||
|
),
|
||||||
|
Text(I18N.of(context).scanBarcode),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Spacer(),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
|
children: <Widget>[
|
||||||
|
Column(
|
||||||
|
children: <Widget>[
|
||||||
|
IconButton(
|
||||||
|
icon: new FaIcon(FontAwesomeIcons.shapes),
|
||||||
|
tooltip: I18N.of(context).parts,
|
||||||
|
onPressed: _parts,
|
||||||
|
),
|
||||||
|
Text(I18N.of(context).parts),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Column(
|
||||||
|
children: <Widget>[
|
||||||
|
IconButton(
|
||||||
|
icon: new FaIcon(FontAwesomeIcons.boxes),
|
||||||
|
tooltip: I18N.of(context).stock,
|
||||||
|
onPressed: _stock,
|
||||||
|
),
|
||||||
|
Text(I18N.of(context).stock),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Spacer(),
|
||||||
|
// TODO - Re-add these when the features actually do something..
|
||||||
|
/*
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
|
children: <Widget>[
|
||||||
|
Column(
|
||||||
|
children: <Widget>[
|
||||||
|
IconButton(
|
||||||
|
icon: new FaIcon(FontAwesomeIcons.building),
|
||||||
|
tooltip: "Suppliers",
|
||||||
|
onPressed: _suppliers,
|
||||||
|
),
|
||||||
|
Text("Suppliers"),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Column(
|
||||||
|
children: <Widget>[
|
||||||
|
IconButton(
|
||||||
|
icon: FaIcon(FontAwesomeIcons.industry),
|
||||||
|
tooltip: "Manufacturers",
|
||||||
|
onPressed: _manufacturers,
|
||||||
|
),
|
||||||
|
Text("Manufacturers")
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Column(
|
||||||
|
children: <Widget>[
|
||||||
|
IconButton(
|
||||||
|
icon: FaIcon(FontAwesomeIcons.userTie),
|
||||||
|
tooltip: "Customers",
|
||||||
|
onPressed: _customers,
|
||||||
|
),
|
||||||
|
Text("Customers"),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Spacer(),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
|
children: <Widget>[
|
||||||
|
Column(
|
||||||
|
children: <Widget>[
|
||||||
|
IconButton(
|
||||||
|
icon: new FaIcon(FontAwesomeIcons.tools),
|
||||||
|
tooltip: "Build",
|
||||||
|
onPressed: _unsupported,
|
||||||
|
),
|
||||||
|
Text("Build"),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Column(
|
||||||
|
children: <Widget>[
|
||||||
|
IconButton(
|
||||||
|
icon: new FaIcon(FontAwesomeIcons.shoppingCart),
|
||||||
|
tooltip: "Order",
|
||||||
|
onPressed: _unsupported,
|
||||||
|
),
|
||||||
|
Text("Order"),
|
||||||
|
]
|
||||||
|
),
|
||||||
|
Column(
|
||||||
|
children: <Widget>[
|
||||||
|
IconButton(
|
||||||
|
icon: new FaIcon(FontAwesomeIcons.truck),
|
||||||
|
tooltip: "Ship",
|
||||||
|
onPressed: _unsupported,
|
||||||
|
),
|
||||||
|
Text("Ship"),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Spacer(),
|
||||||
|
*/
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
child: ListTile(
|
||||||
|
title: Text("$_serverStatus",
|
||||||
|
style: TextStyle(color: _serverStatusColor),
|
||||||
|
),
|
||||||
|
subtitle: Text("$_serverMessage",
|
||||||
|
style: TextStyle(color: _serverStatusColor),
|
||||||
|
),
|
||||||
|
leading: _serverIcon,
|
||||||
|
onTap: () {
|
||||||
|
if (!_serverConnection) {
|
||||||
|
_checkServerConnection();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -2,7 +2,7 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
import 'package:url_launcher/url_launcher.dart';
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ class _PartDisplayState extends RefreshableState<PartDetailWidget> {
|
|||||||
final _editPartKey = GlobalKey<FormState>();
|
final _editPartKey = GlobalKey<FormState>();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String getAppBarTitle(BuildContext context) { return "Part"; }
|
String getAppBarTitle(BuildContext context) => I18N.of(context).part;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<Widget> getAppBarActions(BuildContext context) {
|
List<Widget> getAppBarActions(BuildContext context) {
|
||||||
@ -39,7 +39,7 @@ class _PartDisplayState extends RefreshableState<PartDetailWidget> {
|
|||||||
// TODO: Hide the 'edit' button if the user does not have permission!!
|
// TODO: Hide the 'edit' button if the user does not have permission!!
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: FaIcon(FontAwesomeIcons.edit),
|
icon: FaIcon(FontAwesomeIcons.edit),
|
||||||
tooltip: 'Edit',
|
tooltip: I18N.of(context).edit,
|
||||||
onPressed: _editPartDialog,
|
onPressed: _editPartDialog,
|
||||||
)
|
)
|
||||||
];
|
];
|
||||||
@ -88,17 +88,17 @@ class _PartDisplayState extends RefreshableState<PartDetailWidget> {
|
|||||||
var _revision;
|
var _revision;
|
||||||
var _keywords;
|
var _keywords;
|
||||||
|
|
||||||
showFormDialog(context, "Edit Part",
|
showFormDialog(context, I18N.of(context).editPart,
|
||||||
key: _editPartKey,
|
key: _editPartKey,
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
FlatButton(
|
FlatButton(
|
||||||
child: Text("Cancel"),
|
child: Text(I18N.of(context).cancel),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
FlatButton(
|
FlatButton(
|
||||||
child: Text("Save"),
|
child: Text(I18N.of(context).save),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
if (_editPartKey.currentState.validate()) {
|
if (_editPartKey.currentState.validate()) {
|
||||||
_editPartKey.currentState.save();
|
_editPartKey.currentState.save();
|
||||||
@ -115,12 +115,12 @@ class _PartDisplayState extends RefreshableState<PartDetailWidget> {
|
|||||||
],
|
],
|
||||||
fields: <Widget>[
|
fields: <Widget>[
|
||||||
StringField(
|
StringField(
|
||||||
label: "Part Name",
|
label: I18N.of(context).name,
|
||||||
initial: part.name,
|
initial: part.name,
|
||||||
onSaved: (value) => _name = value,
|
onSaved: (value) => _name = value,
|
||||||
),
|
),
|
||||||
StringField(
|
StringField(
|
||||||
label: "Part Description",
|
label: I18N.of(context).description,
|
||||||
initial: part.description,
|
initial: part.description,
|
||||||
onSaved: (value) => _description = value,
|
onSaved: (value) => _description = value,
|
||||||
),
|
),
|
||||||
|
@ -3,7 +3,7 @@ import 'package:InvenTree/inventree/stock.dart';
|
|||||||
import 'package:InvenTree/widget/refreshable_state.dart';
|
import 'package:InvenTree/widget/refreshable_state.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
// InvenTree packages
|
// InvenTree packages
|
||||||
import 'package:InvenTree/api.dart';
|
import 'package:InvenTree/api.dart';
|
||||||
import 'package:InvenTree/inventree/part.dart';
|
import 'package:InvenTree/inventree/part.dart';
|
||||||
@ -27,7 +27,7 @@ class PartStockDetailWidget extends StatefulWidget {
|
|||||||
class _PartStockDisplayState extends RefreshableState<PartStockDetailWidget> {
|
class _PartStockDisplayState extends RefreshableState<PartStockDetailWidget> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String getAppBarTitle(BuildContext context) { return "Part Stock"; }
|
String getAppBarTitle(BuildContext context) => I18N.of(context).partStock;
|
||||||
|
|
||||||
_PartStockDisplayState(this.part) {
|
_PartStockDisplayState(this.part) {
|
||||||
// TODO
|
// TODO
|
||||||
|
@ -2,7 +2,7 @@ import 'package:InvenTree/widget/drawer.dart';
|
|||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/widgets.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
import 'package:InvenTree/widget/drawer.dart';
|
import 'package:InvenTree/widget/drawer.dart';
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
import 'package:InvenTree/widget/refreshable_state.dart';
|
import 'package:InvenTree/widget/refreshable_state.dart';
|
||||||
import 'package:InvenTree/inventree/part.dart';
|
import 'package:InvenTree/inventree/part.dart';
|
||||||
import 'package:InvenTree/inventree/stock.dart';
|
import 'package:InvenTree/inventree/stock.dart';
|
||||||
@ -23,9 +23,7 @@ class _SearchState extends RefreshableState<SearchWidget> {
|
|||||||
List<InvenTreeStockItem> _stockItems = List<InvenTreeStockItem>();
|
List<InvenTreeStockItem> _stockItems = List<InvenTreeStockItem>();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String getAppBarTitle(BuildContext context) {
|
String getAppBarTitle(BuildContext context) => I18N.of(context).search;
|
||||||
return "Search";
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> _search(BuildContext context) {
|
Future<void> _search(BuildContext context) {
|
||||||
print("Search: $_searchText}");
|
print("Search: $_searchText}");
|
||||||
@ -76,14 +74,14 @@ class _SearchState extends RefreshableState<SearchWidget> {
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
TextField(
|
TextField(
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
hintText: "Search"
|
hintText: I18N.of(context).search,
|
||||||
),
|
),
|
||||||
onChanged: (String text) {
|
onChanged: (String text) {
|
||||||
_searchText = text;
|
_searchText = text;
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
RaisedButton(
|
RaisedButton(
|
||||||
child: Text("Search"),
|
child: Text(I18N.of(context).search),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
_search(context);
|
_search(context);
|
||||||
},
|
},
|
||||||
|
@ -12,6 +12,8 @@ import 'package:InvenTree/widget/stock_item_test_results.dart';
|
|||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
|
|
||||||
import 'package:InvenTree/api.dart';
|
import 'package:InvenTree/api.dart';
|
||||||
|
|
||||||
import 'package:InvenTree/widget/drawer.dart';
|
import 'package:InvenTree/widget/drawer.dart';
|
||||||
@ -35,7 +37,7 @@ class StockDetailWidget extends StatefulWidget {
|
|||||||
class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
|
class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String getAppBarTitle(BuildContext context) { return "Stock Item"; }
|
String getAppBarTitle(BuildContext context) => I18N.of(context).stockItem;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<Widget> getAppBarActions(BuildContext context) {
|
List<Widget> getAppBarActions(BuildContext context) {
|
||||||
@ -43,7 +45,7 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
|
|||||||
// TODO: Hide the 'edit' button if the user does not have permission!!
|
// TODO: Hide the 'edit' button if the user does not have permission!!
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: FaIcon(FontAwesomeIcons.edit),
|
icon: FaIcon(FontAwesomeIcons.edit),
|
||||||
tooltip: "Edit",
|
tooltip: I18N.of(context).edit,
|
||||||
onPressed: _editStockItemDialog,
|
onPressed: _editStockItemDialog,
|
||||||
)
|
)
|
||||||
];
|
];
|
||||||
@ -121,11 +123,11 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
|
|||||||
_quantityController.clear();
|
_quantityController.clear();
|
||||||
_notesController.clear();
|
_notesController.clear();
|
||||||
|
|
||||||
showFormDialog(context, "Add Stock",
|
showFormDialog(context, I18N.of(context).addStock,
|
||||||
key: _addStockKey,
|
key: _addStockKey,
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
FlatButton(
|
FlatButton(
|
||||||
child: Text("Add"),
|
child: Text(I18N.of(context).add),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
if (_addStockKey.currentState.validate()) _addStock();
|
if (_addStockKey.currentState.validate()) _addStock();
|
||||||
},
|
},
|
||||||
@ -134,12 +136,12 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
|
|||||||
fields: <Widget> [
|
fields: <Widget> [
|
||||||
Text("Current stock: ${item.quantity}"),
|
Text("Current stock: ${item.quantity}"),
|
||||||
QuantityField(
|
QuantityField(
|
||||||
label: "Add Stock",
|
label: I18N.of(context).addStock,
|
||||||
controller: _quantityController,
|
controller: _quantityController,
|
||||||
),
|
),
|
||||||
TextFormField(
|
TextFormField(
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: "Notes",
|
labelText: I18N.of(context).notes,
|
||||||
),
|
),
|
||||||
controller: _notesController,
|
controller: _notesController,
|
||||||
)
|
)
|
||||||
@ -168,11 +170,11 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
|
|||||||
_quantityController.clear();
|
_quantityController.clear();
|
||||||
_notesController.clear();
|
_notesController.clear();
|
||||||
|
|
||||||
showFormDialog(context, "Remove Stock",
|
showFormDialog(context, I18N.of(context).removeStock,
|
||||||
key: _removeStockKey,
|
key: _removeStockKey,
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
FlatButton(
|
FlatButton(
|
||||||
child: Text("Remove"),
|
child: Text(I18N.of(context).remove),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
if (_removeStockKey.currentState.validate()) _removeStock();
|
if (_removeStockKey.currentState.validate()) _removeStock();
|
||||||
},
|
},
|
||||||
@ -181,13 +183,13 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
|
|||||||
fields: <Widget>[
|
fields: <Widget>[
|
||||||
Text("Current stock: ${item.quantity}"),
|
Text("Current stock: ${item.quantity}"),
|
||||||
QuantityField(
|
QuantityField(
|
||||||
label: "Remove stock",
|
label: I18N.of(context).removeStock,
|
||||||
controller: _quantityController,
|
controller: _quantityController,
|
||||||
max: item.quantity,
|
max: item.quantity,
|
||||||
),
|
),
|
||||||
TextFormField(
|
TextFormField(
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: "Notes",
|
labelText: I18N.of(context).notes,
|
||||||
),
|
),
|
||||||
controller: _notesController,
|
controller: _notesController,
|
||||||
),
|
),
|
||||||
@ -217,11 +219,11 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
|
|||||||
_quantityController.text = item.quantity.toString();
|
_quantityController.text = item.quantity.toString();
|
||||||
_notesController.clear();
|
_notesController.clear();
|
||||||
|
|
||||||
showFormDialog(context, "Count Stock",
|
showFormDialog(context, I18N.of(context).countStock,
|
||||||
key: _countStockKey,
|
key: _countStockKey,
|
||||||
actions: <Widget> [
|
actions: <Widget> [
|
||||||
FlatButton(
|
FlatButton(
|
||||||
child: Text("Count"),
|
child: Text(I18N.of(context).count),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
if (_countStockKey.currentState.validate()) _countStock();
|
if (_countStockKey.currentState.validate()) _countStock();
|
||||||
},
|
},
|
||||||
@ -229,13 +231,13 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
|
|||||||
],
|
],
|
||||||
fields: <Widget> [
|
fields: <Widget> [
|
||||||
QuantityField(
|
QuantityField(
|
||||||
label: "Count Stock",
|
label: I18N.of(context).countStock,
|
||||||
hint: "${item.quantity}",
|
hint: "${item.quantity}",
|
||||||
controller: _quantityController,
|
controller: _quantityController,
|
||||||
),
|
),
|
||||||
TextFormField(
|
TextFormField(
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: "Notes",
|
labelText: I18N.of(context).notes,
|
||||||
),
|
),
|
||||||
controller: _notesController,
|
controller: _notesController,
|
||||||
)
|
)
|
||||||
@ -271,11 +273,11 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
|
|||||||
|
|
||||||
_quantityController.text = "${item.quantity}";
|
_quantityController.text = "${item.quantity}";
|
||||||
|
|
||||||
showFormDialog(context, "Transfer Stock",
|
showFormDialog(context, I18N.of(context).transferStock,
|
||||||
key: _moveStockKey,
|
key: _moveStockKey,
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
FlatButton(
|
FlatButton(
|
||||||
child: Text("Transfer"),
|
child: Text(I18N.of(context).transfer),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
if (_moveStockKey.currentState.validate()) {
|
if (_moveStockKey.currentState.validate()) {
|
||||||
_moveStockKey.currentState.save();
|
_moveStockKey.currentState.save();
|
||||||
@ -285,7 +287,7 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
|
|||||||
],
|
],
|
||||||
fields: <Widget>[
|
fields: <Widget>[
|
||||||
QuantityField(
|
QuantityField(
|
||||||
label: "Quantity",
|
label: I18N.of(context).quantity,
|
||||||
controller: _quantityController,
|
controller: _quantityController,
|
||||||
max: item.quantity,
|
max: item.quantity,
|
||||||
),
|
),
|
||||||
@ -358,7 +360,7 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
|
|||||||
|
|
||||||
tiles.add(
|
tiles.add(
|
||||||
ListTile(
|
ListTile(
|
||||||
title: Text("Part"),
|
title: Text(I18N.of(context).part),
|
||||||
subtitle: Text("${item.partName}"),
|
subtitle: Text("${item.partName}"),
|
||||||
leading: FaIcon(FontAwesomeIcons.shapes),
|
leading: FaIcon(FontAwesomeIcons.shapes),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
@ -377,7 +379,7 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
|
|||||||
if ((item.locationId > 0) && (item.locationName != null) && (item.locationName.isNotEmpty)) {
|
if ((item.locationId > 0) && (item.locationName != null) && (item.locationName.isNotEmpty)) {
|
||||||
tiles.add(
|
tiles.add(
|
||||||
ListTile(
|
ListTile(
|
||||||
title: Text("Stock Location"),
|
title: Text(I18N.of(context).stockLocation),
|
||||||
subtitle: Text("${item.locationPathString}"),
|
subtitle: Text("${item.locationPathString}"),
|
||||||
leading: FaIcon(FontAwesomeIcons.mapMarkerAlt),
|
leading: FaIcon(FontAwesomeIcons.mapMarkerAlt),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
@ -393,7 +395,7 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
|
|||||||
} else {
|
} else {
|
||||||
tiles.add(
|
tiles.add(
|
||||||
ListTile(
|
ListTile(
|
||||||
title: Text("Stock Location"),
|
title: Text(I18N.of(context).stockLocation),
|
||||||
leading: FaIcon(FontAwesomeIcons.mapMarkerAlt),
|
leading: FaIcon(FontAwesomeIcons.mapMarkerAlt),
|
||||||
subtitle: Text("No location set"),
|
subtitle: Text("No location set"),
|
||||||
)
|
)
|
||||||
@ -412,7 +414,7 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
|
|||||||
} else {
|
} else {
|
||||||
tiles.add(
|
tiles.add(
|
||||||
ListTile(
|
ListTile(
|
||||||
title: Text("Quantity"),
|
title: Text(I18N.of(context).quantity),
|
||||||
leading: FaIcon(FontAwesomeIcons.cubes),
|
leading: FaIcon(FontAwesomeIcons.cubes),
|
||||||
trailing: Text("${item.quantity}"),
|
trailing: Text("${item.quantity}"),
|
||||||
)
|
)
|
||||||
@ -457,7 +459,7 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
|
|||||||
if (item.trackingItemCount > 0) {
|
if (item.trackingItemCount > 0) {
|
||||||
tiles.add(
|
tiles.add(
|
||||||
ListTile(
|
ListTile(
|
||||||
title: Text("History"),
|
title: Text(I18N.of(context).history),
|
||||||
leading: FaIcon(FontAwesomeIcons.history),
|
leading: FaIcon(FontAwesomeIcons.history),
|
||||||
trailing: Text("${item.trackingItemCount}"),
|
trailing: Text("${item.trackingItemCount}"),
|
||||||
onTap: null,
|
onTap: null,
|
||||||
@ -468,7 +470,7 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
|
|||||||
if (item.notes.isNotEmpty) {
|
if (item.notes.isNotEmpty) {
|
||||||
tiles.add(
|
tiles.add(
|
||||||
ListTile(
|
ListTile(
|
||||||
title: Text("Notes"),
|
title: Text(I18N.of(context).notes),
|
||||||
leading: FaIcon(FontAwesomeIcons.stickyNote),
|
leading: FaIcon(FontAwesomeIcons.stickyNote),
|
||||||
trailing: Text(""),
|
trailing: Text(""),
|
||||||
onTap: null,
|
onTap: null,
|
||||||
@ -487,7 +489,7 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
|
|||||||
if (!item.isSerialized()) {
|
if (!item.isSerialized()) {
|
||||||
tiles.add(
|
tiles.add(
|
||||||
ListTile(
|
ListTile(
|
||||||
title: Text("Count Stock"),
|
title: Text(I18N.of(context).countStock),
|
||||||
leading: FaIcon(FontAwesomeIcons.checkCircle),
|
leading: FaIcon(FontAwesomeIcons.checkCircle),
|
||||||
onTap: _countStockDialog,
|
onTap: _countStockDialog,
|
||||||
)
|
)
|
||||||
@ -495,7 +497,7 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
|
|||||||
|
|
||||||
tiles.add(
|
tiles.add(
|
||||||
ListTile(
|
ListTile(
|
||||||
title: Text("Remove Stock"),
|
title: Text(I18N.of(context).removeStock),
|
||||||
leading: FaIcon(FontAwesomeIcons.minusCircle),
|
leading: FaIcon(FontAwesomeIcons.minusCircle),
|
||||||
onTap: _removeStockDialog,
|
onTap: _removeStockDialog,
|
||||||
)
|
)
|
||||||
@ -503,7 +505,7 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
|
|||||||
|
|
||||||
tiles.add(
|
tiles.add(
|
||||||
ListTile(
|
ListTile(
|
||||||
title: Text("Add Stock"),
|
title: Text(I18N.of(context).addStock),
|
||||||
leading: FaIcon(FontAwesomeIcons.plusCircle),
|
leading: FaIcon(FontAwesomeIcons.plusCircle),
|
||||||
onTap: _addStockDialog,
|
onTap: _addStockDialog,
|
||||||
)
|
)
|
||||||
@ -512,7 +514,7 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
|
|||||||
|
|
||||||
tiles.add(
|
tiles.add(
|
||||||
ListTile(
|
ListTile(
|
||||||
title: Text("Transfer Stock"),
|
title: Text(I18N.of(context).transferStock),
|
||||||
leading: FaIcon(FontAwesomeIcons.exchangeAlt),
|
leading: FaIcon(FontAwesomeIcons.exchangeAlt),
|
||||||
onTap: _transferStockDialog,
|
onTap: _transferStockDialog,
|
||||||
)
|
)
|
||||||
@ -601,14 +603,14 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
|
|||||||
return BottomNavigationBar(
|
return BottomNavigationBar(
|
||||||
currentIndex: tabIndex,
|
currentIndex: tabIndex,
|
||||||
onTap: onTabSelectionChanged,
|
onTap: onTabSelectionChanged,
|
||||||
items: const <BottomNavigationBarItem> [
|
items: <BottomNavigationBarItem> [
|
||||||
BottomNavigationBarItem(
|
BottomNavigationBarItem(
|
||||||
icon: FaIcon(FontAwesomeIcons.infoCircle),
|
icon: FaIcon(FontAwesomeIcons.infoCircle),
|
||||||
title: Text("Details"),
|
title: Text(I18N.of(context).details),
|
||||||
),
|
),
|
||||||
BottomNavigationBarItem(
|
BottomNavigationBarItem(
|
||||||
icon: FaIcon(FontAwesomeIcons.wrench),
|
icon: FaIcon(FontAwesomeIcons.wrench),
|
||||||
title: Text("Actions"),
|
title: Text(I18N.of(context).actions),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
@ -5,6 +5,8 @@ import 'package:InvenTree/api.dart';
|
|||||||
import 'package:InvenTree/widget/dialogs.dart';
|
import 'package:InvenTree/widget/dialogs.dart';
|
||||||
import 'package:InvenTree/widget/fields.dart';
|
import 'package:InvenTree/widget/fields.dart';
|
||||||
|
|
||||||
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
|
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
@ -30,7 +32,7 @@ class _StockItemTestResultDisplayState extends RefreshableState<StockItemTestRes
|
|||||||
final _addResultKey = GlobalKey<FormState>();
|
final _addResultKey = GlobalKey<FormState>();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String getAppBarTitle(BuildContext context) { return "Test Results"; }
|
String getAppBarTitle(BuildContext context) => I18N.of(context).testResults;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> request(BuildContext context) async {
|
Future<void> request(BuildContext context) async {
|
||||||
@ -56,7 +58,10 @@ class _StockItemTestResultDisplayState extends RefreshableState<StockItemTestRes
|
|||||||
// TODO - Show a SnackBar here!
|
// TODO - Show a SnackBar here!
|
||||||
refresh();
|
refresh();
|
||||||
} else {
|
} else {
|
||||||
showErrorDialog(context, "Error", "Could not upload test result to server");
|
showErrorDialog(
|
||||||
|
context,
|
||||||
|
I18N.of(context).error,
|
||||||
|
"Could not upload test result to server");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -73,13 +78,13 @@ class _StockItemTestResultDisplayState extends RefreshableState<StockItemTestRes
|
|||||||
key: _addResultKey,
|
key: _addResultKey,
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
FlatButton(
|
FlatButton(
|
||||||
child: Text("Cancel"),
|
child: Text(I18N.of(context).cancel),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
FlatButton(
|
FlatButton(
|
||||||
child: Text("Save"),
|
child: Text(I18N.of(context).save),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
if (_addResultKey.currentState.validate()) {
|
if (_addResultKey.currentState.validate()) {
|
||||||
_addResultKey.currentState.save();
|
_addResultKey.currentState.save();
|
||||||
@ -97,13 +102,13 @@ class _StockItemTestResultDisplayState extends RefreshableState<StockItemTestRes
|
|||||||
onSaved: (value) => _name = value,
|
onSaved: (value) => _name = value,
|
||||||
),
|
),
|
||||||
CheckBoxField(
|
CheckBoxField(
|
||||||
label: "Result",
|
label: I18N.of(context).result,
|
||||||
hint: "Test passed or failed",
|
hint: "Test passed or failed",
|
||||||
initial: true,
|
initial: true,
|
||||||
onSaved: (value) => _result = value,
|
onSaved: (value) => _result = value,
|
||||||
),
|
),
|
||||||
StringField(
|
StringField(
|
||||||
label: "Value",
|
label: I18N.of(context).value,
|
||||||
initial: value,
|
initial: value,
|
||||||
allowEmpty: true,
|
allowEmpty: true,
|
||||||
onSaved: (value) => _value = value,
|
onSaved: (value) => _value = value,
|
||||||
@ -115,13 +120,14 @@ class _StockItemTestResultDisplayState extends RefreshableState<StockItemTestRes
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
ImagePickerField(
|
ImagePickerField(
|
||||||
|
context,
|
||||||
label: "Attach Image",
|
label: "Attach Image",
|
||||||
required: attachmentRequired,
|
required: attachmentRequired,
|
||||||
onSaved: (attachment) => _attachment = attachment,
|
onSaved: (attachment) => _attachment = attachment,
|
||||||
),
|
),
|
||||||
StringField(
|
StringField(
|
||||||
allowEmpty: true,
|
allowEmpty: true,
|
||||||
label: "Notes",
|
label: I18N.of(context).notes,
|
||||||
onSaved: (value) => _notes = value,
|
onSaved: (value) => _notes = value,
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
@ -174,6 +174,11 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.8.1"
|
version: "0.8.1"
|
||||||
|
flutter_localizations:
|
||||||
|
dependency: "direct main"
|
||||||
|
description: flutter
|
||||||
|
source: sdk
|
||||||
|
version: "0.0.0"
|
||||||
flutter_plugin_android_lifecycle:
|
flutter_plugin_android_lifecycle:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -248,7 +253,7 @@ packages:
|
|||||||
source: hosted
|
source: hosted
|
||||||
version: "1.1.1"
|
version: "1.1.1"
|
||||||
intl:
|
intl:
|
||||||
dependency: transitive
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: intl
|
name: intl
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
|
@ -20,8 +20,11 @@ dependencies:
|
|||||||
flutter:
|
flutter:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
|
||||||
# The following adds the Cupertino Icons font to your application.
|
flutter_localizations:
|
||||||
# Use with the CupertinoIcons class for iOS style icons.
|
sdk: flutter
|
||||||
|
|
||||||
|
intl: ^0.16.1
|
||||||
|
|
||||||
cupertino_icons: ^0.1.3
|
cupertino_icons: ^0.1.3
|
||||||
http: ^0.12.1
|
http: ^0.12.1
|
||||||
shared_preferences: ^0.5.7
|
shared_preferences: ^0.5.7
|
||||||
@ -62,6 +65,8 @@ flutter:
|
|||||||
# the material Icons class.
|
# the material Icons class.
|
||||||
uses-material-design: true
|
uses-material-design: true
|
||||||
|
|
||||||
|
generate: true
|
||||||
|
|
||||||
assets:
|
assets:
|
||||||
- assets/image/icon.png
|
- assets/image/icon.png
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user