title: Flutter: Move theme (ThemeData) to a separate file
body: <p>I am just starting a new project in flutter and am absolutely new to it.</p>
  <p>What is the convention with defining themes in Flutter?</p>
  <p>I would like to have a separate file with a theme to keep the <code>main.dart</code> simple. Is there a good/correct/classic way to do it?</p>
  <p>Currently my <code>main.dart</code> looks like this:</p>
  <pre><code>void main() =&gt; runApp(MaterialApp(
        initialRoute: '/',
        theme: ThemeData(
            appBarTheme: AppBarTheme(
              color: Colors.teal,
            ),
            textButtonTheme: TextButtonThemeData(
                style: TextButton.styleFrom(
              primary: Colors.teal,
            )),
            scaffoldBackgroundColor: Colors.grey[200],
            textTheme: TextTheme(
              bodyText1: TextStyle(),
              bodyText2: TextStyle(),
            ).apply(
              bodyColor: Colors.teal[800],
            )),
        routes: {
          '/': (context) =&gt; Loading(),
          '/home': (context) =&gt; Home(),
          '/alarms': (context) =&gt; SetUpAlarm(),
        },
      ));
  </code></pre>