Skip to content

Commit

Permalink
TW-824: install google fonts to fetch font from http
Browse files Browse the repository at this point in the history
  • Loading branch information
Julian KOUNE committed Oct 17, 2023
1 parent a1e7d9f commit db06315
Show file tree
Hide file tree
Showing 37 changed files with 71 additions and 139 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
36 changes: 16 additions & 20 deletions lib/config/themes.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:go_router/go_router.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:linagora_design_flutter/colors/linagora_ref_colors.dart';
import 'package:linagora_design_flutter/colors/linagora_sys_colors.dart';

import 'app_config.dart';

abstract class FluffyThemes {
abstract class TwakeThemes {
static const double columnWidth = 360.0;
static const double iconSize = 24.0;

Expand All @@ -18,58 +19,53 @@ abstract class FluffyThemes {
static bool getDisplayNavigationRail(BuildContext context) =>
!(GoRouterState.of(context).path?.startsWith('/settings') == true);

static const fallbackTextStyle = TextStyle(
fontFamily: 'Inter',
fontFamilyFallback: ['Inter'],
);

static var fallbackTextTheme = TextTheme(
bodyLarge: fallbackTextStyle.copyWith(
bodyLarge: GoogleFonts.inter(
fontWeight: FontWeight.w500,
letterSpacing: -0.15,
),
bodyMedium: fallbackTextStyle.copyWith(
bodyMedium: GoogleFonts.inter(
fontWeight: FontWeight.w500,
letterSpacing: 0.25,
),
bodySmall: fallbackTextStyle.copyWith(
bodySmall: GoogleFonts.inter(
fontWeight: FontWeight.w500,
letterSpacing: 0.4,
),
labelLarge: fallbackTextStyle.copyWith(
labelLarge: GoogleFonts.inter(
fontWeight: FontWeight.w500,
letterSpacing: 0.1,
),
labelSmall: fallbackTextStyle.copyWith(
labelSmall: GoogleFonts.inter(
fontWeight: FontWeight.w500,
letterSpacing: 0.5,
),
displayLarge: fallbackTextStyle.copyWith(
displayLarge: GoogleFonts.inter(
fontWeight: FontWeight.w700,
),
displayMedium: fallbackTextStyle.copyWith(
displayMedium: GoogleFonts.inter(
fontWeight: FontWeight.w600,
letterSpacing: 0.4,
),
displaySmall: fallbackTextStyle.copyWith(
displaySmall: GoogleFonts.inter(
fontWeight: FontWeight.w600,
letterSpacing: 0.4,
),
headlineMedium: fallbackTextStyle.copyWith(
headlineMedium: GoogleFonts.inter(
fontWeight: FontWeight.w600,
),
headlineSmall: fallbackTextStyle.copyWith(
headlineSmall: GoogleFonts.inter(
fontWeight: FontWeight.w600,
letterSpacing: 0.4,
),
titleLarge: fallbackTextStyle.copyWith(
titleLarge: GoogleFonts.inter(
fontWeight: FontWeight.w600,
),
titleMedium: fallbackTextStyle.copyWith(
titleMedium: GoogleFonts.inter(
fontWeight: FontWeight.w500,
letterSpacing: 0.15,
),
titleSmall: fallbackTextStyle.copyWith(
titleSmall: GoogleFonts.inter(
fontWeight: FontWeight.w500,
letterSpacing: 0.1,
),
Expand All @@ -82,7 +78,7 @@ abstract class FluffyThemes {
ThemeData(
visualDensity: VisualDensity.standard,
useMaterial3: true,
fontFamily: 'Inter',
fontFamily: GoogleFonts.inter().fontFamily,
textTheme: brightness == Brightness.light
? Typography.material2021().black.merge(fallbackTextTheme)
: Typography.material2021().white.merge(fallbackTextTheme),
Expand Down
4 changes: 2 additions & 2 deletions lib/pages/bootstrap/bootstrap_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class BootstrapDialogState extends State<BootstrapDialog> {
body: Center(
child: ConstrainedBox(
constraints:
const BoxConstraints(maxWidth: FluffyThemes.columnWidth * 1.5),
const BoxConstraints(maxWidth: TwakeThemes.columnWidth * 1.5),
child: ListView(
padding: const EdgeInsets.all(16.0),
children: [
Expand Down Expand Up @@ -244,7 +244,7 @@ class BootstrapDialogState extends State<BootstrapDialog> {
body: Center(
child: ConstrainedBox(
constraints: const BoxConstraints(
maxWidth: FluffyThemes.columnWidth * 1.5,
maxWidth: TwakeThemes.columnWidth * 1.5,
),
child: ListView(
padding: const EdgeInsets.all(16.0),
Expand Down
4 changes: 2 additions & 2 deletions lib/pages/chat/chat_emoji_picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ class ChatEmojiPicker extends StatelessWidget {
valueListenable: controller.showEmojiPickerNotifier,
builder: (context, showEmojiPicker, _) {
return AnimatedContainer(
duration: FluffyThemes.animationDuration,
curve: FluffyThemes.animationCurve,
duration: TwakeThemes.animationDuration,
curve: TwakeThemes.animationCurve,
width: MediaQuery.of(context).size.width,
height: showEmojiPicker ? MediaQuery.of(context).size.height / 3 : 0,
child: showEmojiPicker
Expand Down
2 changes: 1 addition & 1 deletion lib/pages/chat/chat_event_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ChatEventList extends StatelessWidget {

@override
Widget build(BuildContext context) {
final horizontalPadding = FluffyThemes.isColumnMode(context) ? 8.0 : 0.0;
final horizontalPadding = TwakeThemes.isColumnMode(context) ? 8.0 : 0.0;

// create a map of eventId --> index to greatly improve performance of
// ListView's findChildIndexCallback
Expand Down
4 changes: 2 additions & 2 deletions lib/pages/chat/chat_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class ChatView extends StatelessWidget with MessageContentMixin {
return const SizedBox.shrink();
}

final bottomSheetPadding = FluffyThemes.isColumnMode(context) ? 16.0 : 8.0;
final bottomSheetPadding = TwakeThemes.isColumnMode(context) ? 16.0 : 8.0;

return GestureDetector(
onTapDown: controller.setReadMarker,
Expand Down Expand Up @@ -273,7 +273,7 @@ class ChatView extends StatelessWidget with MessageContentMixin {
controller.room!.membership == Membership.join)
Container(
constraints: const BoxConstraints(
maxWidth: FluffyThemes.columnWidth * 2.5,
maxWidth: TwakeThemes.columnWidth * 2.5,
),
alignment: Alignment.center,
child: controller.room?.isAbandonedDMRoom == true
Expand Down
2 changes: 1 addition & 1 deletion lib/pages/chat/events/message/message.dart
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ class Message extends StatelessWidget {
? LinagoraSysColors.material().secondaryContainer
: Theme.of(context).primaryColor.withAlpha(0),
constraints:
const BoxConstraints(maxWidth: FluffyThemes.columnWidth * 2.5),
const BoxConstraints(maxWidth: TwakeThemes.columnWidth * 2.5),
child: Row(
mainAxisSize: MainAxisSize.max,
children: [
Expand Down
4 changes: 2 additions & 2 deletions lib/pages/chat/reactions_picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ class ReactionsPicker extends StatelessWidget {
controller.room!.canSendDefaultMessages &&
controller.selectedEvents.isNotEmpty;
return AnimatedContainer(
duration: FluffyThemes.animationDuration,
curve: FluffyThemes.animationCurve,
duration: TwakeThemes.animationDuration,
curve: TwakeThemes.animationCurve,
height: (display) ? 56 : 0,
child: Material(
color: Colors.transparent,
Expand Down
4 changes: 2 additions & 2 deletions lib/pages/chat/reply_display.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ class ReplyDisplay extends StatelessWidget {
@override
Widget build(BuildContext context) {
return AnimatedContainer(
duration: FluffyThemes.animationDuration,
curve: FluffyThemes.animationCurve,
duration: TwakeThemes.animationDuration,
curve: TwakeThemes.animationCurve,
height: controller.editEvent != null || controller.replyEvent != null
? 56
: 0,
Expand Down
6 changes: 3 additions & 3 deletions lib/pages/chat/typing_indicators.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ class TypingIndicators extends StatelessWidget {
alignment: Alignment.center,
child: AnimatedContainer(
constraints:
const BoxConstraints(maxWidth: FluffyThemes.columnWidth * 2.5),
const BoxConstraints(maxWidth: TwakeThemes.columnWidth * 2.5),
height:
typingUsers.isEmpty ? 0 : AvatarStyle.defaultSize + bottomPadding,
duration: FluffyThemes.animationDuration,
curve: FluffyThemes.animationCurve,
duration: TwakeThemes.animationDuration,
curve: TwakeThemes.animationCurve,
alignment: controller.timeline!.events.isNotEmpty &&
controller.timeline!.events.first.senderId ==
Matrix.of(context).client.userID
Expand Down
4 changes: 2 additions & 2 deletions lib/pages/chat_draft/draft_chat_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,8 @@ class DraftChatView extends StatelessWidget {
DraftChatViewStyle.containerMaxWidthConstraints,
alignment: Alignment.center,
child: AnimatedContainer(
duration: FluffyThemes.animationDuration,
curve: FluffyThemes.animationCurve,
duration: TwakeThemes.animationDuration,
curve: TwakeThemes.animationCurve,
width: MediaQuery.of(context).size.width,
height: DraftChatViewStyle.animatedContainerHeight(
context,
Expand Down
2 changes: 1 addition & 1 deletion lib/pages/chat_draft/draft_chat_view_style.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class DraftChatViewStyle {
responsive.isMobile(context) ? 56 : 80;

static BoxConstraints get containerMaxWidthConstraints =>
const BoxConstraints(maxWidth: FluffyThemes.columnWidth * 2.5);
const BoxConstraints(maxWidth: TwakeThemes.columnWidth * 2.5);

static double animatedContainerHeight(
BuildContext context,
Expand Down
8 changes: 4 additions & 4 deletions lib/pages/chat_list/chat_list_body_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ class ChatListBodyView extends StatelessWidget {
return Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (FluffyThemes.isColumnMode(context) &&
FluffyThemes.getDisplayNavigationRail(context)) ...[
if (TwakeThemes.isColumnMode(context) &&
TwakeThemes.getDisplayNavigationRail(context)) ...[
Container(
color: Theme.of(context).dividerColor,
width: 1,
Expand Down Expand Up @@ -137,8 +137,8 @@ class ChatListBodyView extends StatelessWidget {
height: ChatListBodyViewStyle.heightIsTorBrowser(
controller.isTorBrowser,
),
duration: FluffyThemes.animationDuration,
curve: FluffyThemes.animationCurve,
duration: TwakeThemes.animationDuration,
curve: TwakeThemes.animationCurve,
clipBehavior: Clip.hardEdge,
decoration: const BoxDecoration(),
child: Material(
Expand Down
8 changes: 4 additions & 4 deletions lib/pages/chat_list/chat_list_item_subtitle.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ class ChatListItemSubtitle extends StatelessWidget with ChatListItemMixin {
.getAllMentionedUserIdsFromMessage(room)
.contains(Matrix.of(context).client.userID);
return AnimatedContainer(
duration: FluffyThemes.animationDuration,
curve: FluffyThemes.animationCurve,
duration: TwakeThemes.animationDuration,
curve: TwakeThemes.animationCurve,
padding: const EdgeInsets.only(bottom: 4),
height: ChatListItemStyle.mentionIconWidth,
width: isMentionned && room.isUnreadOrInvited
Expand Down Expand Up @@ -96,8 +96,8 @@ class ChatListItemSubtitle extends StatelessWidget with ChatListItemMixin {
),
const SizedBox(width: 4),
AnimatedContainer(
duration: FluffyThemes.animationDuration,
curve: FluffyThemes.animationCurve,
duration: TwakeThemes.animationDuration,
curve: TwakeThemes.animationCurve,
padding: const EdgeInsets.symmetric(horizontal: 7),
height: unreadBadgeSize,
width: ChatListItemStyle.notificationBadgeSize(
Expand Down
4 changes: 2 additions & 2 deletions lib/pages/chat_list/navi_rail_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ class NaviRailItem extends StatelessWidget {
left: 0,
child: AnimatedContainer(
width: isSelected ? 4 : 0,
duration: FluffyThemes.animationDuration,
curve: FluffyThemes.animationCurve,
duration: TwakeThemes.animationDuration,
curve: TwakeThemes.animationCurve,
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.primary,
borderRadius: const BorderRadius.only(
Expand Down
4 changes: 2 additions & 2 deletions lib/pages/dialer/pip/pip_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ class PIPViewState extends State<PIPView> with TickerProviderStateMixin {
super.initState();
_corner = widget.initialCorner;
_toggleFloatingAnimationController = AnimationController(
duration: FluffyThemes.animationDuration,
duration: TwakeThemes.animationDuration,
vsync: this,
);
_dragAnimationController = AnimationController(
duration: FluffyThemes.animationDuration,
duration: TwakeThemes.animationDuration,
vsync: this,
);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/pages/homeserver_picker/homeserver_picker_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ class HomeserverPickerView extends StatelessWidget {
// usually forced to logout as TOR browser is non-persistent
AnimatedContainer(
height: controller.isTorBrowser ? 64 : 0,
duration: FluffyThemes.animationDuration,
curve: FluffyThemes.animationCurve,
duration: TwakeThemes.animationDuration,
curve: TwakeThemes.animationCurve,
clipBehavior: Clip.hardEdge,
decoration: const BoxDecoration(),
child: Material(
Expand Down
4 changes: 2 additions & 2 deletions lib/pages/story/story_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,8 @@ class StoryView extends StatelessWidget {
onHorizontalDragStart: controller.hold,
onHorizontalDragEnd: controller.unhold,
child: AnimatedContainer(
duration: FluffyThemes.animationDuration,
curve: FluffyThemes.animationCurve,
duration: TwakeThemes.animationDuration,
curve: TwakeThemes.animationCurve,
padding: const EdgeInsets.symmetric(
horizontal: 16.0,
vertical: 80,
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/adaptive_bottom_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Future<T?> showAdaptiveBottomSheet<T>({
isScrollControlled: isScrollControlled,
constraints: BoxConstraints(
maxHeight: MediaQuery.of(context).size.height - 128,
maxWidth: FluffyThemes.columnWidth * 1.5,
maxWidth: TwakeThemes.columnWidth * 1.5,
),
clipBehavior: Clip.hardEdge,
shape: const RoundedRectangleBorder(
Expand Down
4 changes: 2 additions & 2 deletions lib/widgets/connection_status_header.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ class ConnectionStatusHeaderState extends State<ConnectionStatusHeader> {
client.prevBatch != null;

return AnimatedContainer(
duration: FluffyThemes.animationDuration,
curve: FluffyThemes.animationCurve,
duration: TwakeThemes.animationDuration,
curve: TwakeThemes.animationCurve,
height: hide ? 0 : 36,
clipBehavior: Clip.hardEdge,
decoration: BoxDecoration(color: Theme.of(context).colorScheme.surface),
Expand Down
2 changes: 1 addition & 1 deletion lib/widgets/layouts/login_scaffold.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class LoginScaffold extends StatelessWidget {

@override
Widget build(BuildContext context) {
final isMobileMode = !FluffyThemes.isColumnMode(context);
final isMobileMode = !TwakeThemes.isColumnMode(context);
final scaffold = Scaffold(
backgroundColor: isMobileMode ? null : Colors.transparent,
appBar: appBar == null
Expand Down
4 changes: 2 additions & 2 deletions lib/widgets/lock_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ class LockScreenState extends State<LockScreen> {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: FluffyThemes.buildTheme(Brightness.light),
darkTheme: FluffyThemes.buildTheme(Brightness.dark),
theme: TwakeThemes.buildTheme(Brightness.light),
darkTheme: TwakeThemes.buildTheme(Brightness.dark),
localizationsDelegates: L10n.localizationsDelegates,
supportedLocales: L10n.supportedLocales,
home: Builder(
Expand Down
2 changes: 1 addition & 1 deletion lib/widgets/mxc_image.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class MxcImage extends StatefulWidget {
this.animated = false,
this.animationDuration = const Duration(milliseconds: 500),
this.retryDuration = const Duration(seconds: 2),
this.animationCurve = FluffyThemes.animationCurve,
this.animationCurve = TwakeThemes.animationCurve,
this.thumbnailMethod = ThumbnailMethod.scale,
this.cacheKey,
this.rounded = false,
Expand Down
4 changes: 2 additions & 2 deletions lib/widgets/twake_app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ class TwakeAppState extends State<TwakeApp> {
title: AppConfig.applicationName,
debugShowCheckedModeBanner: false,
themeMode: themeMode,
theme: FluffyThemes.buildTheme(Brightness.light, primaryColor),
darkTheme: FluffyThemes.buildTheme(Brightness.light, primaryColor),
theme: TwakeThemes.buildTheme(Brightness.light, primaryColor),
darkTheme: TwakeThemes.buildTheme(Brightness.light, primaryColor),
scrollBehavior: CustomScrollBehavior(),
localizationsDelegates: L10n.localizationsDelegates,
supportedLocales: L10n.supportedLocales,
Expand Down
Loading

0 comments on commit db06315

Please sign in to comment.