Set fontFamily for all buttons in Flutter

flutter font family not working
font style flutter
flutter font documentation
flutter appbar font
flutter adding a font
apply font flutter
flutter fonts docs
flutter pubspec font

Is there a way to set the fontFamily for all buttons in a Flutter app?

I see I can set my fontFamily for my MaterialApp using theme.fontFamily, but I'd like to use a different fontFamily for all my buttons.

I saw there is also a ButtonThemeData, but it seems to be related to colors and shapes only.

I don't want to set my fontFamily explicitly every time I use a button or having to wrap all types of buttons, is there any way to accomplish this?


Simplest might be to create a helper method that returns a Button configured as you wish.

Use themes to share colors and font styles, To share a Theme across an entire app, provide a ThemeData to the lightBlue[​800], accentColor: Colors.cyan[600], // Define the default font family. fontFamily:  Set a font as the default. Use a font in a specific widget. 1. Import the font files. To work with a font, import the font files into the project. It’s common practice to put font files in a fonts or assets folder at the root of a Flutter project.

You should use themes to customize fonts for whole widgets, including buttons :

Beginners Guide To Text Styling in Flutter, In this guide I'll go over all the ways text can be modified in Flutter Now if you want to use the font you have to set your fontFamily equal to the  Text is a very important part of any mobile app UI. In this guide I’ll go over all the ways text can be modified in Flutter and applying global text themes. To show text in Flutter you use the

I recomend creating a custom button that "extends" Flutter MaterialButton or RawMaterialButton. Remember to add buttonText as a paramater too if you want your button to be reusable. Also remember to add TextStyle(fontFamily: 'Raleway') to the Text widget style.

Another option would be to "extend" the Flutter Text widget in the same way as with the button example below, and add your CustomTextWidget as a child to the Flutter MaterialButton widget. I prefer to use both in a combination. CustomButton together with CustomText widget.

import 'package:flutter/material.dart';

class CustomButton extends StatelessWidget {
  CustomButton({@required this.onPressed});
  final GestureTapCallback onPressed;

  Widget build(BuildContext context) {
    return RawMaterialButton(
      splashColor: Colors.greenAccent,
      child: Padding(
        padding: EdgeInsets.all(10.0),
        child: Row(
          mainAxisSize: MainAxisSize.min,
          children: const <Widget>[
              color: Colors.amber,
              width: 10.0,
              "Tap Me",
              maxLines: 1,
              style: TextStyle(color: Colors.white),
      onPressed: onPressed,
      shape: const StadiumBorder(),

Here is the implementation:

     onPressed: () {
       print("Tapped Me");

Flutter: Different fonts for different locales - SAUGO 360, Of course, to use a font family, it needs to either be a system font, or a custom font you wouldn't want to set the font separately for each and every widget. It is meant to set the button’s label, but it accepts any widget in the wide Flutter catalog. Commonly, you can add a Text widget, but don’t let it limit you! MaterialButton ( child: Text('New

fontFamily in ThemeData doesn't work anymore in Flutter 1.12 , I have to specify fontFamily in TextStyle for each of my widgets instead 'You have pushed the button this many times:', style: Theme.of(context). In the default Material theme, all text styles have their family set to 'Roboto'. Flutter’s Material widgets also use your Theme to set the background colors and font styles for AppBars, Buttons, Checkboxes, and more. Creating an app theme. To share a Theme across an entire app, provide a ThemeData to the MaterialApp constructor. If no theme is provided, Flutter creates a default theme for you.

Flutter – Change Button Font Size, In this Flutter Tutorial, we learned how to change the font size of button in Flutter. Desclaimer: We are not affiliated, associated, authorized, endorsed by, or in any​  A material design "flat button". A flat button is a text label displayed on a (zero elevation) Material widget that reacts to touches by filling with color. Use flat buttons on toolbars, in dialogs, or inline with other content but offset from that content with padding so that the button's presence is obvious.

Beginning App Development with Flutter: Create Cross-Platform , You cannot set a font family on your custom widget for example, and have all of the Texts and TextFields and buttons beneath it suddenly begin rendering with  A floating action button is a circular icon button that hovers over content to promote a primary action in the application. Floating action buttons are most commonly used in the Scaffold.floatingActionButton field.