How to change SnackBar's action font size?

Viewed 586

I've a SnackBar:

SnackBar(
  content: Text('FooBar'),
  action: SnackBarAction(
    label: 'Action',
    onPressed: null,
  ),
);

How can I change the font size of 'Action'?

1 Answers

You can customize the Snackbar's action font size by changing the button theme in the app's global theme. This is because the Snackbar's action is considered as a button. For example, set:

MaterialApp(
  theme: ThemeData(
    textTheme: TextTheme(
      button: TextStyle(fontSize: 16.0),
    ),
  ),
  home: const MyHomePage(title: appName),
);

The actions in Snackbars will be affected as desired.

Related