mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 13:58:47 +00:00
[Gallery] Use google_fonts (#299)
* Use google_fonts package * Use hosted version of google_fonts
This commit is contained in:
@@ -2,6 +2,8 @@ PODS:
|
||||
- Flutter (1.0.0)
|
||||
- package_info (0.0.1):
|
||||
- Flutter
|
||||
- path_provider (0.0.1):
|
||||
- Flutter
|
||||
- shared_preferences (0.0.1):
|
||||
- Flutter
|
||||
- shared_preferences_macos (0.0.1):
|
||||
@@ -18,6 +20,7 @@ PODS:
|
||||
DEPENDENCIES:
|
||||
- Flutter (from `Flutter`)
|
||||
- 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_macos (from `.symlinks/plugins/shared_preferences_macos/ios`)
|
||||
- shared_preferences_web (from `.symlinks/plugins/shared_preferences_web/ios`)
|
||||
@@ -30,6 +33,8 @@ EXTERNAL SOURCES:
|
||||
:path: Flutter
|
||||
package_info:
|
||||
:path: ".symlinks/plugins/package_info/ios"
|
||||
path_provider:
|
||||
:path: ".symlinks/plugins/path_provider/ios"
|
||||
shared_preferences:
|
||||
:path: ".symlinks/plugins/shared_preferences/ios"
|
||||
shared_preferences_macos:
|
||||
@@ -46,6 +51,7 @@ EXTERNAL SOURCES:
|
||||
SPEC CHECKSUMS:
|
||||
Flutter: 0e3d915762c693b495b44d77113d4970485de6ec
|
||||
package_info: 48b108e75b8802c2d5e126f208ef540561c98aef
|
||||
path_provider: fb74bd0465e96b594bb3b5088ee4a4e7bb1f2a9d
|
||||
shared_preferences: 430726339841afefe5142b9c1f50cb6bd7793e01
|
||||
shared_preferences_macos: f3f29b71ccbb56bf40c9dd6396c9acf15e214087
|
||||
shared_preferences_web: 141cce0c3ed1a1c5bf2a0e44f52d31eeb66e5ea9
|
||||
|
||||
@@ -17,6 +17,7 @@ import 'package:gallery/l10n/gallery_localizations.dart';
|
||||
import 'package:gallery/layout/adaptive.dart';
|
||||
import 'package:gallery/pages/splash.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:url_launcher/url_launcher.dart';
|
||||
|
||||
@@ -289,9 +290,8 @@ class _DemoPageState extends State<DemoPage> with TickerProviderStateMixin {
|
||||
);
|
||||
break;
|
||||
case _DemoState.code:
|
||||
final TextStyle codeTheme = TextStyle(
|
||||
final TextStyle codeTheme = GoogleFonts.robotoMono(
|
||||
fontSize: 12 * GalleryOptions.of(context).textScaleFactor(context),
|
||||
fontFamily: 'Roboto Mono',
|
||||
);
|
||||
section = CodeStyle(
|
||||
baseStyle: codeTheme.copyWith(color: Color(0xFFFAFBFB)),
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
|
||||
import 'package:gallery/studies/crane/colors.dart';
|
||||
|
||||
@@ -42,66 +43,64 @@ ThemeData _buildCraneTheme() {
|
||||
}
|
||||
|
||||
TextTheme _buildCraneTextTheme(TextTheme base) {
|
||||
return base
|
||||
.copyWith(
|
||||
display4: base.display4.copyWith(
|
||||
fontWeight: FontWeight.w300,
|
||||
fontSize: 96,
|
||||
),
|
||||
display3: base.display3.copyWith(
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 60,
|
||||
),
|
||||
display2: base.display2.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 48,
|
||||
),
|
||||
display1: base.display1.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 34,
|
||||
),
|
||||
headline: base.headline.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 24,
|
||||
),
|
||||
title: base.title.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 20,
|
||||
),
|
||||
subhead: base.subhead.copyWith(
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 16,
|
||||
letterSpacing: 0.5,
|
||||
),
|
||||
subtitle: base.subtitle.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 12,
|
||||
color: craneGrey,
|
||||
),
|
||||
body2: base.body2.copyWith(
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 16,
|
||||
),
|
||||
body1: base.body1.copyWith(
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 14,
|
||||
),
|
||||
button: base.button.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 13,
|
||||
letterSpacing: 0.8,
|
||||
),
|
||||
caption: base.caption.copyWith(
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 12,
|
||||
color: craneGrey,
|
||||
),
|
||||
overline: base.overline.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 12,
|
||||
),
|
||||
)
|
||||
.apply(
|
||||
fontFamily: 'Raleway',
|
||||
);
|
||||
return GoogleFonts.ralewayTextTheme(
|
||||
base.copyWith(
|
||||
display4: base.display4.copyWith(
|
||||
fontWeight: FontWeight.w300,
|
||||
fontSize: 96,
|
||||
),
|
||||
display3: base.display3.copyWith(
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 60,
|
||||
),
|
||||
display2: base.display2.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 48,
|
||||
),
|
||||
display1: base.display1.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 34,
|
||||
),
|
||||
headline: base.headline.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 24,
|
||||
),
|
||||
title: base.title.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 20,
|
||||
),
|
||||
subhead: base.subhead.copyWith(
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 16,
|
||||
letterSpacing: 0.5,
|
||||
),
|
||||
subtitle: base.subtitle.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 12,
|
||||
color: craneGrey,
|
||||
),
|
||||
body2: base.body2.copyWith(
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 16,
|
||||
),
|
||||
body1: base.body1.copyWith(
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 14,
|
||||
),
|
||||
button: base.button.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 13,
|
||||
letterSpacing: 0.8,
|
||||
),
|
||||
caption: base.caption.copyWith(
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 12,
|
||||
color: craneGrey,
|
||||
),
|
||||
overline: base.overline.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:gallery/data/gallery_options.dart';
|
||||
import 'package:gallery/l10n/gallery_localizations.dart';
|
||||
|
||||
@@ -61,27 +62,29 @@ class RallyApp extends StatelessWidget {
|
||||
TextTheme _buildRallyTextTheme(TextTheme base) {
|
||||
return base
|
||||
.copyWith(
|
||||
// TODO: Use GoogleFonts.robotoCondensed when available
|
||||
body1: base.body1.copyWith(
|
||||
fontFamily: 'Roboto Condensed',
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
body2: base.body2.copyWith(
|
||||
fontFamily: 'Eczar',
|
||||
body2: GoogleFonts.eczar(
|
||||
fontSize: 40,
|
||||
fontWeight: FontWeight.w400,
|
||||
letterSpacing: 1.4,
|
||||
textStyle: base.body2,
|
||||
),
|
||||
// TODO: Use GoogleFonts.robotoCondensed when available
|
||||
button: base.button.copyWith(
|
||||
fontFamily: 'Roboto Condensed',
|
||||
fontWeight: FontWeight.w700,
|
||||
letterSpacing: 2.8,
|
||||
),
|
||||
headline: base.body2.copyWith(
|
||||
fontFamily: 'Eczar',
|
||||
headline: GoogleFonts.eczar(
|
||||
fontSize: 40,
|
||||
fontWeight: FontWeight.w600,
|
||||
letterSpacing: 1.4,
|
||||
textStyle: base.body2,
|
||||
),
|
||||
)
|
||||
.apply(
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:gallery/studies/shrine/colors.dart';
|
||||
import 'package:gallery/studies/shrine/supplemental/cut_corners_border.dart';
|
||||
|
||||
@@ -46,7 +47,7 @@ ThemeData _buildShrineTheme() {
|
||||
}
|
||||
|
||||
TextTheme _buildShrineTextTheme(TextTheme base) {
|
||||
return base
|
||||
return GoogleFonts.rubikTextTheme(base
|
||||
.copyWith(
|
||||
headline: base.headline.copyWith(
|
||||
fontWeight: FontWeight.w500,
|
||||
@@ -82,10 +83,9 @@ TextTheme _buildShrineTextTheme(TextTheme base) {
|
||||
),
|
||||
)
|
||||
.apply(
|
||||
fontFamily: 'Rubik',
|
||||
displayColor: shrineBrown900,
|
||||
bodyColor: shrineBrown900,
|
||||
);
|
||||
));
|
||||
}
|
||||
|
||||
const ColorScheme _shrineColorScheme = ColorScheme(
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
|
||||
class GalleryThemeData {
|
||||
static const _lightFillColor = Colors.black;
|
||||
@@ -75,86 +76,21 @@ class GalleryThemeData {
|
||||
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 _medium = FontWeight.w500;
|
||||
static const _semiBold = FontWeight.w600;
|
||||
static const _bold = FontWeight.w700;
|
||||
|
||||
static const _montserrat = 'Montserrat';
|
||||
static const _oswald = 'Oswald';
|
||||
|
||||
static const heading = TextStyle(
|
||||
fontFamily: _montserrat,
|
||||
fontWeight: _bold,
|
||||
fontSize: 20.0,
|
||||
);
|
||||
|
||||
static const studyTitle = TextStyle(
|
||||
fontFamily: _oswald,
|
||||
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,
|
||||
static TextTheme _textTheme = TextTheme(
|
||||
display1: GoogleFonts.montserrat(fontWeight: _bold, fontSize: 20.0),
|
||||
caption: GoogleFonts.oswald(fontWeight: _semiBold, fontSize: 16.0),
|
||||
headline: GoogleFonts.oswald(fontWeight: _medium, fontSize: 16.0),
|
||||
subhead: GoogleFonts.montserrat(fontWeight: _medium, fontSize: 16.0),
|
||||
overline: GoogleFonts.montserrat(fontWeight: _medium, fontSize: 12.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),
|
||||
title: GoogleFonts.montserrat(fontWeight: _bold, fontSize: 16.0),
|
||||
button: GoogleFonts.montserrat(fontWeight: _semiBold, fontSize: 14.0),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -154,6 +154,13 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
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:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
@@ -168,6 +175,20 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
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:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -181,7 +202,7 @@ packages:
|
||||
name: intl
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.16.1"
|
||||
version: "0.16.0"
|
||||
intl_translation:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -245,6 +266,13 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.6.4"
|
||||
path_provider:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_provider
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.5.1"
|
||||
pedantic:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -259,6 +287,13 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.4.0"
|
||||
platform:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: platform
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.2.1"
|
||||
plugin_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
@@ -25,6 +25,7 @@ dependencies:
|
||||
collection: ^1.14.0
|
||||
flutter_gallery_assets: 0.1.9+2
|
||||
package_info: ^0.4.0+13
|
||||
google_fonts: ^0.3.5
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
@@ -34,6 +35,7 @@ dev_dependencies:
|
||||
|
||||
flutter:
|
||||
assets:
|
||||
- fonts/google_fonts/
|
||||
- assets/demos/
|
||||
- assets/studies/
|
||||
- assets/icons/cupertino/
|
||||
@@ -105,61 +107,11 @@ flutter:
|
||||
- family: GalleryIcons
|
||||
fonts:
|
||||
- asset: fonts/GalleryIcons.ttf
|
||||
- family: Montserrat
|
||||
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
|
||||
# TODO: Remove once google_fonts supports condensed fonts
|
||||
- family: Roboto Condensed
|
||||
fonts:
|
||||
- asset: packages/rally_assets/RobotoCondensed-Light.ttf
|
||||
weight: 400
|
||||
- asset: packages/rally_assets/RobotoCondensed-Regular.ttf
|
||||
weight: 500
|
||||
- asset: packages/rally_assets/RobotoCondensed-Bold.ttf
|
||||
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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user