Skip to content

Commit 979cf19

Browse files
committed
refactoring: Class modifier changed and used flutter gen for fonts
1 parent 6c96629 commit 979cf19

File tree

9 files changed

+31
-15
lines changed

9 files changed

+31
-15
lines changed

lib/main_common.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@ import 'package:flutter/material.dart';
22
import 'package:flutter_template/injection/dependencies.dart';
33
import 'package:flutter_template/presentation/app.dart';
44
import 'package:flutter_template/presentation/app_flavor.dart';
5+
import 'package:flutter_template/presentation/common/assets_cache_manager.dart';
56

67
// ignore: avoid_void_async
78
void mainCommon(AppFlavor flavor) async {
89
WidgetsFlutterBinding.ensureInitialized();
910
await DependencyManager.inject(flavor);
11+
await AssetsCachingManager.cacheAnimationsRoot();
1012
runApp(const App());
1113
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
abstract interface class AssetsCachingManager {
2+
/// Caches only the animations required at the initial app startup,
3+
/// specifically for the splash screen.
4+
///
5+
/// This method should be called before [runApp] to ensure that essential
6+
/// animations are loaded early, improving the user experience during
7+
/// the app's launch phase.
8+
///
9+
/// By caching only necessary animations, this method reduces memory usage
10+
/// and improves performance.
11+
///
12+
/// Typically invoked during app initialization to enhance startup efficiency.
13+
static Future<void> cacheAnimationsRoot() async {
14+
// Example:
15+
// try {
16+
// await AssetLottie(Assets.animations.splash.path).load();
17+
// } catch (e) {
18+
// // Nothing to do
19+
// }
20+
}
21+
}

lib/presentation/resources/app_color_palette.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
33
/// Defines color palette for the application.
44
///
55
/// Consider using the color name that is mentioned in Figma.
6-
sealed class AppColorPalette {
6+
abstract interface class AppColorPalette {
77
const AppColorPalette._();
88

99
static const alpha = Colors.transparent;
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
sealed class AppFonts {
1+
import 'package:flutter_template/gen/fonts.gen.dart';
2+
3+
abstract interface class AppFonts {
24
AppFonts._();
35

4-
static const roboto = 'Roboto';
6+
static const roboto = FontFamily.roboto;
57

68
static String get activeFontFamily => roboto;
79
}

lib/presentation/resources/app_icons.dart

Lines changed: 0 additions & 7 deletions
This file was deleted.

lib/presentation/resources/app_text_styles.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import 'package:flutter/material.dart';
2-
import 'package:flutter_template/presentation/resources/app_colors.dart';
3-
import 'package:flutter_template/presentation/resources/app_fonts.dart';
2+
import 'package:flutter_template/presentation/resources/resources.dart';
43
import 'package:theme_tailor_annotation/theme_tailor_annotation.dart';
54

65
part 'app_text_styles.tailor.dart';

lib/presentation/resources/app_theme.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
22
import 'package:flutter_template/presentation/extensions/color_extensions.dart';
33
import 'package:flutter_template/presentation/resources/resources.dart';
44

5-
sealed class AppTheme {
5+
abstract interface class AppTheme {
66
const AppTheme._();
77

88
static ThemeData fromBrightness(Brightness brightness) {

lib/presentation/resources/app_ui_constants.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import 'package:flutter/material.dart';
44
///
55
/// This class contains non-sensitive information and is designed to maintain consistency
66
/// across the app's UI elements.
7-
sealed class AppUiConstants {
7+
abstract interface class AppUiConstants {
88
AppUiConstants._();
99

1010
// Animations
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
export 'package:flutter_template/presentation/resources/app_colors.dart';
22
export 'package:flutter_template/presentation/resources/app_fonts.dart';
3-
export 'package:flutter_template/presentation/resources/app_icons.dart';
43
export 'package:flutter_template/presentation/resources/app_images.dart';
54
export 'package:flutter_template/presentation/resources/app_text_styles.dart';
65
export 'package:flutter_template/presentation/resources/app_theme.dart';

0 commit comments

Comments
 (0)