2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-04-27 21:16:48 +00:00

Home screen (#559)

* Use grid view for home screen

* Update release notes

* Prune dead code
This commit is contained in:
Oliver 2024-12-05 17:10:56 +11:00 committed by GitHub
parent d4b2204baf
commit 2964950b26
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 41 additions and 15 deletions

View File

@ -1,6 +1,7 @@
### 0.17.0 - November 2024
---
- Enhanced home-screen display using grid-view
- Improvements for image uploading
- Provide "upload image" shortcut on Purchase Order detail view
- Provide "upload image" shortcut on Sales Order detail view

View File

@ -56,6 +56,7 @@ class _InvenTreeSettingsState extends State<InvenTreeSettingsWidget> {
Navigator.push(context, MaterialPageRoute(builder: (context) => InvenTreeSelectServerWidget()));
},
),
Divider(),
ListTile(
title: Text(L10().appSettings),
subtitle: Text(L10().appSettingsDetails),

View File

@ -1,4 +1,5 @@
import "dart:async";
import "dart:math";
import "package:flutter/material.dart";
import "package:flutter_tabler_icons/flutter_tabler_icons.dart";
@ -187,15 +188,24 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> with BaseWidgetPr
return GestureDetector(
child: Card(
margin: EdgeInsets.symmetric(
vertical: 5,
horizontal: 12
),
child: ListTile(
leading: Icon(icon, color: connected && allowed ? COLOR_ACTION : Colors.grey),
title: Text(label),
trailing: trailing,
),
margin: EdgeInsets.all(5),
child: Align(
child: ListTile(
leading: Icon(
icon,
size: 32,
color: connected && allowed ? COLOR_ACTION : Colors.grey
),
title: Text(
label,
style: TextStyle(
fontSize: 20
),
),
trailing: trailing,
),
alignment: Alignment.center,
)
),
onTap: () {
if (!allowed) {
@ -219,9 +229,7 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> with BaseWidgetPr
*/
List<Widget> getListTiles(BuildContext context) {
List<Widget> tiles = [
Divider(height: 5)
];
List<Widget> tiles = [];
// Parts
if (InvenTreePart().canView) {
@ -381,10 +389,26 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> with BaseWidgetPr
return _connectionStatusWidget(context);
}
return ListView(
scrollDirection: Axis.vertical,
children: getListTiles(context),
double w = MediaQuery.of(context).size.width;
double h = MediaQuery.of(context).size.height;
bool smallScreen = max(w, h) < 1000;
int vTiles = smallScreen ? 2 : 3;
int hTiles = smallScreen ? 1 : 2;
double aspect = smallScreen ? 5 : 3;
double padding = smallScreen ? 2 : 10;
return GridView.count(
crossAxisCount: w > h ? vTiles : hTiles,
children: getListTiles(context),
childAspectRatio: aspect,
primary: false,
crossAxisSpacing: padding,
mainAxisSpacing: padding,
padding: EdgeInsets.all(padding),
);
}
@override