|
|
@ -5,6 +5,7 @@ import 'package:hadi_hoda_flutter/common_ui/resources/my_audios.dart'; |
|
|
import 'package:hadi_hoda_flutter/common_ui/resources/my_spaces.dart'; |
|
|
import 'package:hadi_hoda_flutter/common_ui/resources/my_spaces.dart'; |
|
|
import 'package:hadi_hoda_flutter/core/utils/screen_size.dart'; |
|
|
import 'package:hadi_hoda_flutter/core/utils/screen_size.dart'; |
|
|
import 'package:hadi_hoda_flutter/core/utils/set_platform_size.dart'; |
|
|
import 'package:hadi_hoda_flutter/core/utils/set_platform_size.dart'; |
|
|
|
|
|
import 'package:hadi_hoda_flutter/core/widgets/animations/rotation_planet.dart'; |
|
|
import 'package:hadi_hoda_flutter/core/widgets/images/my_image.dart'; |
|
|
import 'package:hadi_hoda_flutter/core/widgets/images/my_image.dart'; |
|
|
import 'package:hadi_hoda_flutter/core/widgets/inkwell/my_inkwell.dart'; |
|
|
import 'package:hadi_hoda_flutter/core/widgets/inkwell/my_inkwell.dart'; |
|
|
import 'package:hadi_hoda_flutter/core/widgets/pop_scope/my_pop_scope.dart'; |
|
|
import 'package:hadi_hoda_flutter/core/widgets/pop_scope/my_pop_scope.dart'; |
|
|
@ -22,7 +23,7 @@ class LevelPage extends StatelessWidget { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
|
|
|
|
@override |
|
|
Widget build(BuildContext context) { |
|
|
Widget build(BuildContext context) { |
|
|
return Scaffold( |
|
|
return Scaffold( |
|
|
body: MyPopScope( |
|
|
body: MyPopScope( |
|
|
@ -35,9 +36,8 @@ class LevelPage extends StatelessWidget { |
|
|
child: Stack( |
|
|
child: Stack( |
|
|
alignment: Alignment.center, |
|
|
alignment: Alignment.center, |
|
|
children: [ |
|
|
children: [ |
|
|
_background(), |
|
|
|
|
|
|
|
|
_background(context), |
|
|
_path(context), |
|
|
_path(context), |
|
|
_levelLocation(context), |
|
|
|
|
|
_planets(context), |
|
|
_planets(context), |
|
|
], |
|
|
], |
|
|
), |
|
|
), |
|
|
@ -56,84 +56,104 @@ class LevelPage extends StatelessWidget { |
|
|
alignment: Alignment.center, |
|
|
alignment: Alignment.center, |
|
|
children: [ |
|
|
children: [ |
|
|
Positioned( |
|
|
Positioned( |
|
|
bottom: 0.3.h, |
|
|
|
|
|
|
|
|
bottom: 0.2.h, |
|
|
right: setSize(context: context, mobile: -40, tablet: -80), |
|
|
right: setSize(context: context, mobile: -40, tablet: -80), |
|
|
child: MyImage( |
|
|
|
|
|
image: MyAssets.planet1, |
|
|
|
|
|
size: setSize(context: context, mobile: 180), |
|
|
|
|
|
|
|
|
child: RotationPlanet( |
|
|
|
|
|
child: MyImage( |
|
|
|
|
|
image: MyAssets.planet1, |
|
|
|
|
|
size: setSize(context: context, mobile: 180), |
|
|
|
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
Positioned( |
|
|
Positioned( |
|
|
bottom: setSize(context: context, mobile: 0.65.h, tablet: 0.9.h), |
|
|
|
|
|
child: MyImage( |
|
|
|
|
|
image: MyAssets.planet2, |
|
|
|
|
|
size: setSize(context: context, mobile: 110), |
|
|
|
|
|
|
|
|
bottom: setSize(context: context, mobile: 0.5.h, tablet: 0.8.h), |
|
|
|
|
|
child: RotationPlanet( |
|
|
|
|
|
child: MyImage( |
|
|
|
|
|
image: MyAssets.planet2, |
|
|
|
|
|
size: setSize(context: context, mobile: 110), |
|
|
|
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
Positioned( |
|
|
Positioned( |
|
|
bottom: setSize(context: context, mobile: 0.8.h, tablet: 1.15.h), |
|
|
|
|
|
|
|
|
bottom: setSize(context: context, mobile: 0.55.h, tablet: 0.9.h), |
|
|
left: setSize(context: context, mobile: -120, tablet: -200), |
|
|
left: setSize(context: context, mobile: -120, tablet: -200), |
|
|
child: MyImage( |
|
|
|
|
|
image: MyAssets.planet3, |
|
|
|
|
|
size: setSize(context: context, mobile: 300), |
|
|
|
|
|
|
|
|
child: RotationPlanet( |
|
|
|
|
|
child: MyImage( |
|
|
|
|
|
image: MyAssets.planet3, |
|
|
|
|
|
size: setSize(context: context, mobile: 250), |
|
|
|
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
Positioned( |
|
|
Positioned( |
|
|
bottom: setSize(context: context, mobile: 1.3.h, tablet: 1.75.h), |
|
|
|
|
|
right: 40, |
|
|
|
|
|
child: MyImage( |
|
|
|
|
|
image: MyAssets.planet4, |
|
|
|
|
|
size: setSize(context: context, mobile: 120), |
|
|
|
|
|
|
|
|
bottom: setSize(context: context, mobile: 0.85.h, tablet: 1.4.h), |
|
|
|
|
|
right: 30, |
|
|
|
|
|
child: RotationPlanet( |
|
|
|
|
|
child: MyImage( |
|
|
|
|
|
image: MyAssets.planet4, |
|
|
|
|
|
size: setSize(context: context, mobile: 100), |
|
|
|
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
Positioned( |
|
|
Positioned( |
|
|
bottom: setSize(context: context, mobile: 1.5.h, tablet: 2.0.h), |
|
|
|
|
|
|
|
|
bottom: setSize(context: context, mobile: 0.95.h, tablet: 1.65.h), |
|
|
left: setSize(context: context, mobile: -130, tablet: -220), |
|
|
left: setSize(context: context, mobile: -130, tablet: -220), |
|
|
child: MyImage( |
|
|
|
|
|
image: MyAssets.planet5, |
|
|
|
|
|
size: setSize(context: context, mobile: 300), |
|
|
|
|
|
|
|
|
child: RotationPlanet( |
|
|
|
|
|
child: MyImage( |
|
|
|
|
|
image: MyAssets.planet5, |
|
|
|
|
|
size: setSize(context: context, mobile: 250), |
|
|
|
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
Positioned( |
|
|
Positioned( |
|
|
bottom: setSize(context: context, mobile: 1.85.h, tablet: 2.55.h), |
|
|
|
|
|
|
|
|
bottom: setSize(context: context, mobile: 1.25.h, tablet: 2.1.h), |
|
|
right: setSize(context: context, mobile: 20, tablet: 20), |
|
|
right: setSize(context: context, mobile: 20, tablet: 20), |
|
|
child: MyImage( |
|
|
|
|
|
image: MyAssets.planet6, |
|
|
|
|
|
size: setSize(context: context, mobile: 80), |
|
|
|
|
|
|
|
|
child: RotationPlanet( |
|
|
|
|
|
child: MyImage( |
|
|
|
|
|
image: MyAssets.planet6, |
|
|
|
|
|
size: setSize(context: context, mobile: 60), |
|
|
|
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
Positioned( |
|
|
Positioned( |
|
|
bottom: setSize(context: context, mobile: 1.95.h, tablet: 2.6.h), |
|
|
|
|
|
child: MyImage( |
|
|
|
|
|
image: MyAssets.planet7, |
|
|
|
|
|
size: setSize(context: context, mobile: 120), |
|
|
|
|
|
|
|
|
bottom: setSize(context: context, mobile: 1.28.h, tablet: 2.2.h), |
|
|
|
|
|
child: RotationPlanet( |
|
|
|
|
|
child: MyImage( |
|
|
|
|
|
image: MyAssets.planet7, |
|
|
|
|
|
size: setSize(context: context, mobile: 100), |
|
|
|
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
Positioned( |
|
|
Positioned( |
|
|
bottom: setSize(context: context, mobile: 2.1.h, tablet: 2.8.h), |
|
|
|
|
|
|
|
|
bottom: setSize(context: context, mobile: 1.4.h, tablet: 2.3.h), |
|
|
right: setSize(context: context, mobile: -50, tablet: -120), |
|
|
right: setSize(context: context, mobile: -50, tablet: -120), |
|
|
child: MyImage( |
|
|
|
|
|
image: MyAssets.planet8, |
|
|
|
|
|
size: setSize(context: context, mobile: 250), |
|
|
|
|
|
|
|
|
child: RotationPlanet( |
|
|
|
|
|
child: MyImage( |
|
|
|
|
|
image: MyAssets.planet8, |
|
|
|
|
|
size: setSize(context: context, mobile: 200), |
|
|
|
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
Positioned( |
|
|
Positioned( |
|
|
bottom: setSize(context: context, mobile: 2.3.h, tablet: 3.1.h), |
|
|
|
|
|
|
|
|
bottom: setSize(context: context, mobile: 1.5.h, tablet: 2.6.h), |
|
|
left: -20, |
|
|
left: -20, |
|
|
child: MyImage( |
|
|
|
|
|
image: MyAssets.planet9, |
|
|
|
|
|
size: setSize(context: context, mobile: 100), |
|
|
|
|
|
|
|
|
child: RotationPlanet( |
|
|
|
|
|
child: MyImage( |
|
|
|
|
|
image: MyAssets.planet9, |
|
|
|
|
|
size: setSize(context: context, mobile: 100), |
|
|
|
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
Positioned( |
|
|
Positioned( |
|
|
bottom: setSize(context: context, mobile: 2.5.h, tablet: 3.4.h), |
|
|
|
|
|
child: MyImage( |
|
|
|
|
|
image: MyAssets.planet10, |
|
|
|
|
|
size: setSize(context: context, mobile: 60), |
|
|
|
|
|
|
|
|
bottom: setSize(context: context, mobile: 1.58.h, tablet: 2.8.h), |
|
|
|
|
|
child: RotationPlanet( |
|
|
|
|
|
child: MyImage( |
|
|
|
|
|
image: MyAssets.planet10, |
|
|
|
|
|
size: setSize(context: context, mobile: 60), |
|
|
|
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
Positioned( |
|
|
Positioned( |
|
|
bottom: setSize(context: context, mobile: 2.55.h, tablet: 3.45.h), |
|
|
|
|
|
|
|
|
bottom: setSize(context: context, mobile: 1.65.h, tablet: 2.9.h), |
|
|
right: 20, |
|
|
right: 20, |
|
|
child: MyImage( |
|
|
child: MyImage( |
|
|
image: MyAssets.satellite, |
|
|
image: MyAssets.satellite, |
|
|
@ -141,11 +161,11 @@ class LevelPage extends StatelessWidget { |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
Positioned( |
|
|
Positioned( |
|
|
bottom: setSize(context: context, mobile: 2.6.h, tablet: 3.5.h), |
|
|
|
|
|
left: setSize(context: context, mobile: 40), |
|
|
|
|
|
|
|
|
bottom: setSize(context: context, mobile: 1.7.h, tablet: 2.9.h), |
|
|
|
|
|
left: setSize(context: context, mobile: 80, tablet: 0.2.w), |
|
|
child: MyImage( |
|
|
child: MyImage( |
|
|
image: MyAssets.planetFinal, |
|
|
image: MyAssets.planetFinal, |
|
|
size: setSize(context: context, mobile: 300), |
|
|
|
|
|
|
|
|
size: setSize(context: context, mobile: 250), |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
], |
|
|
], |
|
|
@ -153,19 +173,57 @@ class LevelPage extends StatelessWidget { |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
Positioned _path(BuildContext context) { |
|
|
|
|
|
|
|
|
Widget _path(BuildContext context) { |
|
|
return Positioned.fill( |
|
|
return Positioned.fill( |
|
|
top: setSize(context: context, mobile: 0.3.h, tablet: 0.37.h), |
|
|
|
|
|
bottom: setSize(context: context, mobile: 0.15.h, tablet: 200), |
|
|
|
|
|
left: MySpaces.s30, |
|
|
|
|
|
right: MySpaces.s30, |
|
|
|
|
|
child: LevelPath( |
|
|
|
|
|
width: setSize(context: context, tablet: 0.45.w, mobile: 0.9.w) ?? 0, |
|
|
|
|
|
height: setSize(context: context, tablet: 1.75.h, mobile: 2.55.h) ?? 0, |
|
|
|
|
|
|
|
|
top: 250, |
|
|
|
|
|
bottom: 150, |
|
|
|
|
|
right: 60, |
|
|
|
|
|
left: 60, |
|
|
|
|
|
child: Stack( |
|
|
|
|
|
alignment: Alignment.center, |
|
|
|
|
|
children: [ |
|
|
|
|
|
Positioned.fill( |
|
|
|
|
|
child: LevelPath(), |
|
|
|
|
|
), |
|
|
|
|
|
Positioned.fill(child: _levelLocation(context)), |
|
|
|
|
|
], |
|
|
), |
|
|
), |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Widget _levelLocation(BuildContext context) { |
|
|
|
|
|
return BlocBuilder<LevelBloc, LevelState>( |
|
|
|
|
|
builder: (context, state) => Stack( |
|
|
|
|
|
clipBehavior: Clip.none, |
|
|
|
|
|
children: [ |
|
|
|
|
|
...List.generate( |
|
|
|
|
|
context.read<LevelBloc>().levelList.length, |
|
|
|
|
|
(index) => Positioned( |
|
|
|
|
|
top: context.read<LevelBloc>().locationList[index].top, |
|
|
|
|
|
bottom: context.read<LevelBloc>().locationList[index].bottom, |
|
|
|
|
|
right: context.read<LevelBloc>().locationList[index].right, |
|
|
|
|
|
left: context.read<LevelBloc>().locationList[index].left, |
|
|
|
|
|
child: BlocBuilder<LevelBloc, LevelState>( |
|
|
|
|
|
buildWhen: (previous, current) => |
|
|
|
|
|
previous.chooseLevel?.id != current.chooseLevel?.id, |
|
|
|
|
|
builder: (context, state) => LevelWidget( |
|
|
|
|
|
chooseLevel: state.chooseLevel, |
|
|
|
|
|
level: context.read<LevelBloc>().levelList[index], |
|
|
|
|
|
type: context.read<LevelBloc>().getLevelType(index + 1), |
|
|
|
|
|
onTap: (LevelEntity level, LevelType type) { |
|
|
|
|
|
context.read<LevelBloc>().add( |
|
|
|
|
|
ChooseLevelEvent(level, type), |
|
|
|
|
|
); |
|
|
|
|
|
}, |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
], |
|
|
|
|
|
), |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
Widget _playButton(BuildContext context) { |
|
|
Widget _playButton(BuildContext context) { |
|
|
return BlocBuilder<LevelBloc, LevelState>( |
|
|
return BlocBuilder<LevelBloc, LevelState>( |
|
|
buildWhen: (previous, current) => |
|
|
buildWhen: (previous, current) => |
|
|
@ -196,6 +254,7 @@ class LevelPage extends StatelessWidget { |
|
|
audio: MyAudios.back, |
|
|
audio: MyAudios.back, |
|
|
child: MyImage( |
|
|
child: MyImage( |
|
|
image: MyAssets.homeButton, |
|
|
image: MyAssets.homeButton, |
|
|
|
|
|
size: setSize(context: context, tablet: 80), |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
Spacer(), |
|
|
Spacer(), |
|
|
@ -209,6 +268,7 @@ class LevelPage extends StatelessWidget { |
|
|
onTap: () => context.read<LevelBloc>().changeMute(), |
|
|
onTap: () => context.read<LevelBloc>().changeMute(), |
|
|
child: MyImage( |
|
|
child: MyImage( |
|
|
image: snapshot.data == 0 ? MyAssets.musicOff : MyAssets.musicOn, |
|
|
image: snapshot.data == 0 ? MyAssets.musicOff : MyAssets.musicOn, |
|
|
|
|
|
size: setSize(context: context, tablet: 80), |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
@ -217,48 +277,10 @@ class LevelPage extends StatelessWidget { |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
Widget _background() { |
|
|
|
|
|
return Stack( |
|
|
|
|
|
children: [ |
|
|
|
|
|
MyImage( |
|
|
|
|
|
image: MyAssets.mapBackground, |
|
|
|
|
|
fit: BoxFit.cover, |
|
|
|
|
|
), |
|
|
|
|
|
], |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Widget _levelLocation(BuildContext context) { |
|
|
|
|
|
return BlocBuilder<LevelBloc, LevelState>( |
|
|
|
|
|
builder: (context, state) => Positioned.fill( |
|
|
|
|
|
child: Stack( |
|
|
|
|
|
children: [ |
|
|
|
|
|
...List.generate( |
|
|
|
|
|
context.read<LevelBloc>().levelList.length, |
|
|
|
|
|
(index) => Positioned( |
|
|
|
|
|
top: context.read<LevelBloc>().locationList[index].top, |
|
|
|
|
|
bottom: context.read<LevelBloc>().locationList[index].bottom, |
|
|
|
|
|
right: context.read<LevelBloc>().locationList[index].right, |
|
|
|
|
|
left: context.read<LevelBloc>().locationList[index].left, |
|
|
|
|
|
child: BlocBuilder<LevelBloc, LevelState>( |
|
|
|
|
|
buildWhen: (previous, current) => |
|
|
|
|
|
previous.chooseLevel?.id != current.chooseLevel?.id, |
|
|
|
|
|
builder: (context, state) => LevelWidget( |
|
|
|
|
|
chooseLevel: state.chooseLevel, |
|
|
|
|
|
level: context.read<LevelBloc>().levelList[index], |
|
|
|
|
|
type: context.read<LevelBloc>().getLevelType(index + 1), |
|
|
|
|
|
onTap: (LevelEntity level, LevelType type) { |
|
|
|
|
|
context.read<LevelBloc>().add( |
|
|
|
|
|
ChooseLevelEvent(level, type), |
|
|
|
|
|
); |
|
|
|
|
|
}, |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
], |
|
|
|
|
|
), |
|
|
|
|
|
), |
|
|
|
|
|
|
|
|
Widget _background(BuildContext context) { |
|
|
|
|
|
return MyImage( |
|
|
|
|
|
image: MyAssets.mapBackground, |
|
|
|
|
|
fit: BoxFit.cover, |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |