2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-07-01 19:30:44 +00:00

Format Code and Add Format Checks to CI (#643)

* Remove unused lib/generated/i18n.dart

* Use `fvm dart format .`

* Add contributing guidelines

* Enforce dart format

* Add `dart format off` directive to generated files
This commit is contained in:
Ben Hagen
2025-06-24 01:55:01 +02:00
committed by GitHub
parent e9db6532e4
commit 4444884afa
100 changed files with 5332 additions and 5592 deletions

View File

@ -1,4 +1,3 @@
import "package:flutter/material.dart";
import "package:flutter_tabler_icons/flutter_tabler_icons.dart";
@ -8,17 +7,12 @@ import "package:inventree/inventree/model.dart";
import "package:inventree/inventree/notification.dart";
import "package:inventree/widget/refreshable_state.dart";
class NotificationWidget extends StatefulWidget {
@override
_NotificationState createState() => _NotificationState();
}
class _NotificationState extends RefreshableState<NotificationWidget> {
_NotificationState() : super();
List<InvenTreeNotification> notifications = [];
@ -29,8 +23,7 @@ class _NotificationState extends RefreshableState<NotificationWidget> {
String getAppBarTitle() => L10().notifications;
@override
Future<void> request (BuildContext context) async {
Future<void> request(BuildContext context) async {
final results = await InvenTreeNotification().list();
notifications.clear();
@ -45,8 +38,10 @@ class _NotificationState extends RefreshableState<NotificationWidget> {
/*
* Dismiss an individual notification entry (mark it as "read")
*/
Future<void> dismissNotification(BuildContext context, InvenTreeNotification notification) async {
Future<void> dismissNotification(
BuildContext context,
InvenTreeNotification notification,
) async {
if (mounted) {
setState(() {
isDismissing = true;
@ -71,18 +66,17 @@ class _NotificationState extends RefreshableState<NotificationWidget> {
*/
@override
List<Widget> getTiles(BuildContext context) {
List<Widget> tiles = [];
tiles.add(
ListTile(
title: Text(
L10().notifications,
),
title: Text(L10().notifications),
subtitle: notifications.isEmpty ? Text(L10().notificationsEmpty) : null,
leading: notifications.isEmpty ? Icon(TablerIcons.bell_exclamation) : Icon(TablerIcons.bell),
leading: notifications.isEmpty
? Icon(TablerIcons.bell_exclamation)
: Icon(TablerIcons.bell),
trailing: Text("${notifications.length}"),
)
),
);
for (var notification in notifications) {
@ -92,15 +86,16 @@ class _NotificationState extends RefreshableState<NotificationWidget> {
subtitle: Text(notification.message),
trailing: IconButton(
icon: Icon(TablerIcons.bookmark),
onPressed: isDismissing ? null : () async {
dismissNotification(context, notification);
},
onPressed: isDismissing
? null
: () async {
dismissNotification(context, notification);
},
),
)
),
);
}
return tiles;
}
}