Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions packages/google_fonts/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## NEXT
## 8.2.0

* Updates minimum supported SDK version to Flutter 3.38/Dart 3.10.
- Extract the class `Config` to its own file and rename it `GoogleFontsConfig`. The `Config` class is now deprecated.
- Updates minimum supported SDK version to Flutter 3.38/Dart 3.10.

## 8.1.0

Expand Down
19 changes: 2 additions & 17 deletions packages/google_fonts/generator/google_fonts.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,13 @@
import 'dart:ui' as ui;

import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;

import 'google_fonts_base.dart';
import 'google_fonts_config.dart';
{{#allParts}}
import '{{partFilePath}}';
{{/allParts}}

/// A collection of properties used to specify custom behavior of the
/// GoogleFonts library.
class Config {
/// Whether or not the GoogleFonts library can make requests to
/// [fonts.google.com](https://fonts.google.com/) to retrieve font files.
bool allowRuntimeFetching = true;

/// The HTTP client used to fetch fonts.
///
/// If this is null, a shared default [http.Client] will be used.
///
/// If you supply a client, you are responsible for closing it.
http.Client? httpClient;
}

/// Provides configuration, and static methods to obtain [TextStyle]s and [TextTheme]s.
///
/// {@youtube 560 315 https://www.youtube.com/watch?v=8Vzv2CdbEY0}
Expand All @@ -49,7 +34,7 @@ class GoogleFonts {
/// ```dart
/// GoogleFonts.config.allowRuntimeFetching = false;
/// ```
static final Config config = Config();
static final GoogleFontsConfig config = GoogleFontsConfig();

/// Returns a [Future] which resolves when requested fonts have finished
/// loading and are ready to be rendered on screen.
Expand Down
1 change: 1 addition & 0 deletions packages/google_fonts/lib/google_fonts.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
// found in the LICENSE file.

export 'src/google_fonts_all_parts.dart';
export 'src/google_fonts_config.dart';
19 changes: 2 additions & 17 deletions packages/google_fonts/lib/src/google_fonts_all_parts.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
import 'dart:ui' as ui;

import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;

import 'google_fonts_base.dart';
import 'google_fonts_config.dart';
import 'google_fonts_parts/part_a.dart';
import 'google_fonts_parts/part_b.dart';
import 'google_fonts_parts/part_c.dart';
Expand Down Expand Up @@ -39,21 +39,6 @@ import 'google_fonts_parts/part_x.dart';
import 'google_fonts_parts/part_y.dart';
import 'google_fonts_parts/part_z.dart';

/// A collection of properties used to specify custom behavior of the
/// GoogleFonts library.
class Config {
/// Whether or not the GoogleFonts library can make requests to
/// [fonts.google.com](https://fonts.google.com/) to retrieve font files.
bool allowRuntimeFetching = true;

/// The HTTP client used to fetch fonts.
///
/// If this is null, a shared default [http.Client] will be used.
///
/// If you supply a client, you are responsible for closing it.
http.Client? httpClient;
}

/// Provides configuration, and static methods to obtain [TextStyle]s and [TextTheme]s.
///
/// {@youtube 560 315 https://www.youtube.com/watch?v=8Vzv2CdbEY0}
Expand All @@ -72,7 +57,7 @@ class GoogleFonts {
/// ```dart
/// GoogleFonts.config.allowRuntimeFetching = false;
/// ```
static final Config config = Config();
static final GoogleFontsConfig config = GoogleFontsConfig();

/// Returns a [Future] which resolves when requested fonts have finished
/// loading and are ready to be rendered on screen.
Expand Down
24 changes: 24 additions & 0 deletions packages/google_fonts/lib/src/google_fonts_config.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright 2013 The Flutter Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:http/http.dart' as http;

/// A collection of properties used to specify custom behavior of the
/// GoogleFonts library.
class GoogleFontsConfig {
/// Whether or not the GoogleFonts library can make requests to
/// [fonts.google.com](https://fonts.google.com/) to retrieve font files.
bool allowRuntimeFetching = true;

/// The HTTP client used to fetch fonts.
///
/// If this is null, a shared default [http.Client] will be used.
///
/// If you supply a client, you are responsible for closing it.
http.Client? httpClient;
}

/// Deprecated. Use [GoogleFontsConfig] instead.
@Deprecated('Use GoogleFontsConfig instead')
typedef Config = GoogleFontsConfig;
2 changes: 1 addition & 1 deletion packages/google_fonts/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: google_fonts
description: A Flutter package to use fonts from fonts.google.com. Supports HTTP fetching, caching, and asset bundling.
repository: https://github.com/flutter/packages/tree/main/packages/google_fonts
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+google_fonts%22
version: 8.1.0
version: 8.2.0

environment:
sdk: ^3.10.0
Expand Down
Loading