Implement TestSuiteListTile Widget for Displaying Test Suites

This commit adds a new StatelessWidget, TestSuiteListTile, designed to display individual TestSuite items in a list.

Key Features:
- Created a TestSuiteListTile class that takes a TestSuite object and a VoidCallback for the onTap event as parameters.
- Utilized Material Design with custom styling to ensure the tile fits well within the application's UI.
- The tile displays the timestamp of the TestSuite, which serves as its title.
- Included a play arrow icon to indicate that the tile is actionable.
- Utilized MediaQuery to adapt the tile width based on the screen size, capped at a maximum width of 260.

By adding this widget, we improve the UX by providing a consistent and intuitive way to interact with TestSuite objects in the UI.
This commit is contained in:
hunteraraujo
2023-09-18 14:55:03 -07:00
parent 1d735caf40
commit 3cbe5a84e4

View File

@@ -0,0 +1,66 @@
import 'package:auto_gpt_flutter_client/models/test_suite.dart';
import 'package:flutter/material.dart';
class TestSuiteListTile extends StatelessWidget {
final TestSuite testSuite;
final VoidCallback onTap;
const TestSuiteListTile({
Key? key,
required this.testSuite,
required this.onTap,
}) : super(key: key);
Widget build(BuildContext context) {
// Determine the width of the TaskView
double taskViewWidth = MediaQuery.of(context).size.width;
double tileWidth = taskViewWidth - 20;
if (tileWidth > 260) {
tileWidth = 260;
}
return GestureDetector(
onTap: () {
onTap();
},
child: Material(
// Use a transparent color to avoid any unnecessary color overlay
color: Colors.transparent,
child: Padding(
// Provide a horizontal padding to ensure the tile does not touch the edges
padding: const EdgeInsets.symmetric(horizontal: 10.0),
child: Container(
// Width and height specifications for the tile
width: tileWidth,
height: 50,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8.0),
),
child: Row(
children: [
// Space from the left edge of the tile
const SizedBox(width: 8),
// Message bubble icon indicating a test suite
const Icon(Icons.play_arrow, color: Colors.black),
const SizedBox(width: 8),
// Test suite title
Expanded(
child: Text(
testSuite.timestamp,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: const TextStyle(color: Colors.black),
),
),
// Disclosure indicator (arrow pointing right)
const Icon(Icons.chevron_right, color: Colors.grey),
const SizedBox(width: 8),
],
),
),
),
),
);
}
}