mirror of
https://github.com/inventree/inventree-app.git
synced 2025-04-29 22:16:47 +00:00
Skeleton for part attachment widget
This commit is contained in:
parent
30c26d167c
commit
40805b2aff
2
lib/l10n
2
lib/l10n
@ -1 +1 @@
|
||||
Subproject commit f4f7b95c28f82bfd4e398ec5bb5e35823102323c
|
||||
Subproject commit 94daf51226f555c1c3a7ad4893931727d0369dda
|
75
lib/widget/part_attachments_widget.dart
Normal file
75
lib/widget/part_attachments_widget.dart
Normal file
@ -0,0 +1,75 @@
|
||||
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:inventree/inventree/part.dart';
|
||||
import 'package:inventree/widget/refreshable_state.dart';
|
||||
|
||||
import '../api.dart';
|
||||
import '../l10.dart';
|
||||
|
||||
class PartAttachmentsWidget extends StatefulWidget {
|
||||
|
||||
PartAttachmentsWidget(this.part, {Key? key}) : super(key: key);
|
||||
|
||||
final InvenTreePart part;
|
||||
|
||||
@override
|
||||
_PartAttachmentDisplayState createState() => _PartAttachmentDisplayState(part);
|
||||
}
|
||||
|
||||
|
||||
class _PartAttachmentDisplayState extends RefreshableState<PartAttachmentsWidget> {
|
||||
|
||||
_PartAttachmentDisplayState(this.part);
|
||||
|
||||
final InvenTreePart part;
|
||||
|
||||
@override
|
||||
String getAppBarTitle(BuildContext context) => L10().attachments;
|
||||
|
||||
@override
|
||||
List<Widget> getAppBarActions(BuildContext context) {
|
||||
|
||||
List<Widget> actions = [];
|
||||
|
||||
if (false && InvenTreeAPI().checkPermission('part', 'change')) {
|
||||
actions.add(
|
||||
IconButton(
|
||||
icon: FaIcon(FontAwesomeIcons.plus),
|
||||
onPressed: null,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return actions;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> request() async {
|
||||
// TODO - Request part attachments from the server
|
||||
}
|
||||
|
||||
@override
|
||||
Widget getBody(BuildContext context) {
|
||||
return Center(
|
||||
child: ListView(
|
||||
children: ListTile.divideTiles(
|
||||
context: context,
|
||||
tiles: attachmentTiles(context)
|
||||
).toList(),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
List<Widget> attachmentTiles(BuildContext context) {
|
||||
|
||||
List<Widget> tiles = [];
|
||||
|
||||
return tiles;
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -6,6 +6,7 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:inventree/app_colors.dart';
|
||||
|
||||
import 'package:inventree/l10.dart';
|
||||
import 'package:inventree/widget/part_attachments_widget.dart';
|
||||
import 'package:inventree/widget/part_notes.dart';
|
||||
import 'package:inventree/widget/progress.dart';
|
||||
import 'package:inventree/inventree/part.dart';
|
||||
@ -31,6 +32,10 @@ class PartDetailWidget extends StatefulWidget {
|
||||
|
||||
class _PartDisplayState extends RefreshableState<PartDetailWidget> {
|
||||
|
||||
InvenTreePart part;
|
||||
|
||||
_PartDisplayState(this.part);
|
||||
|
||||
@override
|
||||
String getAppBarTitle(BuildContext context) => L10().partDetails;
|
||||
|
||||
@ -63,16 +68,10 @@ class _PartDisplayState extends RefreshableState<PartDetailWidget> {
|
||||
return actions;
|
||||
}
|
||||
|
||||
_PartDisplayState(this.part) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
Future<void> _openInvenTreePage() async {
|
||||
part.goToInvenTreePage();
|
||||
}
|
||||
|
||||
InvenTreePart part;
|
||||
|
||||
@override
|
||||
Future<void> onBuild(BuildContext context) async {
|
||||
refresh();
|
||||
@ -351,6 +350,22 @@ class _PartDisplayState extends RefreshableState<PartDetailWidget> {
|
||||
)
|
||||
);
|
||||
|
||||
tiles.add(
|
||||
ListTile(
|
||||
title: Text(L10().attachments),
|
||||
leading: FaIcon(FontAwesomeIcons.fileAlt, color: COLOR_CLICK),
|
||||
trailing: Text(""),
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => PartAttachmentsWidget(part)
|
||||
)
|
||||
);
|
||||
},
|
||||
)
|
||||
);
|
||||
|
||||
return tiles;
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user