showSnackBar
возвращает ScaffoldFeatureController
можно сделать очень долгий снек и закрывать его в ручную ScaffoldFeatureController.close
когда нужно
у меня такая функ-я, где вызываю везде
—— showCustomSnackBar(
BuildContext context, String text, Color color, Widget widget,[int duration]) {
Scaffold.of(context)
..hideCurrentSnackBar()
..showSnackBar(
SnackBar(
// duration: Duration(seconds: 10);
backgroundColor: color,
action: SnackBarAction(
label: 'Ok',
textColor: Colors.white,
onPressed: () {},
),
content: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisSize: MainAxisSize.min,
children: [
SizedBox(
height: 40,
child: widget),
Expanded(
child: Padding(
padding: EdgeInsets.only(left: 16),
child: Text(
"$text",
style: TextStyle(color: Colors.white,fontSize: 15),
))),
],
),
),
);
} ———