Houshan-Basa/lib/ui/screens/auth/gift/gift_credit_screen.dart

323 lines
14 KiB
Dart

// ignore_for_file: use_build_context_synchronously, deprecated_member_use
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:go_router/go_router.dart';
import 'package:hoshan/core/routes/route_generator.dart';
import 'package:hoshan/data/model/home_args.dart';
import 'package:hoshan/ui/screens/splash/cubit/user_info_cubit.dart';
import 'package:hoshan/ui/theme/text.dart';
import 'package:hoshan/ui/widgets/components/button/loading_button.dart';
class GiftCreditScreen extends StatelessWidget {
const GiftCreditScreen({super.key});
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final colorScheme = theme.colorScheme;
final isDark = theme.brightness == Brightness.dark;
final surfaceColor = colorScheme.surface;
final backgroundColor = colorScheme.background;
final onSurface = colorScheme.onSurface;
final cardBorder = colorScheme.outlineVariant;
final warningBg = isDark
? colorScheme.errorContainer.withOpacity(0.2)
: const Color.fromARGB(255, 248, 231, 241);
final warningBorder = isDark
? colorScheme.errorContainer
: const Color.fromARGB(255, 172, 18, 105);
return Directionality(
textDirection: TextDirection.rtl,
child: Scaffold(
backgroundColor: backgroundColor,
body: SafeArea(
child: SingleChildScrollView(
physics: const BouncingScrollPhysics(),
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
const SizedBox(height: 16),
Container(
padding: const EdgeInsets.symmetric(
vertical: 24, horizontal: 16),
decoration: BoxDecoration(
color: surfaceColor,
borderRadius: BorderRadius.circular(16),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.05),
blurRadius: 10,
offset: const Offset(0, 4),
),
],
border: Border.all(color: cardBorder),
),
child: Column(
children: [
SvgPicture.asset('assets/icon/outline/gift 2.svg'),
const SizedBox(height: 20),
Text(
'بسته اعتبار هدیه',
style: AppTextStyles.headline5.copyWith(
color: onSurface,
),
),
// const SizedBox(height: 8),
// Text(
// '1000 سکه هوشان',
// style: AppTextStyles.headline3.copyWith(
// color: Theme.of(context).colorScheme.onSurface,
// fontSize: 16,
// fontWeight: FontWeight.normal),
// ),
],
),
),
const SizedBox(height: 24),
Column(
children: [
Row(
children: [
SvgPicture.asset(
'assets/icon/outline/add family.svg'),
const SizedBox(width: 12),
Text(
'دعوت اعضای خانواده',
style: AppTextStyles.headline6.copyWith(
color: onSurface,
),
),
],
),
SizedBox(
height: 15,
),
RichText(
text: TextSpan(
style: AppTextStyles.body5.copyWith(
color: Theme.of(context).colorScheme.onSurface,
fontFamily: AppTextStyles.defaultFontFamily,
),
children: [
const TextSpan(text: 'شما می‌توانید '),
TextSpan(
text: 'تا 5 نفر',
style: TextStyle(
color: Theme.of(context).colorScheme.primary,
fontWeight: FontWeight.bold,
),
),
const TextSpan(
text:
' از اعضای خانواده خود را به استفاده از هوشان دعوت کنید.',
),
],
),
),
],
),
const SizedBox(height: 24),
_buildFeatureCard(
context,
icon: 'assets/icon/outline/Houshan features.svg',
title: 'دسترسی کامل به هوشان',
description: 'تمامی فیچرهای سرگرمی و آموزش',
borderColor: cardBorder,
titleColor: onSurface,
descColor: onSurface.withOpacity(0.8),
),
const SizedBox(height: 12),
_buildFeatureCard(
context,
icon: 'assets/icon/outline/wallet.svg',
title: 'کیف پول مشترک',
description: 'استفاده از سکه‌های مشترک خانواده',
borderColor: cardBorder,
titleColor: onSurface,
descColor: onSurface.withOpacity(0.8),
),
const SizedBox(height: 12),
_buildFeatureCard(
context,
icon: 'assets/icon/outline/Houshan features.svg',
title: 'ابزارهای خلاقانه',
description:
'تولید عکس، ویدیو، صدا، چت با هوش مصنوعی و ...',
borderColor: cardBorder,
titleColor: onSurface,
descColor: onSurface.withOpacity(0.8),
),
const SizedBox(height: 24),
Container(
padding: const EdgeInsets.all(16),
decoration: BoxDecoration(
color: warningBg,
borderRadius: BorderRadius.circular(16),
border: Border.all(color: warningBorder),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SvgPicture.asset('assets/icon/outline/warning.svg'),
const SizedBox(width: 20),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'نکته مهم',
style: AppTextStyles.headline6.copyWith(
color: onSurface,
),
),
const SizedBox(height: 8),
Text(
'سکه‌های شما بین تمام اعضای خانواده مشترک است. هر عضو می‌تواند از این سکه‌ها استفاده کند و مانده سکه برای همه یکسان خواهد بود',
style: AppTextStyles.body5.copyWith(
color: onSurface,
),
),
],
),
),
],
),
const SizedBox(height: 16),
// کانتینر سفید داخل کادر قرمز
// Container(
// padding: const EdgeInsets.all(12),
// decoration: BoxDecoration(
// color: Colors.white,
// borderRadius: BorderRadius.circular(12),
// border: Border.all(color: AppColors.red[100]!),
// ),
// child: Row(
// children: [
// Expanded(
// child: Center(
// child: Text.rich(
// TextSpan(
// // استایل پایه برای کل متن (رنگ و فونت)
// style: AppTextStyles.body5.copyWith(
// color: Color.fromARGB(255, 61, 61, 61),
// ),
// children: [
// TextSpan(
// text: 'تمدید خودکار: ',
// // این قسمت پررنگ‌تر می‌شود
// style: const TextStyle(
// fontWeight: FontWeight
// .w900, // یا FontWeight.bold
// ),
// ),
// const TextSpan(
// text:
// '',
// // این قسمت معمولی باقی می‌ماند
// style: TextStyle(
// fontWeight: FontWeight.normal,
// ),
// ),
// ],
// ),
// textAlign:
// TextAlign.center, // وسط‌چین کردن متن
// ),
// ),
// ),
// ],
// ),
// ),
],
),
),
const SizedBox(height: 32),
LoadingButton(
width: MediaQuery.sizeOf(context).width,
height: 60,
radius: 100,
color: Theme.of(context).colorScheme.primary,
onPressed: () async {
await context.read<UserInfoCubit>().getUserInfo();
context.go(Routes.home,
extra: HomeArgs(freeCredit: 1000));
},
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'شروع استفاده از هوشان',
style: AppTextStyles.headline6
.copyWith(color: Colors.white),
),
const SizedBox(width: 8),
SvgPicture.asset('assets/icon/outline/arrow-left.svg')
],
),
),
const SizedBox(height: 24),
],
),
),
),
),
),
);
}
Widget _buildFeatureCard(
BuildContext context, {
required String icon,
required String title,
required String description,
required Color borderColor,
required Color titleColor,
required Color descColor,
}) {
return Container(
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 16),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
border: Border.all(color: borderColor),
),
child: Row(
children: [
SvgPicture.asset(
icon,
),
const SizedBox(width: 16),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title,
style: AppTextStyles.body4.copyWith(
fontWeight: FontWeight.bold,
color: titleColor,
),
),
const SizedBox(height: 2),
Text(
description,
style: AppTextStyles.body6.copyWith(
color: descColor,
),
),
],
),
),
],
),
);
}
}