mirror of
https://github.com/inventree/inventree-app.git
synced 2025-04-28 05:26:47 +00:00
Refactor colors used in the app
This commit is contained in:
parent
7a6457f870
commit
1e4e75dfb7
@ -1,5 +1,6 @@
|
|||||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
import 'package:inventree/api.dart';
|
import 'package:inventree/api.dart';
|
||||||
|
import 'package:inventree/app_colors.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:inventree/l10.dart';
|
import 'package:inventree/l10.dart';
|
||||||
@ -120,14 +121,14 @@ class APIFormField {
|
|||||||
return new TextStyle(
|
return new TextStyle(
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
fontSize: 18,
|
fontSize: 18,
|
||||||
color: hasErrors() ? Color.fromRGBO(250, 50, 50, 1) : Color.fromRGBO(50, 50, 50, 1),
|
color: hasErrors() ? COLOR_DANGER : COLOR_GRAY,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
TextStyle _helperStyle() {
|
TextStyle _helperStyle() {
|
||||||
return new TextStyle(
|
return new TextStyle(
|
||||||
fontStyle: FontStyle.italic,
|
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<APIFormWidget> {
|
|||||||
title: Text(
|
title: Text(
|
||||||
error,
|
error,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Color.fromRGBO(250, 50, 50, 1),
|
color: COLOR_DANGER,
|
||||||
fontStyle: FontStyle.italic,
|
fontStyle: FontStyle.italic,
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
),
|
),
|
||||||
|
17
lib/app_colors.dart
Normal file
17
lib/app_colors.dart
Normal file
@ -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);
|
@ -1,3 +1,4 @@
|
|||||||
|
import 'package:inventree/app_colors.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:inventree/widget/spinner.dart';
|
import 'package:inventree/widget/spinner.dart';
|
||||||
@ -219,7 +220,7 @@ class _InvenTreeLoginSettingsState extends State<InvenTreeLoginSettingsWidget> {
|
|||||||
if ((InvenTreeAPI().profile?.key ?? '') != profile.key) {
|
if ((InvenTreeAPI().profile?.key ?? '') != profile.key) {
|
||||||
return FaIcon(
|
return FaIcon(
|
||||||
FontAwesomeIcons.questionCircle,
|
FontAwesomeIcons.questionCircle,
|
||||||
color: Color.fromRGBO(250, 150, 50, 1)
|
color: COLOR_WARNING
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -227,17 +228,17 @@ class _InvenTreeLoginSettingsState extends State<InvenTreeLoginSettingsWidget> {
|
|||||||
if (InvenTreeAPI().isConnected()) {
|
if (InvenTreeAPI().isConnected()) {
|
||||||
return FaIcon(
|
return FaIcon(
|
||||||
FontAwesomeIcons.checkCircle,
|
FontAwesomeIcons.checkCircle,
|
||||||
color: Color.fromRGBO(50, 250, 50, 1)
|
color: COLOR_SUCCESS
|
||||||
);
|
);
|
||||||
} else if (InvenTreeAPI().isConnecting()) {
|
} else if (InvenTreeAPI().isConnecting()) {
|
||||||
return Spinner(
|
return Spinner(
|
||||||
icon: FontAwesomeIcons.spinner,
|
icon: FontAwesomeIcons.spinner,
|
||||||
color: Color.fromRGBO(50, 50, 250, 1),
|
color: COLOR_PROGRESS,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return FaIcon(
|
return FaIcon(
|
||||||
FontAwesomeIcons.timesCircle,
|
FontAwesomeIcons.timesCircle,
|
||||||
color: Color.fromRGBO(250, 50, 50, 1),
|
color: COLOR_DANGER,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -255,7 +256,7 @@ class _InvenTreeLoginSettingsState extends State<InvenTreeLoginSettingsWidget> {
|
|||||||
title: Text(
|
title: Text(
|
||||||
profile.name,
|
profile.name,
|
||||||
),
|
),
|
||||||
tileColor: profile.selected ? Color.fromRGBO(0, 0, 0, 0.05) : null,
|
tileColor: profile.selected ? COLOR_SELECTED : null,
|
||||||
subtitle: Text("${profile.server}"),
|
subtitle: Text("${profile.server}"),
|
||||||
trailing: _getProfileIcon(profile),
|
trailing: _getProfileIcon(profile),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import 'package:inventree/app_colors.dart';
|
||||||
import 'package:inventree/user_profile.dart';
|
import 'package:inventree/user_profile.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@ -131,7 +132,7 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
|
|||||||
leading: FaIcon(FontAwesomeIcons.server),
|
leading: FaIcon(FontAwesomeIcons.server),
|
||||||
trailing: FaIcon(
|
trailing: FaIcon(
|
||||||
FontAwesomeIcons.user,
|
FontAwesomeIcons.user,
|
||||||
color: Color.fromRGBO(250, 50, 50, 1),
|
color: COLOR_DANGER,
|
||||||
),
|
),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
_selectProfile();
|
_selectProfile();
|
||||||
@ -147,7 +148,7 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
|
|||||||
leading: FaIcon(FontAwesomeIcons.server),
|
leading: FaIcon(FontAwesomeIcons.server),
|
||||||
trailing: Spinner(
|
trailing: Spinner(
|
||||||
icon: FontAwesomeIcons.spinner,
|
icon: FontAwesomeIcons.spinner,
|
||||||
color: Color.fromRGBO(50, 50, 250, 1),
|
color: COLOR_PROGRESS,
|
||||||
),
|
),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
_selectProfile();
|
_selectProfile();
|
||||||
@ -160,7 +161,7 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
|
|||||||
leading: FaIcon(FontAwesomeIcons.server),
|
leading: FaIcon(FontAwesomeIcons.server),
|
||||||
trailing: FaIcon(
|
trailing: FaIcon(
|
||||||
FontAwesomeIcons.checkCircle,
|
FontAwesomeIcons.checkCircle,
|
||||||
color: Color.fromRGBO(50, 250, 50, 1)
|
color: COLOR_SUCCESS
|
||||||
),
|
),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
_selectProfile();
|
_selectProfile();
|
||||||
@ -173,7 +174,7 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
|
|||||||
leading: FaIcon(FontAwesomeIcons.server),
|
leading: FaIcon(FontAwesomeIcons.server),
|
||||||
trailing: FaIcon(
|
trailing: FaIcon(
|
||||||
FontAwesomeIcons.timesCircle,
|
FontAwesomeIcons.timesCircle,
|
||||||
color: Color.fromRGBO(250, 50, 50, 1),
|
color: COLOR_DANGER,
|
||||||
),
|
),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
_selectProfile();
|
_selectProfile();
|
||||||
|
@ -4,6 +4,7 @@ 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:font_awesome_flutter/font_awesome_flutter.dart';
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
|
import 'package:inventree/app_colors.dart';
|
||||||
|
|
||||||
import 'package:inventree/l10.dart';
|
import 'package:inventree/l10.dart';
|
||||||
import 'package:inventree/api_form.dart';
|
import 'package:inventree/api_form.dart';
|
||||||
@ -198,7 +199,7 @@ class _PartDisplayState extends RefreshableState<PartDetailWidget> {
|
|||||||
subtitle: Text("${part.description}"),
|
subtitle: Text("${part.description}"),
|
||||||
trailing: IconButton(
|
trailing: IconButton(
|
||||||
icon: FaIcon(part.starred ? FontAwesomeIcons.solidStar : FontAwesomeIcons.star,
|
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,
|
onPressed: _toggleStar,
|
||||||
),
|
),
|
||||||
@ -232,6 +233,29 @@ class _PartDisplayState extends RefreshableState<PartDetailWidget> {
|
|||||||
return tiles;
|
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
|
// Category information
|
||||||
if (part.categoryName.isNotEmpty) {
|
if (part.categoryName.isNotEmpty) {
|
||||||
tiles.add(
|
tiles.add(
|
||||||
|
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
|
|
||||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
|
import 'package:inventree/app_colors.dart';
|
||||||
|
|
||||||
class Spinner extends StatefulWidget {
|
class Spinner extends StatefulWidget {
|
||||||
final IconData? icon;
|
final IconData? icon;
|
||||||
@ -9,7 +10,7 @@ class Spinner extends StatefulWidget {
|
|||||||
final Color color;
|
final Color color;
|
||||||
|
|
||||||
const Spinner({
|
const Spinner({
|
||||||
this.color = const Color.fromRGBO(150, 150, 150, 1),
|
this.color = COLOR_GRAY_LIGHT,
|
||||||
Key? key,
|
Key? key,
|
||||||
@required this.icon,
|
@required this.icon,
|
||||||
this.duration = const Duration(milliseconds: 1800),
|
this.duration = const Duration(milliseconds: 1800),
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import 'package:inventree/app_colors.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';
|
||||||
import 'package:inventree/inventree/model.dart';
|
import 'package:inventree/inventree/model.dart';
|
||||||
@ -207,7 +208,7 @@ class _StockItemTestResultDisplayState extends RefreshableState<StockItemTestRes
|
|||||||
String _value = "";
|
String _value = "";
|
||||||
String _notes = "";
|
String _notes = "";
|
||||||
|
|
||||||
FaIcon _icon = FaIcon(FontAwesomeIcons.questionCircle, color: Color.fromRGBO(0, 0, 250, 1));
|
FaIcon _icon = FaIcon(FontAwesomeIcons.questionCircle, color: COLOR_BLUE);
|
||||||
bool _valueRequired = false;
|
bool _valueRequired = false;
|
||||||
bool _attachmentRequired = false;
|
bool _attachmentRequired = false;
|
||||||
|
|
||||||
@ -229,11 +230,11 @@ class _StockItemTestResultDisplayState extends RefreshableState<StockItemTestRes
|
|||||||
|
|
||||||
if (_result == true) {
|
if (_result == true) {
|
||||||
_icon = FaIcon(FontAwesomeIcons.checkCircle,
|
_icon = FaIcon(FontAwesomeIcons.checkCircle,
|
||||||
color: Color.fromRGBO(0, 250, 0, 0.8)
|
color: COLOR_SUCCESS,
|
||||||
);
|
);
|
||||||
} else if (_result == false) {
|
} else if (_result == false) {
|
||||||
_icon = FaIcon(FontAwesomeIcons.timesCircle,
|
_icon = FaIcon(FontAwesomeIcons.timesCircle,
|
||||||
color: Color.fromRGBO(250, 0, 0, 0.8)
|
color: COLOR_DANGER,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user