diff --git a/assets/fonts/opensans/OpenSans-Italic.ttf b/assets/fonts/opensans/OpenSans-Italic.ttf new file mode 100644 index 0000000..8312b2c Binary files /dev/null and b/assets/fonts/opensans/OpenSans-Italic.ttf differ diff --git a/assets/fonts/opensans/OpenSans.ttf b/assets/fonts/opensans/OpenSans.ttf new file mode 100644 index 0000000..ac587b4 Binary files /dev/null and b/assets/fonts/opensans/OpenSans.ttf differ diff --git a/assets/fonts/rubik/Rubik-Italic-VariableFont_wght.ttf b/assets/fonts/rubik/Rubik-Italic-VariableFont_wght.ttf new file mode 100644 index 0000000..36dbec5 Binary files /dev/null and b/assets/fonts/rubik/Rubik-Italic-VariableFont_wght.ttf differ diff --git a/assets/fonts/rubik/Rubik-VariableFont_wght.ttf b/assets/fonts/rubik/Rubik-VariableFont_wght.ttf new file mode 100644 index 0000000..bbab349 Binary files /dev/null and b/assets/fonts/rubik/Rubik-VariableFont_wght.ttf differ diff --git a/lib/models/settings/subtitle_settings_model.dart b/lib/models/settings/subtitle_settings_model.dart index 38afce0..7ef4db6 100644 --- a/lib/models/settings/subtitle_settings_model.dart +++ b/lib/models/settings/subtitle_settings_model.dart @@ -2,12 +2,13 @@ import 'dart:convert'; import 'dart:math' as math; +import 'package:flutter/material.dart'; + import 'package:collection/collection.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; + import 'package:fladder/providers/settings/subtitle_settings_provider.dart'; import 'package:fladder/providers/settings/video_player_settings_provider.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:google_fonts/google_fonts.dart'; class SubtitleSettingsModel { final double fontSize; @@ -79,7 +80,7 @@ class SubtitleSettingsModel { height: 1.4, fontSize: fontSize, fontWeight: fontWeight, - fontFamily: GoogleFonts.openSans().fontFamily, + fontFamily: 'OpenSans', letterSpacing: 0.0, wordSpacing: 0.0, color: color, diff --git a/lib/screens/login/widgets/discover_servers_widget.dart b/lib/screens/login/widgets/discover_servers_widget.dart index 868d24b..dbda9d7 100644 --- a/lib/screens/login/widgets/discover_servers_widget.dart +++ b/lib/screens/login/widgets/discover_servers_widget.dart @@ -6,6 +6,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:fladder/models/credentials_model.dart'; import 'package:fladder/providers/discovery_provider.dart'; +import 'package:fladder/util/fladder_config.dart'; import 'package:fladder/util/list_padding.dart'; import 'package:fladder/util/localization_helper.dart'; import 'package:fladder/util/theme_extensions.dart'; @@ -21,7 +22,6 @@ class DiscoverServersWidget extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - if (kIsWeb) return const SizedBox.shrink(); final existingServers = serverCredentials .map( (credentials) => DiscoveryInfo( @@ -58,51 +58,53 @@ class DiscoverServersWidget extends ConsumerWidget { ) .toList() .addInBetween(const SizedBox(height: 4)), - const Divider(), ], - Row( - children: [ - Text( - context.localized.discovered, - style: context.textTheme.bodyLarge, - ), - const Spacer(), - const Opacity(opacity: 0.65, child: Icon(IconsaxBold.airdrop, size: 16)), - ], - ), - const SizedBox(height: 4), - discoverdServersStream.when( - data: (data) { - final servers = data.where((discoverdServer) => !existingServers.contains(discoverdServer)); - return servers.isNotEmpty - ? Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - ...servers.map( - (serverInfo) => _ServerInfoCard( - server: serverInfo, - onPressed: onPressed, - ), - ) - ].toList().addInBetween(const SizedBox(height: 4)), - ) - : Center( - child: Opacity( - opacity: 0.65, - child: Text( - context.localized.noServersFound, - style: context.textTheme.bodyLarge, - ), - )); - }, - error: (error, stackTrace) => Text(context.localized.error), - loading: () => const Center( - child: SizedBox.square( - dimension: 24.0, - child: CircularProgressIndicator.adaptive(strokeCap: StrokeCap.round), + if (!kIsWeb && FladderConfig.baseUrl?.isEmpty == true) ...[ + const Divider(), + Row( + children: [ + Text( + context.localized.discovered, + style: context.textTheme.bodyLarge, + ), + const Spacer(), + const Opacity(opacity: 0.65, child: Icon(IconsaxBold.airdrop, size: 16)), + ], + ), + const SizedBox(height: 4), + discoverdServersStream.when( + data: (data) { + final servers = data.where((discoverdServer) => !existingServers.contains(discoverdServer)); + return servers.isNotEmpty + ? Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ...servers.map( + (serverInfo) => _ServerInfoCard( + server: serverInfo, + onPressed: onPressed, + ), + ) + ].toList().addInBetween(const SizedBox(height: 4)), + ) + : Center( + child: Opacity( + opacity: 0.65, + child: Text( + context.localized.noServersFound, + style: context.textTheme.bodyLarge, + ), + )); + }, + error: (error, stackTrace) => Text(context.localized.error), + loading: () => const Center( + child: SizedBox.square( + dimension: 24.0, + child: CircularProgressIndicator.adaptive(strokeCap: StrokeCap.round), + ), ), ), - ), + ], const SizedBox(height: 32), ], ); diff --git a/lib/screens/settings/settings_scaffold.dart b/lib/screens/settings/settings_scaffold.dart index ec76ee7..62d2316 100644 --- a/lib/screens/settings/settings_scaffold.dart +++ b/lib/screens/settings/settings_scaffold.dart @@ -1,3 +1,4 @@ +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:auto_route/auto_route.dart'; @@ -74,7 +75,8 @@ class SettingsScaffold extends ConsumerWidget { ), ), SliverPadding( - padding: MediaQuery.paddingOf(context), + padding: MediaQuery.paddingOf(context) + .copyWith(top: AdaptiveLayout.of(context).isDesktop || kIsWeb ? 0 : null), sliver: SliverList( delegate: SliverChildListDelegate(items), ), diff --git a/lib/theme.dart b/lib/theme.dart index c7445fd..6b5d8c1 100644 --- a/lib/theme.dart +++ b/lib/theme.dart @@ -1,7 +1,9 @@ -import 'package:dynamic_color/dynamic_color.dart'; -import 'package:fladder/util/custom_color_themes.dart'; import 'package:flutter/material.dart'; -import 'package:google_fonts/google_fonts.dart'; + +import 'package:dynamic_color/dynamic_color.dart'; + +import 'package:fladder/theme/fonts.dart'; +import 'package:fladder/util/custom_color_themes.dart'; ColorScheme? generateDynamicColourSchemes(ColorScheme? theme) { if (theme == null) return null; @@ -34,7 +36,7 @@ class FladderTheme { static ThemeData theme(ColorScheme? colorScheme) { final ColorScheme? scheme = generateDynamicColourSchemes(colorScheme); - final textTheme = GoogleFonts.rubikTextTheme( + final textTheme = FladderFonts.rubikTextTheme( const TextTheme(), ); return ThemeData( diff --git a/lib/theme/fonts.dart b/lib/theme/fonts.dart new file mode 100644 index 0000000..afd5978 --- /dev/null +++ b/lib/theme/fonts.dart @@ -0,0 +1,115 @@ +import 'package:flutter/material.dart'; + +class FladderFonts { + static TextTheme rubikTextTheme([TextTheme? textTheme]) { + textTheme ??= ThemeData.light().textTheme; + + return TextTheme( + displayLarge: TextStyle( + fontFamily: 'Rubik', + fontSize: textTheme.displayLarge?.fontSize, + fontVariations: [ + const FontVariation('wght', 300), + ], + ), + displayMedium: TextStyle( + fontFamily: 'Rubik', + fontSize: textTheme.displayMedium?.fontSize, + fontVariations: [ + const FontVariation('wght', 400), + ], + ), + displaySmall: TextStyle( + fontFamily: 'Rubik', + fontSize: textTheme.displaySmall?.fontSize, + fontVariations: [ + const FontVariation('wght', 500), + ], + ), + headlineLarge: TextStyle( + fontFamily: 'Rubik', + fontSize: textTheme.headlineLarge?.fontSize, + fontVariations: [ + const FontVariation('wght', 600), + ], + ), + headlineMedium: TextStyle( + fontFamily: 'Rubik', + fontSize: textTheme.headlineMedium?.fontSize, + fontVariations: [ + const FontVariation('wght', 700), + ], + ), + headlineSmall: TextStyle( + fontFamily: 'Rubik', + fontSize: textTheme.headlineSmall?.fontSize, + fontVariations: [ + const FontVariation('wght', 800), + ], + ), + titleLarge: TextStyle( + fontFamily: 'Rubik', + fontSize: textTheme.titleLarge?.fontSize, + fontVariations: [ + const FontVariation('wght', 400), + ], + ), + titleMedium: TextStyle( + fontFamily: 'Rubik', + fontSize: textTheme.titleMedium?.fontSize, + fontVariations: [ + const FontVariation('wght', 500), + ], + ), + titleSmall: TextStyle( + fontFamily: 'Rubik', + fontSize: textTheme.titleSmall?.fontSize, + fontVariations: [ + const FontVariation('wght', 600), + ], + ), + bodyLarge: TextStyle( + fontFamily: 'Rubik', + fontSize: textTheme.bodyLarge?.fontSize, + fontVariations: [ + const FontVariation('wght', 400), + ], + ), + bodyMedium: TextStyle( + fontFamily: 'Rubik', + fontSize: textTheme.bodyMedium?.fontSize, + fontVariations: [ + const FontVariation('wght', 500), + ], + ), + bodySmall: TextStyle( + fontFamily: 'Rubik', + fontSize: textTheme.bodySmall?.fontSize, + fontVariations: [ + const FontVariation('wght', 400), + ], + ), + labelLarge: TextStyle( + fontFamily: 'Rubik', + fontSize: textTheme.labelLarge?.fontSize, + fontVariations: [ + const FontVariation('wght', 600), + ], + ), + labelMedium: TextStyle( + fontFamily: 'Rubik', + fontSize: textTheme.labelMedium?.fontSize, + fontVariations: [ + const FontVariation('wght', 500), + ], + ), + labelSmall: TextStyle( + fontFamily: 'Rubik', + fontSize: textTheme.labelSmall?.fontSize, + fontVariations: [ + const FontVariation('wght', 400), + ], + ), + ); + } +} diff --git a/lib/widgets/navigation_scaffold/components/navigation_drawer.dart b/lib/widgets/navigation_scaffold/components/navigation_drawer.dart index 12e8f74..66b26fa 100644 --- a/lib/widgets/navigation_scaffold/components/navigation_drawer.dart +++ b/lib/widgets/navigation_scaffold/components/navigation_drawer.dart @@ -42,7 +42,7 @@ class NestedNavigationDrawer extends ConsumerWidget { surfaceTintColor: isExpanded ? Colors.transparent : null, children: [ Padding( - padding: EdgeInsets.fromLTRB(28, AdaptiveLayout.of(context).isDesktop ? 0 : 16, 16, 0), + padding: EdgeInsets.fromLTRB(28, AdaptiveLayout.of(context).isDesktop || kIsWeb ? 0 : 16, 16, 0), child: Row( children: [ Expanded( diff --git a/pubspec.lock b/pubspec.lock index 14faadc..3309c4f 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -794,14 +794,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.2" - 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 83a8210..7094544 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -64,9 +64,6 @@ dependencies: shared_preferences: ^2.1.0 path_provider: ^2.1.3 - # Fonts - google_fonts: ^6.1.0 - # Media media_kit: ^1.1.10 # Primary package. media_kit_video: ^1.2.4 # For video rendering. @@ -162,6 +159,20 @@ flutter: - config/ fonts: + - family: Rubik + fonts: + - asset: assets/fonts/rubik/Rubik-VariableFont_wght.ttf + style: normal + - asset: assets/fonts/rubik/Rubik-Italic-VariableFont_wght.ttf + style: italic + + - family: OpenSans + fonts: + - asset: assets/fonts/opensans/OpenSans.ttf + style: normal + - asset: assets/fonts/opensans/OpenSans-Italic.ttf + style: italic + - family: mp-font fonts: - asset: assets/fonts/mp-font.ttf