diff --git a/lib/api_form.dart b/lib/api_form.dart index ed74752f..786c5e02 100644 --- a/lib/api_form.dart +++ b/lib/api_form.dart @@ -1,5 +1,6 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:inventree/api.dart'; +import 'package:inventree/app_colors.dart'; import 'package:inventree/widget/dialogs.dart'; import 'package:inventree/widget/fields.dart'; import 'package:inventree/l10.dart'; @@ -120,14 +121,14 @@ class APIFormField { return new TextStyle( fontWeight: FontWeight.bold, fontSize: 18, - color: hasErrors() ? Color.fromRGBO(250, 50, 50, 1) : Color.fromRGBO(50, 50, 50, 1), + color: hasErrors() ? COLOR_DANGER : COLOR_GRAY, ); } TextStyle _helperStyle() { return new TextStyle( fontStyle: FontStyle.italic, - color: hasErrors() ? Color.fromRGBO(205, 50, 50, 1) : Color.fromRGBO(50, 50, 50, 1), + color: hasErrors() ? COLOR_DANGER : COLOR_GRAY, ); } @@ -299,7 +300,7 @@ class _APIFormWidgetState extends State { title: Text( error, style: TextStyle( - color: Color.fromRGBO(250, 50, 50, 1), + color: COLOR_DANGER, fontStyle: FontStyle.italic, fontSize: 16, ), diff --git a/lib/app_colors.dart b/lib/app_colors.dart new file mode 100644 index 00000000..73db5f30 --- /dev/null +++ b/lib/app_colors.dart @@ -0,0 +1,17 @@ + + +import 'dart:ui'; + +const Color COLOR_GRAY = Color.fromRGBO(50, 50, 50, 1); +const Color COLOR_GRAY_LIGHT = Color.fromRGBO(150, 150, 150, 1); + +const Color COLOR_BLUE = Color.fromRGBO(0, 0, 250, 1); + +const Color COLOR_STAR = Color.fromRGBO(250, 250, 100, 1); + +const Color COLOR_WARNING = Color.fromRGBO(250, 150, 50, 1); +const Color COLOR_DANGER = Color.fromRGBO(250, 50, 50, 1); +const Color COLOR_SUCCESS = Color.fromRGBO(50, 250, 50, 1); +const Color COLOR_PROGRESS = Color.fromRGBO(50, 50, 250, 1); + +const Color COLOR_SELECTED = Color.fromRGBO(0, 0, 0, 0.05); \ No newline at end of file diff --git a/lib/settings/login.dart b/lib/settings/login.dart index 977e558c..e6a8dd1e 100644 --- a/lib/settings/login.dart +++ b/lib/settings/login.dart @@ -1,3 +1,4 @@ +import 'package:inventree/app_colors.dart'; import 'package:inventree/widget/dialogs.dart'; import 'package:inventree/widget/fields.dart'; import 'package:inventree/widget/spinner.dart'; @@ -219,7 +220,7 @@ class _InvenTreeLoginSettingsState extends State { if ((InvenTreeAPI().profile?.key ?? '') != profile.key) { return FaIcon( FontAwesomeIcons.questionCircle, - color: Color.fromRGBO(250, 150, 50, 1) + color: COLOR_WARNING ); } @@ -227,17 +228,17 @@ class _InvenTreeLoginSettingsState extends State { if (InvenTreeAPI().isConnected()) { return FaIcon( FontAwesomeIcons.checkCircle, - color: Color.fromRGBO(50, 250, 50, 1) + color: COLOR_SUCCESS ); } else if (InvenTreeAPI().isConnecting()) { return Spinner( icon: FontAwesomeIcons.spinner, - color: Color.fromRGBO(50, 50, 250, 1), + color: COLOR_PROGRESS, ); } else { return FaIcon( FontAwesomeIcons.timesCircle, - color: Color.fromRGBO(250, 50, 50, 1), + color: COLOR_DANGER, ); } } @@ -255,7 +256,7 @@ class _InvenTreeLoginSettingsState extends State { title: Text( profile.name, ), - tileColor: profile.selected ? Color.fromRGBO(0, 0, 0, 0.05) : null, + tileColor: profile.selected ? COLOR_SELECTED : null, subtitle: Text("${profile.server}"), trailing: _getProfileIcon(profile), onTap: () { diff --git a/lib/widget/home.dart b/lib/widget/home.dart index f7ce3fba..b62dca09 100644 --- a/lib/widget/home.dart +++ b/lib/widget/home.dart @@ -1,3 +1,4 @@ +import 'package:inventree/app_colors.dart'; import 'package:inventree/user_profile.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -131,7 +132,7 @@ class _InvenTreeHomePageState extends State { leading: FaIcon(FontAwesomeIcons.server), trailing: FaIcon( FontAwesomeIcons.user, - color: Color.fromRGBO(250, 50, 50, 1), + color: COLOR_DANGER, ), onTap: () { _selectProfile(); @@ -147,7 +148,7 @@ class _InvenTreeHomePageState extends State { leading: FaIcon(FontAwesomeIcons.server), trailing: Spinner( icon: FontAwesomeIcons.spinner, - color: Color.fromRGBO(50, 50, 250, 1), + color: COLOR_PROGRESS, ), onTap: () { _selectProfile(); @@ -160,7 +161,7 @@ class _InvenTreeHomePageState extends State { leading: FaIcon(FontAwesomeIcons.server), trailing: FaIcon( FontAwesomeIcons.checkCircle, - color: Color.fromRGBO(50, 250, 50, 1) + color: COLOR_SUCCESS ), onTap: () { _selectProfile(); @@ -173,7 +174,7 @@ class _InvenTreeHomePageState extends State { leading: FaIcon(FontAwesomeIcons.server), trailing: FaIcon( FontAwesomeIcons.timesCircle, - color: Color.fromRGBO(250, 50, 50, 1), + color: COLOR_DANGER, ), onTap: () { _selectProfile(); diff --git a/lib/widget/part_detail.dart b/lib/widget/part_detail.dart index d717b2a1..f78b258b 100644 --- a/lib/widget/part_detail.dart +++ b/lib/widget/part_detail.dart @@ -4,6 +4,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import 'package:inventree/app_colors.dart'; import 'package:inventree/l10.dart'; import 'package:inventree/api_form.dart'; @@ -198,7 +199,7 @@ class _PartDisplayState extends RefreshableState { subtitle: Text("${part.description}"), trailing: IconButton( icon: FaIcon(part.starred ? FontAwesomeIcons.solidStar : FontAwesomeIcons.star, - color: part.starred ? Color.fromRGBO(250, 250, 100, 1) : null, + color: part.starred ? COLOR_STAR : null, ), onPressed: _toggleStar, ), @@ -232,6 +233,29 @@ class _PartDisplayState extends RefreshableState { return tiles; } + if (!part.isActive) { + tiles.add( + ListTile( + title: Text( + L10().inactive, + style: TextStyle( + color: COLOR_DANGER + ) + ), + subtitle: Text( + L10().inactiveDetail, + style: TextStyle( + color: COLOR_DANGER + ) + ), + leading: FaIcon( + FontAwesomeIcons.exclamationCircle, + color: COLOR_DANGER + ), + ) + ); + } + // Category information if (part.categoryName.isNotEmpty) { tiles.add( diff --git a/lib/widget/spinner.dart b/lib/widget/spinner.dart index eb049a11..1770a90f 100644 --- a/lib/widget/spinner.dart +++ b/lib/widget/spinner.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import 'package:inventree/app_colors.dart'; class Spinner extends StatefulWidget { final IconData? icon; @@ -9,7 +10,7 @@ class Spinner extends StatefulWidget { final Color color; const Spinner({ - this.color = const Color.fromRGBO(150, 150, 150, 1), + this.color = COLOR_GRAY_LIGHT, Key? key, @required this.icon, this.duration = const Duration(milliseconds: 1800), diff --git a/lib/widget/stock_item_test_results.dart b/lib/widget/stock_item_test_results.dart index 66adf0d2..fe85175e 100644 --- a/lib/widget/stock_item_test_results.dart +++ b/lib/widget/stock_item_test_results.dart @@ -1,3 +1,4 @@ +import 'package:inventree/app_colors.dart'; import 'package:inventree/inventree/part.dart'; import 'package:inventree/inventree/stock.dart'; import 'package:inventree/inventree/model.dart'; @@ -207,7 +208,7 @@ class _StockItemTestResultDisplayState extends RefreshableState