mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-28 03:14:32 +01:00
This commit introduces the NewTaskButton widget, designed to allow users to create new tasks. The button follows specific design guidelines, including dimensions, colors, and layout. Key Features: Button with a set height and adaptive width. Icon and text layout within the button. Styling for background, border, and corner radius. Associated tests to ensure the button's functionality and appearance.
25 lines
749 B
Dart
25 lines
749 B
Dart
import 'package:auto_gpt_flutter_client/views/new_task_button.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
void main() {
|
|
testWidgets('NewTaskButton triggers callback on press',
|
|
(WidgetTester tester) async {
|
|
bool wasPressed = false;
|
|
|
|
// Build our widget.
|
|
await tester.pumpWidget(MaterialApp(
|
|
home: Scaffold(
|
|
body: NewTaskButton(onPressed: () => wasPressed = true),
|
|
),
|
|
));
|
|
|
|
// Verify if the button with the text 'New Task' is displayed.
|
|
expect(find.text('New Task'), findsOneWidget);
|
|
|
|
// Tap the button and verify if the onPressed callback is triggered.
|
|
await tester.tap(find.byType(ElevatedButton));
|
|
expect(wasPressed, true);
|
|
});
|
|
}
|