Skip to content

Commit

Permalink
Add other stage names in expanded artefact
Browse files Browse the repository at this point in the history
  • Loading branch information
omar-selo committed Jul 4, 2023
1 parent a9b417e commit f8ab559
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 12 deletions.
2 changes: 1 addition & 1 deletion frontend/lib/providers/name_of_selected_stage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ part 'name_of_selected_stage.g.dart';

@riverpod
String nameOfSelectedStage(NameOfSelectedStageRef ref) {
throw Exception('No stage selected yet');
throw Exception('Name of selected stage not set yet');
}
8 changes: 8 additions & 0 deletions frontend/lib/providers/names_of_stages.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import 'package:riverpod_annotation/riverpod_annotation.dart';

part 'names_of_stages.g.dart';

@riverpod
List<String> namesOfStages(NamesOfStagesRef ref) {
throw Exception('Names of stages not set yet');
}
28 changes: 24 additions & 4 deletions frontend/lib/ui/dashboard/artefact_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'dart:math';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:intersperse/intersperse.dart';
import 'package:yaru/yaru.dart';
import 'package:yaru_icons/yaru_icons.dart';
import 'package:yaru_widgets/widgets.dart';

Expand All @@ -11,6 +12,7 @@ import '../../models/artefact_build.dart';
import '../../models/test_execution.dart';
import '../../providers/artefact_builds.dart';
import '../../providers/name_of_selected_stage.dart';
import '../../providers/names_of_stages.dart';
import '../inline_url_text.dart';
import '../spacing.dart';

Expand Down Expand Up @@ -84,7 +86,8 @@ class _ArtefactInfoSection extends ConsumerWidget {

@override
Widget build(BuildContext context, WidgetRef ref) {
final stageName = ref.watch(nameOfSelectedStageProvider);
final selectedStageName = ref.watch(nameOfSelectedStageProvider);
final namesOfStages = ref.watch(namesOfStagesProvider);

final artefactDetails = [
'version: ${artefact.version}',
Expand All @@ -98,8 +101,25 @@ class _ArtefactInfoSection extends ConsumerWidget {
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(stageName),
const SizedBox(height: Spacing.level2),
Row(
children: namesOfStages
.map<Widget>(
(stageName) => Text(
stageName,
style: Theme.of(context).textTheme.bodyLarge?.apply(
color: stageName == selectedStageName
? YaruColors.orange
: null,
),
),
)
.toList()
.intersperse(
Text(' > ', style: Theme.of(context).textTheme.bodyLarge),
)
.toList(),
),
const SizedBox(height: Spacing.level3),
...artefactDetails
.map<Widget>(
(detail) => Text(
Expand All @@ -108,7 +128,7 @@ class _ArtefactInfoSection extends ConsumerWidget {
),
)
.toList()
.intersperse(const SizedBox(height: Spacing.level2))
.intersperse(const SizedBox(height: Spacing.level3))
.toList()
],
),
Expand Down
21 changes: 14 additions & 7 deletions frontend/lib/ui/dashboard/dashboard_body.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:intersperse/intersperse.dart';
import '../../models/artefact.dart';
import '../../models/stage.dart';
import '../../providers/name_of_selected_stage.dart';
import '../../providers/names_of_stages.dart';
import '../spacing.dart';
import 'artefact_dialog.dart';

Expand All @@ -15,13 +16,19 @@ class DashboardBody extends StatelessWidget {

@override
Widget build(BuildContext context) {
return ListView.separated(
padding:
const EdgeInsets.symmetric(horizontal: Spacing.pageHorizontalPadding),
scrollDirection: Axis.horizontal,
itemBuilder: (_, i) => _StageColumn(stage: stages[i]),
separatorBuilder: (_, __) => const SizedBox(width: Spacing.level5),
itemCount: stages.length,
return ProviderScope(
overrides: [
namesOfStagesProvider
.overrideWithValue(stages.map((stage) => stage.name).toList())
],
child: ListView.separated(
padding: const EdgeInsets.symmetric(
horizontal: Spacing.pageHorizontalPadding),
scrollDirection: Axis.horizontal,
itemBuilder: (_, i) => _StageColumn(stage: stages[i]),
separatorBuilder: (_, __) => const SizedBox(width: Spacing.level5),
itemCount: stages.length,
),
);
}
}
Expand Down

0 comments on commit f8ab559

Please sign in to comment.