[Gallery] Use google_fonts (#299)

* Use google_fonts package

* Use hosted version of google_fonts
pull/307/head
Pierre-Louis 5 years ago committed by GitHub
parent a90a244fcf
commit 6a65b01f5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2,6 +2,8 @@ PODS:
- Flutter (1.0.0) - Flutter (1.0.0)
- package_info (0.0.1): - package_info (0.0.1):
- Flutter - Flutter
- path_provider (0.0.1):
- Flutter
- shared_preferences (0.0.1): - shared_preferences (0.0.1):
- Flutter - Flutter
- shared_preferences_macos (0.0.1): - shared_preferences_macos (0.0.1):
@ -18,6 +20,7 @@ PODS:
DEPENDENCIES: DEPENDENCIES:
- Flutter (from `Flutter`) - Flutter (from `Flutter`)
- package_info (from `.symlinks/plugins/package_info/ios`) - package_info (from `.symlinks/plugins/package_info/ios`)
- path_provider (from `.symlinks/plugins/path_provider/ios`)
- shared_preferences (from `.symlinks/plugins/shared_preferences/ios`) - shared_preferences (from `.symlinks/plugins/shared_preferences/ios`)
- shared_preferences_macos (from `.symlinks/plugins/shared_preferences_macos/ios`) - shared_preferences_macos (from `.symlinks/plugins/shared_preferences_macos/ios`)
- shared_preferences_web (from `.symlinks/plugins/shared_preferences_web/ios`) - shared_preferences_web (from `.symlinks/plugins/shared_preferences_web/ios`)
@ -30,6 +33,8 @@ EXTERNAL SOURCES:
:path: Flutter :path: Flutter
package_info: package_info:
:path: ".symlinks/plugins/package_info/ios" :path: ".symlinks/plugins/package_info/ios"
path_provider:
:path: ".symlinks/plugins/path_provider/ios"
shared_preferences: shared_preferences:
:path: ".symlinks/plugins/shared_preferences/ios" :path: ".symlinks/plugins/shared_preferences/ios"
shared_preferences_macos: shared_preferences_macos:
@ -46,6 +51,7 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS: SPEC CHECKSUMS:
Flutter: 0e3d915762c693b495b44d77113d4970485de6ec Flutter: 0e3d915762c693b495b44d77113d4970485de6ec
package_info: 48b108e75b8802c2d5e126f208ef540561c98aef package_info: 48b108e75b8802c2d5e126f208ef540561c98aef
path_provider: fb74bd0465e96b594bb3b5088ee4a4e7bb1f2a9d
shared_preferences: 430726339841afefe5142b9c1f50cb6bd7793e01 shared_preferences: 430726339841afefe5142b9c1f50cb6bd7793e01
shared_preferences_macos: f3f29b71ccbb56bf40c9dd6396c9acf15e214087 shared_preferences_macos: f3f29b71ccbb56bf40c9dd6396c9acf15e214087
shared_preferences_web: 141cce0c3ed1a1c5bf2a0e44f52d31eeb66e5ea9 shared_preferences_web: 141cce0c3ed1a1c5bf2a0e44f52d31eeb66e5ea9

@ -17,6 +17,7 @@ import 'package:gallery/l10n/gallery_localizations.dart';
import 'package:gallery/layout/adaptive.dart'; import 'package:gallery/layout/adaptive.dart';
import 'package:gallery/pages/splash.dart'; import 'package:gallery/pages/splash.dart';
import 'package:gallery/themes/gallery_theme_data.dart'; import 'package:gallery/themes/gallery_theme_data.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
@ -289,9 +290,8 @@ class _DemoPageState extends State<DemoPage> with TickerProviderStateMixin {
); );
break; break;
case _DemoState.code: case _DemoState.code:
final TextStyle codeTheme = TextStyle( final TextStyle codeTheme = GoogleFonts.robotoMono(
fontSize: 12 * GalleryOptions.of(context).textScaleFactor(context), fontSize: 12 * GalleryOptions.of(context).textScaleFactor(context),
fontFamily: 'Roboto Mono',
); );
section = CodeStyle( section = CodeStyle(
baseStyle: codeTheme.copyWith(color: Color(0xFFFAFBFB)), baseStyle: codeTheme.copyWith(color: Color(0xFFFAFBFB)),

@ -3,6 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:gallery/studies/crane/colors.dart'; import 'package:gallery/studies/crane/colors.dart';
@ -42,66 +43,64 @@ ThemeData _buildCraneTheme() {
} }
TextTheme _buildCraneTextTheme(TextTheme base) { TextTheme _buildCraneTextTheme(TextTheme base) {
return base return GoogleFonts.ralewayTextTheme(
.copyWith( base.copyWith(
display4: base.display4.copyWith( display4: base.display4.copyWith(
fontWeight: FontWeight.w300, fontWeight: FontWeight.w300,
fontSize: 96, fontSize: 96,
), ),
display3: base.display3.copyWith( display3: base.display3.copyWith(
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
fontSize: 60, fontSize: 60,
), ),
display2: base.display2.copyWith( display2: base.display2.copyWith(
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 48, fontSize: 48,
), ),
display1: base.display1.copyWith( display1: base.display1.copyWith(
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 34, fontSize: 34,
), ),
headline: base.headline.copyWith( headline: base.headline.copyWith(
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 24, fontSize: 24,
), ),
title: base.title.copyWith( title: base.title.copyWith(
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 20, fontSize: 20,
), ),
subhead: base.subhead.copyWith( subhead: base.subhead.copyWith(
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
fontSize: 16, fontSize: 16,
letterSpacing: 0.5, letterSpacing: 0.5,
), ),
subtitle: base.subtitle.copyWith( subtitle: base.subtitle.copyWith(
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 12, fontSize: 12,
color: craneGrey, color: craneGrey,
), ),
body2: base.body2.copyWith( body2: base.body2.copyWith(
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
fontSize: 16, fontSize: 16,
), ),
body1: base.body1.copyWith( body1: base.body1.copyWith(
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
fontSize: 14, fontSize: 14,
), ),
button: base.button.copyWith( button: base.button.copyWith(
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 13, fontSize: 13,
letterSpacing: 0.8, letterSpacing: 0.8,
), ),
caption: base.caption.copyWith( caption: base.caption.copyWith(
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
fontSize: 12, fontSize: 12,
color: craneGrey, color: craneGrey,
), ),
overline: base.overline.copyWith( overline: base.overline.copyWith(
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
fontSize: 12, fontSize: 12,
), ),
) ),
.apply( );
fontFamily: 'Raleway',
);
} }

@ -3,6 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:gallery/data/gallery_options.dart'; import 'package:gallery/data/gallery_options.dart';
import 'package:gallery/l10n/gallery_localizations.dart'; import 'package:gallery/l10n/gallery_localizations.dart';
@ -61,27 +62,29 @@ class RallyApp extends StatelessWidget {
TextTheme _buildRallyTextTheme(TextTheme base) { TextTheme _buildRallyTextTheme(TextTheme base) {
return base return base
.copyWith( .copyWith(
// TODO: Use GoogleFonts.robotoCondensed when available
body1: base.body1.copyWith( body1: base.body1.copyWith(
fontFamily: 'Roboto Condensed', fontFamily: 'Roboto Condensed',
fontSize: 14, fontSize: 14,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
), ),
body2: base.body2.copyWith( body2: GoogleFonts.eczar(
fontFamily: 'Eczar',
fontSize: 40, fontSize: 40,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
letterSpacing: 1.4, letterSpacing: 1.4,
textStyle: base.body2,
), ),
// TODO: Use GoogleFonts.robotoCondensed when available
button: base.button.copyWith( button: base.button.copyWith(
fontFamily: 'Roboto Condensed', fontFamily: 'Roboto Condensed',
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
letterSpacing: 2.8, letterSpacing: 2.8,
), ),
headline: base.body2.copyWith( headline: GoogleFonts.eczar(
fontFamily: 'Eczar',
fontSize: 40, fontSize: 40,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
letterSpacing: 1.4, letterSpacing: 1.4,
textStyle: base.body2,
), ),
) )
.apply( .apply(

@ -3,6 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:gallery/studies/shrine/colors.dart'; import 'package:gallery/studies/shrine/colors.dart';
import 'package:gallery/studies/shrine/supplemental/cut_corners_border.dart'; import 'package:gallery/studies/shrine/supplemental/cut_corners_border.dart';
@ -46,7 +47,7 @@ ThemeData _buildShrineTheme() {
} }
TextTheme _buildShrineTextTheme(TextTheme base) { TextTheme _buildShrineTextTheme(TextTheme base) {
return base return GoogleFonts.rubikTextTheme(base
.copyWith( .copyWith(
headline: base.headline.copyWith( headline: base.headline.copyWith(
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
@ -82,10 +83,9 @@ TextTheme _buildShrineTextTheme(TextTheme base) {
), ),
) )
.apply( .apply(
fontFamily: 'Rubik',
displayColor: shrineBrown900, displayColor: shrineBrown900,
bodyColor: shrineBrown900, bodyColor: shrineBrown900,
); ));
} }
const ColorScheme _shrineColorScheme = ColorScheme( const ColorScheme _shrineColorScheme = ColorScheme(

@ -3,6 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
class GalleryThemeData { class GalleryThemeData {
static const _lightFillColor = Colors.black; static const _lightFillColor = Colors.black;
@ -75,86 +76,21 @@ class GalleryThemeData {
brightness: Brightness.dark, brightness: Brightness.dark,
); );
static TextTheme _textTheme = TextTheme(
display1: _GalleryTextStyles.heading,
caption: _GalleryTextStyles.studyTitle,
headline: _GalleryTextStyles.categoryTitle,
subhead: _GalleryTextStyles.listTitle,
overline: _GalleryTextStyles.listDescription,
body2: _GalleryTextStyles.sliderTitle,
subtitle: _GalleryTextStyles.settingsFooter,
body1: _GalleryTextStyles.options,
title: _GalleryTextStyles.title,
button: _GalleryTextStyles.button,
);
}
class _GalleryTextStyles {
static const _regular = FontWeight.w400; static const _regular = FontWeight.w400;
static const _medium = FontWeight.w500; static const _medium = FontWeight.w500;
static const _semiBold = FontWeight.w600; static const _semiBold = FontWeight.w600;
static const _bold = FontWeight.w700; static const _bold = FontWeight.w700;
static const _montserrat = 'Montserrat'; static TextTheme _textTheme = TextTheme(
static const _oswald = 'Oswald'; display1: GoogleFonts.montserrat(fontWeight: _bold, fontSize: 20.0),
caption: GoogleFonts.oswald(fontWeight: _semiBold, fontSize: 16.0),
static const heading = TextStyle( headline: GoogleFonts.oswald(fontWeight: _medium, fontSize: 16.0),
fontFamily: _montserrat, subhead: GoogleFonts.montserrat(fontWeight: _medium, fontSize: 16.0),
fontWeight: _bold, overline: GoogleFonts.montserrat(fontWeight: _medium, fontSize: 12.0),
fontSize: 20.0, body2: GoogleFonts.montserrat(fontWeight: _regular, fontSize: 14.0),
); subtitle: GoogleFonts.montserrat(fontWeight: _medium, fontSize: 14.0),
body1: GoogleFonts.montserrat(fontWeight: _regular, fontSize: 16.0),
static const studyTitle = TextStyle( title: GoogleFonts.montserrat(fontWeight: _bold, fontSize: 16.0),
fontFamily: _oswald, button: GoogleFonts.montserrat(fontWeight: _semiBold, fontSize: 14.0),
fontWeight: _semiBold,
fontSize: 16.0,
);
static const categoryTitle = TextStyle(
fontFamily: _oswald,
fontWeight: _medium,
fontSize: 16.0,
);
static const listTitle = TextStyle(
fontFamily: _montserrat,
fontWeight: _medium,
fontSize: 16.0,
);
static const listDescription = TextStyle(
fontFamily: _montserrat,
fontWeight: _medium,
fontSize: 12.0,
);
static const sliderTitle = TextStyle(
fontFamily: _montserrat,
fontWeight: _regular,
fontSize: 14.0,
);
static const settingsFooter = TextStyle(
fontFamily: _montserrat,
fontWeight: _medium,
fontSize: 14.0,
);
static const options = TextStyle(
fontFamily: _montserrat,
fontWeight: _regular,
fontSize: 16.0,
);
static const title = TextStyle(
fontFamily: _montserrat,
fontWeight: _bold,
fontSize: 16.0,
);
static const button = TextStyle(
fontFamily: _montserrat,
fontWeight: _semiBold,
fontSize: 14.0,
); );
} }

@ -154,6 +154,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.2.0" version: "1.2.0"
google_fonts:
dependency: "direct main"
description:
name: google_fonts
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.5"
grinder: grinder:
dependency: "direct dev" dependency: "direct dev"
description: description:
@ -168,6 +175,20 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.14.0+3" version: "0.14.0+3"
http:
dependency: transitive
description:
name: http
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.0+4"
http_parser:
dependency: transitive
description:
name: http_parser
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.3"
image: image:
dependency: transitive dependency: transitive
description: description:
@ -181,7 +202,7 @@ packages:
name: intl name: intl
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.16.1" version: "0.16.0"
intl_translation: intl_translation:
dependency: "direct main" dependency: "direct main"
description: description:
@ -245,6 +266,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.6.4" version: "1.6.4"
path_provider:
dependency: transitive
description:
name: path_provider
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.1"
pedantic: pedantic:
dependency: transitive dependency: transitive
description: description:
@ -259,6 +287,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.4.0" version: "2.4.0"
platform:
dependency: transitive
description:
name: platform
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.1"
plugin_platform_interface: plugin_platform_interface:
dependency: transitive dependency: transitive
description: description:

@ -25,6 +25,7 @@ dependencies:
collection: ^1.14.0 collection: ^1.14.0
flutter_gallery_assets: 0.1.9+2 flutter_gallery_assets: 0.1.9+2
package_info: ^0.4.0+13 package_info: ^0.4.0+13
google_fonts: ^0.3.5
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
@ -34,6 +35,7 @@ dev_dependencies:
flutter: flutter:
assets: assets:
- fonts/google_fonts/
- assets/demos/ - assets/demos/
- assets/studies/ - assets/studies/
- assets/icons/cupertino/ - assets/icons/cupertino/
@ -105,61 +107,11 @@ flutter:
- family: GalleryIcons - family: GalleryIcons
fonts: fonts:
- asset: fonts/GalleryIcons.ttf - asset: fonts/GalleryIcons.ttf
- family: Montserrat # TODO: Remove once google_fonts supports condensed fonts
fonts:
- asset: fonts/Montserrat-Bold.ttf
weight: 700
- asset: fonts/Montserrat-Medium.ttf
weight: 500
- asset: fonts/Montserrat-Regular.ttf
weight: 400
- asset: fonts/Montserrat-SemiBold.ttf
weight: 600
- family: Oswald
fonts:
- asset: fonts/Oswald-SemiBold.ttf
weight: 600
- asset: fonts/Oswald-Medium.ttf
weight: 500
- family: Roboto Condensed - family: Roboto Condensed
fonts: fonts:
- asset: packages/rally_assets/RobotoCondensed-Light.ttf - asset: packages/rally_assets/RobotoCondensed-Light.ttf
weight: 400 weight: 400
- asset: packages/rally_assets/RobotoCondensed-Regular.ttf
weight: 500
- asset: packages/rally_assets/RobotoCondensed-Bold.ttf - asset: packages/rally_assets/RobotoCondensed-Bold.ttf
weight: 700 weight: 700
- family: Eczar
fonts:
- asset: packages/rally_assets/Eczar-Regular.ttf
weight: 400
- asset: packages/rally_assets/Eczar-SemiBold.ttf
weight: 600
- asset: packages/rally_assets/Eczar-Bold.ttf
weight: 700
# Crane font
- family: Raleway
fonts:
- asset: fonts/Raleway-Light.ttf
weight: 300
- asset: fonts/Raleway-Regular.ttf
weight: 400
- asset: fonts/Raleway-Medium.ttf
weight: 500
- asset: fonts/Raleway-SemiBold.ttf
weight: 600
# Shrine font
- family: Rubik
fonts:
- asset: fonts/Rubik-Regular.ttf
weight: 400
- asset: fonts/Rubik-Medium.ttf
weight: 500
- asset: fonts/Rubik-Bold.ttf
weight: 600
# Code font
- family: Roboto Mono
fonts:
- asset: fonts/RobotoMono-Regular.ttf
weight: 500

Loading…
Cancel
Save