mirror of
https://github.com/inventree/inventree-app.git
synced 2025-04-28 13:36:50 +00:00
Add FAB context menu for the StockItem view
- Uses flutter_speed_dial plugin
This commit is contained in:
parent
0cc2efe218
commit
5382ded50c
@ -11,6 +11,7 @@ import 'package:InvenTree/api.dart';
|
|||||||
|
|
||||||
import 'package:InvenTree/widget/drawer.dart';
|
import 'package:InvenTree/widget/drawer.dart';
|
||||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
|
import 'package:flutter_speed_dial/flutter_speed_dial.dart';
|
||||||
|
|
||||||
class StockDetailWidget extends StatefulWidget {
|
class StockDetailWidget extends StatefulWidget {
|
||||||
|
|
||||||
@ -152,6 +153,43 @@ class _StockItemDisplayState extends State<StockDetailWidget> {
|
|||||||
return tiles;
|
return tiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Return a list of context-sensitive action buttons.
|
||||||
|
* Not all buttons will be avaialable for a given StockItem,
|
||||||
|
* depending on the properties of that StockItem
|
||||||
|
*/
|
||||||
|
List<SpeedDialChild> actionButtons() {
|
||||||
|
var buttons = List<SpeedDialChild>();
|
||||||
|
|
||||||
|
buttons.add(SpeedDialChild(
|
||||||
|
child: Icon(Icons.add_circle),
|
||||||
|
label: "Add Stock",
|
||||||
|
onTap: null,
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
buttons.add(SpeedDialChild(
|
||||||
|
child: Icon(Icons.remove_circle),
|
||||||
|
label: "Remove Stock",
|
||||||
|
onTap: null,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
buttons.add(SpeedDialChild(
|
||||||
|
child: Icon(Icons.check_circle),
|
||||||
|
label: "Count Stock",
|
||||||
|
onTap: null,
|
||||||
|
));
|
||||||
|
|
||||||
|
buttons.add(SpeedDialChild(
|
||||||
|
child: Icon(Icons.location_on),
|
||||||
|
label: "Transfer Stock",
|
||||||
|
onTap: null,
|
||||||
|
));
|
||||||
|
|
||||||
|
return buttons;
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
@ -159,10 +197,11 @@ class _StockItemDisplayState extends State<StockDetailWidget> {
|
|||||||
title: Text("Stock Item"),
|
title: Text("Stock Item"),
|
||||||
),
|
),
|
||||||
drawer: new InvenTreeDrawer(context),
|
drawer: new InvenTreeDrawer(context),
|
||||||
floatingActionButton: FloatingActionButton(
|
floatingActionButton: SpeedDial(
|
||||||
child: FaIcon(FontAwesomeIcons.ellipsisH),
|
visible: true,
|
||||||
// TODO: Add pop-up icons
|
animatedIcon: AnimatedIcons.menu_close,
|
||||||
// REF: https://stackoverflow.com/questions/46480221/flutter-floating-action-button-with-speed-dial#46480722
|
heroTag: 'stock-item-fab',
|
||||||
|
children: actionButtons(),
|
||||||
),
|
),
|
||||||
body: Center(
|
body: Center(
|
||||||
child: ListView(
|
child: ListView(
|
||||||
|
@ -83,6 +83,13 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.7.4"
|
version: "0.7.4"
|
||||||
|
flutter_speed_dial:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: flutter_speed_dial
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "1.2.5"
|
||||||
flutter_svg:
|
flutter_svg:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -31,6 +31,7 @@ dependencies:
|
|||||||
qr_utils: ^0.1.4 # Barcode / QR-code support
|
qr_utils: ^0.1.4 # Barcode / QR-code support
|
||||||
package_info: ^0.4.0+16 # App information introspection
|
package_info: ^0.4.0+16 # App information introspection
|
||||||
font_awesome_flutter: ^8.8.1 # FontAwesome icon set
|
font_awesome_flutter: ^8.8.1 # FontAwesome icon set
|
||||||
|
flutter_speed_dial: ^1.2.5 # FAB menu elements
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user