From 47d7d6fc6da34c9ef4fea58cff9b4292f7b9c1b6 Mon Sep 17 00:00:00 2001 From: Juan Date: Mon, 25 Apr 2022 16:47:43 -0700 Subject: [PATCH] feat: set poppins font family (#357) * fix: use google_fonts package * chore: remove unused import --- lib/components/style_model_theme.dart | 11 +++++++---- lib/main.dart | 7 +++++++ pubspec.lock | 7 +++++++ pubspec.yaml | 1 + 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/lib/components/style_model_theme.dart b/lib/components/style_model_theme.dart index 12ac4a2b2..13f16c445 100644 --- a/lib/components/style_model_theme.dart +++ b/lib/components/style_model_theme.dart @@ -1,3 +1,5 @@ +import 'dart:io'; + import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:rtchat/models/style.dart'; @@ -12,11 +14,12 @@ class StyleModelTheme extends StatelessWidget { return Consumer( builder: (context, model, child) { final theme = Theme.of(context); + final fontFamily = Platform.isIOS + ? Typography.whiteCupertino.bodyText2!.fontFamily + : Typography.whiteMountainView.bodyText2!.fontFamily; final themeData = theme.copyWith( - textTheme: - theme.textTheme.apply(fontSizeDelta: model.fontSize - 14), - ); - + textTheme: theme.textTheme.apply( + fontSizeDelta: model.fontSize - 14, fontFamily: fontFamily)); return Theme( data: themeData, child: DefaultTextStyle( diff --git a/lib/main.dart b/lib/main.dart index a3ce8e2a0..d518ca8d9 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -10,6 +10,7 @@ import 'package:firebase_remote_config/firebase_remote_config.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:google_fonts/google_fonts.dart'; import 'package:provider/provider.dart'; import 'package:rtchat/models/activity_feed.dart'; import 'package:rtchat/models/audio.dart'; @@ -271,10 +272,16 @@ class _AppState extends State { child: MaterialApp( title: 'RealtimeChat', theme: ThemeData( + textTheme: GoogleFonts.poppinsTextTheme( + Theme.of(context).textTheme, + ), brightness: Brightness.light, primarySwatch: primarySwatch, ), darkTheme: ThemeData( + textTheme: GoogleFonts.poppinsTextTheme( + Theme.of(context).textTheme, + ), brightness: Brightness.dark, primarySwatch: primarySwatch, scaffoldBackgroundColor: Colors.black, diff --git a/pubspec.lock b/pubspec.lock index ee8a10e5a..7ee7e3eb4 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -303,6 +303,13 @@ packages: description: flutter source: sdk version: "0.0.0" + google_fonts: + dependency: "direct main" + description: + name: google_fonts + url: "https://pub.dartlang.org" + source: hosted + version: "2.3.1" html: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index bf28fe635..a09556e37 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -34,6 +34,7 @@ dependencies: firebase_remote_config: ^2.0.0 flutter_keyboard_visibility: ^5.0.3 characters: ^1.2.0 + google_fonts: ^2.3.1 mobile_scanner: ^1.0.0 motion_sensors: ^0.1.0