mirror of
https://github.com/inventree/inventree-app.git
synced 2025-04-29 22:16:47 +00:00
Simplify grid layout
This commit is contained in:
parent
7d80b4f151
commit
d28392bae3
@ -64,31 +64,42 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
|
|||||||
scanQrCode(context);
|
scanQrCode(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _parts(BuildContext context) {
|
void _showParts(BuildContext context) {
|
||||||
if (!InvenTreeAPI().checkConnection(context)) return;
|
if (!InvenTreeAPI().checkConnection(context)) return;
|
||||||
|
|
||||||
Navigator.push(context, MaterialPageRoute(builder: (context) => CategoryDisplayWidget(null)));
|
Navigator.push(context, MaterialPageRoute(builder: (context) => CategoryDisplayWidget(null)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void _stock(BuildContext context) {
|
void _showStarredParts(BuildContext context) {
|
||||||
|
if (!InvenTreeAPI().checkConnection(context)) return;
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
// Navigator.push(context, MaterialPageRoute(builder: (context) => StarredPartWidget()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void _showStock(BuildContext context) {
|
||||||
if (!InvenTreeAPI().checkConnection(context)) return;
|
if (!InvenTreeAPI().checkConnection(context)) return;
|
||||||
|
|
||||||
Navigator.push(context, MaterialPageRoute(builder: (context) => LocationDisplayWidget(null)));
|
Navigator.push(context, MaterialPageRoute(builder: (context) => LocationDisplayWidget(null)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void _suppliers() {
|
void _showPurchaseOrders(BuildContext context) {
|
||||||
|
if (!InvenTreeAPI().checkConnection(context)) return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void _showSuppliers(BuildContext context) {
|
||||||
if (!InvenTreeAPI().checkConnection(context)) return;
|
if (!InvenTreeAPI().checkConnection(context)) return;
|
||||||
|
|
||||||
Navigator.push(context, MaterialPageRoute(builder: (context) => CompanyListWidget(L10().suppliers, {"is_supplier": "true"})));
|
Navigator.push(context, MaterialPageRoute(builder: (context) => CompanyListWidget(L10().suppliers, {"is_supplier": "true"})));
|
||||||
}
|
}
|
||||||
|
|
||||||
void _manufacturers() {
|
void _showManufacturers(BuildContext context) {
|
||||||
if (!InvenTreeAPI().checkConnection(context)) return;
|
if (!InvenTreeAPI().checkConnection(context)) return;
|
||||||
|
|
||||||
Navigator.push(context, MaterialPageRoute(builder: (context) => CompanyListWidget(L10().manufacturers, {"is_manufacturer": "true"})));
|
Navigator.push(context, MaterialPageRoute(builder: (context) => CompanyListWidget(L10().manufacturers, {"is_manufacturer": "true"})));
|
||||||
}
|
}
|
||||||
|
|
||||||
void _customers() {
|
void _showCustomers(BuildContext context) {
|
||||||
if (!InvenTreeAPI().checkConnection(context)) return;
|
if (!InvenTreeAPI().checkConnection(context)) return;
|
||||||
|
|
||||||
Navigator.push(context, MaterialPageRoute(builder: (context) => CompanyListWidget(L10().customers, {"is_customer": "true"})));
|
Navigator.push(context, MaterialPageRoute(builder: (context) => CompanyListWidget(L10().customers, {"is_customer": "true"})));
|
||||||
@ -183,6 +194,36 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget _header(String label) {
|
||||||
|
return Card(
|
||||||
|
margin: EdgeInsets.symmetric(
|
||||||
|
vertical: 1,
|
||||||
|
horizontal: 10,
|
||||||
|
),
|
||||||
|
child: ListTile(
|
||||||
|
contentPadding: EdgeInsets.symmetric(
|
||||||
|
horizontal: 10,
|
||||||
|
vertical: 1
|
||||||
|
),
|
||||||
|
title: Text(
|
||||||
|
label,
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _grid(List<Widget> children) {
|
||||||
|
return GridView.extent(
|
||||||
|
maxCrossAxisExtent: 140,
|
||||||
|
shrinkWrap: true,
|
||||||
|
physics: ClampingScrollPhysics(),
|
||||||
|
children: children,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Widget _iconButton(String label, IconData icon, {Function()? callback}) {
|
Widget _iconButton(String label, IconData icon, {Function()? callback}) {
|
||||||
|
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
@ -194,8 +235,16 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
|
|||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
FaIcon(icon),
|
FaIcon(
|
||||||
Text(label),
|
icon,
|
||||||
|
color: COLOR_CLICK,
|
||||||
|
),
|
||||||
|
Divider(
|
||||||
|
height: 10,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
label,
|
||||||
|
),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
@ -218,21 +267,21 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
|
|||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text(L10().appTitle),
|
title: Text(L10().appTitle),
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
/*
|
// IconButton(
|
||||||
IconButton(
|
// icon: FaIcon(FontAwesomeIcons.barcode),
|
||||||
icon: FaIcon(FontAwesomeIcons.search),
|
// tooltip: L10().scanBarcode,
|
||||||
tooltip: L10().search,
|
// onPressed: () {
|
||||||
onPressed: _searchParts,
|
// _scan(context);
|
||||||
),
|
// },
|
||||||
*/
|
// ),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
drawer: new InvenTreeDrawer(context),
|
drawer: new InvenTreeDrawer(context),
|
||||||
body: GridView.extent(
|
body: ListView(
|
||||||
maxCrossAxisExtent: 150,
|
physics: ClampingScrollPhysics(),
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
physics: ClampingScrollPhysics(),
|
children: [
|
||||||
children: [
|
_grid([
|
||||||
_iconButton(
|
_iconButton(
|
||||||
L10().scanBarcode,
|
L10().scanBarcode,
|
||||||
FontAwesomeIcons.barcode,
|
FontAwesomeIcons.barcode,
|
||||||
@ -241,69 +290,64 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
|
|||||||
}
|
}
|
||||||
),
|
),
|
||||||
_iconButton(
|
_iconButton(
|
||||||
L10().parts,
|
L10().search,
|
||||||
FontAwesomeIcons.shapes,
|
FontAwesomeIcons.search,
|
||||||
callback: () {
|
callback: () {
|
||||||
_parts(context);
|
// TODO: Launch "generic" search widget
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
_iconButton(
|
_iconButton(
|
||||||
L10().searchParts,
|
L10().parts,
|
||||||
FontAwesomeIcons.search,
|
FontAwesomeIcons.shapes,
|
||||||
callback: () {
|
callback: () {
|
||||||
_searchParts();
|
_showParts(context);
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
// TODO - Re-add starred parts link
|
|
||||||
/*
|
// TODO - Re-add starred parts link
|
||||||
|
/*
|
||||||
Column(
|
Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: FaIcon(FontAwesomeIcons.solidStar),
|
icon: FaIcon(FontAwesomeIcons.solidStar),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.push(context, MaterialPageRoute(builder: (context) => StarredPartWidget()));
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
Text("Starred Parts"),
|
Text("Starred Parts"),
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
*/
|
*/
|
||||||
|
|
||||||
_iconButton(
|
_iconButton(
|
||||||
L10().stock,
|
L10().stock,
|
||||||
FontAwesomeIcons.boxes,
|
FontAwesomeIcons.boxes,
|
||||||
callback: () {
|
callback: () {
|
||||||
_stock(context);
|
_showStock(context);
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
_iconButton(
|
_iconButton(
|
||||||
L10().searchStock,
|
L10().purchaseOrders,
|
||||||
FontAwesomeIcons.search,
|
FontAwesomeIcons.shoppingCart,
|
||||||
callback: () {
|
callback: () {
|
||||||
_searchStock();
|
_showPurchaseOrders(context);
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
_iconButton(
|
_iconButton(
|
||||||
L10().purchaseOrders,
|
L10().suppliers,
|
||||||
FontAwesomeIcons.shoppingCart,
|
FontAwesomeIcons.building,
|
||||||
callback: () {
|
callback: () {
|
||||||
// TODO
|
_showSuppliers(context);
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
_iconButton(
|
_iconButton(
|
||||||
L10().suppliers,
|
L10().manufacturers,
|
||||||
FontAwesomeIcons.building,
|
FontAwesomeIcons.industry,
|
||||||
callback: () {
|
callback: () {
|
||||||
_suppliers();
|
_showManufacturers(context);
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
_iconButton(
|
/*
|
||||||
L10().manufacturers,
|
|
||||||
FontAwesomeIcons.industry,
|
|
||||||
callback: () {
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
),
|
|
||||||
/*
|
|
||||||
Spacer(),
|
Spacer(),
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
@ -342,7 +386,7 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
|
|||||||
),
|
),
|
||||||
Spacer(),
|
Spacer(),
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
Spacer(),
|
Spacer(),
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
@ -355,8 +399,10 @@ class _InvenTreeHomePageState extends State<InvenTreeHomePage> {
|
|||||||
),
|
),
|
||||||
]),
|
]),
|
||||||
*/
|
*/
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
]
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user