mirror of
https://github.com/inventree/inventree-app.git
synced 2025-05-11 11:48:52 +00:00
Add beginnings of "page" widget view
This commit is contained in:
parent
e92a05a306
commit
c2e398463f
@ -33,6 +33,8 @@ class _PartDisplayState extends RefreshableState<PartDetailWidget> {
|
|||||||
|
|
||||||
InvenTreePart part;
|
InvenTreePart part;
|
||||||
|
|
||||||
|
int _tabIndex = 0;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> request(BuildContext context) async {
|
Future<void> request(BuildContext context) async {
|
||||||
await part.reload(context);
|
await part.reload(context);
|
||||||
@ -162,12 +164,56 @@ class _PartDisplayState extends RefreshableState<PartDetailWidget> {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _onTabSelectionChanged(int index) {
|
||||||
|
setState(() {
|
||||||
|
_tabIndex = index;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget getSelectedWidget(int index) {
|
||||||
|
switch (index) {
|
||||||
|
case 0:
|
||||||
|
return Center(
|
||||||
|
child: ListView(
|
||||||
|
children: partTiles(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
case 1:
|
||||||
|
return Center(
|
||||||
|
child: ListView(
|
||||||
|
children: <Widget>[
|
||||||
|
ListTile(
|
||||||
|
title: Text("Stock"),
|
||||||
|
subtitle: Text("Stock info goes here!"),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
);
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget getBody(BuildContext context) {
|
Widget getBottomNavBar(BuildContext context) {
|
||||||
return Center(
|
return BottomNavigationBar(
|
||||||
child: ListView(
|
currentIndex: _tabIndex,
|
||||||
children: partTiles(),
|
onTap: _onTabSelectionChanged,
|
||||||
),
|
items: const <BottomNavigationBarItem> [
|
||||||
|
BottomNavigationBarItem(
|
||||||
|
icon: FaIcon(FontAwesomeIcons.infoCircle),
|
||||||
|
title: Text("Details"),
|
||||||
|
),
|
||||||
|
BottomNavigationBarItem(
|
||||||
|
icon: FaIcon(FontAwesomeIcons.boxes),
|
||||||
|
title: Text("Stock"),
|
||||||
|
),
|
||||||
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget getBody(BuildContext context) {
|
||||||
|
return getSelectedWidget(_tabIndex);
|
||||||
|
}
|
||||||
}
|
}
|
@ -46,7 +46,13 @@ abstract class RefreshableState<T extends StatefulWidget> extends State<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Function to construct a body (MUST BE PROVIDED)
|
// Function to construct a body (MUST BE PROVIDED)
|
||||||
Widget getBody(BuildContext context);
|
Widget getBody(BuildContext context) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget getBottomNavBar(BuildContext context) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -60,7 +66,8 @@ abstract class RefreshableState<T extends StatefulWidget> extends State<T> {
|
|||||||
body: RefreshIndicator(
|
body: RefreshIndicator(
|
||||||
onRefresh: refresh,
|
onRefresh: refresh,
|
||||||
child: getBody(context)
|
child: getBody(context)
|
||||||
)
|
),
|
||||||
|
bottomNavigationBar: getBottomNavBar(context),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user