Update Send button and tests

This commit is contained in:
Ashita Prasad
2024-12-16 03:41:26 +05:30
parent fe558a066a
commit 3da407b899
4 changed files with 8 additions and 10 deletions

View File

@ -18,17 +18,15 @@ class SendButton extends StatelessWidget {
Widget build(BuildContext context) {
return ADFilledButton(
onPressed: isWorking ? onCancel : onTap,
isTonal: isWorking ? true : false,
items: isWorking
? const [
kHSpacer8,
Text(
kLabelCancel,
style: kTextStyleButton,
),
kHSpacer10,
Icon(
size: 16,
Icons.cancel,
)
kHSpacer6,
]
: const [
Text(

View File

@ -84,6 +84,8 @@ const kSizedBoxEmpty = SizedBox();
const kHSpacer2 = SizedBox(width: 2);
const kHSpacer4 = SizedBox(width: 4);
const kHSpacer5 = SizedBox(width: 5);
const kHSpacer6 = SizedBox(width: 6);
const kHSpacer8 = SizedBox(width: 8);
const kHSpacer10 = SizedBox(width: 10);
const kHSpacer12 = SizedBox(width: 12);
const kHSpacer20 = SizedBox(width: 20);

View File

@ -17,7 +17,7 @@ void main() {
final icon = find.byIcon(Icons.snippet_folder_rounded);
Finder button = find.ancestor(
of: icon,
matching: find.byWidgetPredicate((widget) => widget is ElevatedButton));
matching: find.byWidgetPredicate((widget) => widget is FilledButton));
expect(button, findsOneWidget);
expect(find.text(kLabelSelectFile), findsOneWidget);
@ -37,7 +37,7 @@ void main() {
final icon = find.byIcon(Icons.snippet_folder_rounded);
Finder button = find.ancestor(
of: icon,
matching: find.byWidgetPredicate((widget) => widget is ElevatedButton));
matching: find.byWidgetPredicate((widget) => widget is FilledButton));
expect(button, findsOneWidget);
expect(find.text(testValue), findsOneWidget);
@ -61,7 +61,7 @@ void main() {
final icon = find.byIcon(Icons.snippet_folder_rounded);
Finder button = find.ancestor(
of: icon,
matching: find.byWidgetPredicate((widget) => widget is ElevatedButton));
matching: find.byWidgetPredicate((widget) => widget is FilledButton));
await tester.tap(button);
await tester.pump();

View File

@ -56,7 +56,6 @@ void main() {
// Verify initial cancel state
expect(find.byIcon(Icons.send), findsNothing);
expect(find.text(kLabelSend), findsNothing);
expect(find.byIcon(Icons.cancel), findsOneWidget);
expect(find.text(kLabelCancel), findsOneWidget);
// Tap and verify callback
@ -94,7 +93,6 @@ void main() {
await tester.pump();
// Verify cancel state
expect(find.byIcon(Icons.cancel), findsOneWidget);
expect(find.text(kLabelCancel), findsOneWidget);
// Tap to cancel