Browse Source

fix: intro

pull/10/head
AmirrezaChegini 1 week ago
parent
commit
74cfdc144d
  1. 4
      lib/core/utils/screen_size.dart
  2. 75
      lib/features/intro/presentation/ui/intro_page.dart
  3. 16
      lib/features/intro/presentation/ui/widgets/intro_loading.dart
  4. 2
      lib/main.dart

4
lib/core/utils/screen_size.dart

@ -6,8 +6,8 @@ extension ScreenSize on BuildContext {
double get heightScreen => MediaQuery.sizeOf(this).height; 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 w => Get.context!.widthScreen * this / 375;
double get h => Get.context!.heightScreen * this / 812; 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());
} }

75
lib/features/intro/presentation/ui/intro_page.dart

@ -1,7 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.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_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/resources/my_text_style.dart';
import 'package:shia_game_flutter/common_ui/theme/my_theme.dart'; import 'package:shia_game_flutter/common_ui/theme/my_theme.dart';
import 'package:shia_game_flutter/core/utils/my_localization.dart'; import 'package:shia_game_flutter/core/utils/my_localization.dart';
@ -29,10 +28,7 @@ class IntroPage extends GetView<IntroController> {
), ),
child: Stack( child: Stack(
alignment: Alignment.center, alignment: Alignment.center,
children: [
_logo(context),
_bottomLoading(context),
],
children: [_logo(context), _bottomLoading(context)],
), ),
), ),
), ),
@ -40,63 +36,44 @@ class IntroPage extends GetView<IntroController> {
} }
Stack _logo(BuildContext context) { Stack _logo(BuildContext context) {
return const Stack(
return Stack(
clipBehavior: Clip.none, clipBehavior: Clip.none,
alignment: Alignment.center, alignment: Alignment.center,
children: [ children: [
MyImage(asset: MyAssets.shiaMind),
const MyImage(asset: MyAssets.shiaMind),
PositionedDirectional( PositionedDirectional(
top: -124,
end: -62,
child: MyImage(
asset: MyAssets.question,
),
top: -124.h,
end: -62.w,
child: const MyImage(asset: MyAssets.question),
), ),
PositionedDirectional( 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( 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( PositionedDirectional(
bottom: -90,
start: -30,
child: MyImage(
asset: MyAssets.question,
),
bottom: -90.h,
start: -30.w,
child: const MyImage(asset: MyAssets.question),
), ),
PositionedDirectional( 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( 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( 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<IntroController> {
Positioned _bottomLoading(BuildContext context) { Positioned _bottomLoading(BuildContext context) {
return Positioned( return Positioned(
bottom: MySpaces.s16,
bottom: 16.h,
child: Column( child: Column(
spacing: MySpaces.s10,
spacing: 10.h,
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
Text( Text(
context.translate.loading, context.translate.loading,
style: Lexend.regular.copyWith(fontSize: MySpaces.s14),
style: Lexend.regular.copyWith(fontSize: 12.sp),
), ),
const IntroLoading(), const IntroLoading(),
], ],

16
lib/features/intro/presentation/ui/widgets/intro_loading.dart

@ -1,5 +1,5 @@
import 'package:flutter/material.dart'; 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 { class IntroLoading extends StatelessWidget {
const IntroLoading({ const IntroLoading({
@ -9,13 +9,13 @@ class IntroLoading extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
width: 188,
height: MySpaces.s16,
width: 188.w,
height: 16.h,
padding: const EdgeInsetsDirectional.only( 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( decoration: const ShapeDecoration(
shape: StadiumBorder( shape: StadiumBorder(
@ -26,7 +26,7 @@ class IntroLoading extends StatelessWidget {
), ),
), ),
child: Container( child: Container(
height: MySpaces.s14,
height: 14.h,
decoration: ShapeDecoration( decoration: ShapeDecoration(
shape: StadiumBorder( shape: StadiumBorder(
side: BorderSide( side: BorderSide(

2
lib/main.dart

@ -31,7 +31,7 @@ class MainApp extends StatelessWidget {
fallbackLocale: const Locale('en', 'US'), fallbackLocale: const Locale('en', 'US'),
supportedLocales: const [Locale('en', 'US')], supportedLocales: const [Locale('en', 'US')],
getPages: appPages, getPages: appPages,
initialRoute: Routes.masterPage,
initialRoute: Routes.introPage,
localizationsDelegates: const [ localizationsDelegates: const [
AppLocalizations.delegate, AppLocalizations.delegate,
GlobalMaterialLocalizations.delegate, GlobalMaterialLocalizations.delegate,

Loading…
Cancel
Save