showSnackBar
Tue Sep 24 2024 11:46:10 GMT+0000 (Coordinated Universal Time)
Saved by
@Rishi1808
void showSnackBar(
String text,
) {
ScaffoldMessenger.of(globalNavigatorKey.currentContext!)
..hideCurrentSnackBar()
..showSnackBar(
SnackBar(
backgroundColor:
Theme.of(globalNavigatorKey.currentContext!).colorScheme.primary,
padding: const EdgeInsets.all(0),
content: Container(
height: 60,
decoration: const BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(
20,
),
topRight: Radius.circular(
20,
),
),
),
child: Center(
child: Text(
text,
overflow: TextOverflow.visible,
style: Theme.of(globalNavigatorKey.currentContext!)
.textTheme
.titleMedium!
.copyWith(
color: Theme.of(globalNavigatorKey.currentContext!)
.colorScheme
.onPrimary,
),
),
),
),
),
);
}
content_copyCOPY
Comments