Mobile Client: On pipeline error, badge on card

This commit is contained in:
Arthi-chaud
2022-03-06 11:00:26 +01:00
parent b85145d34b
commit b4cc7cb413
4 changed files with 20 additions and 3 deletions

View File

@@ -17,6 +17,9 @@ class Pipeline {
/// Is the pipeline enabled
bool enabled;
/// An error trace, if exists
String? errorMessage;
///The pipeline's reactions
final List<Reaction> reactions;
@@ -27,6 +30,7 @@ class Pipeline {
required this.name,
required this.triggerCount,
required this.enabled,
this.errorMessage,
required this.trigger,
required this.reactions});
@@ -36,6 +40,7 @@ class Pipeline {
var reactions = data['reactions'] as List<dynamic>;
return Pipeline(
errorMessage: action['error'],
name: action['name'] as String,
enabled: action['enabled'] as bool,
id: action['id'] as int,

View File

@@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import 'package:aeris/src/models/pipeline.dart';
import 'package:aeris/src/views/pipeline_detail_page.dart';
import 'package:aeris/src/widgets/clickable_card.dart';
import 'package:badges/badges.dart';
import 'aeris_card_page.dart';
/// Widget for Action-reaction card on home page
@@ -27,7 +27,11 @@ class _PipelineCardState extends State<PipelineCard> {
(array, logo) =>
array + [logo, const SizedBox(height: 5)]).toList();
reactionLogos.removeLast();
return ClickableCard(
return Badge(
showBadge: widget.pipeline.errorMessage != null,
badgeContent: Icon(Icons.priority_high, color: Theme.of(context).colorScheme.surface),
position: const BadgePosition(end: 3, top: 0),
child: ClickableCard(
onTap: () {
showAerisCardPage(
context,
@@ -76,6 +80,6 @@ class _PipelineCardState extends State<PipelineCard> {
const SizedBox(width: 10),
Column(children: reactionLogos)
])),
])));
]))));
}
}

View File

@@ -43,6 +43,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.8.2"
badges:
dependency: "direct main"
description:
name: badges
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.2"
boolean_selector:
dependency: transitive
description:

View File

@@ -61,6 +61,7 @@ dependencies:
flutter_typeahead: ^3.2.4
simple_autocomplete_formfield: ^0.3.0
positioned_tap_detector_2: ^1.0.4
badges: ^2.0.2
dev_dependencies:
flutter_launcher_icons: "^0.9.2"