diff --git a/.gitignore b/.gitignore index 3820a95..fb24cf0 100644 --- a/.gitignore +++ b/.gitignore @@ -32,6 +32,9 @@ migrate_working_dir/ .pub/ /build/ /coverage/ +/pubspec.lock +/.metadata +/assets/svg/*.vec # Symbolication related app.*.symbols diff --git a/analysis_options.yaml b/analysis_options.yaml index f9b3034..31e4275 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1 +1,14 @@ include: package:flutter_lints/flutter.yaml + +linter: + rules: + prefer_const_constructors: true + prefer_const_declarations: true + prefer_const_constructors_in_immutables: true + prefer_final_fields: true + prefer_final_locals: true + avoid_classes_with_only_static_members: true + avoid_print: true + always_declare_return_types: true + use_key_in_widget_constructors: true + require_trailing_commas: true \ No newline at end of file diff --git a/compile_svg.zsh b/compile_svg.zsh new file mode 100755 index 0000000..702da25 --- /dev/null +++ b/compile_svg.zsh @@ -0,0 +1,4 @@ +for f in assets/svg/*.svg; do + echo "Compiling $f" + fvm dart run vector_graphics_compiler -i "$f" -o "${f}.vec" +done \ No newline at end of file diff --git a/lib/common_ui/resources/my_assets.dart b/lib/common_ui/resources/my_assets.dart index 59ccf34..fb7beba 100644 --- a/lib/common_ui/resources/my_assets.dart +++ b/lib/common_ui/resources/my_assets.dart @@ -41,38 +41,38 @@ class MyAssets { static const String giftBackground = 'assets/images/gift_background.png'; /// SVG - static const String closeBtn = 'assets/svg/close_btn.svg'; - static const String musicOff = 'assets/svg/music_off.svg'; - static const String musicOn = 'assets/svg/music_on.svg'; - static const String button = 'assets/svg/button.svg'; - static const String buttonTablet = 'assets/svg/button_tablet.svg'; - static const String button2 = 'assets/svg/button_2.svg'; - static const String button2Tablet = 'assets/svg/button_2_tablet.svg'; - static const String button3 = 'assets/svg/button_3.svg'; - static const String button3Tablet = 'assets/svg/button_3_tablet.svg'; - static const String theme = 'assets/svg/theme.svg'; - static const String facebook = 'assets/svg/facebook.svg'; - static const String whatsapp = 'assets/svg/whatsapp.svg'; - static const String youtube = 'assets/svg/youtube.svg'; - static const String instagram = 'assets/svg/instagram.svg'; - static const String language = 'assets/svg/language.svg'; - static const String newHorizon = 'assets/svg/new_horizon.svg'; - static const String home = 'assets/svg/home.svg'; - static const String music = 'assets/svg/music.svg'; - static const String done = 'assets/svg/done.svg'; - static const String correct = 'assets/svg/correct.svg'; - static const String wrong = 'assets/svg/wrong.svg'; - static const String handPoint = 'assets/svg/hand_point.svg'; - static const String location = 'assets/svg/location.svg'; - static const String doneRounded = 'assets/svg/done_rounded.svg'; - static const String lang = 'assets/svg/lang.svg'; - static const String unMusic = 'assets/svg/unmusic.svg'; - static const String globe = 'assets/svg/globe.svg'; - static const String homeButton = 'assets/svg/home_button.svg'; - static const String diamondContainer = 'assets/svg/diamond_container.svg'; - static const String iconPlay = 'assets/svg/icon_play.svg'; - static const String iconNotif = 'assets/svg/icon_notif.svg'; - static const String iconPlayVideo = 'assets/svg/icon_play_video.svg'; + static const String closeBtn = 'assets/svg/close_btn.svg.vec'; + static const String musicOff = 'assets/svg/music_off.svg.vec'; + static const String musicOn = 'assets/svg/music_on.svg.vec'; + static const String button = 'assets/svg/button.svg.vec.vec'; + static const String buttonTablet = 'assets/svg/button_tablet.svg.vec'; + static const String button2 = 'assets/svg/button_2.svg.vec'; + static const String button2Tablet = 'assets/svg/button_2_tablet.svg.vec'; + static const String button3 = 'assets/svg/button_3.svg.vec'; + static const String button3Tablet = 'assets/svg/button_3_tablet.svg.vec'; + static const String theme = 'assets/svg/theme.svg.vec'; + static const String facebook = 'assets/svg/facebook.svg.vec'; + static const String whatsapp = 'assets/svg/whatsapp.svg.vec'; + static const String youtube = 'assets/svg/youtube.svg.vec'; + static const String instagram = 'assets/svg/instagram.svg.vec'; + static const String language = 'assets/svg/language.svg.vec'; + static const String newHorizon = 'assets/svg/new_horizon.svg.vec'; + static const String home = 'assets/svg/home.svg.vec'; + static const String music = 'assets/svg/music.svg.vec'; + static const String done = 'assets/svg/done.svg.vec'; + static const String correct = 'assets/svg/correct.svg.vec'; + static const String wrong = 'assets/svg/wrong.svg.vec'; + static const String handPoint = 'assets/svg/hand_point.svg.vec'; + static const String location = 'assets/svg/location.svg.vec'; + static const String doneRounded = 'assets/svg/done_rounded.svg.vec'; + static const String lang = 'assets/svg/lang.svg.vec'; + static const String unMusic = 'assets/svg/unmusic.svg.vec'; + static const String globe = 'assets/svg/globe.svg.vec'; + static const String homeButton = 'assets/svg/home_button.svg.vec'; + static const String diamondContainer = 'assets/svg/diamond_container.svg.vec'; + static const String iconPlay = 'assets/svg/icon_play.svg.vec'; + static const String iconNotif = 'assets/svg/icon_notif.svg.vec'; + static const String iconPlayVideo = 'assets/svg/icon_play_video.svg.vec'; static final List images = [ backgroundHome, diff --git a/lib/core/routers/hero_dialog_route.dart b/lib/core/routers/hero_dialog_route.dart index 54a199f..b191512 100644 --- a/lib/core/routers/hero_dialog_route.dart +++ b/lib/core/routers/hero_dialog_route.dart @@ -25,7 +25,7 @@ class HeroDialogRoute extends PageRoute { bool get maintainState => false; @override - Color get barrierColor => Color(0XFF322386).withValues(alpha: 0.3); // Or your desired barrier color + Color get barrierColor => const Color(0XFF322386).withValues(alpha: 0.3); // Or your desired barrier color @override Widget buildPage(BuildContext context, Animation animation, Animation secondaryAnimation) { diff --git a/lib/core/routers/my_routes.dart b/lib/core/routers/my_routes.dart index e149e3c..07b7cd7 100644 --- a/lib/core/routers/my_routes.dart +++ b/lib/core/routers/my_routes.dart @@ -95,7 +95,7 @@ GoRouter _appPages() => GoRouter( name: Routes.languagePage, path: Routes.languagePage, builder: (context, state) => BlocProvider( - create: (context) => LanguageBloc()..add(InitLanguageEvent()), + create: (context) => LanguageBloc()..add(const InitLanguageEvent()), child: const LanguagePage(), ), ), diff --git a/lib/core/utils/storage_path.dart b/lib/core/utils/storage_path.dart index 56a6746..01e9543 100644 --- a/lib/core/utils/storage_path.dart +++ b/lib/core/utils/storage_path.dart @@ -3,6 +3,10 @@ import 'dart:io'; import 'package:path_provider/path_provider.dart'; class StoragePath { + static const StoragePath _i = StoragePath._internal(); + const StoragePath._internal(); + factory StoragePath() => _i; + static Directory documentDir = Directory(''); static Future getDocumentDir() async { diff --git a/lib/core/widgets/animations/fade_anim.dart b/lib/core/widgets/animations/fade_anim.dart index 0a5e40b..2db0e92 100644 --- a/lib/core/widgets/animations/fade_anim.dart +++ b/lib/core/widgets/animations/fade_anim.dart @@ -19,8 +19,8 @@ class _FadeAnimState extends State super.initState(); _controller = AnimationController( vsync: this, - duration: Duration(milliseconds: 500), - reverseDuration: Duration(seconds: 500), + duration: const Duration(milliseconds: 500), + reverseDuration: const Duration(seconds: 500), ); _animation = Tween( begin: 0, diff --git a/lib/core/widgets/animations/fade_anim_delayed.dart b/lib/core/widgets/animations/fade_anim_delayed.dart index 1e925f0..ea9f655 100644 --- a/lib/core/widgets/animations/fade_anim_delayed.dart +++ b/lib/core/widgets/animations/fade_anim_delayed.dart @@ -24,8 +24,8 @@ class _FadeAnimDelayedState extends State super.initState(); _controller = AnimationController( vsync: this, - duration: Duration(milliseconds: 500), - reverseDuration: Duration(seconds: 500), + duration: const Duration(milliseconds: 500), + reverseDuration: const Duration(seconds: 500), ); _animation = Tween( begin: 0, diff --git a/lib/core/widgets/animations/globe_animation.dart b/lib/core/widgets/animations/globe_animation.dart index 4911704..779d265 100644 --- a/lib/core/widgets/animations/globe_animation.dart +++ b/lib/core/widgets/animations/globe_animation.dart @@ -25,8 +25,8 @@ class _GlobeAnimationState extends State super.initState(); _controller = AnimationController( vsync: this, - duration: Duration(seconds: 1), - reverseDuration: Duration(seconds: 1), + duration: const Duration(seconds: 1), + reverseDuration: const Duration(seconds: 1), ); _animation = Tween( begin: 1, @@ -39,15 +39,15 @@ class _GlobeAnimationState extends State super.didUpdateWidget(oldWidget); if (widget.state) { _controller.repeat(reverse: true); - _timer = Timer.periodic(Duration(seconds: 1), (timer) { + _timer = Timer.periodic(const Duration(seconds: 1), (timer) { if (_gradient == null) { if (!mounted) return; setState(() { _gradient = RadialGradient( colors: [ - Color(0XFFDFCD00), - Color(0XFFDFCD00).withValues(alpha: 0.35), - Color(0XFFDFCD00).withValues(alpha: 0), + const Color(0XFFDFCD00), + const Color(0XFFDFCD00).withValues(alpha: 0.35), + const Color(0XFFDFCD00).withValues(alpha: 0), ], center: Alignment.center, ); @@ -66,9 +66,9 @@ class _GlobeAnimationState extends State setState(() { _gradient = RadialGradient( colors: [ - Color(0XFFDFCD00).withValues(alpha: 0), - Color(0XFFDFCD00).withValues(alpha: 0), - Color(0XFFDFCD00).withValues(alpha: 0), + const Color(0XFFDFCD00).withValues(alpha: 0), + const Color(0XFFDFCD00).withValues(alpha: 0), + const Color(0XFFDFCD00).withValues(alpha: 0), ], center: Alignment.center, ); @@ -94,7 +94,7 @@ class _GlobeAnimationState extends State alignment: Alignment.center, child: AnimatedContainer( duration: const Duration(milliseconds: 500), - padding: EdgeInsets.all(MySpaces.s0), + padding: const EdgeInsets.all(MySpaces.s0), decoration: BoxDecoration(gradient: _gradient), child: child, ), diff --git a/lib/core/widgets/animations/rotation_anim.dart b/lib/core/widgets/animations/rotation_anim.dart index ea4d9e9..b588fdd 100644 --- a/lib/core/widgets/animations/rotation_anim.dart +++ b/lib/core/widgets/animations/rotation_anim.dart @@ -19,7 +19,7 @@ class _RotationAnimState extends State super.initState(); _controller = AnimationController( vsync: this, - duration: Duration(seconds: 20), + duration: const Duration(seconds: 20), ); _animation = Tween( begin: 0, diff --git a/lib/core/widgets/animations/scale_anim.dart b/lib/core/widgets/animations/scale_anim.dart index e76c247..214be38 100644 --- a/lib/core/widgets/animations/scale_anim.dart +++ b/lib/core/widgets/animations/scale_anim.dart @@ -20,8 +20,8 @@ class _ScaleAnimState extends State super.initState(); _controller = AnimationController( vsync: this, - duration: Duration(milliseconds: 200), - reverseDuration: Duration(milliseconds: 200), + duration: const Duration(milliseconds: 200), + reverseDuration: const Duration(milliseconds: 200), ); _animation = Tween( begin: 0, diff --git a/lib/core/widgets/animations/ship_anim.dart b/lib/core/widgets/animations/ship_anim.dart index 217ca2d..ddcdd3e 100644 --- a/lib/core/widgets/animations/ship_anim.dart +++ b/lib/core/widgets/animations/ship_anim.dart @@ -22,8 +22,8 @@ class _ShipAnimState extends State super.initState(); _controller = AnimationController( vsync: this, - duration: Duration(seconds: 15), - reverseDuration: Duration(seconds: 15), + duration: const Duration(seconds: 15), + reverseDuration: const Duration(seconds: 15), )..repeat(); } diff --git a/lib/core/widgets/animations/slide_anim.dart b/lib/core/widgets/animations/slide_anim.dart index 14c02c9..e62368d 100644 --- a/lib/core/widgets/animations/slide_anim.dart +++ b/lib/core/widgets/animations/slide_anim.dart @@ -19,7 +19,7 @@ class SlideAnim extends StatefulWidget { class _SlideAnimState extends State with SingleTickerProviderStateMixin { late Animation _animation; - final List offsetList = [ + final List offsetList = const [ Offset(-2, -2), Offset(2, -2), Offset(-2, 2), diff --git a/lib/core/widgets/animations/slide_down_fade.dart b/lib/core/widgets/animations/slide_down_fade.dart index e035c65..0ef73a7 100644 --- a/lib/core/widgets/animations/slide_down_fade.dart +++ b/lib/core/widgets/animations/slide_down_fade.dart @@ -25,8 +25,8 @@ class _SlideDownFadeState extends State super.initState(); _controller = AnimationController( vsync: this, - duration: Duration(milliseconds: 500), - reverseDuration: Duration(milliseconds: 500), + duration: const Duration(milliseconds: 500), + reverseDuration: const Duration(milliseconds: 500), ); _fadeAnim = Tween( @@ -35,7 +35,7 @@ class _SlideDownFadeState extends State ).animate(CurvedAnimation(parent: _controller, curve: Curves.easeIn)); _slideAnim = Tween( - begin: Offset(0, -0.1), + begin: const Offset(0, -0.1), end: Offset.zero, ).animate(CurvedAnimation(parent: _controller, curve: Curves.easeIn)); startAnim(); diff --git a/lib/core/widgets/animations/slide_up_fade.dart b/lib/core/widgets/animations/slide_up_fade.dart index 5b9dda4..8df3866 100644 --- a/lib/core/widgets/animations/slide_up_fade.dart +++ b/lib/core/widgets/animations/slide_up_fade.dart @@ -25,8 +25,8 @@ class _SlideUpFadeState extends State super.initState(); _controller = AnimationController( vsync: this, - duration: Duration(milliseconds: 500), - reverseDuration: Duration(milliseconds: 500), + duration: const Duration(milliseconds: 500), + reverseDuration: const Duration(milliseconds: 500), ); _fadeAnim = Tween( @@ -35,7 +35,7 @@ class _SlideUpFadeState extends State ).animate(CurvedAnimation(parent: _controller, curve: Curves.easeIn)); _slideAnim = Tween( - begin: Offset(0, 0.1), + begin: const Offset(0, 0.1), end: Offset.zero, ).animate(CurvedAnimation(parent: _controller, curve: Curves.easeIn)); startAnim(); diff --git a/lib/core/widgets/answer_box/styles/picture_box.dart b/lib/core/widgets/answer_box/styles/picture_box.dart index 6566b12..c7d4689 100644 --- a/lib/core/widgets/answer_box/styles/picture_box.dart +++ b/lib/core/widgets/answer_box/styles/picture_box.dart @@ -42,13 +42,13 @@ class AnswerPictureBox extends StatelessWidget { AspectRatio( aspectRatio: 1, child: AnimatedSwitcher( - duration: Duration(milliseconds: 150), - reverseDuration: Duration(milliseconds: 150), + duration: const Duration(milliseconds: 150), + reverseDuration: const Duration(milliseconds: 150), switchInCurve: Curves.linear, switchOutCurve: Curves.linear, child: selected && (index != correctAnswer) ? Gif( - key: Key('1'), + key: const Key('1'), width: context.widthScreen, height: context.heightScreen, image: FileImage(File(image)), @@ -59,7 +59,7 @@ class AnswerPictureBox extends StatelessWidget { colorBlendMode: BlendMode.color, ) : Gif( - key: Key('2'), + key: const Key('2'), width: context.widthScreen, height: context.heightScreen, image: FileImage(File(image)), @@ -80,7 +80,7 @@ class AnswerPictureBox extends StatelessWidget { child: Container( width: MySpaces.s34, alignment: Alignment.center, - decoration: BoxDecoration( + decoration: const BoxDecoration( color: Color(0XFFF2F7FF), borderRadius: BorderRadius.vertical( bottom: Radius.circular(10), @@ -89,7 +89,7 @@ class AnswerPictureBox extends StatelessWidget { child: Text( '$index', style: MYTextStyle.titr1.copyWith( - color: Color(0XFF9B85D8), + color: const Color(0XFF9B85D8), ), ), ), @@ -114,7 +114,7 @@ class _CustomShapePainter extends CustomPainter { @override void paint(Canvas canvas, Size size) { final Paint strokePaint = Paint() - ..color = Color(0XFFF2F7FF) + ..color = const Color(0XFFF2F7FF) ..style = PaintingStyle.stroke ..strokeWidth = 4; @@ -132,8 +132,8 @@ class _CustomShapeClipper extends CustomClipper { @override Path getClip(Size size) { // Original SVG dimensions to calculate the scaling factors. - final double originalWidth = 193.0; - final double originalHeight = 189.0; + const double originalWidth = 193.0; + const double originalHeight = 189.0; // Scaling factors to make the path responsive. final double scaleX = size.width / originalWidth; diff --git a/lib/core/widgets/answer_box/styles/text_box.dart b/lib/core/widgets/answer_box/styles/text_box.dart index 343e1c6..c6f82ec 100644 --- a/lib/core/widgets/answer_box/styles/text_box.dart +++ b/lib/core/widgets/answer_box/styles/text_box.dart @@ -13,9 +13,9 @@ class AnswerTextBox extends StatelessWidget { clipper: WavyBannerClipper(), child: Container( height: 90, - padding: EdgeInsets.symmetric(horizontal: MySpaces.s10), + padding: const EdgeInsets.symmetric(horizontal: MySpaces.s10), alignment: Alignment.center, - decoration: BoxDecoration( + decoration: const BoxDecoration( gradient: LinearGradient( begin: Alignment.topCenter, end: Alignment.bottomCenter, @@ -29,7 +29,7 @@ class AnswerTextBox extends StatelessWidget { text, textAlign: TextAlign.center, style: MYTextStyle.matn2.copyWith( - color: Color(0XFF322386), + color: const Color(0XFF322386), height: 1.2, ), maxLines: 5, diff --git a/lib/core/widgets/button/my_blue_button.dart b/lib/core/widgets/button/my_blue_button.dart index b90f8b1..7082d11 100644 --- a/lib/core/widgets/button/my_blue_button.dart +++ b/lib/core/widgets/button/my_blue_button.dart @@ -41,7 +41,7 @@ class MyBlueButton extends StatelessWidget { child: Text( title ?? '', style: MYTextStyle.button1.copyWith( - color: Color(0XFF1D6EFF), + color: const Color(0XFF1D6EFF), ), ), ), diff --git a/lib/core/widgets/button/my_white_button.dart b/lib/core/widgets/button/my_white_button.dart index e88b951..62f9b61 100644 --- a/lib/core/widgets/button/my_white_button.dart +++ b/lib/core/widgets/button/my_white_button.dart @@ -40,7 +40,7 @@ class MyWhiteButton extends StatelessWidget { child: Text( title ?? '', style: MYTextStyle.button1.copyWith( - color: Color(0XFFD93D16), + color: const Color(0XFFD93D16), fontSize: setSize(context: context, tablet: 60), ), ), diff --git a/lib/core/widgets/button/my_yellow_button.dart b/lib/core/widgets/button/my_yellow_button.dart index 33fc12e..d9d746c 100644 --- a/lib/core/widgets/button/my_yellow_button.dart +++ b/lib/core/widgets/button/my_yellow_button.dart @@ -41,7 +41,7 @@ class MyYellowButton extends StatelessWidget { child: Text( title ?? '', style: MYTextStyle.button1.copyWith( - color: Color(0XFFD93D16), + color: const Color(0XFFD93D16), fontSize: setSize(context: context, tablet: 60), ), ), diff --git a/lib/core/widgets/confetti/my_confetti.dart b/lib/core/widgets/confetti/my_confetti.dart deleted file mode 100644 index a5f0486..0000000 --- a/lib/core/widgets/confetti/my_confetti.dart +++ /dev/null @@ -1,60 +0,0 @@ -import 'dart:math'; - -import 'package:confetti/confetti.dart'; -import 'package:flutter/material.dart'; - -class MyConfetti extends StatelessWidget { - const MyConfetti({super.key, required this.controller}); - - final ConfettiController controller; - - @override - Widget build(BuildContext context) { - return ConfettiWidget( - confettiController: controller, - shouldLoop: false, - blastDirectionality: BlastDirectionality.explosive, - blastDirection: pi / 2, - gravity: 1, - emissionFrequency: 0.5, - numberOfParticles: 15, - particleDrag: 0.1, - colors: const [ - Colors.red, - Colors.orange, - Colors.yellow, - Colors.green, - Colors.blue, - Colors.purple, - Colors.pink, - Colors.cyan, - ], - createParticlePath: (size) { - double degToRad(double deg) => deg * (pi / 180.0); - - const numberOfPoints = 5; - final halfWidth = size.width / 2; - final externalRadius = halfWidth; - final internalRadius = halfWidth / 2.5; - final degreesPerStep = degToRad(360 / numberOfPoints); - final halfDegreesPerStep = degreesPerStep / 2; - final path = Path(); - final fullAngle = degToRad(360); - path.moveTo(size.width, halfWidth); - - for (double step = 0; step < fullAngle; step += degreesPerStep) { - path.lineTo( - halfWidth + externalRadius * cos(step), - halfWidth + externalRadius * sin(step), - ); - path.lineTo( - halfWidth + internalRadius * cos(step + halfDegreesPerStep), - halfWidth + internalRadius * sin(step + halfDegreesPerStep), - ); - } - path.close(); - return path; - }, - ); - } -} diff --git a/lib/core/widgets/dialog/about_us_dialog.dart b/lib/core/widgets/dialog/about_us_dialog.dart index 75d8241..9760fcf 100644 --- a/lib/core/widgets/dialog/about_us_dialog.dart +++ b/lib/core/widgets/dialog/about_us_dialog.dart @@ -15,7 +15,7 @@ import 'package:hadi_hoda_flutter/core/widgets/inkwell/my_inkwell.dart'; Future showAboutUsDialog({required BuildContext context}) async { await showDialog( context: context, - builder: (context) => AboutUsDialog(), + builder: (context) => const AboutUsDialog(), barrierColor: MyColors.purple.withValues(alpha: 0.82), useSafeArea: false, ); @@ -49,7 +49,7 @@ class AboutUsDialog extends StatelessWidget { Text( context.translate.about_us, style: MYTextStyle.titr3.copyWith( - color: Color(0XFF322386), + color: const Color(0XFF322386), ), ), Expanded( @@ -58,14 +58,14 @@ class AboutUsDialog extends StatelessWidget { minFontSize: 12, maxFontSize: 20, style: MYTextStyle.matn1.copyWith( - color: Color(0XFF494178), + color: const Color(0XFF494178), ), ), ), - MyImage( + const MyImage( image: MyAssets.newHorizon, ), - MyImage( + const MyImage( image: MyAssets.khadijeLogo, size: 100, ), diff --git a/lib/core/widgets/dialog/exit_dialog.dart b/lib/core/widgets/dialog/exit_dialog.dart index 9d4a7bf..b059cf9 100644 --- a/lib/core/widgets/dialog/exit_dialog.dart +++ b/lib/core/widgets/dialog/exit_dialog.dart @@ -14,7 +14,7 @@ import 'package:hadi_hoda_flutter/core/widgets/dialog/styles/dialog_button.dart' Future showExitDialog({required BuildContext context}) async { await showDialog( context: context, - builder: (context) => ExitDialog(), + builder: (context) => const ExitDialog(), barrierColor: MyColors.purple.withValues(alpha: 0.82), useSafeArea: false, ); @@ -41,11 +41,11 @@ class ExitDialog extends StatelessWidget { children: [ Text( context.translate.want_to_exit, - style: MYTextStyle.titr0.copyWith(color: Color(0XFF322386)), + style: MYTextStyle.titr0.copyWith(color: const Color(0XFF322386)), ), Text( context.translate.exit_dialog_desc, - style: MYTextStyle.titr3.copyWith(color: Color(0XFF6272A9)), + style: MYTextStyle.titr3.copyWith(color: const Color(0XFF6272A9)), textAlign: TextAlign.center, ), Row( @@ -57,12 +57,12 @@ class ExitDialog extends StatelessWidget { context.pop(); }, height: 72, - color: Color(0XFFC0BDD3), + color: const Color(0XFFC0BDD3), child: Text( context.translate.cancel, style: MYTextStyle.button2.copyWith( shadows: [ - BoxShadow( + const BoxShadow( color: Color(0XFF9895AE), offset: Offset(0, 3.32), ), @@ -77,12 +77,12 @@ class ExitDialog extends StatelessWidget { SystemNavigator.pop(); }, height: 72, - color: Color(0XFFD42427), + color: const Color(0XFFD42427), child: Text( context.translate.exit, style: MYTextStyle.button2.copyWith( shadows: [ - BoxShadow( + const BoxShadow( color: Color(0XFFC82020), offset: Offset(0, 3.32), ), diff --git a/lib/core/widgets/dialog/hadith_dialog.dart b/lib/core/widgets/dialog/hadith_dialog.dart index 0191fce..b10e197 100644 --- a/lib/core/widgets/dialog/hadith_dialog.dart +++ b/lib/core/widgets/dialog/hadith_dialog.dart @@ -53,7 +53,7 @@ class HadithDialog extends StatelessWidget { if(hadith.isNotEmpty){ return ListView.separated( itemCount: hadith.length, - separatorBuilder: (context, index) => Divider( + separatorBuilder: (context, index) => const Divider( height: 40, thickness: 1, endIndent: MySpaces.s20, @@ -64,13 +64,13 @@ class HadithDialog extends StatelessWidget { TextSpan( text: '${hadith[index].narratorName ?? ''}:\n', style: MYTextStyle.titr1.copyWith( - color: Color(0XFF494178), + color: const Color(0XFF494178), ), children: [ TextSpan( text: hadith[index].hadithText, style: MYTextStyle.matn1.copyWith( - color: Color(0XFF494178), + color: const Color(0XFF494178), ), ), ], @@ -82,7 +82,7 @@ class HadithDialog extends StatelessWidget { child: Text( context.translate.no_hadith, style: MYTextStyle.titr4.copyWith( - color: Color(0XFF494178), + color: const Color(0XFF494178), ), ), ); diff --git a/lib/core/widgets/dialog/reward_dialog.dart b/lib/core/widgets/dialog/reward_dialog.dart index cb63843..5c5ee5e 100644 --- a/lib/core/widgets/dialog/reward_dialog.dart +++ b/lib/core/widgets/dialog/reward_dialog.dart @@ -62,14 +62,14 @@ class RewardDialog extends StatelessWidget { Text( context.translate.reward, style: MYTextStyle.titr0.copyWith( - color: Color(0XFF322386), + color: const Color(0XFF322386), fontSize: 22, ), ), Text( prize.title ?? '', style: MYTextStyle.titr0.copyWith( - color: Color(0XFF322386), + color: const Color(0XFF322386), fontSize: 22, ), ), @@ -91,7 +91,7 @@ class RewardDialog extends StatelessWidget { prize.imageURL ?? '', fit: BoxFit.cover, ), - MyImage( + const MyImage( image: MyAssets.iconPlayVideo, ), ], @@ -129,7 +129,7 @@ class _CustomShapePainter extends CustomPainter { @override void paint(Canvas canvas, Size size) { final Paint strokePaint = Paint() - ..color = Color(0XFFF2F7FF) + ..color = const Color(0XFFF2F7FF) ..style = PaintingStyle.stroke ..strokeWidth = 4; @@ -147,8 +147,8 @@ class _CustomShapeClipper extends CustomClipper { @override Path getClip(Size size) { // Original SVG dimensions to calculate the scaling factors. - final double originalWidth = 193.0; - final double originalHeight = 189.0; + const double originalWidth = 193.0; + const double originalHeight = 189.0; // Scaling factors to make the path responsive. final double scaleX = size.width / originalWidth; diff --git a/lib/core/widgets/error/error_state.dart b/lib/core/widgets/error/error_state.dart index 2d6244f..23d2c4c 100644 --- a/lib/core/widgets/error/error_state.dart +++ b/lib/core/widgets/error/error_state.dart @@ -17,19 +17,19 @@ class ErrorState extends StatelessWidget { Widget build(BuildContext context) { return Column( children: [ - Spacer(), + const Spacer(), Text( context.translate.lost_connection, style: MYTextStyle.button1, ), - MyImage(image: MyAssets.error), + const MyImage(image: MyAssets.error), MySpaces.s40.gapHeight, Text( context.translate.connected_to_internet, textAlign: TextAlign.center, style: MYTextStyle.matn3, ), - Spacer(), + const Spacer(), MyBlueButton( title: context.translate.retry, onTap: onTap, diff --git a/lib/core/widgets/showcase/my_showcase_widget.dart b/lib/core/widgets/showcase/my_showcase_widget.dart index 31c7858..4b762f1 100644 --- a/lib/core/widgets/showcase/my_showcase_widget.dart +++ b/lib/core/widgets/showcase/my_showcase_widget.dart @@ -20,7 +20,7 @@ enum ShowcaseTooltipType { crossAxisAlignment: CrossAxisAlignment.center, spacing: MySpaces.s4, children: [ - MyImage( + const MyImage( image: MyAssets.handPoint, size: 50, ), @@ -44,7 +44,7 @@ enum ShowcaseTooltipType { Transform.flip( flipY: true, flipX: true, - child: MyImage( + child: const MyImage( image: MyAssets.handPoint, size: 50, ), @@ -63,7 +63,7 @@ enum ShowcaseTooltipType { ), Transform.rotate( angle: 2.5, - child: MyImage( + child: const MyImage( image: MyAssets.handPoint, size: 50, ), @@ -98,8 +98,8 @@ class MyShowcaseWidget extends StatelessWidget { return Showcase( key: globalKey ?? GlobalKey(), disableBarrierInteraction: false, - targetShapeBorder: CircleBorder(), - overlayColor: Color(0XFF0F0041), + targetShapeBorder: const CircleBorder(), + overlayColor: const Color(0XFF0F0041), overlayOpacity: 0.82, /// ToolTip tooltipPadding: EdgeInsets.zero, @@ -108,7 +108,7 @@ class MyShowcaseWidget extends StatelessWidget { targetTooltipGap: 0, toolTipSlideEndDistance: MySpaces.s6, toolTipMargin: 0, - tooltipActionConfig: TooltipActionConfig( + tooltipActionConfig: const TooltipActionConfig( gapBetweenContentAndAction: 0, ), tooltipActions: [ diff --git a/lib/core/widgets/video/my_video_player.dart b/lib/core/widgets/video/my_video_player.dart index 7e37ffb..365898a 100644 --- a/lib/core/widgets/video/my_video_player.dart +++ b/lib/core/widgets/video/my_video_player.dart @@ -30,7 +30,7 @@ class _MyVideoPlayerState extends State { _mainAudioService.stop(); _effectAudioService.stop(); _controller = PodPlayerController( - podPlayerConfig: PodPlayerConfig( + podPlayerConfig: const PodPlayerConfig( autoPlay: false, isLooping: false, wakelockEnabled: true, @@ -62,7 +62,7 @@ class _MyVideoPlayerState extends State { matchVideoAspectRatioToFrame: true, matchFrameAspectRatioToVideo: true, videoAspectRatio: _controller.videoPlayerValue?.aspectRatio ?? 16 / 9, - podProgressBarConfig: PodProgressBarConfig(), + podProgressBarConfig: const PodProgressBarConfig(), onToggleFullScreen: (isFullScreen) async { if (isFullScreen) { await MyDevice.setAllOrientations(); diff --git a/lib/features/download/presentation/bloc/download_bloc.dart b/lib/features/download/presentation/bloc/download_bloc.dart index ffe9310..af7064e 100644 --- a/lib/features/download/presentation/bloc/download_bloc.dart +++ b/lib/features/download/presentation/bloc/download_bloc.dart @@ -40,7 +40,7 @@ class DownloadBloc extends Bloc { final LoadingStreamUseCase _loadingStreamUseCase; /// ------------Variables------------ - Stream loadingStream = Stream.empty(); + Stream loadingStream = const Stream.empty(); /// ------------Controllers------------ @@ -51,7 +51,7 @@ class DownloadBloc extends Bloc { GetImagesEvent event, Emitter emit, ) async { - emit(state.copyWith(getFilesStatus: BaseInit())); + emit(state.copyWith(getFilesStatus: const BaseInit())); await _getImagesUseCase(NoParams()).then((value) { value.fold( (data) { diff --git a/lib/features/download/presentation/ui/download_page.dart b/lib/features/download/presentation/ui/download_page.dart index 7efeedd..eee353d 100644 --- a/lib/features/download/presentation/ui/download_page.dart +++ b/lib/features/download/presentation/ui/download_page.dart @@ -25,7 +25,7 @@ class DownloadPage extends StatelessWidget { height: context.heightScreen, width: context.widthScreen, decoration: BoxDecoration( - gradient: LinearGradient( + gradient: const LinearGradient( begin: Alignment.topCenter, end: Alignment.bottomCenter, colors: [ @@ -34,7 +34,7 @@ class DownloadPage extends StatelessWidget { ], ), image: DecorationImage( - image: AssetImage(MyAssets.pattern), + image: const AssetImage(MyAssets.pattern), scale: 3, repeat: ImageRepeat.repeat, colorFilter: ColorFilter.mode( @@ -74,7 +74,7 @@ class DownloadPage extends StatelessWidget { } Widget _image() { - return Stack( + return const Stack( children: [ MyImage( image: MyAssets.hadiHoda, @@ -101,7 +101,7 @@ class DownloadPage extends StatelessWidget { style: MYTextStyle.titr0, ), StreamBuilder( - initialData: DownloadEntity(), + initialData: const DownloadEntity(), stream: context.read().loadingStream, builder: (context, snapshot) => Text( '${context.translate.downloading_data} (${snapshot.data?.count.toMB ?? 0.0}mb / ${snapshot.data?.total.toMB ?? 0.0}mb)', diff --git a/lib/features/download/presentation/ui/widgets/download_loading_widget.dart b/lib/features/download/presentation/ui/widgets/download_loading_widget.dart index 933eb13..c9cd0be 100644 --- a/lib/features/download/presentation/ui/widgets/download_loading_widget.dart +++ b/lib/features/download/presentation/ui/widgets/download_loading_widget.dart @@ -19,7 +19,7 @@ class DownloadLoadingWidget extends StatelessWidget { child: Container( width: 300, height: 60, - padding: EdgeInsets.symmetric( + padding: const EdgeInsets.symmetric( vertical: MySpaces.s4, horizontal: MySpaces.s2, ), @@ -34,7 +34,7 @@ class DownloadLoadingWidget extends StatelessWidget { ), ), child: StreamBuilder( - initialData: DownloadEntity(), + initialData: const DownloadEntity(), stream: loadingStream, builder: (context, snapshot) { return Row( @@ -49,12 +49,12 @@ class DownloadLoadingWidget extends StatelessWidget { end: 260 - ((snapshot.data?.percent ?? 0) * 260 / 100), ), decoration: BoxDecoration( - color: Color(0xFF1F59BD).withValues(alpha: 0.25), + color: const Color(0xFF1F59BD).withValues(alpha: 0.25), ), child: ClipPath( clipper: BubbleClip(), child: Container( - decoration: BoxDecoration( + decoration: const BoxDecoration( gradient: RadialGradient( radius: 2, colors: [ @@ -74,7 +74,7 @@ class DownloadLoadingWidget extends StatelessWidget { child: Text( '${snapshot.data?.percent?.toInt() ?? 0}%', style: MYTextStyle.titr4.copyWith( - color: Color(0XFF6E83A8), + color: const Color(0XFF6E83A8), ), ), ), diff --git a/lib/features/guider/presentation/bloc/guider_bloc.dart b/lib/features/guider/presentation/bloc/guider_bloc.dart index 96c3750..be6db95 100644 --- a/lib/features/guider/presentation/bloc/guider_bloc.dart +++ b/lib/features/guider/presentation/bloc/guider_bloc.dart @@ -115,12 +115,12 @@ class GuiderBloc extends Bloc { ); emit( state.copyWith( - getQuestionStatus: BaseComplete(''), + getQuestionStatus: const BaseComplete(''), levelEntity: level, currentQuestion: data.questions?.first, ), ); - await Future.delayed(Duration(milliseconds: 300), () { + await Future.delayed(const Duration(milliseconds: 300), () { animationController.forward().then((value) { startShowcase(); }); diff --git a/lib/features/guider/presentation/ui/guider_page.dart b/lib/features/guider/presentation/ui/guider_page.dart index 5058822..258107b 100644 --- a/lib/features/guider/presentation/ui/guider_page.dart +++ b/lib/features/guider/presentation/ui/guider_page.dart @@ -40,8 +40,8 @@ class _GuiderPageState extends State with TickerProviderStateMixin { .read() .animationController = AnimationController( vsync: this, - duration: Duration(milliseconds: 500), - reverseDuration: Duration(milliseconds: 500), + duration: const Duration(milliseconds: 500), + reverseDuration: const Duration(milliseconds: 500), ); } @@ -64,13 +64,13 @@ class _GuiderPageState extends State with TickerProviderStateMixin { 0, ), decoration: BoxDecoration( - gradient: LinearGradient( + gradient: const LinearGradient( begin: Alignment.topCenter, end: Alignment.bottomCenter, colors: [Color(0XFF6930DA), Color(0XFF263AA1)], ), image: DecorationImage( - image: AssetImage(MyAssets.pattern), + image: const AssetImage(MyAssets.pattern), scale: 3, repeat: ImageRepeat.repeat, colorFilter: ColorFilter.mode( @@ -85,7 +85,7 @@ class _GuiderPageState extends State with TickerProviderStateMixin { android: MySpaces.s20, iOS: 50, )?.gapHeight ?? - SizedBox.shrink(), + const SizedBox.shrink(), _topButtons(context), MySpaces.s10.gapHeight, Expanded( @@ -100,7 +100,7 @@ class _GuiderPageState extends State with TickerProviderStateMixin { ), ), setPlatform(android: MySpaces.s20)?.gapHeight ?? - SizedBox.shrink(), + const SizedBox.shrink(), ], ), ), @@ -141,7 +141,7 @@ class _GuiderPageState extends State with TickerProviderStateMixin { .read() .showCaseKey['stepper_key']!, description: context.translate.showcase_stepper, - child: QuestionStepper(length: 4, currentStep: 1), + child: const QuestionStepper(length: 4, currentStep: 1), ), ); } @@ -157,7 +157,7 @@ class _GuiderPageState extends State with TickerProviderStateMixin { style: MYTextStyle.titr1.copyWith( shadows: [ BoxShadow( - offset: Offset(0, 2), + offset: const Offset(0, 2), color: MyColors.black.withValues(alpha: 0.25), ), ], @@ -172,13 +172,13 @@ class _GuiderPageState extends State with TickerProviderStateMixin { builder: (context, state) => GridView.builder( itemCount: state.currentQuestion?.answers?.length ?? 0, - physics: NeverScrollableScrollPhysics(), + physics: const NeverScrollableScrollPhysics(), shrinkWrap: true, clipBehavior: Clip.none, padding: EdgeInsets.symmetric( horizontal: setSize(context: context, tablet: 70) ?? 0, ), - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 2, crossAxisSpacing: MySpaces.s20, mainAxisSpacing: 20, @@ -186,7 +186,7 @@ class _GuiderPageState extends State with TickerProviderStateMixin { ), itemBuilder: (context, index) => state.currentQuestion?.answers?[index].imageId == null - ? SizedBox.shrink() + ? const SizedBox.shrink() : SlideAnim( controller: context.read().animationController, index: index, diff --git a/lib/features/home/presentation/ui/home_page.dart b/lib/features/home/presentation/ui/home_page.dart index 467afec..431473f 100644 --- a/lib/features/home/presentation/ui/home_page.dart +++ b/lib/features/home/presentation/ui/home_page.dart @@ -21,7 +21,7 @@ class HomePage extends StatelessWidget { return Scaffold( body: MyPopScope( child: DecoratedBox( - decoration: BoxDecoration( + decoration: const BoxDecoration( image: DecorationImage( image: AssetImage(MyAssets.backgroundHome), fit: BoxFit.cover, @@ -47,7 +47,7 @@ class HomePage extends StatelessWidget { top: setPlatform(android: MySpaces.s36, iOS: 50), end: MySpaces.s16, child: SlideDownFade( - delay: Duration(milliseconds: 200), + delay: const Duration(milliseconds: 200), child: StreamBuilder( initialData: 1, stream: context.read().volumeStream, @@ -67,7 +67,7 @@ class HomePage extends StatelessWidget { Positioned _image(BuildContext context) { return Positioned( top: setSize(context: context, mobile: 0.1.h, tablet: 0.15.h), - child: Stack( + child: const Stack( children: [ MyImage( image: MyAssets.hadiHoda, @@ -91,7 +91,7 @@ class HomePage extends StatelessWidget { right: MySpaces.s16, child: SafeArea( child: SlideUpFade( - delay: Duration(milliseconds: 200), + delay: const Duration(milliseconds: 200), child: Row( crossAxisAlignment: CrossAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.spaceBetween, diff --git a/lib/features/intro/presentation/bloc/intro_bloc.dart b/lib/features/intro/presentation/bloc/intro_bloc.dart index b863df4..34eb70c 100644 --- a/lib/features/intro/presentation/bloc/intro_bloc.dart +++ b/lib/features/intro/presentation/bloc/intro_bloc.dart @@ -37,7 +37,7 @@ class IntroBloc extends Bloc { /// ------------UseCases------------ /// ------------Variables------------ - final List intros = [ + final List intros = const [ Intro1Screen(key: Key('0')), Intro2Screen(key: Key('1')), Intro3Screen(key: Key('2')), diff --git a/lib/features/intro/presentation/ui/intro_page.dart b/lib/features/intro/presentation/ui/intro_page.dart index 0ef36e9..5663b63 100644 --- a/lib/features/intro/presentation/ui/intro_page.dart +++ b/lib/features/intro/presentation/ui/intro_page.dart @@ -31,8 +31,8 @@ class IntroPage extends StatelessWidget { BlocBuilder _mainScreen() { return BlocBuilder( builder: (context, state) => AnimatedSwitcher( - duration: Duration(milliseconds: 200), - reverseDuration: Duration(milliseconds: 200), + duration: const Duration(milliseconds: 200), + reverseDuration: const Duration(milliseconds: 200), switchInCurve: Curves.linear, switchOutCurve: Curves.linear, child: context.read().intros[state.currentIntro], diff --git a/lib/features/intro/presentation/ui/screens/intro_1_screen.dart b/lib/features/intro/presentation/ui/screens/intro_1_screen.dart index 37926cd..ae31cd1 100644 --- a/lib/features/intro/presentation/ui/screens/intro_1_screen.dart +++ b/lib/features/intro/presentation/ui/screens/intro_1_screen.dart @@ -12,12 +12,12 @@ class Intro1Screen extends StatelessWidget { return SizedBox.expand( child: PodVideoPlayer( controller: context.read().podController1, - overlayBuilder: (options) => SizedBox.shrink(), + overlayBuilder: (options) => const SizedBox.shrink(), alwaysShowProgressBar: false, videoAspectRatio: context.widthScreen / context.heightScreen, frameAspectRatio: context.widthScreen / context.heightScreen, - backgroundColor: Color(0XFF00154C), - onLoading: (context) => SizedBox.shrink(), + backgroundColor: const Color(0XFF00154C), + onLoading: (context) => const SizedBox.shrink(), ), ); } diff --git a/lib/features/intro/presentation/ui/screens/intro_2_screen.dart b/lib/features/intro/presentation/ui/screens/intro_2_screen.dart index 6ecdacb..36e110b 100644 --- a/lib/features/intro/presentation/ui/screens/intro_2_screen.dart +++ b/lib/features/intro/presentation/ui/screens/intro_2_screen.dart @@ -13,12 +13,12 @@ class Intro2Screen extends StatelessWidget { return SizedBox.expand( child: PodVideoPlayer( controller: context.read().podController2, - overlayBuilder: (options) => SizedBox.shrink(), + overlayBuilder: (options) => const SizedBox.shrink(), alwaysShowProgressBar: false, videoAspectRatio: context.widthScreen / context.heightScreen, frameAspectRatio: context.widthScreen / context.heightScreen, backgroundColor: MyColors.transparent, - onLoading: (context) => SizedBox.shrink(), + onLoading: (context) => const SizedBox.shrink(), ), ); } diff --git a/lib/features/intro/presentation/ui/screens/intro_3_screen.dart b/lib/features/intro/presentation/ui/screens/intro_3_screen.dart index 1330dff..135b381 100644 --- a/lib/features/intro/presentation/ui/screens/intro_3_screen.dart +++ b/lib/features/intro/presentation/ui/screens/intro_3_screen.dart @@ -13,12 +13,12 @@ class Intro3Screen extends StatelessWidget { return SizedBox.expand( child: PodVideoPlayer( controller: context.read().podController3, - overlayBuilder: (options) => SizedBox.shrink(), + overlayBuilder: (options) => const SizedBox.shrink(), alwaysShowProgressBar: false, videoAspectRatio: context.widthScreen / context.heightScreen, frameAspectRatio: context.widthScreen / context.heightScreen, backgroundColor: MyColors.transparent, - onLoading: (context) => SizedBox.shrink(), + onLoading: (context) => const SizedBox.shrink(), ), ); } diff --git a/lib/features/intro/presentation/ui/screens/intro_4_screen.dart b/lib/features/intro/presentation/ui/screens/intro_4_screen.dart index b365751..61209d7 100644 --- a/lib/features/intro/presentation/ui/screens/intro_4_screen.dart +++ b/lib/features/intro/presentation/ui/screens/intro_4_screen.dart @@ -13,12 +13,12 @@ class Intro4Screen extends StatelessWidget { return SizedBox.expand( child: PodVideoPlayer( controller: context.read().podController4, - overlayBuilder: (options) => SizedBox.shrink(), + overlayBuilder: (options) => const SizedBox.shrink(), alwaysShowProgressBar: false, videoAspectRatio: context.widthScreen / context.heightScreen, frameAspectRatio: context.widthScreen / context.heightScreen, backgroundColor: MyColors.transparent, - onLoading: (context) => SizedBox.shrink(), + onLoading: (context) => const SizedBox.shrink(), ), ); } diff --git a/lib/features/intro/presentation/ui/screens/intro_5_screen.dart b/lib/features/intro/presentation/ui/screens/intro_5_screen.dart index 7a235cf..57a61b8 100644 --- a/lib/features/intro/presentation/ui/screens/intro_5_screen.dart +++ b/lib/features/intro/presentation/ui/screens/intro_5_screen.dart @@ -13,12 +13,12 @@ class Intro5Screen extends StatelessWidget { return SizedBox.expand( child: PodVideoPlayer( controller: context.read().podController5, - overlayBuilder: (options) => SizedBox.shrink(), + overlayBuilder: (options) => const SizedBox.shrink(), alwaysShowProgressBar: false, videoAspectRatio: context.widthScreen / context.heightScreen, frameAspectRatio: context.widthScreen / context.heightScreen, backgroundColor: MyColors.transparent, - onLoading: (context) => SizedBox.shrink(), + onLoading: (context) => const SizedBox.shrink(), ), ); } diff --git a/lib/features/intro/presentation/ui/widgets/bubble_chat_widget.dart b/lib/features/intro/presentation/ui/widgets/bubble_chat_widget.dart index 729d6be..e29ed0c 100644 --- a/lib/features/intro/presentation/ui/widgets/bubble_chat_widget.dart +++ b/lib/features/intro/presentation/ui/widgets/bubble_chat_widget.dart @@ -21,15 +21,15 @@ class BubbleChatWidget extends StatelessWidget { clipper: _ShapeClipper(flip: flip), child: Container( width: width, - padding: EdgeInsets.only( + padding: const EdgeInsets.only( left: MySpaces.s18, right: MySpaces.s18, top: MySpaces.s16, bottom: MySpaces.s28, ), decoration: BoxDecoration( - color: Color(0XFFF5E8D7).withValues(alpha: 0.5), - borderRadius: BorderRadius.all(Radius.circular(20)), + color: const Color(0XFFF5E8D7).withValues(alpha: 0.5), + borderRadius: const BorderRadius.all(Radius.circular(20)), border: Border.all( width: 1, color: MyColors.white.withValues(alpha: 0.5), @@ -55,9 +55,9 @@ class _ShapeClipper extends CustomClipper { @override Path getClip(Size size) { - var path = Path(); - double w = size.width; - double h = size.height; + final Path path = Path(); + final double w = size.width; + final double h = size.height; // The drawing logic remains exactly the same path.moveTo(w * 0.92, 0); diff --git a/lib/features/language/presentation/bloc/language_bloc.dart b/lib/features/language/presentation/bloc/language_bloc.dart index c6a616f..bf9e56a 100644 --- a/lib/features/language/presentation/bloc/language_bloc.dart +++ b/lib/features/language/presentation/bloc/language_bloc.dart @@ -49,9 +49,9 @@ class LanguageBloc extends Bloc { value: state.selectedLang.code ?? MyConstants.defaultLanguage, ), ]); - AppBloc appBloc = locator(); + final AppBloc appBloc = locator(); appBloc.add( - ChangeLocaleEvent(state.selectedLang.locale ?? Locale('en', 'US'))); + ChangeLocaleEvent(state.selectedLang.locale ?? const Locale('en', 'US'))); if (Directory( '${StoragePath.documentDir.path}/${state.selectedLang diff --git a/lib/features/language/presentation/ui/language_page.dart b/lib/features/language/presentation/ui/language_page.dart index 811c017..189bc48 100644 --- a/lib/features/language/presentation/ui/language_page.dart +++ b/lib/features/language/presentation/ui/language_page.dart @@ -26,13 +26,13 @@ class LanguagePage extends StatelessWidget { height: context.heightScreen, width: context.widthScreen, decoration: BoxDecoration( - gradient: LinearGradient( + gradient: const LinearGradient( begin: Alignment.topCenter, end: Alignment.bottomCenter, colors: [Color(0XFF00154C), Color(0XFF150532)], ), image: DecorationImage( - image: AssetImage(MyAssets.pattern), + image: const AssetImage(MyAssets.pattern), scale: 3, repeat: ImageRepeat.repeat, colorFilter: ColorFilter.mode( @@ -61,7 +61,7 @@ class LanguagePage extends StatelessWidget { spacing: MySpaces.s10, mainAxisAlignment: MainAxisAlignment.center, children: [ - MyImage(image: MyAssets.lang, size: 28), + const MyImage(image: MyAssets.lang, size: 28), Expanded( child: AutoSizeText( context.translate.select_language, @@ -69,7 +69,7 @@ class LanguagePage extends StatelessWidget { maxFontSize: 20, maxLines: 1, textAlign: TextAlign.center, - style: MYTextStyle.titr0.copyWith(color: Color(0XFF847AC4)), + style: MYTextStyle.titr0.copyWith(color: const Color(0XFF847AC4)), ), ), ], @@ -108,7 +108,7 @@ class LanguagePage extends StatelessWidget { Widget _btn(BuildContext context) { return MyBlueButton( - onTap: () => context.read().add(SaveLevelsEvent()), + onTap: () => context.read().add(const SaveLevelsEvent()), title: context.translate.select, ); } diff --git a/lib/features/language/presentation/ui/widgets/language_widget.dart b/lib/features/language/presentation/ui/widgets/language_widget.dart index 1725b68..fc2cd43 100644 --- a/lib/features/language/presentation/ui/widgets/language_widget.dart +++ b/lib/features/language/presentation/ui/widgets/language_widget.dart @@ -19,7 +19,7 @@ class LanguageWidget extends StatelessWidget { onTap: onTap, title: Text(title ?? ''), titleTextStyle: MYTextStyle.titr1, - contentPadding: EdgeInsets.symmetric( + contentPadding: const EdgeInsets.symmetric( vertical: MySpaces.s12, horizontal: 30, ), @@ -31,20 +31,20 @@ class LanguageWidget extends StatelessWidget { ? Container( height: 17, width: 17, - padding: EdgeInsets.all(3), + padding: const EdgeInsets.all(3), decoration: BoxDecoration( shape: BoxShape.circle, - border: Border.all(width: 1, color: Color(0XFF3CFF3C)), - gradient: LinearGradient( + border: Border.all(width: 1, color: const Color(0XFF3CFF3C)), + gradient: const LinearGradient( begin: Alignment.topCenter, end: Alignment.bottomCenter, colors: [Color(0XFF48D336), Color(0XFF2D7C23)], ), ), - child: MyImage(image: MyAssets.doneRounded), + child: const MyImage(image: MyAssets.doneRounded), ) - : SizedBox(height: 17, width: 17), - shape: RoundedRectangleBorder( + : const SizedBox(height: 17, width: 17), + shape: const RoundedRectangleBorder( borderRadius: BorderRadius.all(Radius.circular(12)), ), selectedTileColor: MyColors.white.withValues(alpha: 0.2), diff --git a/lib/features/level/data/datasource/level_datasource.dart b/lib/features/level/data/datasource/level_datasource.dart index 77490c1..e102bf5 100644 --- a/lib/features/level/data/datasource/level_datasource.dart +++ b/lib/features/level/data/datasource/level_datasource.dart @@ -26,7 +26,7 @@ class LocalLevelDatasourceImpl implements ILevelDatasource { ); return findData.nodes ?? []; } catch (_) { - throw MyException(errorMessage: 'Operation Failed'); + throw const MyException(errorMessage: 'Operation Failed'); } } } \ No newline at end of file diff --git a/lib/features/level/presentation/bloc/level_bloc.dart b/lib/features/level/presentation/bloc/level_bloc.dart index 62449dc..11e9ac7 100644 --- a/lib/features/level/presentation/bloc/level_bloc.dart +++ b/lib/features/level/presentation/bloc/level_bloc.dart @@ -240,7 +240,7 @@ class LevelBloc extends Bloc { } int get diamonds { - int currentLevel = int.parse( + final int currentLevel = int.parse( LocalStorage.readData(key: MyConstants.currentLevel) ?? '1', ); return currentLevel - 1; diff --git a/lib/features/level/presentation/ui/level_page.dart b/lib/features/level/presentation/ui/level_page.dart index 1c8c075..1bccb69 100644 --- a/lib/features/level/presentation/ui/level_page.dart +++ b/lib/features/level/presentation/ui/level_page.dart @@ -193,7 +193,7 @@ class LevelPage extends StatelessWidget { child: Stack( alignment: Alignment.center, children: [ - Positioned.fill( + const Positioned.fill( child: LevelPath(), ), Positioned.fill(child: _levelLocation(context)), @@ -243,7 +243,7 @@ class LevelPage extends StatelessWidget { } Widget _ship(BuildContext context) { - return ShipAnim( + return const ShipAnim( child: MyImage(image: MyAssets.ship), ); } @@ -278,7 +278,7 @@ class LevelPage extends StatelessWidget { size: setSize(context: context, tablet: 80), ), ), - Spacer(), + const Spacer(), DiamondLevel( diamonds: context.read().diamonds, ), @@ -299,7 +299,7 @@ class LevelPage extends StatelessWidget { } Widget _background(BuildContext context) { - return MyImage( + return const MyImage( image: MyAssets.mapBackground, fit: BoxFit.cover, ); diff --git a/lib/features/level/presentation/ui/widgets/bottom_path.dart b/lib/features/level/presentation/ui/widgets/bottom_path.dart index 0d5e1b3..66fb96f 100644 --- a/lib/features/level/presentation/ui/widgets/bottom_path.dart +++ b/lib/features/level/presentation/ui/widgets/bottom_path.dart @@ -10,7 +10,7 @@ class BottomPath extends StatelessWidget { @override Widget build(BuildContext context) { return CustomPaint( - painter: _Path(), + painter: const _Path(), size: Size( context.widthScreen * 0.76, context.heightScreen * 0.64, diff --git a/lib/features/level/presentation/ui/widgets/diamond_level.dart b/lib/features/level/presentation/ui/widgets/diamond_level.dart index 4170dc3..8caea48 100644 --- a/lib/features/level/presentation/ui/widgets/diamond_level.dart +++ b/lib/features/level/presentation/ui/widgets/diamond_level.dart @@ -32,7 +32,7 @@ class DiamondLevel extends StatelessWidget { MySpaces.s16.gapWidth, ShaderMask( blendMode: BlendMode.modulate, - shaderCallback: (bounds) => LinearGradient( + shaderCallback: (bounds) => const LinearGradient( begin: Alignment.topCenter, end: Alignment.bottomCenter, colors: [Color(0XFF4BA5EA), Color(0XFF0C4EE9)], @@ -44,7 +44,7 @@ class DiamondLevel extends StatelessWidget { shadows: [ BoxShadow( color: MyColors.black.withValues(alpha: 0.25), - offset: Offset(0, 1.43), + offset: const Offset(0, 1.43), blurRadius: 1.43, ), ], diff --git a/lib/features/level/presentation/ui/widgets/node_widget.dart b/lib/features/level/presentation/ui/widgets/node_widget.dart index 46af3e4..93cb885 100644 --- a/lib/features/level/presentation/ui/widgets/node_widget.dart +++ b/lib/features/level/presentation/ui/widgets/node_widget.dart @@ -21,15 +21,15 @@ enum LevelType { }; static Map get textShadowColor => { - LevelType.unFinished: Color(0XFF5B5B5B), - LevelType.finished: Color(0XFF096D7B), - LevelType.current: Color(0XFF91500D), + LevelType.unFinished: const Color(0XFF5B5B5B), + LevelType.finished: const Color(0XFF096D7B), + LevelType.current: const Color(0XFF91500D), }; static Map get textColor => { - LevelType.unFinished: Color(0XFFEDEDED), - LevelType.finished: Color(0XFFFFF2D0), - LevelType.current: Color(0XFFFFF2D0), + LevelType.unFinished: const Color(0XFFEDEDED), + LevelType.finished: const Color(0XFFFFF2D0), + LevelType.current: const Color(0XFFFFF2D0), }; } @@ -66,10 +66,10 @@ class NodeWidget extends StatelessWidget { alignment: Alignment.center, children: [ if (getReward(node.prize?.afterLevel ?? 1)) ...{ - MyImage(image: MyAssets.giftBackground, size: 70), - MyImage(image: MyAssets.gift, size: 50), + const MyImage(image: MyAssets.giftBackground, size: 70), + const MyImage(image: MyAssets.gift, size: 50), } else ...{ - MyImage(image: MyAssets.giftDisable, size: 50), + const MyImage(image: MyAssets.giftDisable, size: 50), }, ], ), @@ -97,7 +97,7 @@ class NodeWidget extends StatelessWidget { begin: Alignment.topCenter, end: Alignment.bottomCenter, colors: [ - Color(0XFFFFFFFF), + const Color(0XFFFFFFFF), LevelType.textColor[type(node.level?.order ?? 1)] ?? MyColors.white, ], @@ -118,7 +118,7 @@ class NodeWidget extends StatelessWidget { node.level?.order ?? 1, )] ?? MyColors.white, - offset: Offset(0, 2.97), + offset: const Offset(0, 2.97), ), ], ), @@ -138,17 +138,17 @@ class NodeWidget extends StatelessWidget { child: Container( height: setSize(context: context, mobile: 17, tablet: 24), width: setSize(context: context, mobile: 17, tablet: 24), - padding: EdgeInsets.all(3), + padding: const EdgeInsets.all(3), decoration: BoxDecoration( shape: BoxShape.circle, - border: Border.all(width: 1, color: Color(0XFF3CFF3C)), - gradient: LinearGradient( + border: Border.all(width: 1, color: const Color(0XFF3CFF3C)), + gradient: const LinearGradient( begin: Alignment.topCenter, end: Alignment.bottomCenter, colors: [Color(0XFF48D336), Color(0XFF2D7C23)], ), ), - child: MyImage(image: MyAssets.doneRounded), + child: const MyImage(image: MyAssets.doneRounded), ), ), ], diff --git a/lib/features/level/presentation/ui/widgets/play_button.dart b/lib/features/level/presentation/ui/widgets/play_button.dart index bd41792..1a121b3 100644 --- a/lib/features/level/presentation/ui/widgets/play_button.dart +++ b/lib/features/level/presentation/ui/widgets/play_button.dart @@ -20,16 +20,16 @@ class PlayButton extends StatelessWidget { child: Stack( alignment: Alignment.center, children: [ - MyImage(image: MyAssets.button2), + const MyImage(image: MyAssets.button2), Positioned( top: MySpaces.s2, child: Row( spacing: MySpaces.s4, children: [ - MyImage(image: MyAssets.iconPlay), + const MyImage(image: MyAssets.iconPlay), ShaderMask( blendMode: BlendMode.modulate, - shaderCallback: (bounds) => LinearGradient( + shaderCallback: (bounds) => const LinearGradient( begin: Alignment.topCenter, end: Alignment.bottomCenter, colors: [Color(0XFFF9601F), Color(0XFFD93D16)], @@ -40,8 +40,8 @@ class PlayButton extends StatelessWidget { style: MYTextStyle.button1.copyWith( shadows: [ BoxShadow( - color: Color(0XFFFFFFAB).withValues(alpha: 0.40), - offset: Offset(0, 2.61), + color: const Color(0XFFFFFFAB).withValues(alpha: 0.40), + offset: const Offset(0, 2.61), ), ], ), @@ -54,7 +54,7 @@ class PlayButton extends StatelessWidget { bottom: MySpaces.s20, child: Text( '${context.translate.step} ${level.order ?? 0}', - style: MYTextStyle.matn3.copyWith(color: Color(0XFFD8490B)), + style: MYTextStyle.matn3.copyWith(color: const Color(0XFFD8490B)), ), ), ], diff --git a/lib/features/question/data/datasource/question_datasource.dart b/lib/features/question/data/datasource/question_datasource.dart index a89b1f3..076b51a 100644 --- a/lib/features/question/data/datasource/question_datasource.dart +++ b/lib/features/question/data/datasource/question_datasource.dart @@ -49,7 +49,7 @@ class QuestionDatasourceImpl implements IQuestionDatasource { orElse: () => TotalDataEntity(), ); if(index > (findData.nodes?.length ?? 0)){ - throw MyException(); + throw const MyException(); } final NodeEntity? findLevel = findData.nodes?.singleWhere( (e) => e.level?.order == index, diff --git a/lib/features/question/presentation/bloc/question_bloc.dart b/lib/features/question/presentation/bloc/question_bloc.dart index 2937190..910d465 100644 --- a/lib/features/question/presentation/bloc/question_bloc.dart +++ b/lib/features/question/presentation/bloc/question_bloc.dart @@ -29,7 +29,7 @@ class QuestionBloc extends Bloc { this._getNextLevelUseCase, this._mainAudioService, this._effectAudioService, - ) : super(QuestionState()) { + ) : super(const QuestionState()) { volumeStream = _mainAudioService.volumeStream(); playingStream = _mainAudioService.playingStream(); initAudios(); @@ -238,7 +238,7 @@ class QuestionBloc extends Bloc { ], ); emit(state.copyWith( - getQuestionStatus: BaseComplete(''), + getQuestionStatus: const BaseComplete(''), levelEntity: level, currentQuestion: data.questions?.first, )); @@ -268,7 +268,7 @@ class QuestionBloc extends Bloc { e.order == event.correctAnswer) ?? AnswerEntity(), showConfetti: true, ); - await Future.delayed(Duration(seconds: 1), () async { + await Future.delayed(const Duration(seconds: 1), () async { final QuestionEntity? findPreQuestion = state.currentQuestion; final int findIndex = (findPreQuestion?.order ?? 1); emit( @@ -291,7 +291,7 @@ class QuestionBloc extends Bloc { } else { showingAnswerSequence(show: true); answerAnimationController.reverse(); - await Future.delayed(Duration(seconds: 1)); + await Future.delayed(const Duration(seconds: 1)); imageAnimationController.forward(); await playQuestionAudio(); imageAnimationController.reverse(); diff --git a/lib/features/question/presentation/ui/question_page.dart b/lib/features/question/presentation/ui/question_page.dart index 2feda58..d64f6e7 100644 --- a/lib/features/question/presentation/ui/question_page.dart +++ b/lib/features/question/presentation/ui/question_page.dart @@ -33,13 +33,13 @@ class QuestionPage extends StatelessWidget { tablet: MySpaces.s30) ?? 0, ), decoration: BoxDecoration( - gradient: LinearGradient( + gradient: const LinearGradient( begin: Alignment.topCenter, end: Alignment.bottomCenter, colors: [Color(0XFF6930DA), Color(0XFF263AA1)], ), image: DecorationImage( - image: AssetImage(MyAssets.pattern), + image: const AssetImage(MyAssets.pattern), scale: 3, repeat: ImageRepeat.repeat, colorFilter: ColorFilter.mode( @@ -50,7 +50,7 @@ class QuestionPage extends StatelessWidget { ), child: Column( children: [ - setPlatform(android: MySpaces.s20, iOS: 50)?.gapHeight ?? SizedBox.shrink(), + setPlatform(android: MySpaces.s20, iOS: 50)?.gapHeight ?? const SizedBox.shrink(), _topButtons(context), MySpaces.s10.gapHeight, Expanded( @@ -61,14 +61,14 @@ class QuestionPage extends StatelessWidget { builder: (context, state) { if (state.currentQuestion?.order == state.levelEntity?.questions?.length) { - return DiamondScreen(); + return const DiamondScreen(); } else { - return QuestionScreen(); + return const QuestionScreen(); } }, ), ), - setPlatform(android: MySpaces.s20,)?.gapHeight ?? SizedBox.shrink(), + setPlatform(android: MySpaces.s20,)?.gapHeight ?? const SizedBox.shrink(), ], ), ), diff --git a/lib/features/question/presentation/ui/screens/diamond_screen.dart b/lib/features/question/presentation/ui/screens/diamond_screen.dart index 2a236b7..8c8ac35 100644 --- a/lib/features/question/presentation/ui/screens/diamond_screen.dart +++ b/lib/features/question/presentation/ui/screens/diamond_screen.dart @@ -41,7 +41,7 @@ class DiamondScreen extends StatelessWidget { Lottie.asset( MyAnimations.lightPurple, ), - MyImage( + const MyImage( image: MyAssets.diamondBig, ), Positioned( @@ -58,7 +58,7 @@ class DiamondScreen extends StatelessWidget { style: MYTextStyle.titr0, ), ShaderMask( - shaderCallback: (bounds) => LinearGradient( + shaderCallback: (bounds) => const LinearGradient( begin: Alignment.centerLeft, end: Alignment.centerRight, colors: [ @@ -72,7 +72,7 @@ class DiamondScreen extends StatelessWidget { shadows: [ BoxShadow( color: MyColors.black.withValues(alpha: 0.25), - offset: Offset(0, 1.22), + offset: const Offset(0, 1.22), blurRadius: 0.82, ), ], @@ -150,7 +150,7 @@ class DiamondScreen extends StatelessWidget { Widget _ship(BuildContext context) { - return ShipAnim( + return const ShipAnim( child: MyImage(image: MyAssets.ship), ); } diff --git a/lib/features/question/presentation/ui/screens/question_screen.dart b/lib/features/question/presentation/ui/screens/question_screen.dart index 4f5d106..506bf41 100644 --- a/lib/features/question/presentation/ui/screens/question_screen.dart +++ b/lib/features/question/presentation/ui/screens/question_screen.dart @@ -42,14 +42,14 @@ class _QuestionScreenState extends State with TickerProviderStat WidgetsBinding.instance.addObserver(this); context.read().answerAnimationController = AnimationController( vsync: this, - duration: Duration(milliseconds: 500), - reverseDuration: Duration(milliseconds: 500), + duration: const Duration(milliseconds: 500), + reverseDuration: const Duration(milliseconds: 500), ); context.read().imageAnimationController = AnimationController( vsync: this, - duration: Duration(milliseconds: 500), - reverseDuration: Duration(milliseconds: 500), + duration: const Duration(milliseconds: 500), + reverseDuration: const Duration(milliseconds: 500), ); if(LocalStorage.readData(key: MyConstants.firstShowcase) == 'true') { context.read().imageAnimationController.forward(); @@ -93,10 +93,10 @@ class _QuestionScreenState extends State with TickerProviderStat Widget _questionImage(BuildContext context) { return Column( children: [ - Spacer(), + const Spacer(), BlocBuilder( builder: (context, state) => FadeAnimDelayed( - duration: Duration(seconds: 1), + duration: const Duration(seconds: 1), child: FadeAnimController( key: Key('${state.currentQuestion?.image}'), controller: context.read().imageAnimationController, @@ -111,7 +111,7 @@ class _QuestionScreenState extends State with TickerProviderStat ), ), ), - Spacer(), + const Spacer(), ], ); } @@ -141,7 +141,7 @@ class _QuestionScreenState extends State with TickerProviderStat style: MYTextStyle.titr1.copyWith( shadows: [ BoxShadow( - offset: Offset(0, 2), + offset: const Offset(0, 2), color: MyColors.black.withValues(alpha: 0.25), ), ], @@ -161,13 +161,13 @@ class _QuestionScreenState extends State with TickerProviderStat previous.currentQuestion?.id != current.currentQuestion?.id, builder: (context, state) => GridView.builder( itemCount: state.currentQuestion?.answers?.length ?? 0, - physics: NeverScrollableScrollPhysics(), + physics: const NeverScrollableScrollPhysics(), shrinkWrap: true, clipBehavior: Clip.none, padding: EdgeInsets.symmetric( horizontal: setSize(context: context, tablet: 70) ?? 0, ), - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 2, crossAxisSpacing: MySpaces.s20, mainAxisSpacing: 20, @@ -175,7 +175,7 @@ class _QuestionScreenState extends State with TickerProviderStat ), itemBuilder: (context, index) => state.currentQuestion?.answers?[index].imageId == null - ? SizedBox.shrink() + ? const SizedBox.shrink() : SlideAnim( key: Key('${state.currentQuestion?.id}'), controller: context.read().answerAnimationController, diff --git a/lib/features/question/presentation/ui/widgets/glassy_button.dart b/lib/features/question/presentation/ui/widgets/glassy_button.dart index 2e9cc1c..4befc3c 100644 --- a/lib/features/question/presentation/ui/widgets/glassy_button.dart +++ b/lib/features/question/presentation/ui/widgets/glassy_button.dart @@ -25,7 +25,7 @@ class GlassyButton extends StatelessWidget { end: Alignment.bottomCenter, colors: [ Colors.white.withValues(alpha: 0.3), - Color(0XFF6930DA).withValues(alpha: 0.1), + const Color(0XFF6930DA).withValues(alpha: 0.1), ], ), border: Border.all(color: Colors.white.withValues(alpha: 0.3)), @@ -33,7 +33,7 @@ class GlassyButton extends StatelessWidget { child: MyInkwell( onTap: onTap, audio: audio, - borderRadius: BorderRadius.all(Radius.circular(100)), + borderRadius: const BorderRadius.all(Radius.circular(100)), child: Padding( padding: EdgeInsets.all( setSize(context: context, mobile: MySpaces.s12, tablet: MySpaces.s20) ?? 0, diff --git a/lib/features/question/presentation/ui/widgets/question_stepper.dart b/lib/features/question/presentation/ui/widgets/question_stepper.dart index d7408b4..f763ca4 100644 --- a/lib/features/question/presentation/ui/widgets/question_stepper.dart +++ b/lib/features/question/presentation/ui/widgets/question_stepper.dart @@ -15,7 +15,7 @@ class QuestionStepper extends StatelessWidget { height: 70, child: EasyStepper( activeStep: currentStep - 1, - lineStyle: LineStyle( + lineStyle: const LineStyle( lineLength: 20, lineType: LineType.normal, defaultLineColor: Color(0XFFDFDDF6), @@ -29,36 +29,36 @@ class QuestionStepper extends StatelessWidget { showLoadingAnimation: false, stepRadius: 18, showStepBorder: false, - padding: EdgeInsets.all(0), + padding: const EdgeInsets.all(0), enableStepTapping: false, steps: List.generate( length, (index) => EasyStep( customStep: index == length - 1 - ? MyImage(image: MyAssets.diamond, size: 50) + ? const MyImage(image: MyAssets.diamond, size: 50) : ClipPath( clipper: _StepperClipper(), child: Container( height: 32, width: 32, - padding: EdgeInsets.all(4), - decoration: BoxDecoration( + padding: const EdgeInsets.all(4), + decoration: const BoxDecoration( color: Color(0XFFDFDDF6), shape: BoxShape.circle, ), child: ClipPath( clipper: _StepperClipper(), child: Container( - padding: EdgeInsets.all(6), + padding: const EdgeInsets.all(6), decoration: BoxDecoration( shape: BoxShape.circle, color: index < currentStep - 1 - ? Color(0XFF21B738) + ? const Color(0XFF21B738) : index == currentStep - 1 - ? Color(0XFF847AC4) + ? const Color(0XFF847AC4) : Colors.transparent, ), - child: index < currentStep - 1 ? MyImage(image: MyAssets.done) : null, + child: index < currentStep - 1 ? const MyImage(image: MyAssets.done) : null, ), ), ), diff --git a/lib/features/question/presentation/ui/widgets/question_title.dart b/lib/features/question/presentation/ui/widgets/question_title.dart index 4d4305e..5262ec9 100644 --- a/lib/features/question/presentation/ui/widgets/question_title.dart +++ b/lib/features/question/presentation/ui/widgets/question_title.dart @@ -31,7 +31,7 @@ class QuestionTitle extends StatelessWidget { BoxShadow( color: MyColors.black.withValues(alpha: 0.25), blurRadius: 0.82, - offset: Offset(0, 1.22), + offset: const Offset(0, 1.22), ), ], ), diff --git a/lib/features/sample/presentation/ui/sample_page.dart b/lib/features/sample/presentation/ui/sample_page.dart index 848565d..0292338 100644 --- a/lib/features/sample/presentation/ui/sample_page.dart +++ b/lib/features/sample/presentation/ui/sample_page.dart @@ -5,7 +5,7 @@ class SamplePage extends StatelessWidget { @override Widget build(BuildContext context) { - return Scaffold( + return const Scaffold( body: Center( child: Text('Sample Page'), ), diff --git a/lib/features/splash/presentation/bloc/splash_bloc.dart b/lib/features/splash/presentation/bloc/splash_bloc.dart index b4270a2..266f31f 100644 --- a/lib/features/splash/presentation/bloc/splash_bloc.dart +++ b/lib/features/splash/presentation/bloc/splash_bloc.dart @@ -21,7 +21,7 @@ class SplashBloc extends Bloc { Future goToHomePage(BuildContext context) async { await preCacheImages(); await Future.delayed( - Duration(seconds: 2), + const Duration(seconds: 2), () { if (context.mounted) { context.goNamed(Routes.homePage); diff --git a/lib/features/splash/presentation/ui/splash_page.dart b/lib/features/splash/presentation/ui/splash_page.dart index 7036d27..79ea4a3 100644 --- a/lib/features/splash/presentation/ui/splash_page.dart +++ b/lib/features/splash/presentation/ui/splash_page.dart @@ -32,7 +32,7 @@ class _SplashPageState extends State { height: context.heightScreen, width: context.widthScreen, decoration: BoxDecoration( - gradient: LinearGradient( + gradient: const LinearGradient( begin: Alignment.topCenter, end: Alignment.bottomCenter, colors: [ @@ -41,7 +41,7 @@ class _SplashPageState extends State { ], ), image: DecorationImage( - image: AssetImage(MyAssets.pattern), + image: const AssetImage(MyAssets.pattern), scale: 3, repeat: ImageRepeat.repeat, colorFilter: ColorFilter.mode( @@ -62,7 +62,7 @@ class _SplashPageState extends State { } Widget _image() { - return Stack( + return const Stack( children: [ MyImage( image: MyAssets.hadiHoda, diff --git a/lib/init_bindings.dart b/lib/init_bindings.dart index 9a80563..cf4e6e5 100644 --- a/lib/init_bindings.dart +++ b/lib/init_bindings.dart @@ -70,18 +70,18 @@ void initBindings() { locator.registerLazySingleton(() => LoadingStreamUseCase(locator())); /// Guider Feature - locator.registerLazySingleton(() => GuiderDatasourceImpl()); + locator.registerLazySingleton(() => const GuiderDatasourceImpl()); locator.registerLazySingleton(() => GuiderRepositoryImpl(locator())); locator.registerLazySingleton(() => GetFirstLevelUseCase(locator())); /// Question Feature - locator.registerLazySingleton(() => QuestionDatasourceImpl()); + locator.registerLazySingleton(() => const QuestionDatasourceImpl()); locator.registerLazySingleton(() => QuestionRepositoryImpl(locator())); locator.registerLazySingleton(() => GetLevelUseCase(locator())); locator.registerLazySingleton(() => GetNextLevelUseCase(locator())); /// Level Feature - locator.registerLazySingleton(() => LocalLevelDatasourceImpl()); + locator.registerLazySingleton(() => const LocalLevelDatasourceImpl()); locator.registerLazySingleton(() => LevelRepositoryImpl(locator())); locator.registerLazySingleton(() => GetLevelsUseCase(locator())); } diff --git a/lib/main.dart b/lib/main.dart index b09833c..1b11c47 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -44,7 +44,7 @@ class MainApp extends StatelessWidget { themeMode: ThemeService.getTheme(), locale: state.locale, supportedLocales: MyConstants.languages.map( - (e) => e.locale ?? Locale('en', 'US'), + (e) => e.locale ?? const Locale('en', 'US'), ), routerConfig: appPages, localizationsDelegates: const [ diff --git a/pubspec.lock b/pubspec.lock index b4f8cb6..7fb0c62 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -185,14 +185,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.19.1" - confetti: - dependency: "direct main" - description: - name: confetti - sha256: "79376a99648efbc3f23582f5784ced0fe239922bd1a0fb41f582051eba750751" - url: "https://pub.dev" - source: hosted - version: "0.8.0" convert: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 5be1773..d7b3d24 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: hadi_hoda_flutter description: "A new Flutter project." publish_to: 'none' -version: 0.2.1+1 +version: 0.3.1+1 environment: sdk: ^3.9.2 @@ -9,7 +9,6 @@ environment: dependencies: auto_size_text: ^3.0.0 bloc: ^9.0.0 - confetti: ^0.8.0 dio: ^5.9.0 easy_stepper: ^0.8.5+1 equatable: ^2.0.7 @@ -52,9 +51,7 @@ flutter: - assets/animations/ - assets/audios/ - assets/videos/ - - path: assets/svg/ - transformers: - - package: vector_graphics_compiler + - assets/svg/ fonts: