1// Copyright 2018 The Chromium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5import 'package:flutter/material.dart'; 6 7final ThemeData kLightGalleryTheme = _buildLightTheme(); 8final ThemeData kDarkGalleryTheme = _buildDarkTheme(); 9 10TextTheme _buildTextTheme(TextTheme base) { 11 return base.copyWith( 12 title: base.title.copyWith( 13 fontFamily: 'GoogleSans', 14 ), 15 ); 16} 17 18ThemeData _buildDarkTheme() { 19 const Color primaryColor = Color(0xFF0175c2); 20 const Color secondaryColor = Color(0xFF13B9FD); 21 final ColorScheme colorScheme = const ColorScheme.dark().copyWith( 22 primary: primaryColor, 23 secondary: secondaryColor, 24 ); 25 final ThemeData base = ThemeData( 26 brightness: Brightness.dark, 27 accentColorBrightness: Brightness.dark, 28 primaryColor: primaryColor, 29 primaryColorDark: const Color(0xFF0050a0), 30 primaryColorLight: secondaryColor, 31 buttonColor: primaryColor, 32 indicatorColor: Colors.white, 33 toggleableActiveColor: const Color(0xFF6997DF), 34 accentColor: secondaryColor, 35 canvasColor: const Color(0xFF202124), 36 scaffoldBackgroundColor: const Color(0xFF202124), 37 backgroundColor: const Color(0xFF202124), 38 errorColor: const Color(0xFFB00020), 39 buttonTheme: ButtonThemeData( 40 colorScheme: colorScheme, 41 textTheme: ButtonTextTheme.primary, 42 ), 43 ); 44 return base.copyWith( 45 textTheme: _buildTextTheme(base.textTheme), 46 primaryTextTheme: _buildTextTheme(base.primaryTextTheme), 47 accentTextTheme: _buildTextTheme(base.accentTextTheme), 48 ); 49} 50 51ThemeData _buildLightTheme() { 52 const Color primaryColor = Color(0xFF0175c2); 53 const Color secondaryColor = Color(0xFF13B9FD); 54 final ColorScheme colorScheme = const ColorScheme.light().copyWith( 55 primary: primaryColor, 56 secondary: secondaryColor, 57 ); 58 final ThemeData base = ThemeData( 59 brightness: Brightness.light, 60 accentColorBrightness: Brightness.dark, 61 colorScheme: colorScheme, 62 primaryColor: primaryColor, 63 buttonColor: primaryColor, 64 indicatorColor: Colors.white, 65 toggleableActiveColor: const Color(0xFF1E88E5), 66 splashColor: Colors.white24, 67 splashFactory: InkRipple.splashFactory, 68 accentColor: secondaryColor, 69 canvasColor: Colors.white, 70 scaffoldBackgroundColor: Colors.white, 71 backgroundColor: Colors.white, 72 errorColor: const Color(0xFFB00020), 73 buttonTheme: ButtonThemeData( 74 colorScheme: colorScheme, 75 textTheme: ButtonTextTheme.primary, 76 ), 77 ); 78 return base.copyWith( 79 textTheme: _buildTextTheme(base.textTheme), 80 primaryTextTheme: _buildTextTheme(base.primaryTextTheme), 81 accentTextTheme: _buildTextTheme(base.accentTextTheme), 82 ); 83} 84