import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:hadi_hoda_flutter/common_ui/resources/my_assets.dart'; import 'package:hadi_hoda_flutter/core/utils/my_image.dart'; import 'package:hadi_hoda_flutter/core/utils/screen_size.dart'; import 'package:hadi_hoda_flutter/features/home/presentation/bloc/home_bloc.dart'; import 'package:hadi_hoda_flutter/features/home/presentation/ui/widgets/bottom_path.dart'; import 'package:hadi_hoda_flutter/features/home/presentation/ui/widgets/mission_widget.dart'; import 'package:hadi_hoda_flutter/features/home/presentation/ui/widgets/top_path.dart'; class HomePage extends StatelessWidget { const HomePage({super.key}); @override Widget build(BuildContext context) { return Scaffold( body: SingleChildScrollView( child: Stack( alignment: Alignment.center, children: [ _background(), _topPath(context), _bottomPath(context), ], ), ), ); } MyImage _background() { return MyImage(image: MyAssets.mapBackground, fit: BoxFit.cover); } Positioned _topPath(BuildContext context) { return Positioned( top: context.heightScreen * 0.16, left: context.widthScreen * 0.15, child: Stack( children: [ TopPath( height: 950, width: context.widthScreen * 0.6, ), ...List.generate( context.read().topLocationList.length, (index) => Positioned( top: context.read().topLocationList[index].top, bottom: context.read().topLocationList[index].bottom, right: context.read().topLocationList[index].right, left: context.read().topLocationList[index].left, child: MissionWidget( index: context.read().topLocationList[index].index ?? 0, ), ), ), ], ), ); } Positioned _bottomPath(BuildContext context) { return Positioned( bottom: context.heightScreen * 0.12, left: context.widthScreen * 0.2, child: Stack( clipBehavior: Clip.none, children: [ BottomPath( width: context.widthScreen * 0.75, height: context.heightScreen * 0.65, ), ...List.generate( context.read().bottomLocationList.length, (index) => Positioned( top: context.read().bottomLocationList[index].top, bottom: context.read().bottomLocationList[index].bottom, right: context.read().bottomLocationList[index].right, left: context.read().bottomLocationList[index].left, child: MissionWidget( index: context.read().bottomLocationList[index].index ?? 0, ), ), ), ], ), ); } }