make error snack bar fn global

This commit is contained in:
RafayAhmad7548 2025-08-10 07:10:30 +05:00
parent 045d0694e7
commit a45378a094
3 changed files with 22 additions and 17 deletions

View file

@ -28,3 +28,17 @@ class MainApp extends StatelessWidget {
);
}
}
SnackBar buildErrorSnackBar(BuildContext context, String error) {
return SnackBar(
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
behavior: SnackBarBehavior.floating,
content: Row(
spacing: 10,
children: [
Icon(Icons.error, color: Colors.red,),
Text(error, style: TextStyle(color: Theme.of(context).colorScheme.onSecondaryContainer),),
],
)
);
}