mirror of
https://github.com/inventree/inventree-app.git
synced 2025-04-28 05:26:47 +00:00
Add separator divider elements in lists
This commit is contained in:
parent
18b4783c11
commit
1c0b469020
@ -15,48 +15,96 @@ class InvenTreeAboutWidget extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
List<Widget> tiles = [];
|
||||
|
||||
tiles.add(
|
||||
ListTile(
|
||||
title: Text(
|
||||
I18N.of(context).serverDetails,
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
if (InvenTreeAPI().isConnected()) {
|
||||
tiles.add(
|
||||
ListTile(
|
||||
title: Text(I18N.of(context).address),
|
||||
subtitle: Text(InvenTreeAPI().baseUrl.isNotEmpty ? InvenTreeAPI().baseUrl : "Not connected"),
|
||||
)
|
||||
);
|
||||
|
||||
tiles.add(
|
||||
ListTile(
|
||||
title: Text(I18N.of(context).version),
|
||||
subtitle: Text(InvenTreeAPI().version.isNotEmpty ? InvenTreeAPI().version : "Not connected"),
|
||||
)
|
||||
);
|
||||
|
||||
tiles.add(
|
||||
ListTile(
|
||||
title: Text("Server Instance"),
|
||||
subtitle: Text(InvenTreeAPI().instance.isNotEmpty ? InvenTreeAPI().instance : "Not connected"),
|
||||
)
|
||||
);
|
||||
} else {
|
||||
tiles.add(
|
||||
ListTile(
|
||||
title: Text("Not Connected"),
|
||||
subtitle: Text(
|
||||
"InvenTree server not connected",
|
||||
style: TextStyle(fontStyle: FontStyle.italic),
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
tiles.add(
|
||||
ListTile(
|
||||
title: Text(
|
||||
I18N.of(context).appDetails,
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
tiles.add(
|
||||
ListTile(
|
||||
title: Text(I18N.of(context).name),
|
||||
subtitle: Text("${info.appName}"),
|
||||
)
|
||||
);
|
||||
|
||||
tiles.add(
|
||||
ListTile(
|
||||
title: Text("Package Name"),
|
||||
subtitle: Text("${info.packageName}"),
|
||||
)
|
||||
);
|
||||
|
||||
tiles.add(
|
||||
ListTile(
|
||||
title: Text(I18N.of(context).version),
|
||||
subtitle: Text("${info.version}"),
|
||||
)
|
||||
);
|
||||
|
||||
tiles.add(
|
||||
ListTile(
|
||||
title: Text(I18N.of(context).build),
|
||||
subtitle: Text("${info.buildNumber}"),
|
||||
)
|
||||
);
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text("About InvenTree"),
|
||||
),
|
||||
body: ListView(
|
||||
children: <Widget>[
|
||||
ListTile(
|
||||
title: Text(I18N.of(context).serverDetails),
|
||||
),
|
||||
ListTile(
|
||||
title: Text(I18N.of(context).address),
|
||||
subtitle: Text(InvenTreeAPI().baseUrl.isNotEmpty ? InvenTreeAPI().baseUrl : "Not connected"),
|
||||
),
|
||||
ListTile(
|
||||
title: Text(I18N.of(context).version),
|
||||
subtitle: Text(InvenTreeAPI().version.isNotEmpty ? InvenTreeAPI().version : "Not connected"),
|
||||
),
|
||||
ListTile(
|
||||
title: Text("Server Instance"),
|
||||
subtitle: Text(InvenTreeAPI().instance.isNotEmpty ? InvenTreeAPI().instance : "Not connected"),
|
||||
),
|
||||
Divider(),
|
||||
ListTile(
|
||||
title: Text(I18N.of(context).appDetails),
|
||||
),
|
||||
ListTile(
|
||||
title: Text(I18N.of(context).name),
|
||||
subtitle: Text("${info.appName}"),
|
||||
),
|
||||
ListTile(
|
||||
title: Text("Package Name"),
|
||||
subtitle: Text("${info.packageName}"),
|
||||
),
|
||||
ListTile(
|
||||
title: Text(I18N.of(context).version),
|
||||
subtitle: Text("${info.version}"),
|
||||
),
|
||||
ListTile(
|
||||
title: Text(I18N.of(context).build),
|
||||
subtitle: Text("${info.buildNumber}"),
|
||||
)
|
||||
],
|
||||
children: ListTile.divideTiles(
|
||||
context: context,
|
||||
tiles: tiles,
|
||||
).toList(),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -300,7 +300,10 @@ class _InvenTreeLoginSettingsState extends State<InvenTreeLoginSettingsWidget> {
|
||||
),
|
||||
body: Container(
|
||||
child: ListView(
|
||||
children: children,
|
||||
children: ListTile.divideTiles(
|
||||
context: context,
|
||||
tiles: children
|
||||
).toList(),
|
||||
)
|
||||
),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
|
@ -34,14 +34,15 @@ class _InvenTreeSettingsState extends State<InvenTreeSettingsWidget> {
|
||||
),
|
||||
body: Center(
|
||||
child: ListView(
|
||||
children: <Widget>[
|
||||
children: ListTile.divideTiles(
|
||||
context: context,
|
||||
tiles: <Widget>[
|
||||
ListTile(
|
||||
title: Text(I18N.of(context).profile),
|
||||
subtitle: Text("Configure user profile settings"),
|
||||
leading: FaIcon(FontAwesomeIcons.user),
|
||||
onTap: _editServerSettings,
|
||||
),
|
||||
Divider(),
|
||||
ListTile(
|
||||
title: Text(I18N.of(context).about),
|
||||
subtitle: Text(I18N.of(context).appDetails),
|
||||
@ -60,7 +61,8 @@ class _InvenTreeSettingsState extends State<InvenTreeSettingsWidget> {
|
||||
leading: FaIcon(FontAwesomeIcons.bug),
|
||||
onTap: null,
|
||||
),
|
||||
],
|
||||
]
|
||||
).toList()
|
||||
)
|
||||
)
|
||||
);
|
||||
|
@ -231,9 +231,10 @@ class SubcategoryList extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListView.builder(
|
||||
return ListView.separated(
|
||||
shrinkWrap: true,
|
||||
physics: ClampingScrollPhysics(),
|
||||
separatorBuilder: (_, __) => const Divider(),
|
||||
itemBuilder: _build, itemCount: _categories.length);
|
||||
}
|
||||
}
|
||||
@ -282,9 +283,10 @@ class PartList extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListView.builder(
|
||||
return ListView.separated(
|
||||
shrinkWrap: true,
|
||||
physics: ClampingScrollPhysics(),
|
||||
separatorBuilder: (_, __) => const Divider(height: 1),
|
||||
itemBuilder: _build, itemCount: _parts.length);
|
||||
}
|
||||
}
|
||||
|
@ -102,7 +102,9 @@ class InvenTreeDrawer extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return Drawer(
|
||||
child: new ListView(
|
||||
children: <Widget>[
|
||||
children: ListTile.divideTiles(
|
||||
context: context,
|
||||
tiles: <Widget>[
|
||||
new ListTile(
|
||||
leading: new Image.asset(
|
||||
"assets/image/icon.png",
|
||||
@ -112,7 +114,6 @@ class InvenTreeDrawer extends StatelessWidget {
|
||||
title: new Text("InvenTree"),
|
||||
onTap: _home,
|
||||
),
|
||||
new Divider(),
|
||||
/*
|
||||
// TODO - Add search functionality!
|
||||
new ListTile(
|
||||
@ -122,18 +123,17 @@ class InvenTreeDrawer extends StatelessWidget {
|
||||
),
|
||||
*/
|
||||
new ListTile(
|
||||
title: new Text("Scan Barcode"),
|
||||
title: new Text(I18N.of(context).scanBarcode),
|
||||
onTap: _scan,
|
||||
leading: new FaIcon(FontAwesomeIcons.barcode),
|
||||
),
|
||||
new Divider(),
|
||||
new ListTile(
|
||||
title: new Text("Parts"),
|
||||
title: new Text(I18N.of(context).parts),
|
||||
leading: new Icon(Icons.category),
|
||||
onTap: _showParts,
|
||||
),
|
||||
new ListTile(
|
||||
title: new Text("Stock"),
|
||||
title: new Text(I18N.of(context).stock),
|
||||
leading: new FaIcon(FontAwesomeIcons.boxes),
|
||||
onTap: _showStock,
|
||||
),
|
||||
@ -154,13 +154,13 @@ class InvenTreeDrawer extends StatelessWidget {
|
||||
onTap: _showCustomers,
|
||||
),
|
||||
*/
|
||||
new Divider(),
|
||||
new ListTile(
|
||||
title: new Text(I18N.of(context).settings),
|
||||
leading: new Icon(Icons.settings),
|
||||
onTap: _settings,
|
||||
),
|
||||
]
|
||||
).toList(),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -156,7 +156,10 @@ class _LocationDisplayState extends RefreshableState<LocationDisplayWidget> {
|
||||
);
|
||||
case 1:
|
||||
return ListView(
|
||||
children: actionTiles(),
|
||||
children: ListTile.divideTiles(
|
||||
context: context,
|
||||
tiles: actionTiles()
|
||||
).toList()
|
||||
);
|
||||
default:
|
||||
return null;
|
||||
@ -298,10 +301,11 @@ class SublocationList extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListView.builder(
|
||||
return ListView.separated(
|
||||
shrinkWrap: true,
|
||||
physics: ClampingScrollPhysics(),
|
||||
itemBuilder: _build,
|
||||
separatorBuilder: (_, __) => const Divider(),
|
||||
itemCount: _locations.length
|
||||
);
|
||||
}
|
||||
@ -342,9 +346,10 @@ class StockList extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListView.builder(
|
||||
return ListView.separated(
|
||||
shrinkWrap: true,
|
||||
physics: ClampingScrollPhysics(),
|
||||
separatorBuilder: (_, __) => const Divider(),
|
||||
itemBuilder: _build, itemCount: _items.length);
|
||||
}
|
||||
}
|
@ -82,6 +82,7 @@ class _PartDisplayState extends RefreshableState<PartDetailWidget> {
|
||||
|
||||
void _showStock(BuildContext context) async {
|
||||
await part.getStockItems(context);
|
||||
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => PartStockDetailWidget(part))
|
||||
@ -349,13 +350,19 @@ class _PartDisplayState extends RefreshableState<PartDetailWidget> {
|
||||
case 0:
|
||||
return Center(
|
||||
child: ListView(
|
||||
children: partTiles(),
|
||||
children: ListTile.divideTiles(
|
||||
context: context,
|
||||
tiles: partTiles()
|
||||
).toList()
|
||||
),
|
||||
);
|
||||
case 1:
|
||||
return Center(
|
||||
child: ListView(
|
||||
children: actionTiles(),
|
||||
children: ListTile.divideTiles(
|
||||
context: context,
|
||||
tiles: actionTiles()
|
||||
).toList()
|
||||
)
|
||||
);
|
||||
default:
|
||||
|
@ -100,10 +100,11 @@ class PartStockList extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListView.builder(
|
||||
return ListView.separated(
|
||||
shrinkWrap: true,
|
||||
physics: ClampingScrollPhysics(),
|
||||
itemBuilder: _build,
|
||||
separatorBuilder: (_, __) => const Divider(height: 1),
|
||||
itemCount: _items.length
|
||||
);
|
||||
}
|
||||
|
@ -579,11 +579,17 @@ class _StockItemDisplayState extends RefreshableState<StockDetailWidget> {
|
||||
switch (index) {
|
||||
case 0:
|
||||
return ListView(
|
||||
children: detailTiles(),
|
||||
children: ListTile.divideTiles(
|
||||
context: context,
|
||||
tiles: detailTiles()
|
||||
).toList(),
|
||||
);
|
||||
case 1:
|
||||
return ListView(
|
||||
children: actionTiles(),
|
||||
children: ListTile.divideTiles(
|
||||
context: context,
|
||||
tiles: actionTiles()
|
||||
).toList()
|
||||
);
|
||||
default:
|
||||
return null;
|
||||
|
@ -250,7 +250,10 @@ class _StockItemTestResultDisplayState extends RefreshableState<StockItemTestRes
|
||||
@override
|
||||
Widget getBody(BuildContext context) {
|
||||
return ListView(
|
||||
children: resultsList(),
|
||||
children: ListTile.divideTiles(
|
||||
context: context,
|
||||
tiles: resultsList()
|
||||
).toList()
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user