From e265d355799fe91c81c84e3c5c9aeafbd520f8be Mon Sep 17 00:00:00 2001 From: cogwheel0 <172976095+cogwheel0@users.noreply.github.com> Date: Thu, 28 Aug 2025 10:12:59 +0530 Subject: [PATCH] chore: remove google_fonts dependency and update typography to use system fonts --- lib/features/chat/views/chat_page.dart | 4 +- .../chat/widgets/user_message_bubble.dart | 7 ++ lib/shared/theme/app_theme.dart | 17 ++- lib/shared/theme/theme_extensions.dart | 116 ++++++++---------- .../widgets/markdown/markdown_config.dart | 9 +- pubspec.lock | 8 -- pubspec.yaml | 1 - 7 files changed, 72 insertions(+), 90 deletions(-) diff --git a/lib/features/chat/views/chat_page.dart b/lib/features/chat/views/chat_page.dart index ff3cef0..cc86621 100644 --- a/lib/features/chat/views/chat_page.dart +++ b/lib/features/chat/views/chat_page.dart @@ -1092,7 +1092,7 @@ class _ChatPageState extends ConsumerState { .copyWith( color: context.conduitTheme.textPrimary, - fontWeight: FontWeight.w400, + fontWeight: FontWeight.w600, ), maxLines: 1, overflow: TextOverflow.ellipsis, @@ -1220,7 +1220,7 @@ class _ChatPageState extends ConsumerState { .copyWith( color: context.conduitTheme.textPrimary, - fontWeight: FontWeight.w400, + fontWeight: FontWeight.w600, ), maxLines: 1, overflow: TextOverflow.ellipsis, diff --git a/lib/features/chat/widgets/user_message_bubble.dart b/lib/features/chat/widgets/user_message_bubble.dart index 8739ef7..6cebd19 100644 --- a/lib/features/chat/widgets/user_message_bubble.dart +++ b/lib/features/chat/widgets/user_message_bubble.dart @@ -486,6 +486,13 @@ class _UserMessageBubbleState extends ConsumerState color: context.conduitTheme.chatBubbleUserText, ), softWrap: true, + textAlign: TextAlign.left, + textHeightBehavior: const TextHeightBehavior( + applyHeightToFirstAscent: false, + applyHeightToLastDescent: false, + leadingDistribution: + TextLeadingDistribution.even, + ), ), ), ), diff --git a/lib/shared/theme/app_theme.dart b/lib/shared/theme/app_theme.dart index 1568d75..7fd7acd 100644 --- a/lib/shared/theme/app_theme.dart +++ b/lib/shared/theme/app_theme.dart @@ -1,6 +1,5 @@ import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; -import 'package:google_fonts/google_fonts.dart'; import 'package:flutter_animate/flutter_animate.dart'; import 'theme_extensions.dart'; @@ -99,10 +98,9 @@ class AppTheme { snackBarTheme: SnackBarThemeData( behavior: SnackBarBehavior.floating, backgroundColor: neutral900.withValues(alpha: 0.92), - contentTextStyle: GoogleFonts.inter( + contentTextStyle: const TextStyle( color: neutral50, - fontSize: AppTypography.bodyMedium, - ), + ).copyWith(fontSize: AppTypography.bodyMedium), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(AppBorderRadius.snackbar), ), @@ -132,7 +130,8 @@ class AppTheme { vertical: Spacing.sm, ), ), - textTheme: GoogleFonts.interTextTheme(), + // Use platform default system font text theme + textTheme: ThemeData.light().textTheme, extensions: const [ConduitThemeExtension.auroraLight], ); @@ -197,10 +196,9 @@ class AppTheme { snackBarTheme: SnackBarThemeData( behavior: SnackBarBehavior.floating, backgroundColor: neutral800.withValues(alpha: 0.92), - contentTextStyle: GoogleFonts.inter( + contentTextStyle: const TextStyle( color: neutral50, - fontSize: AppTypography.bodyMedium, - ), + ).copyWith(fontSize: AppTypography.bodyMedium), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(AppBorderRadius.snackbar), ), @@ -230,7 +228,8 @@ class AppTheme { vertical: Spacing.sm, ), ), - textTheme: GoogleFonts.interTextTheme(ThemeData.dark().textTheme), + // Use platform default system font text theme + textTheme: ThemeData.dark().textTheme, extensions: const [ConduitThemeExtension.dark], ); diff --git a/lib/shared/theme/theme_extensions.dart b/lib/shared/theme/theme_extensions.dart index 6425af6..e44cd47 100644 --- a/lib/shared/theme/theme_extensions.dart +++ b/lib/shared/theme/theme_extensions.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:google_fonts/google_fonts.dart'; +// Using system fonts; no GoogleFonts dependency required import 'app_theme.dart'; /// Extended theme data for consistent styling across the app @@ -1366,7 +1366,8 @@ class ConduitShadows { /// Typography scale following Conduit design tokens - Enhanced for production class AppTypography { - static const String fontFamily = 'Inter'; + // Primary UI font now uses the platform default system font + static const String fontFamily = ''; static const String monospaceFontFamily = 'SF Mono'; // Letter spacing values - Enhanced for better readability @@ -1390,157 +1391,138 @@ class AppTypography { static const double labelSmall = 12; // Text styles following Conduit design - Enhanced for production - static final TextStyle displayLargeStyle = GoogleFonts.inter( - fontSize: displayLarge, + static final TextStyle displayLargeStyle = const TextStyle( fontWeight: FontWeight.w700, letterSpacing: -0.8, height: 1.1, - ); + ).copyWith(fontSize: displayLarge); - static final TextStyle displayMediumStyle = GoogleFonts.inter( - fontSize: displayMedium, + static final TextStyle displayMediumStyle = const TextStyle( fontWeight: FontWeight.w700, letterSpacing: -0.6, height: 1.2, - ); + ).copyWith(fontSize: displayMedium); - static final TextStyle bodyLargeStyle = GoogleFonts.inter( - fontSize: bodyLarge, + static final TextStyle bodyLargeStyle = const TextStyle( fontWeight: FontWeight.w400, letterSpacing: 0, height: 1.6, - ); + ).copyWith(fontSize: bodyLarge); - static final TextStyle bodyMediumStyle = GoogleFonts.inter( - fontSize: bodyMedium, + static final TextStyle bodyMediumStyle = const TextStyle( fontWeight: FontWeight.w400, letterSpacing: 0, height: 1.6, - ); + ).copyWith(fontSize: bodyMedium); - static final TextStyle codeStyle = GoogleFonts.sourceCodePro( - fontSize: bodySmall, + static final TextStyle codeStyle = const TextStyle( fontWeight: FontWeight.w400, letterSpacing: 0, height: 1.5, - ); + fontFamily: monospaceFontFamily, + ).copyWith(fontSize: bodySmall); // Additional styled text getters for convenience - Enhanced - static TextStyle get headlineLargeStyle => GoogleFonts.inter( - fontSize: headlineLarge, + static TextStyle get headlineLargeStyle => const TextStyle( fontWeight: FontWeight.w700, letterSpacing: -0.4, height: 1.3, - ); + ).copyWith(fontSize: headlineLarge); - static TextStyle get headlineMediumStyle => GoogleFonts.inter( - fontSize: headlineMedium, + static TextStyle get headlineMediumStyle => const TextStyle( fontWeight: FontWeight.w600, letterSpacing: -0.2, height: 1.3, - ); + ).copyWith(fontSize: headlineMedium); - static TextStyle get headlineSmallStyle => GoogleFonts.inter( - fontSize: headlineSmall, + static TextStyle get headlineSmallStyle => const TextStyle( fontWeight: FontWeight.w600, letterSpacing: 0, height: 1.4, - ); + ).copyWith(fontSize: headlineSmall); - static TextStyle get bodySmallStyle => GoogleFonts.inter( - fontSize: bodySmall, + static TextStyle get bodySmallStyle => const TextStyle( fontWeight: FontWeight.w400, letterSpacing: 0, height: 1.5, - ); + ).copyWith(fontSize: bodySmall); // Enhanced text styles for chat messages - static TextStyle get chatMessageStyle => GoogleFonts.inter( - fontSize: bodyMedium, + static TextStyle get chatMessageStyle => const TextStyle( fontWeight: FontWeight.w400, - letterSpacing: 0.1, - height: 1.6, - ); + letterSpacing: 0.0, + height: 1.4, + ).copyWith(fontSize: bodyMedium); - static TextStyle get chatCodeStyle => GoogleFonts.sourceCodePro( - fontSize: bodySmall, + static TextStyle get chatCodeStyle => const TextStyle( fontWeight: FontWeight.w400, letterSpacing: 0, height: 1.5, - ); + fontFamily: monospaceFontFamily, + ).copyWith(fontSize: bodySmall); // Enhanced label styles - static TextStyle get labelStyle => GoogleFonts.inter( - fontSize: labelMedium, + static TextStyle get labelStyle => const TextStyle( fontWeight: FontWeight.w500, letterSpacing: 0.2, height: 1.4, - ); + ).copyWith(fontSize: labelMedium); // Enhanced caption styles - static TextStyle get captionStyle => GoogleFonts.inter( - fontSize: labelSmall, + static TextStyle get captionStyle => const TextStyle( fontWeight: FontWeight.w500, letterSpacing: 0.5, height: 1.3, - ); + ).copyWith(fontSize: labelSmall); // Enhanced typography for better hierarchy - static TextStyle get micro => GoogleFonts.inter( - fontSize: 10, + static TextStyle get micro => const TextStyle( fontWeight: FontWeight.w400, letterSpacing: 0.1, height: 1.4, - ); + ).copyWith(fontSize: 10); - static TextStyle get tiny => GoogleFonts.inter( - fontSize: 12, + static TextStyle get tiny => const TextStyle( fontWeight: FontWeight.w400, letterSpacing: 0.1, height: 1.4, - ); + ).copyWith(fontSize: 12); - static TextStyle get small => GoogleFonts.inter( - fontSize: 14, + static TextStyle get small => const TextStyle( fontWeight: FontWeight.w400, letterSpacing: 0, height: 1.5, - ); + ).copyWith(fontSize: 14); - static TextStyle get standard => GoogleFonts.inter( - fontSize: 16, + static TextStyle get standard => const TextStyle( fontWeight: FontWeight.w400, letterSpacing: 0, height: 1.6, - ); + ).copyWith(fontSize: 16); - static TextStyle get large => GoogleFonts.inter( - fontSize: 18, + static TextStyle get large => const TextStyle( fontWeight: FontWeight.w400, letterSpacing: 0, height: 1.6, - ); + ).copyWith(fontSize: 18); - static TextStyle get extraLarge => GoogleFonts.inter( - fontSize: 20, + static TextStyle get extraLarge => const TextStyle( fontWeight: FontWeight.w400, letterSpacing: 0, height: 1.5, - ); + ).copyWith(fontSize: 20); - static TextStyle get huge => GoogleFonts.inter( - fontSize: 24, + static TextStyle get huge => const TextStyle( fontWeight: FontWeight.w600, letterSpacing: -0.2, height: 1.3, - ); + ).copyWith(fontSize: 24); - static TextStyle get massive => GoogleFonts.inter( - fontSize: 32, + static TextStyle get massive => const TextStyle( fontWeight: FontWeight.w700, letterSpacing: -0.4, height: 1.2, - ); + ).copyWith(fontSize: 32); } /// Consistent icon sizes - Enhanced for production with better hierarchy diff --git a/lib/shared/widgets/markdown/markdown_config.dart b/lib/shared/widgets/markdown/markdown_config.dart index 47eb7fc..e3c966d 100644 --- a/lib/shared/widgets/markdown/markdown_config.dart +++ b/lib/shared/widgets/markdown/markdown_config.dart @@ -113,11 +113,11 @@ class ConduitMarkdownConfig { ), ), - // Paragraph config + // Paragraphs — improve readability and spacing on mobile PConfig( textStyle: AppTypography.chatMessageStyle.copyWith( color: theme.textPrimary, - height: 1.3, + height: 1.45, ), ), @@ -125,20 +125,23 @@ class ConduitMarkdownConfig { H1Config( style: AppTypography.headlineLargeStyle.copyWith( color: theme.textPrimary, + height: 1.25, ), ), H2Config( style: AppTypography.headlineMediumStyle.copyWith( color: theme.textPrimary, + height: 1.25, ), ), H3Config( style: AppTypography.headlineSmallStyle.copyWith( color: theme.textPrimary, + height: 1.3, ), ), - // Blockquote + // Blockquote — keep default rendering for compatibility BlockquoteConfig(), // Code inline diff --git a/pubspec.lock b/pubspec.lock index 026fcbb..19ecc11 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -493,14 +493,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.3" - google_fonts: - dependency: "direct main" - description: - name: google_fonts - sha256: b1ac0fe2832c9cc95e5e88b57d627c5e68c223b9657f4b96e1487aa9098c7b82 - url: "https://pub.dev" - source: hosted - version: "6.2.1" graphs: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 5cdae61..fea73e7 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -53,7 +53,6 @@ dependencies: cupertino_icons: ^1.0.8 json_annotation: ^4.9.0 freezed_annotation: ^3.0.0 - google_fonts: ^6.2.1 wakelock_plus: ^1.2.10 share_plus: ^11.1.0