From 175f4e6668e69b6b665c49c4282bab70b631b578 Mon Sep 17 00:00:00 2001 From: akhdanre Date: Sun, 18 May 2025 15:55:09 +0700 Subject: [PATCH] feat: clean up environtment --- .../widget/quiz_item_wa_component.dart | 6 +++--- .../view/admin_result_page.dart | 10 +++++----- .../view/detail_participant_result_page.dart | 4 ++-- .../controller/join_room_controller.dart | 2 +- .../join_room/view/join_room_view.dart | 19 +++++-------------- lib/feature/library/view/library_view.dart | 2 +- .../monitor_quiz/view/monitor_quiz_view.dart | 8 ++++---- .../room_maker/view/room_maker_view.dart | 2 +- 8 files changed, 22 insertions(+), 31 deletions(-) diff --git a/lib/component/widget/quiz_item_wa_component.dart b/lib/component/widget/quiz_item_wa_component.dart index a9b4b8e..ea7e79a 100644 --- a/lib/component/widget/quiz_item_wa_component.dart +++ b/lib/component/widget/quiz_item_wa_component.dart @@ -39,7 +39,7 @@ class QuizItemWAComponent extends StatelessWidget { borderRadius: BorderRadius.circular(16), boxShadow: [ BoxShadow( - color: Colors.black.withOpacity(0.04), + color: Colors.black.withValues(alpha: 0.04), blurRadius: 6, offset: const Offset(0, 2), ), @@ -78,11 +78,11 @@ class QuizItemWAComponent extends StatelessWidget { Color iconColor = AppColors.shadowPrimary; if (isCorrectAnswer) { - backgroundColor = AppColors.primaryBlue.withOpacity(0.15); + backgroundColor = AppColors.primaryBlue.withValues(alpha: 0.15); icon = LucideIcons.checkCircle2; iconColor = AppColors.primaryBlue; } else if (isUserWrongAnswer) { - backgroundColor = Colors.red.withOpacity(0.15); + backgroundColor = Colors.red.withValues(alpha: 0.15); icon = LucideIcons.xCircle; iconColor = Colors.red; } diff --git a/lib/feature/admin_result_page/view/admin_result_page.dart b/lib/feature/admin_result_page/view/admin_result_page.dart index 1232724..c09a5f9 100644 --- a/lib/feature/admin_result_page/view/admin_result_page.dart +++ b/lib/feature/admin_result_page/view/admin_result_page.dart @@ -65,10 +65,10 @@ // return Card( // elevation: 2, // color: Colors.white, -// shadowColor: AppColors.shadowPrimary.withOpacity(0.2), +// shadowColor: AppColors.shadowPrimary.withValues(alpha:0.2), // shape: RoundedRectangleBorder( // borderRadius: BorderRadius.circular(16), -// side: BorderSide(color: AppColors.accentBlue.withOpacity(0.2)), +// side: BorderSide(color: AppColors.accentBlue.withValues(alpha:0.2)), // ), // child: Padding( // padding: const EdgeInsets.all(20), @@ -164,10 +164,10 @@ // child: Card( // elevation: 2, // color: Colors.white, -// shadowColor: AppColors.shadowPrimary.withOpacity(0.2), +// shadowColor: AppColors.shadowPrimary.withValues(alpha:0.2), // shape: RoundedRectangleBorder( // borderRadius: BorderRadius.circular(16), -// side: BorderSide(color: AppColors.accentBlue.withOpacity(0.2)), +// side: BorderSide(color: AppColors.accentBlue.withValues(alpha:0.2)), // ), // child: Padding( // padding: const EdgeInsets.all(20), @@ -216,7 +216,7 @@ // height: 60, // decoration: BoxDecoration( // shape: BoxShape.circle, -// color: _getScoreColor(participant.scorePercent).withOpacity(0.1), +// color: _getScoreColor(participant.scorePercent).withValues(alpha:0.1), // border: Border.all( // color: _getScoreColor(participant.scorePercent), // width: 2, diff --git a/lib/feature/admin_result_page/view/detail_participant_result_page.dart b/lib/feature/admin_result_page/view/detail_participant_result_page.dart index 967011f..f121b27 100644 --- a/lib/feature/admin_result_page/view/detail_participant_result_page.dart +++ b/lib/feature/admin_result_page/view/detail_participant_result_page.dart @@ -98,7 +98,7 @@ // Container( // padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8), // decoration: BoxDecoration( -// color: _getScoreColor(participant.scorePercent).withOpacity(0.1), +// color: _getScoreColor(participant.scorePercent).withValues(alpha:0.1), // borderRadius: BorderRadius.circular(16), // border: Border.all( // color: _getScoreColor(participant.scorePercent), @@ -145,7 +145,7 @@ // height: 28, // decoration: BoxDecoration( // shape: BoxShape.circle, -// color: answer.isCorrect ? AppColors.primaryBlue.withOpacity(0.1) : AppColors.scorePoor.withOpacity(0.1), +// color: answer.isCorrect ? AppColors.primaryBlue.withValues(alpha:0.1) : AppColors.scorePoor.withValues(alpha:0.1), // ), // child: Center( // child: Text( diff --git a/lib/feature/join_room/controller/join_room_controller.dart b/lib/feature/join_room/controller/join_room_controller.dart index 5577158..4306f53 100644 --- a/lib/feature/join_room/controller/join_room_controller.dart +++ b/lib/feature/join_room/controller/join_room_controller.dart @@ -24,7 +24,7 @@ class JoinRoomController extends GetxController { Get.snackbar( "Error", "Kode room dan nama harus diisi", - backgroundColor: Get.theme.colorScheme.error.withOpacity(0.9), + backgroundColor: Get.theme.colorScheme.error.withValues(alpha: 0.9), colorText: Colors.white, ); return; diff --git a/lib/feature/join_room/view/join_room_view.dart b/lib/feature/join_room/view/join_room_view.dart index ed3f197..45215a1 100644 --- a/lib/feature/join_room/view/join_room_view.dart +++ b/lib/feature/join_room/view/join_room_view.dart @@ -8,11 +8,12 @@ import 'package:quiz_app/component/global_text_field.dart'; import 'package:quiz_app/feature/join_room/controller/join_room_controller.dart'; class JoinRoomView extends GetView { + const JoinRoomView({super.key}); + @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.white, - // Menggunakan extendBodyBehindAppBar untuk efek lebih menarik extendBodyBehindAppBar: true, appBar: AppBar( backgroundColor: Colors.transparent, @@ -23,7 +24,6 @@ class JoinRoomView extends GetView { ), ), body: Container( - // Background putih bersih color: Colors.white, child: SafeArea( child: SingleChildScrollView( @@ -33,7 +33,6 @@ class JoinRoomView extends GetView { children: [ const SizedBox(height: 20), - // Animated Trophy Icon with Hero animation TweenAnimationBuilder( duration: const Duration(seconds: 1), tween: Tween(begin: 0.0, end: 1.0), @@ -46,10 +45,10 @@ class JoinRoomView extends GetView { child: Container( padding: EdgeInsets.all(22), decoration: BoxDecoration( - color: AppColors.primaryBlue.withOpacity(0.05), + color: AppColors.primaryBlue.withValues(alpha: 0.05), shape: BoxShape.circle, border: Border.all( - color: AppColors.primaryBlue.withOpacity(0.15), + color: AppColors.primaryBlue.withValues(alpha: 0.15), width: 2, ), ), @@ -63,7 +62,6 @@ class JoinRoomView extends GetView { const SizedBox(height: 30), - // Animated Title TweenAnimationBuilder( duration: const Duration(milliseconds: 800), tween: Tween(begin: 0.0, end: 1.0), @@ -118,10 +116,8 @@ class JoinRoomView extends GetView { const SizedBox(height: 40), - // Animated Card TweenAnimationBuilder( duration: const Duration(milliseconds: 1000), - // delay: const Duration(milliseconds: 400), tween: Tween(begin: 0.0, end: 1.0), builder: (context, value, child) { return Opacity( @@ -139,7 +135,7 @@ class JoinRoomView extends GetView { borderRadius: BorderRadius.circular(24), boxShadow: [ BoxShadow( - color: Colors.grey.withOpacity(0.08), + color: Colors.grey.withValues(alpha: 0.08), blurRadius: 15, offset: const Offset(0, 5), ), @@ -167,8 +163,6 @@ class JoinRoomView extends GetView { ], ), const SizedBox(height: 25), - - // Custom text field with better styling Container( decoration: BoxDecoration( color: Colors.white, @@ -185,10 +179,7 @@ class JoinRoomView extends GetView { forceUpperCase: true, ), ), - const SizedBox(height: 30), - - // Button with gradient GlobalButton( text: context.tr("join_quiz_now"), onPressed: controller.joinRoom, diff --git a/lib/feature/library/view/library_view.dart b/lib/feature/library/view/library_view.dart index a583c9b..aaeeeb5 100644 --- a/lib/feature/library/view/library_view.dart +++ b/lib/feature/library/view/library_view.dart @@ -78,7 +78,7 @@ class LibraryView extends GetView { borderRadius: BorderRadius.circular(12), boxShadow: [ BoxShadow( - color: Colors.black.withOpacity(0.05), + color: Colors.black.withValues(alpha: 0.05), blurRadius: 6, offset: const Offset(0, 2), ), diff --git a/lib/feature/monitor_quiz/view/monitor_quiz_view.dart b/lib/feature/monitor_quiz/view/monitor_quiz_view.dart index 32f5570..57c7788 100644 --- a/lib/feature/monitor_quiz/view/monitor_quiz_view.dart +++ b/lib/feature/monitor_quiz/view/monitor_quiz_view.dart @@ -139,10 +139,10 @@ class MonitorQuizView extends GetView { return Card( elevation: 2, color: Colors.white, - shadowColor: AppColors.shadowPrimary.withOpacity(0.2), + shadowColor: AppColors.shadowPrimary.withValues(alpha: 0.2), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(16), - side: BorderSide(color: AppColors.accentBlue.withOpacity(0.2)), + side: BorderSide(color: AppColors.accentBlue.withValues(alpha: 0.2)), ), child: Padding( padding: const EdgeInsets.all(20), @@ -246,9 +246,9 @@ class MonitorQuizView extends GetView { width: 130, padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 12), decoration: BoxDecoration( - color: color.withOpacity(0.08), + color: color.withValues(alpha: 0.08), borderRadius: BorderRadius.circular(8), - border: Border.all(color: color.withOpacity(0.2), width: 1), + border: Border.all(color: color.withValues(alpha: 0.2), width: 1), ), child: Row( children: [ diff --git a/lib/feature/room_maker/view/room_maker_view.dart b/lib/feature/room_maker/view/room_maker_view.dart index cf0ba5d..bf79d92 100644 --- a/lib/feature/room_maker/view/room_maker_view.dart +++ b/lib/feature/room_maker/view/room_maker_view.dart @@ -77,7 +77,7 @@ class RoomMakerView extends GetView { borderRadius: BorderRadius.circular(16), boxShadow: [ BoxShadow( - color: Colors.black.withOpacity(0.05), + color: Colors.black.withValues(alpha: 0.05), blurRadius: 8, offset: Offset(0, 4), ),