@@ -115,9 +115,6 @@ void main() {
115
115
onTap: () {
116
116
getBar = GetSnackBar (
117
117
message: 'bar1' ,
118
- icon: Icon (Icons .alarm),
119
- mainButton:
120
- TextButton (onPressed: () {}, child: Text ('button' )),
121
118
duration: const Duration (seconds: 2 ),
122
119
isDismissible: true ,
123
120
dismissDirection: dismissDirection,
@@ -212,4 +209,38 @@ void main() {
212
209
await tester.pump (const Duration (milliseconds: 3000 ));
213
210
await getBarController.close (withAnimations: false );
214
211
});
212
+
213
+ testWidgets ("Get test actions and icon" , (tester) async {
214
+ final icon = Icon (Icons .alarm);
215
+ final action = TextButton (onPressed: () {}, child: Text ('button' ));
216
+
217
+ late final GetSnackBar getBar;
218
+
219
+ await tester.pumpWidget (GetMaterialApp (home: Scaffold ()));
220
+
221
+ expect (Get .isSnackbarOpen, false );
222
+ expect (find.text ('bar1' ), findsNothing);
223
+
224
+ getBar = GetSnackBar (
225
+ message: 'bar1' ,
226
+ icon: icon,
227
+ mainButton: action,
228
+ leftBarIndicatorColor: Colors .yellow,
229
+ showProgressIndicator: true ,
230
+ // maxWidth: 100,
231
+ borderColor: Colors .red,
232
+ duration: const Duration (seconds: 1 ),
233
+ isDismissible: false ,
234
+ );
235
+ Get .showSnackbar (getBar);
236
+
237
+ expect (Get .isSnackbarOpen, true );
238
+ await tester.pump (const Duration (milliseconds: 500 ));
239
+ expect (find.byWidget (getBar), findsOneWidget);
240
+ expect (find.byWidget (icon), findsOneWidget);
241
+ expect (find.byWidget (action), findsOneWidget);
242
+ await tester.pump (const Duration (milliseconds: 500 ));
243
+
244
+ expect (Get .isSnackbarOpen, false );
245
+ });
215
246
}
0 commit comments