You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
2.1 KiB
63 lines
2.1 KiB
import 'package:flutter/material.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
import 'package:hadi_hoda_flutter/common_ui/resources/my_colors.dart';
|
|
import 'package:hadi_hoda_flutter/common_ui/resources/my_spaces.dart';
|
|
import 'package:hadi_hoda_flutter/common_ui/resources/my_text_style.dart';
|
|
import 'package:hadi_hoda_flutter/core/utils/my_localization.dart';
|
|
import 'package:hadi_hoda_flutter/features/intro/presentation/bloc/intro_bloc.dart';
|
|
import 'package:hadi_hoda_flutter/features/intro/presentation/bloc/intro_event.dart';
|
|
import 'package:hadi_hoda_flutter/features/intro/presentation/bloc/intro_state.dart';
|
|
|
|
class IntroPage extends StatelessWidget {
|
|
const IntroPage({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
body: SizedBox.expand(
|
|
child: GestureDetector(
|
|
onTap: () => context.read<IntroBloc>().add(ChangeIntroEvent()),
|
|
child: Stack(
|
|
children: [
|
|
_mainScreen(),
|
|
_skipButton(context),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
BlocBuilder<IntroBloc, IntroState> _mainScreen() {
|
|
return BlocBuilder<IntroBloc, IntroState>(
|
|
builder: (context, state) => AnimatedSwitcher(
|
|
duration: Duration(milliseconds: 200),
|
|
reverseDuration: Duration(milliseconds: 200),
|
|
switchInCurve: Curves.linear,
|
|
switchOutCurve: Curves.linear,
|
|
child: context.read<IntroBloc>().intros[state.currentIntro],
|
|
transitionBuilder: (child, animation) =>
|
|
FadeTransition(opacity: animation, child: child),
|
|
),
|
|
);
|
|
}
|
|
|
|
PositionedDirectional _skipButton(BuildContext context) {
|
|
return PositionedDirectional(
|
|
start: MySpaces.s30,
|
|
bottom: MySpaces.s16,
|
|
child: TextButton(
|
|
onPressed: () => context.read<IntroBloc>().goToLevelPage(),
|
|
style: TextButton.styleFrom(
|
|
foregroundColor: MyColors.white.withValues(alpha: 0.7),
|
|
),
|
|
child: Text(
|
|
context.translate.skip,
|
|
style: MYTextStyle.button2.copyWith(
|
|
color: MyColors.white.withValues(alpha: 0.7),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|