Skip to content

Commit

Permalink
Display test result info and add padding for scrollbar (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
omar-selo authored Dec 15, 2023
1 parent 3be6424 commit 0f99704
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 4 deletions.
5 changes: 5 additions & 0 deletions frontend/lib/models/test_result.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,14 @@ part 'test_result.g.dart';

@freezed
class TestResult with _$TestResult {
const TestResult._();

const factory TestResult({
required String name,
required TestResultStatus status,
@Default('') String category,
@Default('') String comment,
@JsonKey(name: 'io_log') @Default('') String ioLog,
}) = _TestResult;

factory TestResult.fromJson(Map<String, Object?> json) =>
Expand Down
9 changes: 7 additions & 2 deletions frontend/lib/ui/artefact_dialog/artefact_dialog_body.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:yaru_widgets/yaru_widgets.dart';

import '../../models/artefact.dart';
import '../../providers/artefact_builds.dart';
import '../spacing.dart';
import 'artefact_build_expandable.dart';

class ArtefactDialogBody extends ConsumerWidget {
Expand All @@ -23,8 +24,12 @@ class ArtefactDialogBody extends ConsumerWidget {
Expanded(
child: ListView.builder(
itemCount: artefactBuilds.length,
itemBuilder: (_, i) =>
ArtefactBuildExpandable(artefactBuild: artefactBuilds[i]),
itemBuilder: (_, i) => Padding(
// Padding is to avoid scroll bar covering trailing buttons
padding: const EdgeInsets.only(right: Spacing.level3),
child:
ArtefactBuildExpandable(artefactBuild: artefactBuilds[i]),
),
),
),
],
Expand Down
41 changes: 41 additions & 0 deletions frontend/lib/ui/artefact_dialog/test_result_expandable.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import 'package:flutter/material.dart';
import 'package:yaru_widgets/yaru_widgets.dart';

import '../../models/test_result.dart';
import '../spacing.dart';

class TestResultExpandable extends StatelessWidget {
const TestResultExpandable({super.key, required this.testResult});

final TestResult testResult;

@override
Widget build(BuildContext context) {
return YaruExpandable(
expandButtonPosition: YaruExpandableButtonPosition.start,
header: Text(testResult.name),
child: Padding(
padding: const EdgeInsets.only(left: Spacing.level5),
child: Column(
children: [
if (testResult.category != '')
YaruTile(
title: const Text('Category'),
subtitle: Text(testResult.category),
),
if (testResult.comment != '')
YaruTile(
title: const Text('Comment'),
subtitle: Text(testResult.comment),
),
if (testResult.ioLog != '')
YaruTile(
title: const Text('IO Log'),
subtitle: Text(testResult.ioLog),
),
],
),
),
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'package:yaru_widgets/yaru_widgets.dart';
import '../../models/test_result.dart';
import '../../providers/test_results.dart';
import '../spacing.dart';
import 'test_result_expandable.dart';

class TestResultsFilterExpandable extends ConsumerWidget {
const TestResultsFilterExpandable({
Expand Down Expand Up @@ -47,12 +48,13 @@ class TestResultsFilterExpandable extends ConsumerWidget {
),
expandButtonPosition: YaruExpandableButtonPosition.start,
child: Padding(
padding: const EdgeInsets.only(left: Spacing.level5),
padding: const EdgeInsets.only(left: Spacing.level4),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: filteredTestResults
.map(
(testResult) => YaruTile(title: Text(testResult.name)),
(testResult) =>
TestResultExpandable(testResult: testResult),
)
.toList(),
),
Expand Down

0 comments on commit 0f99704

Please sign in to comment.