Skip to content

Commit

Permalink
Fix scroll resetting on rerun or review (#203)
Browse files Browse the repository at this point in the history
  • Loading branch information
omar-selo authored Aug 8, 2024
1 parent fcf5c52 commit 7eb4eef
Showing 1 changed file with 34 additions and 36 deletions.
70 changes: 34 additions & 36 deletions frontend/lib/ui/artefact_page/artefact_page_body.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:intersperse/intersperse.dart';
import 'package:yaru/widgets.dart';
import 'package:yaru/yaru.dart';
import '../../models/artefact.dart';
import '../../models/test_execution.dart';
import '../../providers/filtered_test_executions.dart';
Expand All @@ -18,45 +18,43 @@ class ArtefactPageBody extends ConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final pageUri = AppRoutes.uriFromContext(context);
final filteredTestExecutions =
ref.watch(filteredTestExecutionsProvider(pageUri));
final testExecutions =
ref.watch(filteredTestExecutionsProvider(pageUri)).value;

return filteredTestExecutions.when(
data: (testExecutions) => Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.baseline,
textBaseline: TextBaseline.alphabetic,
children: [
Text(
'Environments',
style: Theme.of(context).textTheme.headlineSmall,
),
const SizedBox(width: Spacing.level4),
_TestExecutionsStatusSummary(testExecutions: testExecutions),
const Spacer(),
const RerunFilteredEnvironmentsButton(),
],
),
Expanded(
child: ListView.builder(
itemCount: testExecutions.length,
itemBuilder: (_, i) => Padding(
// Padding is to avoid scroll bar covering trailing buttons
padding: const EdgeInsets.only(right: Spacing.level3),
child: TestExecutionExpandable(
testExecution: testExecutions[i],
),
if (testExecutions == null) {
return const YaruCircularProgressIndicator();
}

return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.baseline,
textBaseline: TextBaseline.alphabetic,
children: [
Text(
'Environments',
style: Theme.of(context).textTheme.headlineSmall,
),
const SizedBox(width: Spacing.level4),
_TestExecutionsStatusSummary(testExecutions: testExecutions),
const Spacer(),
const RerunFilteredEnvironmentsButton(),
],
),
Expanded(
child: ListView.builder(
itemCount: testExecutions.length,
itemBuilder: (_, i) => Padding(
// Padding is to avoid scroll bar covering trailing buttons
padding: const EdgeInsets.only(right: Spacing.level3),
child: TestExecutionExpandable(
testExecution: testExecutions[i],
),
),
),
],
),
loading: () => const Center(child: YaruCircularProgressIndicator()),
error: (error, stackTrace) {
return Center(child: Text('Error: $error'));
},
),
],
);
}
}
Expand Down

0 comments on commit 7eb4eef

Please sign in to comment.