Browse Source

fix: bottom path responsive

pull/20/head
AmirrezaChegini 3 weeks ago
parent
commit
c707a424f7
  1. 2
      lib/features/level/presentation/bloc/level_bloc.dart
  2. 5
      lib/features/level/presentation/ui/level_page.dart
  3. 22
      lib/features/level/presentation/ui/widgets/bottom_path.dart

2
lib/features/level/presentation/bloc/level_bloc.dart

@ -43,7 +43,7 @@ class LevelBloc extends Bloc<LevelEvent, LevelState> {
LevelLocation(bottom: 50, left: 100, index: 2),
LevelLocation(bottom: 150, left: 60, index: 3),
LevelLocation(bottom: 210, left: 110, index: 4),
LevelLocation(bottom: 250, right: 60, index: 5),
LevelLocation(bottom: 260, right: 70, index: 5),
LevelLocation(top: 170, right: 40, index: 6),
LevelLocation(top: 70, right: 70, index: 7),
LevelLocation(top: -20, right: 70, index: 8),

5
lib/features/level/presentation/ui/level_page.dart

@ -133,10 +133,7 @@ class LevelPage extends StatelessWidget {
builder: (context, state) => Stack(
clipBehavior: Clip.none,
children: [
BottomPath(
width: context.widthScreen * 0.75,
height: context.heightScreen * 0.65,
),
BottomPath(),
...List.generate(
context.read<LevelBloc>().bottom8LevelList.length,
(index) => Positioned(

22
lib/features/level/presentation/ui/widgets/bottom_path.dart

@ -1,34 +1,28 @@
import 'package:flutter/material.dart';
import 'package:hadi_hoda_flutter/common_ui/resources/my_colors.dart';
import 'package:hadi_hoda_flutter/core/utils/screen_size.dart';
import 'package:path_drawing/path_drawing.dart';
class BottomPath extends StatelessWidget {
const BottomPath({
super.key,
this.width = 500,
this.height = 1523,
this.color = Colors.white,
});
const BottomPath({super.key});
final double width;
final double height;
final Color color;
@override
Widget build(BuildContext context) {
return CustomPaint(
painter: _Path(color),
painter: _Path(),
size: Size(
width,
height,
context.widthScreen * 0.76,
context.heightScreen * 0.64,
), // or Size.infinite inside a parent with constraints
);
}
}
class _Path extends CustomPainter {
_Path(this.color);
const _Path();
final Color color;
final Color color = MyColors.white;
// SVG viewBox
static const double _vbW = 500;

Loading…
Cancel
Save