mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-18 14:34:23 +01:00
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:
66
frontend/lib/views/task/test_suite_list_tile.dart
Normal file
66
frontend/lib/views/task/test_suite_list_tile.dart
Normal 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),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user