2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-04-28 13:36:50 +00:00

Change home screen from "grid" display to "list" display

This commit is contained in:
Oliver Walters 2022-05-04 10:02:50 +10:00
parent 1e1ed96d64
commit 102b4e021b
2 changed files with 30 additions and 45 deletions

View File

@ -1,6 +1,11 @@
## InvenTree App Release Notes ## InvenTree App Release Notes
--- ---
### 0.7.0 -
---
- Refactor home screen display
### 0.6.2 - April 2022 ### 0.6.2 - April 2022
--- ---

View File

@ -41,11 +41,11 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
} }
bool homeShowPo = true; bool homeShowPo = false;
bool homeShowSubscribed = true; bool homeShowSubscribed = false;
bool homeShowManufacturers = true; bool homeShowManufacturers = false;
bool homeShowCustomers = true; bool homeShowCustomers = false;
bool homeShowSuppliers = true; bool homeShowSuppliers = false;
final GlobalKey<_InvenTreeHomePageState> _homeKey = GlobalKey<_InvenTreeHomePageState>(); final GlobalKey<_InvenTreeHomePageState> _homeKey = GlobalKey<_InvenTreeHomePageState>();
@ -169,7 +169,7 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
} }
Widget _iconButton(BuildContext context, String label, IconData icon, {Function()? callback, String role = "", String permission = ""}) { Widget _listTile(BuildContext context, String label, IconData icon, {Function()? callback, String role = "", String permission = ""}) {
bool connected = InvenTreeAPI().isConnected(); bool connected = InvenTreeAPI().isConnected();
@ -182,27 +182,13 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
return GestureDetector( return GestureDetector(
child: Card( child: Card(
margin: EdgeInsets.symmetric( margin: EdgeInsets.symmetric(
vertical: 12, vertical: 5,
horizontal: 12 horizontal: 12
), ),
child: Column( child: ListTile(
mainAxisAlignment: MainAxisAlignment.center, leading: FaIcon(icon, color: connected && allowed ? COLOR_CLICK : Colors.grey),
children: [ title: Text(label),
FaIcon(
icon,
color: connected && allowed ? COLOR_CLICK : Colors.grey,
), ),
Divider(
height: 15,
thickness: 0,
color: Colors.transparent,
),
Text(
label,
textAlign: TextAlign.center,
),
]
)
), ),
onTap: () { onTap: () {
@ -224,12 +210,12 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
); );
} }
List<Widget> getGridTiles(BuildContext context) { List<Widget> getListTiles(BuildContext context) {
List<Widget> tiles = []; List<Widget> tiles = [];
// Barcode scanner // Barcode scanner
tiles.add(_iconButton( tiles.add(_listTile(
context, context,
L10().scanBarcode, L10().scanBarcode,
Icons.qr_code_scanner, Icons.qr_code_scanner,
@ -239,7 +225,7 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
)); ));
// Search widget // Search widget
tiles.add(_iconButton( tiles.add(_listTile(
context, context,
L10().search, L10().search,
FontAwesomeIcons.search, FontAwesomeIcons.search,
@ -249,7 +235,7 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
)); ));
// Parts // Parts
tiles.add(_iconButton( tiles.add(_listTile(
context, context,
L10().parts, L10().parts,
FontAwesomeIcons.shapes, FontAwesomeIcons.shapes,
@ -260,7 +246,7 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
// Starred parts // Starred parts
if (homeShowSubscribed) { if (homeShowSubscribed) {
tiles.add(_iconButton( tiles.add(_listTile(
context, context,
L10().partsStarred, L10().partsStarred,
FontAwesomeIcons.bell, FontAwesomeIcons.bell,
@ -271,7 +257,7 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
} }
// Stock button // Stock button
tiles.add(_iconButton( tiles.add(_listTile(
context, context,
L10().stock, L10().stock,
FontAwesomeIcons.boxes, FontAwesomeIcons.boxes,
@ -282,7 +268,7 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
// Purchase orderes // Purchase orderes
if (homeShowPo) { if (homeShowPo) {
tiles.add(_iconButton( tiles.add(_listTile(
context, context,
L10().purchaseOrders, L10().purchaseOrders,
FontAwesomeIcons.shoppingCart, FontAwesomeIcons.shoppingCart,
@ -294,7 +280,7 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
// Suppliers // Suppliers
if (homeShowSuppliers) { if (homeShowSuppliers) {
tiles.add(_iconButton( tiles.add(_listTile(
context, context,
L10().suppliers, L10().suppliers,
FontAwesomeIcons.building, FontAwesomeIcons.building,
@ -306,7 +292,7 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
// Manufacturers // Manufacturers
if (homeShowManufacturers) { if (homeShowManufacturers) {
tiles.add(_iconButton( tiles.add(_listTile(
context, context,
L10().manufacturers, L10().manufacturers,
FontAwesomeIcons.industry, FontAwesomeIcons.industry,
@ -318,7 +304,7 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
// Customers // Customers
if (homeShowCustomers) { if (homeShowCustomers) {
tiles.add(_iconButton( tiles.add(_listTile(
context, context,
L10().customers, L10().customers,
FontAwesomeIcons.userTie, FontAwesomeIcons.userTie,
@ -329,7 +315,7 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
} }
// Settings // Settings
tiles.add(_iconButton( tiles.add(_listTile(
context, context,
L10().settings, L10().settings,
FontAwesomeIcons.cogs, FontAwesomeIcons.cogs,
@ -360,15 +346,9 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
), ),
drawer: InvenTreeDrawer(context), drawer: InvenTreeDrawer(context),
body: ListView( body: ListView(
children: [ scrollDirection: Axis.vertical,
GridView.extent( children: getListTiles(context),
maxCrossAxisExtent: 140, )
shrinkWrap: true,
physics: ClampingScrollPhysics(),
children: getGridTiles(context),
),
],
),
); );
} }
} }