diff --git a/lib/l10n b/lib/l10n index ed3bd59b..6e095a0d 160000 --- a/lib/l10n +++ b/lib/l10n @@ -1 +1 @@ -Subproject commit ed3bd59b15b2c69b9a21649a0e0507efd811c1a1 +Subproject commit 6e095a0d6c7d044a60ccda07d03ae8594d8b4b27 diff --git a/lib/preferences.dart b/lib/preferences.dart index ea43720f..3be8e8c7 100644 --- a/lib/preferences.dart +++ b/lib/preferences.dart @@ -1,13 +1,9 @@ -import 'package:flutter/cupertino.dart'; -import 'package:shared_preferences/shared_preferences.dart'; -import 'api.dart'; import 'package:path_provider/path_provider.dart'; import 'package:sembast/sembast.dart'; import 'package:sembast/sembast_io.dart'; import 'package:path/path.dart'; import 'dart:async'; - /* * Class for storing InvenTree preferences in a NoSql DB */ diff --git a/lib/settings/settings.dart b/lib/settings/settings.dart index a93c8821..32cb2d82 100644 --- a/lib/settings/settings.dart +++ b/lib/settings/settings.dart @@ -7,7 +7,6 @@ import 'package:InvenTree/preferences.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; -import 'package:shared_preferences/shared_preferences.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; @@ -70,8 +69,6 @@ class _InvenTreeSettingsState extends State { void _editServerSettings() async { - var prefs = await SharedPreferences.getInstance(); - List profiles = await UserProfileDBManager().getAllProfiles(); Navigator.push(context, MaterialPageRoute(builder: (context) => InvenTreeLoginSettingsWidget())); diff --git a/lib/widget/category_display.dart b/lib/widget/category_display.dart index 64b8da88..57b9a88e 100644 --- a/lib/widget/category_display.dart +++ b/lib/widget/category_display.dart @@ -147,8 +147,7 @@ class _CategoryDisplayState extends RefreshableState { if (category == null) { return Card( child: ListTile( - title: Text(I18N.of(context).partCategories), - subtitle: Text("Top level part category"), + title: Text("Top level part category"), ) ); } else { @@ -183,70 +182,84 @@ class _CategoryDisplayState extends RefreshableState { } @override - Widget getBody(BuildContext context) { - return ListView( - children: [ - getCategoryDescriptionCard(), - ExpansionPanelList( - expansionCallback: (int index, bool isExpanded) { - setState(() { - - switch (index) { - case 0: - InvenTreePreferences().expandCategoryList = !isExpanded; - break; - case 1: - InvenTreePreferences().expandPartList = !isExpanded; - break; - default: - break; - } - }); - }, - children: [ - ExpansionPanel( - headerBuilder: (BuildContext context, bool isExpanded) { - return ListTile( - title: Text(I18N.of(context).subcategories), - leading: FaIcon(FontAwesomeIcons.stream), - trailing: Text("${_subcategories.length}"), - onTap: () { - setState(() { - InvenTreePreferences().expandCategoryList = !InvenTreePreferences().expandCategoryList; - }); - }, - onLongPress: () { - // TODO - Context menu for e.g. creating a new PartCategory - }, - ); - }, - body: SubcategoryList(_subcategories), - isExpanded: InvenTreePreferences().expandCategoryList && _subcategories.length > 0, - ), - ExpansionPanel( - headerBuilder: (BuildContext context, bool isExpanded) { - return ListTile( - title: Text(I18N.of(context).parts), - leading: FaIcon(FontAwesomeIcons.shapes), - trailing: Text("${_parts.length}"), - onTap: () { - setState(() { - InvenTreePreferences().expandPartList = !InvenTreePreferences().expandPartList; - }); - }, - onLongPress: () { - // TODO - Context menu for e.g. creating a new Part - }, - ); - }, - body: PartList(_parts), - isExpanded: InvenTreePreferences().expandPartList && _parts.length > 0, - ) - ], + Widget getBottomNavBar(BuildContext context) { + return BottomNavigationBar( + currentIndex: tabIndex, + onTap: onTabSelectionChanged, + items: [ + BottomNavigationBarItem( + icon: FaIcon(FontAwesomeIcons.sitemap), + label: I18N.of(context).details, + ), + BottomNavigationBarItem( + icon: FaIcon(FontAwesomeIcons.shapes), + label: I18N.of(context).parts, + ), + BottomNavigationBarItem( + icon: FaIcon(FontAwesomeIcons.wrench), + label: I18N.of(context).actions ), ] ); } + + List detailTiles() { + return [ + getCategoryDescriptionCard(), + Divider(), + ListTile( + title: Text( + I18N.of(context).subcategories, + style: TextStyle(fontWeight: FontWeight.bold) + ) + ), + SubcategoryList(_subcategories), + ]; + } + + List partTiles() { + return [ + getCategoryDescriptionCard(), + Divider(), + ListTile( + title: Text( + I18N.of(context).parts, + style: TextStyle(fontWeight: FontWeight.bold) + ) + ), + PartList(_parts) + ]; + } + + List actionTiles() { + + List tiles = [ + getCategoryDescriptionCard() + ]; + + // TODO - Actions! + + return tiles; + } + + @override + Widget getBody(BuildContext context) { + + switch (tabIndex) { + case 0: + return ListView( + children: detailTiles() + ); + case 1: + return ListView( + children: partTiles() + ); + case 2: + return ListView( + children: actionTiles() + ); + } + } } diff --git a/lib/widget/location_display.dart b/lib/widget/location_display.dart index ebaef9b5..1b2276fb 100644 --- a/lib/widget/location_display.dart +++ b/lib/widget/location_display.dart @@ -149,9 +149,7 @@ class _LocationDisplayState extends RefreshableState { if (location == null) { return Card( child: ListTile( - title: Text(I18N.of(context).stockLocations), - subtitle: Text(I18N.of(context).stockTopLevel), - leading: FaIcon(FontAwesomeIcons.levelUpAlt), + title: Text(I18N.of(context).stockTopLevel), ) ); } else { @@ -190,13 +188,17 @@ class _LocationDisplayState extends RefreshableState { currentIndex: tabIndex, onTap: onTabSelectionChanged, items: [ + BottomNavigationBarItem( + icon: FaIcon(FontAwesomeIcons.sitemap), + label: I18N.of(context).details, + ), BottomNavigationBarItem( icon: FaIcon(FontAwesomeIcons.boxes), - title: Text(I18N.of(context).stock), + label: I18N.of(context).stock, ), BottomNavigationBarItem( icon: FaIcon(FontAwesomeIcons.wrench), - title: Text(I18N.of(context).actions), + label: I18N.of(context).actions, ) ] ); @@ -208,6 +210,10 @@ class _LocationDisplayState extends RefreshableState { return ListView( children: detailTiles(), ); + case 1: + return ListView( + children: stockTiles(), + ); case 1: return ListView( children: ListTile.divideTiles( @@ -227,73 +233,39 @@ class _LocationDisplayState extends RefreshableState { List detailTiles() { - List tiles = []; - - // Location description - tiles.add(locationDescriptionCard()); - - // Sublocation panel - ExpansionPanel sublocations = ExpansionPanel( - headerBuilder: (BuildContext context, bool isExpanded) { - return ListTile( - title: Text("Sublocations"), - leading: FaIcon(FontAwesomeIcons.mapMarkerAlt), - trailing: Text("${_sublocations.length}"), - onTap: () { - setState(() { - InvenTreePreferences().expandLocationList = !InvenTreePreferences().expandLocationList; - }); - }, - ); - }, - body: SublocationList(_sublocations), - isExpanded: InvenTreePreferences().expandLocationList && _sublocations.length > 0, - ); - - ExpansionPanel subitems = ExpansionPanel( - headerBuilder: (BuildContext context, bool isExpanded) { - return ListTile( - title: Text("Stock Items"), - leading: FaIcon(FontAwesomeIcons.boxes), - trailing: Text("${_items.length}"), - onTap: () { - setState(() { - InvenTreePreferences().expandStockList = !InvenTreePreferences().expandStockList; - }); - }, - ); - }, - body: StockList(_items), - isExpanded: InvenTreePreferences().expandStockList && _items.length > 0, - ); - - // Sublocations and items - tiles.add( - ExpansionPanelList( - expansionCallback: (int index, bool isExpanded) { - setState(() { - switch (index) { - case 0: - InvenTreePreferences().expandLocationList = !isExpanded; - break; - case 1: - InvenTreePreferences().expandStockList = !isExpanded; - break; - default: - break; - } - }); - }, - children: [ - sublocations, - subitems, - ] - ) - ); + List tiles = [ + locationDescriptionCard(), + Divider(), + ListTile( + title: Text( + I18N.of(context).sublocations, + style: TextStyle(fontWeight: FontWeight.bold) + ), + ), + SublocationList(_sublocations) + ]; return tiles; } + + List stockTiles() { + List tiles = [ + locationDescriptionCard(), + Divider(), + ListTile( + title: Text( + I18N.of(context).stockItems, + style: TextStyle(fontWeight: FontWeight.bold) + ) + ), + StockList(_items), + ]; + + return tiles; + } + + List actionTiles() { List tiles = []; diff --git a/pubspec.yaml b/pubspec.yaml index fea2174a..27c6c173 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -27,8 +27,6 @@ dependencies: cupertino_icons: ^0.1.3 http: ^0.12.1 - shared_preferences: ^0.5.7 - cached_network_image: ^2.5.0 qr_code_scanner: ^0.0.13 package_info: ^0.4.0 # App information introspection