diff --git a/lib/core/utils/screen_size.dart b/lib/core/utils/screen_size.dart index 91225eb..b7dcfd0 100644 --- a/lib/core/utils/screen_size.dart +++ b/lib/core/utils/screen_size.dart @@ -6,8 +6,8 @@ extension ScreenSize on BuildContext { double get heightScreen => MediaQuery.sizeOf(this).height; } -extension AdaptiveSize on double { +extension AdaptiveSize on int { double get w => Get.context!.widthScreen * this / 375; double get h => Get.context!.heightScreen * this / 812; - double get sp => MediaQuery.textScalerOf(Get.context!).scale(this); + double get sp => MediaQuery.textScalerOf(Get.context!).scale(toDouble()); } diff --git a/lib/features/intro/presentation/ui/intro_page.dart b/lib/features/intro/presentation/ui/intro_page.dart index 780ca54..7830db4 100644 --- a/lib/features/intro/presentation/ui/intro_page.dart +++ b/lib/features/intro/presentation/ui/intro_page.dart @@ -1,7 +1,6 @@ import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:shia_game_flutter/common_ui/resources/my_assets.dart'; -import 'package:shia_game_flutter/common_ui/resources/my_spaces.dart'; import 'package:shia_game_flutter/common_ui/resources/my_text_style.dart'; import 'package:shia_game_flutter/common_ui/theme/my_theme.dart'; import 'package:shia_game_flutter/core/utils/my_localization.dart'; @@ -29,10 +28,7 @@ class IntroPage extends GetView { ), child: Stack( alignment: Alignment.center, - children: [ - _logo(context), - _bottomLoading(context), - ], + children: [_logo(context), _bottomLoading(context)], ), ), ), @@ -40,63 +36,44 @@ class IntroPage extends GetView { } Stack _logo(BuildContext context) { - return const Stack( + return Stack( clipBehavior: Clip.none, alignment: Alignment.center, children: [ - MyImage(asset: MyAssets.shiaMind), + const MyImage(asset: MyAssets.shiaMind), PositionedDirectional( - top: -124, - end: -62, - child: MyImage( - asset: MyAssets.question, - ), + top: -124.h, + end: -62.w, + child: const MyImage(asset: MyAssets.question), ), PositionedDirectional( - top: -157, - end: 60, - child: MyImage( - asset: MyAssets.question, - size: 30, - ), + top: -157.h, + end: 60.w, + child: const MyImage(asset: MyAssets.question, size: 30), ), PositionedDirectional( - top: -90, - start: -30, - child: MyImage( - asset: MyAssets.question, - size: 25, - ), + top: -90.h, + start: -30.w, + child: const MyImage(asset: MyAssets.question, size: 25), ), PositionedDirectional( - bottom: -90, - start: -30, - child: MyImage( - asset: MyAssets.question, - ), + bottom: -90.h, + start: -30.w, + child: const MyImage(asset: MyAssets.question), ), PositionedDirectional( - bottom: -90, - end: -62, - child: MyImage( - asset: MyAssets.question, - size: 15, - ), + bottom: -90.h, + end: -62.w, + child: const MyImage(asset: MyAssets.question, size: 15), ), PositionedDirectional( - bottom: -10, - end: 70, - child: MyImage( - asset: MyAssets.question, - size: 15, - ), + bottom: -10.h, + end: 70.w, + child: const MyImage(asset: MyAssets.question, size: 15), ), PositionedDirectional( - top: -15, - child: MyImage( - asset: MyAssets.introStar, - size: 75, - ), + top: -15.h, + child: const MyImage(asset: MyAssets.introStar, size: 75), ), ], ); @@ -104,14 +81,14 @@ class IntroPage extends GetView { Positioned _bottomLoading(BuildContext context) { return Positioned( - bottom: MySpaces.s16, + bottom: 16.h, child: Column( - spacing: MySpaces.s10, + spacing: 10.h, mainAxisSize: MainAxisSize.min, children: [ Text( context.translate.loading, - style: Lexend.regular.copyWith(fontSize: MySpaces.s14), + style: Lexend.regular.copyWith(fontSize: 12.sp), ), const IntroLoading(), ], diff --git a/lib/features/intro/presentation/ui/widgets/intro_loading.dart b/lib/features/intro/presentation/ui/widgets/intro_loading.dart index d165b97..ca3836f 100644 --- a/lib/features/intro/presentation/ui/widgets/intro_loading.dart +++ b/lib/features/intro/presentation/ui/widgets/intro_loading.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:shia_game_flutter/common_ui/resources/my_spaces.dart'; +import 'package:shia_game_flutter/core/utils/screen_size.dart'; class IntroLoading extends StatelessWidget { const IntroLoading({ @@ -9,13 +9,13 @@ class IntroLoading extends StatelessWidget { @override Widget build(BuildContext context) { return Container( - width: 188, - height: MySpaces.s16, + width: 188.w, + height: 16.h, padding: const EdgeInsetsDirectional.only( - start: MySpaces.s2, - top: MySpaces.s2, - bottom: MySpaces.s2, - end: MySpaces.s20, + start: 2, + top: 2, + bottom: 2, + end: 20, ), decoration: const ShapeDecoration( shape: StadiumBorder( @@ -26,7 +26,7 @@ class IntroLoading extends StatelessWidget { ), ), child: Container( - height: MySpaces.s14, + height: 14.h, decoration: ShapeDecoration( shape: StadiumBorder( side: BorderSide( diff --git a/lib/main.dart b/lib/main.dart index 98bea17..dedefa7 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -31,7 +31,7 @@ class MainApp extends StatelessWidget { fallbackLocale: const Locale('en', 'US'), supportedLocales: const [Locale('en', 'US')], getPages: appPages, - initialRoute: Routes.masterPage, + initialRoute: Routes.introPage, localizationsDelegates: const [ AppLocalizations.delegate, GlobalMaterialLocalizations.delegate,