Remove google_fonts dependency & add Inter fonts

The Google fonts package was causing inconsistent weight of fonts and
would have to be re-declared every time the style needed to be used.
Now the Inter font files are bundled in and don't require an http
request to fetch them.
This commit is contained in:
tommyxchow 2021-11-14 02:10:32 -05:00
parent a9c72e3fcb
commit 70ca29bd98
15 changed files with 35 additions and 31 deletions

BIN
fonts/Inter-Black.ttf Normal file

Binary file not shown.

BIN
fonts/Inter-Bold.ttf Normal file

Binary file not shown.

BIN
fonts/Inter-ExtraBold.ttf Normal file

Binary file not shown.

BIN
fonts/Inter-ExtraLight.ttf Normal file

Binary file not shown.

BIN
fonts/Inter-Light.ttf Normal file

Binary file not shown.

BIN
fonts/Inter-Medium.ttf Normal file

Binary file not shown.

BIN
fonts/Inter-Regular.ttf Normal file

Binary file not shown.

BIN
fonts/Inter-SemiBold.ttf Normal file

Binary file not shown.

BIN
fonts/Inter-Thin.ttf Normal file

Binary file not shown.

View file

@ -1,7 +1,6 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/widgets.dart';
import 'package:frosty/models/irc.dart';
import 'package:google_fonts/google_fonts.dart';
class IRC {
/// Applies the given CLEARCHAT message to the given list of messages.
@ -115,7 +114,7 @@ class IRC {
span.add(
TextSpan(
text: ircMessage.tags['display-name']!,
style: GoogleFonts.inter(
style: TextStyle(
color: HexColor.fromHex(ircMessage.tags['color'] ?? '#868686'),
fontWeight: FontWeight.bold,
),

View file

@ -6,7 +6,6 @@ import 'package:frosty/stores/auth_store.dart';
import 'package:frosty/stores/stream_list_store.dart';
import 'package:frosty/stores/home_store.dart';
import 'package:frosty/stores/settings_store.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:provider/provider.dart';
void main() {
@ -29,26 +28,28 @@ class MyApp extends StatelessWidget {
title: 'Frosty',
theme: ThemeData(
primarySwatch: Colors.deepPurple,
fontFamily: GoogleFonts.inter().fontFamily,
fontFamily: 'Inter',
splashFactory: Platform.isIOS ? NoSplash.splashFactory : null,
appBarTheme: AppBarTheme(
titleTextStyle: GoogleFonts.inter(fontSize: 20, fontWeight: FontWeight.bold),
appBarTheme: const AppBarTheme(
titleTextStyle: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
),
),
darkTheme: ThemeData.dark().copyWith(
scaffoldBackgroundColor: Colors.black,
splashFactory: Platform.isIOS ? NoSplash.splashFactory : null,
textTheme: ThemeData.dark().textTheme.apply(fontFamily: GoogleFonts.inter().fontFamily),
colorScheme: ColorScheme.fromSwatch(
primarySwatch: Colors.deepPurple,
scaffoldBackgroundColor: Colors.black,
splashFactory: Platform.isIOS ? NoSplash.splashFactory : null,
textTheme: ThemeData.dark().textTheme.apply(fontFamily: 'Inter'),
appBarTheme: const AppBarTheme(
color: Colors.black,
titleTextStyle: TextStyle(
fontFamily: 'Inter',
fontSize: 28,
fontWeight: FontWeight.bold,
),
appBarTheme: AppBarTheme(
color: Colors.black,
titleTextStyle: GoogleFonts.inter(fontSize: 28, fontWeight: FontWeight.bold),
),
bottomNavigationBarTheme: const BottomNavigationBarThemeData(
backgroundColor: Colors.black,
)),
),
bottomNavigationBarTheme: const BottomNavigationBarThemeData(
backgroundColor: Colors.black,
),
),
home: Scaffold(
body: FutureBuilder(
future: Future.wait([

View file

@ -8,7 +8,6 @@ import 'package:frosty/stores/settings_store.dart';
import 'package:frosty/stores/video_store.dart';
import 'package:frosty/widgets/chat.dart';
import 'package:frosty/widgets/video.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:provider/provider.dart';
class VideoChat extends StatelessWidget {
@ -31,7 +30,8 @@ class VideoChat extends StatelessWidget {
return AspectRatio(
aspectRatio: 16 / 9,
child: Video(
channelName: userLogin,
userLogin: userLogin,
userName: userName,
videoStore: VideoStore(),
settingsStore: context.read<SettingsStore>(),
),
@ -40,7 +40,7 @@ class VideoChat extends StatelessWidget {
return AppBar(
title: Text(
userName,
style: GoogleFonts.inter(fontSize: 20, fontWeight: FontWeight.bold),
style: const TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
),
actions: [
IconButton(

View file

@ -2,7 +2,6 @@ import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:frosty/models/stream.dart';
import 'package:frosty/screens/video_chat.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:intl/intl.dart';
/// A tappable card widget that displays a stream's thumbnail and details.
@ -50,7 +49,7 @@ class StreamCard extends StatelessWidget {
children: [
Text(
streamInfo.userName,
style: GoogleFonts.inter(fontSize: 16, fontWeight: FontWeight.bold),
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
),
const SizedBox(height: 5),
SingleChildScrollView(

View file

@ -324,13 +324,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.2"
google_fonts:
dependency: "direct main"
description:
name: google_fonts
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
graphs:
dependency: transitive
description:

View file

@ -46,7 +46,6 @@ dependencies:
mobx: ^2.0.0
flutter_mobx: ^2.0.0
shared_preferences: ^2.0.8
google_fonts: ^2.1.0
dev_dependencies:
flutter_test:
@ -73,6 +72,19 @@ flutter:
# the material Icons class.
uses-material-design: true
fonts:
- family: Inter
fonts:
- asset: fonts/Inter-Thin.ttf
- asset: fonts/Inter-ExtraLight.ttf
- asset: fonts/Inter-Light.ttf
- asset: fonts/Inter-Regular.ttf
- asset: fonts/Inter-Medium.ttf
- asset: fonts/Inter-SemiBold.ttf
- asset: fonts/Inter-Bold.ttf
- asset: fonts/Inter-ExtraBold.ttf
- asset: fonts/Inter-Black.ttf
# To add assets to your application, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg