diff --git a/lib/core/widgets/app_bar/styles/app_bar_action.dart b/lib/core/widgets/app_bar/styles/app_bar_action.dart index 77c0b59..d1142ab 100644 --- a/lib/core/widgets/app_bar/styles/app_bar_action.dart +++ b/lib/core/widgets/app_bar/styles/app_bar_action.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:shia_game_flutter/common_ui/resources/my_spaces.dart'; +import 'package:shia_game_flutter/core/widgets/container/my_container.dart'; import 'package:shia_game_flutter/core/widgets/image/my_image.dart'; class AppBarAction extends StatelessWidget { @@ -10,28 +11,19 @@ class AppBarAction extends StatelessWidget { @override Widget build(BuildContext context) { - return InkWell( + return MyContainer( onTap: onTap, - borderRadius: BorderRadius.all(Radius.circular(100)), - child: Ink( - width: MySpaces.s32, - height: MySpaces.s32, - padding: EdgeInsets.all(MySpaces.s6), - decoration: BoxDecoration( - shape: BoxShape.circle, - border: Border.all( - width: 1, - color: Color(0XFF6D2ADA), - strokeAlign: BorderSide.strokeAlignInside, - ), - gradient: LinearGradient( - begin: AlignmentDirectional.topStart, - end: AlignmentDirectional.bottomEnd, - colors: [Color(0XFF823FEB), Color(0XFF4F09BF)], - ), - ), - child: MyImage(asset: icon ?? ''), + width: MySpaces.s32, + height: MySpaces.s32, + padding: EdgeInsets.all(MySpaces.s6), + boxShape: BoxShape.circle, + borderColor: Color(0XFF6D2ADA), + gradient: LinearGradient( + begin: AlignmentDirectional.topStart, + end: AlignmentDirectional.bottomEnd, + colors: [Color(0XFF823FEB), Color(0XFF4F09BF)], ), + child: MyImage(asset: icon ?? ''), ); } } \ No newline at end of file diff --git a/lib/core/widgets/app_bar/styles/app_bar_add_widget.dart b/lib/core/widgets/app_bar/styles/app_bar_add_widget.dart index 092de31..7e9ef77 100644 --- a/lib/core/widgets/app_bar/styles/app_bar_add_widget.dart +++ b/lib/core/widgets/app_bar/styles/app_bar_add_widget.dart @@ -4,6 +4,7 @@ import 'package:shia_game_flutter/common_ui/resources/my_assets.dart'; import 'package:shia_game_flutter/common_ui/resources/my_spaces.dart'; import 'package:shia_game_flutter/common_ui/resources/my_text_style.dart'; import 'package:shia_game_flutter/common_ui/theme/my_theme.dart'; +import 'package:shia_game_flutter/core/widgets/container/my_container.dart'; import 'package:shia_game_flutter/core/widgets/image/my_image.dart'; class AppBarAddWidget extends StatelessWidget { @@ -22,55 +23,43 @@ class AppBarAddWidget extends StatelessWidget { @override Widget build(BuildContext context) { - return InkWell( + return MyContainer( onTap: onTap, - borderRadius: BorderRadius.all(Radius.circular(100)), - child: Ink( - width: 96, - height: 32, - padding: EdgeInsets.all(1), - decoration: ShapeDecoration( - shape: StadiumBorder(), - gradient: LinearGradient( - begin: AlignmentDirectional.topStart, - end: AlignmentDirectional.bottomEnd, - colors: gradientColors ?? [], - ), - ), - child: Ink( - padding: EdgeInsetsDirectional.only( - start: MySpaces.s8, - end: MySpaces.s4, - ), - decoration: ShapeDecoration( - shape: StadiumBorder(), - color: context.backgroundColor, + width: 96, + height: 32, + borderRadius: BorderRadius.all(Radius.circular(50)), + borderGradient: LinearGradient( + begin: AlignmentDirectional.topStart, + end: AlignmentDirectional.bottomEnd, + colors: gradientColors ?? [], + ), + padding: EdgeInsetsDirectional.only( + start: MySpaces.s8, + end: MySpaces.s4, + ), + color: context.backgroundColor, + child: Row( + children: [ + MyImage(asset: icon ?? ''), + Expanded( + child: Text( + '$number', + maxLines: 1, + textAlign: TextAlign.center, + overflow: TextOverflow.ellipsis, + style: Lexend.bold.copyWith(fontSize: 12), + ), ), - child: Row( - children: [ - MyImage(asset: icon ?? ''), - Expanded( - child: Text( - '$number', - maxLines: 1, - textAlign: TextAlign.center, - overflow: TextOverflow.ellipsis, - style: Lexend.bold.copyWith(fontSize: 12), - ), - ), - Container( - width: 23, - height: 23, - padding: EdgeInsets.all(MySpaces.s6), - decoration: BoxDecoration( - shape: BoxShape.circle, - color: Color(0XFF4F09BF), - ), - child: MyImage(asset: MyAssets.iconPlus), - ), - ], + MyContainer( + onTap: onTap, + width: 23, + height: 23, + padding: EdgeInsets.all(5), + color: Color(0XFF4F09BF), + boxShape: BoxShape.circle, + child: MyImage(asset: MyAssets.iconPlus), ), - ), + ], ), ); } diff --git a/lib/core/widgets/button/my_gradient_button.dart b/lib/core/widgets/button/my_gradient_button.dart index 133fee4..3ce7d78 100644 --- a/lib/core/widgets/button/my_gradient_button.dart +++ b/lib/core/widgets/button/my_gradient_button.dart @@ -1,16 +1,19 @@ import 'package:flutter/material.dart'; -import 'package:shia_game_flutter/common_ui/resources/my_text_style.dart'; -import 'package:shia_game_flutter/core/widgets/container/gradient_container.dart'; +import 'package:shia_game_flutter/core/widgets/container/my_container.dart'; +import 'package:shia_game_flutter/core/widgets/text/gradient_text.dart'; class MyGradientButton extends StatelessWidget { - const MyGradientButton({super.key}); + const MyGradientButton({super.key, this.onTap, this.title}); + + final VoidCallback? onTap; + final String? title; @override Widget build(BuildContext context) { - return GradientContainer( + return MyContainer( height: 32, width: 116, - onTap: () {}, + onTap: onTap, borderColor: Color(0XFF6D2ADA), borderRadius: BorderRadius.all(Radius.circular(5)), gradient: LinearGradient( @@ -18,27 +21,12 @@ class MyGradientButton extends StatelessWidget { end: AlignmentDirectional.bottomEnd, colors: [Color(0XFF823FEB), Color(0XFF4F09BF)], ), - child: ShaderMask( - blendMode: BlendMode.modulate, - shaderCallback: (bounds) => LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: [Color(0XFFFFFFFF), Color(0XFFFFFFFF), Color(0XFF9C8CC2)], - ).createShader(bounds), - child: Text( - 'Change Profile', - style: Lexend.extraBold.copyWith( - fontSize: 12, - shadows: [ - BoxShadow( - color: Color(0xFF1B0D31), - blurRadius: 0, - offset: Offset(0, 1.69), - spreadRadius: 0, - ), - ], - ), - ), + child: GradientText( + text: title, + color: Color(0XFF9C8CC2), + shadowColor: Color(0xFF1B0D31), + offset: Offset(0, 1.69), + fontSize: 12, ), ); } diff --git a/lib/core/widgets/container/gradient_container.dart b/lib/core/widgets/container/my_container.dart similarity index 51% rename from lib/core/widgets/container/gradient_container.dart rename to lib/core/widgets/container/my_container.dart index ab1cacf..76e9f22 100644 --- a/lib/core/widgets/container/gradient_container.dart +++ b/lib/core/widgets/container/my_container.dart @@ -1,13 +1,12 @@ import 'package:flutter/material.dart'; import 'package:shia_game_flutter/common_ui/theme/my_theme.dart'; -class GradientContainer extends StatelessWidget { - const GradientContainer({ +class MyContainer extends StatelessWidget { + const MyContainer({ super.key, this.width, this.height, this.padding, - this.shapeBorder, this.boxShape, this.borderGradient, this.borderRadius, @@ -18,12 +17,12 @@ class GradientContainer extends StatelessWidget { this.gradient, this.borderColor, this.onTap, + this.inset, }); final double? width; final double? height; final EdgeInsetsGeometry? padding; - final ShapeBorder? shapeBorder; final BoxShape? boxShape; final Gradient? borderGradient; final Gradient? gradient; @@ -34,52 +33,43 @@ class GradientContainer extends StatelessWidget { final Widget? child; final DecorationImage? image; final VoidCallback? onTap; + final bool? inset; @override Widget build(BuildContext context) { return Material( color: context.noColor, - borderRadius: borderRadius, + borderRadius: boxShape == BoxShape.circle + ? BorderRadius.all(Radius.circular(100)) + : borderRadius, shadowColor: boxShadow?.first.color, elevation: boxShadow?.first.blurRadius ?? 0, - shape: shapeBorder, child: InkWell( onTap: onTap, customBorder: RoundedRectangleBorder( - borderRadius: borderRadius ?? BorderRadius.zero, + borderRadius: boxShape == BoxShape.circle + ? BorderRadius.all(Radius.circular(100)) + : borderRadius ?? BorderRadius.zero, ), child: Ink( padding: EdgeInsets.all(1), width: width, height: height, - decoration: shapeBorder == null - ? BoxDecoration( - shape: boxShape ?? BoxShape.rectangle, - gradient: borderGradient, - borderRadius: borderRadius, - color: borderColor, - ) - : ShapeDecoration( - shape: shapeBorder!, - gradient: borderGradient, - color: borderColor, - ), + decoration: BoxDecoration( + shape: boxShape ?? BoxShape.rectangle, + gradient: borderGradient, + borderRadius: borderRadius, + color: borderColor, + ), child: Ink( padding: padding, - decoration: shapeBorder == null - ? BoxDecoration( - shape: boxShape ?? BoxShape.rectangle, - gradient: gradient, - borderRadius: borderRadius, - color: color, - image: image, - ) - : ShapeDecoration( - shape: shapeBorder!, - gradient: gradient, - color: color, - image: image, - ), + decoration: BoxDecoration( + shape: boxShape ?? BoxShape.rectangle, + gradient: gradient, + borderRadius: borderRadius, + color: color, + image: image, + ), child: Center(child: child), ), ), diff --git a/lib/core/widgets/text/gradient_text.dart b/lib/core/widgets/text/gradient_text.dart new file mode 100644 index 0000000..e9da190 --- /dev/null +++ b/lib/core/widgets/text/gradient_text.dart @@ -0,0 +1,54 @@ +import 'package:flutter/material.dart'; +import 'package:shia_game_flutter/common_ui/resources/my_text_style.dart'; +import 'package:shia_game_flutter/common_ui/theme/my_theme.dart'; + +class GradientText extends StatelessWidget { + const GradientText({ + super.key, + this.text, + this.color = const Color(0xFFFFFFFF), + this.fontSize = 14, + this.shadowColor = const Color(0xFF000000), + this.blurRadius = 0, + this.spreadRadius = 0, + this.offset = Offset.zero, + }); + + final String? text; + final Color color; + final double? fontSize; + final Color shadowColor; + final double blurRadius; + final double spreadRadius; + final Offset offset; + + @override + Widget build(BuildContext context) { + return ShaderMask( + blendMode: BlendMode.modulate, + shaderCallback: (bounds) => LinearGradient( + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + colors: [ + context.primaryColor, + context.primaryColor, + color, + ], + ).createShader(bounds), + child: Text( + text ?? '', + style: Lexend.extraBold.copyWith( + fontSize: fontSize, + shadows: [ + BoxShadow( + color: shadowColor, + blurRadius: blurRadius, + offset: offset, + spreadRadius: spreadRadius, + ), + ], + ), + ), + ); + } +} diff --git a/lib/features/home/presentation/pages/home_page.dart b/lib/features/home/presentation/pages/home_page.dart index 878a860..d3df729 100644 --- a/lib/features/home/presentation/pages/home_page.dart +++ b/lib/features/home/presentation/pages/home_page.dart @@ -3,9 +3,11 @@ import 'package:get/get.dart'; import 'package:shia_game_flutter/common_ui/resources/my_assets.dart'; import 'package:shia_game_flutter/common_ui/resources/my_spaces.dart'; import 'package:shia_game_flutter/core/utils/gap.dart'; +import 'package:shia_game_flutter/core/utils/my_localization.dart'; import 'package:shia_game_flutter/core/widgets/background/my_background.dart'; import 'package:shia_game_flutter/core/widgets/image/my_image.dart'; import 'package:shia_game_flutter/features/home/presentation/controller/home_controller.dart'; +import 'package:shia_game_flutter/features/home/presentation/pages/widgets/enums/custom_widget_type.dart'; import 'package:shia_game_flutter/features/home/presentation/pages/widgets/home_battle_cast.dart'; import 'package:shia_game_flutter/features/home/presentation/pages/widgets/home_battle_league.dart'; import 'package:shia_game_flutter/features/home/presentation/pages/widgets/home_custom_widget.dart'; @@ -25,7 +27,7 @@ class HomePage extends GetView { HomeMembership(), HomeBattleLeague(), MySpaces.s20.gapHeight, - _customWidgets(), + _customWidgets(context), MySpaces.s20.gapHeight, HomeBattleCast(), ], @@ -33,14 +35,14 @@ class HomePage extends GetView { ); } - Widget _customWidgets() { + Widget _customWidgets(BuildContext context) { return Row( spacing: MySpaces.s22, children: [ Expanded( child: HomeCustomWidget( type: CustomWidgetType.customLeague, - firstText: 'ongoing:', + firstText: '${context.translate.ongoing}:', secondText: 'Saba Center League - Imam Hassan ministry London school', ), @@ -48,8 +50,8 @@ class HomePage extends GetView { Expanded( child: HomeCustomWidget( type: CustomWidgetType.friendBattle, - firstText: 'online:', - secondText: 'No one\'s online', + firstText: '${context.translate.online}:', + secondText: context.translate.no_one_online, ), ), ], diff --git a/lib/features/home/presentation/pages/widgets/enums/custom_widget_type.dart b/lib/features/home/presentation/pages/widgets/enums/custom_widget_type.dart new file mode 100644 index 0000000..cc75f8e --- /dev/null +++ b/lib/features/home/presentation/pages/widgets/enums/custom_widget_type.dart @@ -0,0 +1,73 @@ +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; +import 'package:shia_game_flutter/common_ui/resources/my_assets.dart'; +import 'package:shia_game_flutter/core/utils/my_localization.dart'; +import 'package:shia_game_flutter/core/widgets/text/gradient_text.dart'; + +enum CustomWidgetType { + customLeague, + friendBattle; + + static Map get borderGradient => { + CustomWidgetType.customLeague: LinearGradient( + begin: AlignmentDirectional.topCenter, + end: AlignmentDirectional.bottomCenter, + colors: [Color(0XFF4BAD42), Color(0XFF147743)], + ), + CustomWidgetType.friendBattle: LinearGradient( + begin: AlignmentDirectional.topCenter, + end: AlignmentDirectional.bottomCenter, + colors: [Color(0XFFED9851), Color(0XFFC77041)], + ), + }; + + static Map get gradient => { + CustomWidgetType.customLeague: RadialGradient( + radius: 0.7, + center: Alignment(-0.6, -0.8), + colors: [Color(0XFF58AE23), Color(0XFF066A36)], + ), + CustomWidgetType.friendBattle: RadialGradient( + radius: 0.7, + center: Alignment(-0.6, -0.8), + colors: [Color(0XFFE99E53), Color(0XFFBC673A)], + ), + }; + + static Map get image => { + CustomWidgetType.customLeague: MyAssets.medal, + CustomWidgetType.friendBattle: MyAssets.friendBattle, + }; + + static Map get containerColor => { + CustomWidgetType.customLeague: Color(0XFF05542B), + CustomWidgetType.friendBattle: Color(0XFFA45A31), + }; + + static Map get firstTextColor => { + CustomWidgetType.customLeague: Color(0XFF4FDF94), + CustomWidgetType.friendBattle: Color(0XFFE3DFD5), + }; + + static Map get secondTextColor => { + CustomWidgetType.customLeague: Color(0XFF85C9A6), + CustomWidgetType.friendBattle: Color(0XFFDFBC9D), + }; + + static Map get title => { + CustomWidgetType.customLeague: GradientText( + text: Get.context?.translate.custom_league, + color: Color(0XFFBEF8DA), + shadowColor: Color(0xFF07592F), + blurRadius: 0.52, + offset: Offset(0, 1.04), + ), + CustomWidgetType.friendBattle: GradientText( + text: Get.context?.translate.friends_battle, + color: Color(0XFFFFB994), + shadowColor: Color(0xFFAA5B31), + blurRadius: 0.52, + offset: Offset(0, 1.04), + ), + }; +} \ No newline at end of file diff --git a/lib/features/home/presentation/pages/widgets/home_battle_cast.dart b/lib/features/home/presentation/pages/widgets/home_battle_cast.dart index e3ea720..439f16a 100644 --- a/lib/features/home/presentation/pages/widgets/home_battle_cast.dart +++ b/lib/features/home/presentation/pages/widgets/home_battle_cast.dart @@ -4,8 +4,10 @@ import 'package:shia_game_flutter/common_ui/resources/my_assets.dart'; import 'package:shia_game_flutter/common_ui/resources/my_spaces.dart'; import 'package:shia_game_flutter/common_ui/resources/my_text_style.dart'; import 'package:shia_game_flutter/core/utils/gap.dart'; -import 'package:shia_game_flutter/core/widgets/container/gradient_container.dart'; +import 'package:shia_game_flutter/core/utils/my_localization.dart'; +import 'package:shia_game_flutter/core/widgets/container/my_container.dart'; import 'package:shia_game_flutter/core/widgets/image/my_image.dart'; +import 'package:shia_game_flutter/core/widgets/text/gradient_text.dart'; class HomeBattleCast extends StatelessWidget { const HomeBattleCast({ @@ -18,7 +20,7 @@ class HomeBattleCast extends StatelessWidget { alignment: Alignment.center, clipBehavior: Clip.none, children: [ - GradientContainer( + MyContainer( height: 120, borderRadius: BorderRadius.all(Radius.circular(MySpaces.s20)), borderGradient: LinearGradient( @@ -44,27 +46,13 @@ class HomeBattleCast extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.end, children: [ - ShaderMask( - blendMode: BlendMode.modulate, - shaderCallback: (bounds) => LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: [Color(0XFFFFFFFF), Color(0XFFE4E3FF)], - ).createShader(bounds), - child: Text( - 'Battle Cast', - style: Lexend.extraBold.copyWith( - fontSize: 22, - shadows: [ - BoxShadow( - color: Color(0xFF3C38C4), - blurRadius: 0.52, - offset: Offset(0, 1.04), - spreadRadius: 0, - ), - ], - ), - ), + GradientText( + text: context.translate.battle_cast, + color: Color(0XFFE4E3FF), + offset: Offset(0, 1.04), + blurRadius: 0.52, + shadowColor: Color(0xFF3C38C4), + fontSize: 22, ), MySpaces.s10.gapHeight, Container( @@ -96,7 +84,7 @@ class HomeBattleCast extends StatelessWidget { PositionedDirectional( start: -1, top: -MySpaces.s4, - child: GradientContainer( + child: MyContainer( color: Color(0XFFCC9B22), padding: EdgeInsets.symmetric( vertical: MySpaces.s2, diff --git a/lib/features/home/presentation/pages/widgets/home_battle_league.dart b/lib/features/home/presentation/pages/widgets/home_battle_league.dart index 54eeaea..579f51e 100644 --- a/lib/features/home/presentation/pages/widgets/home_battle_league.dart +++ b/lib/features/home/presentation/pages/widgets/home_battle_league.dart @@ -3,9 +3,11 @@ import 'package:shia_game_flutter/common_ui/resources/my_assets.dart'; import 'package:shia_game_flutter/common_ui/resources/my_spaces.dart'; import 'package:shia_game_flutter/common_ui/resources/my_text_style.dart'; import 'package:shia_game_flutter/core/utils/gap.dart'; +import 'package:shia_game_flutter/core/utils/my_localization.dart'; import 'package:shia_game_flutter/core/utils/screen_size.dart'; -import 'package:shia_game_flutter/core/widgets/container/gradient_container.dart'; +import 'package:shia_game_flutter/core/widgets/container/my_container.dart'; import 'package:shia_game_flutter/core/widgets/image/my_image.dart'; +import 'package:shia_game_flutter/core/widgets/text/gradient_text.dart'; class HomeBattleLeague extends StatelessWidget { const HomeBattleLeague({super.key}); @@ -15,7 +17,7 @@ class HomeBattleLeague extends StatelessWidget { return Stack( alignment: AlignmentDirectional.bottomEnd, children: [ - GradientContainer( + MyContainer( width: context.widthScreen, height: 120, padding: EdgeInsets.symmetric( @@ -38,30 +40,16 @@ class HomeBattleLeague extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ context.widthScreen.gapWidth, - ShaderMask( - blendMode: BlendMode.modulate, - shaderCallback: (bounds) => LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: [Color(0XFFFFFFFF), Color(0XFFCAA8FF)], - ).createShader(bounds), - child: Text( - 'Battle League', - style: Lexend.extraBold.copyWith( - fontSize: 22, - shadows: [ - BoxShadow( - color: Color(0xFF3E1381), - blurRadius: 0.84, - offset: Offset(0, 1.69), - spreadRadius: 0, - ), - ], - ), - ), + GradientText( + text: context.translate.battle_league, + color: Color(0XFFCAA8FF), + shadowColor: Color(0xFF3E1381), + blurRadius: 0.84, + offset: Offset(0, 1.69), + fontSize: 22, ), Text( - 'The faster you answer, the winner', + context.translate.answer_win, style: Lexend.medium.copyWith( fontSize: 10, color: Color(0XFFA183D2), diff --git a/lib/features/home/presentation/pages/widgets/home_custom_widget.dart b/lib/features/home/presentation/pages/widgets/home_custom_widget.dart index dc8853e..eeaf067 100644 --- a/lib/features/home/presentation/pages/widgets/home_custom_widget.dart +++ b/lib/features/home/presentation/pages/widgets/home_custom_widget.dart @@ -1,112 +1,13 @@ import 'package:flutter/material.dart' hide BoxDecoration, BoxShadow; import 'package:flutter_inset_box_shadow_update/flutter_inset_box_shadow_update.dart'; -import 'package:get/get.dart'; import 'package:shia_game_flutter/common_ui/resources/my_assets.dart'; import 'package:shia_game_flutter/common_ui/resources/my_spaces.dart'; import 'package:shia_game_flutter/common_ui/resources/my_text_style.dart'; import 'package:shia_game_flutter/core/utils/gap.dart'; -import 'package:shia_game_flutter/core/utils/my_localization.dart'; import 'package:shia_game_flutter/core/utils/screen_size.dart'; -import 'package:shia_game_flutter/core/widgets/container/gradient_container.dart'; +import 'package:shia_game_flutter/core/widgets/container/my_container.dart'; import 'package:shia_game_flutter/core/widgets/image/my_image.dart'; - -enum CustomWidgetType { - customLeague, - friendBattle; - - static Map get borderGradient => { - CustomWidgetType.customLeague: LinearGradient( - begin: AlignmentDirectional.topCenter, - end: AlignmentDirectional.bottomCenter, - colors: [Color(0XFF4BAD42), Color(0XFF147743)], - ), - CustomWidgetType.friendBattle: LinearGradient( - begin: AlignmentDirectional.topCenter, - end: AlignmentDirectional.bottomCenter, - colors: [Color(0XFFED9851), Color(0XFFC77041)], - ), - }; - - static Map get gradient => { - CustomWidgetType.customLeague: RadialGradient( - radius: 0.7, - center: Alignment(-0.6, -0.8), - colors: [Color(0XFF58AE23), Color(0XFF066A36)], - ), - CustomWidgetType.friendBattle: RadialGradient( - radius: 0.7, - center: Alignment(-0.6, -0.8), - colors: [Color(0XFFE99E53), Color(0XFFBC673A)], - ), - }; - - static Map get image => { - CustomWidgetType.customLeague: MyAssets.medal, - CustomWidgetType.friendBattle: MyAssets.friendBattle, - }; - - static Map get containerColor => { - CustomWidgetType.customLeague: Color(0XFF05542B), - CustomWidgetType.friendBattle: Color(0XFFA45A31), - }; - - static Map get firstTextColor => { - CustomWidgetType.customLeague: Color(0XFF4FDF94), - CustomWidgetType.friendBattle: Color(0XFFE3DFD5), - }; - - static Map get secondTextColor => { - CustomWidgetType.customLeague: Color(0XFF85C9A6), - CustomWidgetType.friendBattle: Color(0XFFDFBC9D), - }; - - static Map get title => { - CustomWidgetType.customLeague: ShaderMask( - blendMode: BlendMode.modulate, - shaderCallback: (bounds) => LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: [Color(0XFFFFFFFF), Color(0XFFFFFFFF), Color(0XFFBEF8DA)], - ).createShader(bounds), - child: Text( - Get.context?.translate.custom_league ?? '', - style: Lexend.extraBold.copyWith( - fontSize: 14, - shadows: [ - BoxShadow( - color: Color(0xFF07592F), - blurRadius: 0.52, - offset: Offset(0, 1.04), - spreadRadius: 0, - ), - ], - ), - ), - ), - CustomWidgetType.friendBattle: ShaderMask( - blendMode: BlendMode.modulate, - shaderCallback: (bounds) => LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: [Color(0XFFFFFFFF), Color(0XFFFFFFFF), Color(0XFFFFB994)], - ).createShader(bounds), - child: Text( - Get.context?.translate.friends_battle ?? '', - style: Lexend.extraBold.copyWith( - fontSize: 14, - shadows: [ - BoxShadow( - color: Color(0xFFAA5B31), - blurRadius: 0.52, - offset: Offset(0, 1.04), - spreadRadius: 0, - ), - ], - ), - ), - ), - }; -} +import 'package:shia_game_flutter/features/home/presentation/pages/widgets/enums/custom_widget_type.dart'; class HomeCustomWidget extends StatelessWidget { const HomeCustomWidget({ @@ -122,7 +23,7 @@ class HomeCustomWidget extends StatelessWidget { @override Widget build(BuildContext context) { - return GradientContainer( + return MyContainer( height: 130, borderRadius: BorderRadius.all(Radius.circular(20)), borderGradient: CustomWidgetType.borderGradient[type], diff --git a/lib/features/home/presentation/pages/widgets/home_membership.dart b/lib/features/home/presentation/pages/widgets/home_membership.dart index a505bbd..b5bd6c3 100644 --- a/lib/features/home/presentation/pages/widgets/home_membership.dart +++ b/lib/features/home/presentation/pages/widgets/home_membership.dart @@ -7,7 +7,7 @@ import 'package:shia_game_flutter/common_ui/theme/my_theme.dart'; import 'package:shia_game_flutter/core/utils/gap.dart'; import 'package:shia_game_flutter/core/utils/my_localization.dart'; import 'package:shia_game_flutter/core/utils/screen_size.dart'; -import 'package:shia_game_flutter/core/widgets/container/gradient_container.dart'; +import 'package:shia_game_flutter/core/widgets/container/my_container.dart'; import 'package:shia_game_flutter/core/widgets/image/my_image.dart'; class HomeMembership extends StatelessWidget { @@ -15,7 +15,7 @@ class HomeMembership extends StatelessWidget { @override Widget build(BuildContext context) { - return GradientContainer( + return MyContainer( width: context.widthScreen, color: context.backgroundColor, borderGradient: LinearGradient( diff --git a/lib/features/profile/presentation/ui/profile_page.dart b/lib/features/profile/presentation/ui/profile_page.dart index 210589e..f004afe 100644 --- a/lib/features/profile/presentation/ui/profile_page.dart +++ b/lib/features/profile/presentation/ui/profile_page.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:shia_game_flutter/common_ui/resources/my_spaces.dart'; import 'package:shia_game_flutter/core/utils/gap.dart'; +import 'package:shia_game_flutter/core/utils/my_localization.dart'; import 'package:shia_game_flutter/core/widgets/background/my_background.dart'; import 'package:shia_game_flutter/core/widgets/button/my_gradient_button.dart'; import 'package:shia_game_flutter/core/widgets/input/my_input.dart'; @@ -21,14 +22,11 @@ class ProfilePage extends GetView { children: [ 60.0.gapHeight, ProfileAvatar(), - MyGradientButton(), + _changeProfileBtn(context), MySpaces.s40.gapHeight, - MyInput( - labelText: 'User Name', - hintText: 'Unknown123456', - ), + _userNameInput(context), MySpaces.s28.gapHeight, - _locationInput(), + _locationInput(context), 200.0.gapHeight, _bottomButtons(), ], @@ -36,14 +34,28 @@ class ProfilePage extends GetView { ); } - Row _locationInput() { + MyGradientButton _changeProfileBtn(BuildContext context) { + return MyGradientButton( + onTap: () {}, + title: context.translate.change_profile, + ); + } + + MyInput _userNameInput(BuildContext context) { + return MyInput( + labelText: context.translate.username, + hintText: 'Unknown123456', + ); + } + + Row _locationInput(BuildContext context) { return Row( crossAxisAlignment: CrossAxisAlignment.end, spacing: MySpaces.s10, children: [ Expanded( child: MyInput( - labelText: 'Your Region', + labelText: context.translate.your_region, hintText: 'Iran - Tehran', ), ), diff --git a/lib/features/profile/presentation/ui/widgets/profile_delete_account.dart b/lib/features/profile/presentation/ui/widgets/profile_delete_account.dart index f44437e..3969223 100644 --- a/lib/features/profile/presentation/ui/widgets/profile_delete_account.dart +++ b/lib/features/profile/presentation/ui/widgets/profile_delete_account.dart @@ -3,14 +3,14 @@ import 'package:shia_game_flutter/common_ui/resources/my_spaces.dart'; import 'package:shia_game_flutter/common_ui/resources/my_text_style.dart'; import 'package:shia_game_flutter/common_ui/theme/my_theme.dart'; import 'package:shia_game_flutter/core/utils/my_localization.dart'; -import 'package:shia_game_flutter/core/widgets/container/gradient_container.dart'; +import 'package:shia_game_flutter/core/widgets/container/my_container.dart'; class ProfileDeleteAccount extends StatelessWidget { const ProfileDeleteAccount({super.key}); @override Widget build(BuildContext context) { - return GradientContainer( + return MyContainer( height: 58, onTap: () {}, borderRadius: BorderRadius.all(Radius.circular(MySpaces.s12)), diff --git a/lib/features/profile/presentation/ui/widgets/profile_location.dart b/lib/features/profile/presentation/ui/widgets/profile_location.dart index 233eb43..e7f9d7f 100644 --- a/lib/features/profile/presentation/ui/widgets/profile_location.dart +++ b/lib/features/profile/presentation/ui/widgets/profile_location.dart @@ -1,6 +1,6 @@ import 'package:flutter/material.dart'; import 'package:shia_game_flutter/common_ui/resources/my_assets.dart'; -import 'package:shia_game_flutter/core/widgets/container/gradient_container.dart'; +import 'package:shia_game_flutter/core/widgets/container/my_container.dart'; import 'package:shia_game_flutter/core/widgets/image/my_image.dart'; class ProfileLocation extends StatelessWidget { @@ -8,7 +8,7 @@ class ProfileLocation extends StatelessWidget { @override Widget build(BuildContext context) { - return GradientContainer( + return MyContainer( onTap: () {}, width: 48, height: 48, diff --git a/lib/features/profile/presentation/ui/widgets/profile_logout.dart b/lib/features/profile/presentation/ui/widgets/profile_logout.dart index d1999cf..8f3758c 100644 --- a/lib/features/profile/presentation/ui/widgets/profile_logout.dart +++ b/lib/features/profile/presentation/ui/widgets/profile_logout.dart @@ -3,7 +3,7 @@ import 'package:shia_game_flutter/common_ui/resources/my_assets.dart'; import 'package:shia_game_flutter/common_ui/resources/my_spaces.dart'; import 'package:shia_game_flutter/common_ui/resources/my_text_style.dart'; import 'package:shia_game_flutter/core/utils/my_localization.dart'; -import 'package:shia_game_flutter/core/widgets/container/gradient_container.dart'; +import 'package:shia_game_flutter/core/widgets/container/my_container.dart'; import 'package:shia_game_flutter/core/widgets/image/my_image.dart'; class ProfileLogout extends StatelessWidget { @@ -11,7 +11,7 @@ class ProfileLogout extends StatelessWidget { @override Widget build(BuildContext context) { - return GradientContainer( + return MyContainer( height: 58, onTap: () {}, borderRadius: BorderRadius.all(Radius.circular(MySpaces.s12)), diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index ec1386d..e32b6ee 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -9,5 +9,14 @@ "custom_league": "Custom League", "friends_battle": "Friends Battle", "logout": "Log out", - "delete_account": "Delete Account" + "delete_account": "Delete Account", + "username": "User Name", + "your_region": "Your Region", + "change_profile": "Change Profile", + "battle_league": "Battle League", + "answer_win": "The faster you answer, the winner", + "ongoing": "ongoing", + "online": "online", + "battle_cast": "Battle Cast", + "no_one_online": "No one's online" } \ No newline at end of file diff --git a/lib/l10n/app_localizations.dart b/lib/l10n/app_localizations.dart index 3297b55..71f86c3 100644 --- a/lib/l10n/app_localizations.dart +++ b/lib/l10n/app_localizations.dart @@ -153,6 +153,60 @@ abstract class AppLocalizations { /// In en, this message translates to: /// **'Delete Account'** String get delete_account; + + /// No description provided for @username. + /// + /// In en, this message translates to: + /// **'User Name'** + String get username; + + /// No description provided for @your_region. + /// + /// In en, this message translates to: + /// **'Your Region'** + String get your_region; + + /// No description provided for @change_profile. + /// + /// In en, this message translates to: + /// **'Change Profile'** + String get change_profile; + + /// No description provided for @battle_league. + /// + /// In en, this message translates to: + /// **'Battle League'** + String get battle_league; + + /// No description provided for @answer_win. + /// + /// In en, this message translates to: + /// **'The faster you answer, the winner'** + String get answer_win; + + /// No description provided for @ongoing. + /// + /// In en, this message translates to: + /// **'ongoing'** + String get ongoing; + + /// No description provided for @online. + /// + /// In en, this message translates to: + /// **'online'** + String get online; + + /// No description provided for @battle_cast. + /// + /// In en, this message translates to: + /// **'Battle Cast'** + String get battle_cast; + + /// No description provided for @no_one_online. + /// + /// In en, this message translates to: + /// **'No one\'s online'** + String get no_one_online; } class _AppLocalizationsDelegate diff --git a/lib/l10n/app_localizations_en.dart b/lib/l10n/app_localizations_en.dart index 0436ab4..6847d8a 100644 --- a/lib/l10n/app_localizations_en.dart +++ b/lib/l10n/app_localizations_en.dart @@ -37,4 +37,31 @@ class AppLocalizationsEn extends AppLocalizations { @override String get delete_account => 'Delete Account'; + + @override + String get username => 'User Name'; + + @override + String get your_region => 'Your Region'; + + @override + String get change_profile => 'Change Profile'; + + @override + String get battle_league => 'Battle League'; + + @override + String get answer_win => 'The faster you answer, the winner'; + + @override + String get ongoing => 'ongoing'; + + @override + String get online => 'online'; + + @override + String get battle_cast => 'Battle Cast'; + + @override + String get no_one_online => 'No one\'s online'; }