Files
Tanami_App/lib/features/MainScreens/Wallet/presentation/pages/walletDetails.dart
2024-06-12 11:28:44 +05:30

403 lines
14 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:tanami_app/core/routes/routes.dart';
import 'package:tanami_app/core/styles/app_text.dart';
import '../../../../../core/styles/app_color.dart';
import '../../../../../shared/components/button_widget.dart';
class WalletDetails extends StatelessWidget {
final String type;
WalletDetails({super.key, required this.type});
final List titles = [
AppText.status,
AppText.paymentMethod,
AppText.accountName,
AppText.iban,
AppText.beneficiaryAddress,
AppText.bankName,
AppText.branchAddress,
AppText.SWIFTcode,
AppText.refid,
];
final List values = [
'On hold',
'Google/Apple Pay',
'Name Surname',
'DE 1234 5678 9012 3456',
'Hohenzollernring 58, 95444',
'Name Bank',
'Hohenzollernring 58, 95444',
'BC12345',
'FRYU FHDU 1234',
];
// final Map<String, String> data_deposit = {
// AppText.paymentMethod: 'Google/Apple Pay',
// AppText.accountName: 'Name Surname',
// AppText.iban: 'DE 1234 5678 9012 3456',
// AppText.beneficiaryAddress: 'Hohenzollernring 58, 95444',
// AppText.bankName: 'Bank Name',
// AppText.branchAddress: 'Hohenzollernring 58, 95444',
// AppText.SWIFTcode: 'BC12345',
// AppText.refid: 'FRYU FHDU 1234',
// };
// final Map<String, String> data_withdraw = {
// AppText.status: 'On hold',
// AppText.paymentMethod: 'Google/Apple Pay',
// AppText.accountName: 'Name Surname',
// AppText.iban: 'DE 1234 5678 9012 3456',
// AppText.beneficiaryAddress: 'Hohenzollernring 58, 95444',
// AppText.bankName: 'Bank Name',
// AppText.branchAddress: 'Hohenzollernring 58, 95444',
// AppText.SWIFTcode: 'BC12345',
// AppText.refid: 'FRYU FHDU 1234',
// };
// final Map<String, String> data_invest = {
// AppText.paymentMethod: 'Google/Apple Pay',
// };
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
bottomNavigationBar: type == "confirm-investment"
? Container(
margin: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 15,
),
width: 1.sw,
height: 60.h,
child: ButtonWidget().elevatedBtn(
txtClr: AppColor.plainWhite,
function: () {
goRouter.pop();
goRouter.pop();
goRouter.pop();
goRouter.pop();
goRouter.pop();
},
text: AppText.closeText,
clr: AppColor.primaryColor2,
),
)
: const SizedBox(),
appBar: AppBar(
backgroundColor: Colors.white,
elevation: 0,
automaticallyImplyLeading: type == "confirm-investment" ? false : true,
actions: [
type == "confirm-investment"
? IconButton(
onPressed: () {
goRouter.pop();
goRouter.pop();
goRouter.pop();
goRouter.pop();
goRouter.pop();
},
icon: const Icon(
Icons.cancel_outlined,
color: Color(0xFF363636),
))
: const SizedBox()
],
scrolledUnderElevation: 0.0,
centerTitle: true,
title: Text(
type == "confirm-investment"
? AppText.investmentConfirmationText
: AppText.walletDetailsTitle,
style: GoogleFonts.dmSans(
color: const Color(0xFF272727),
fontSize: 20.sp,
fontWeight: FontWeight.w700,
),
),
),
body: Stack(
children: [
Padding(
padding: const EdgeInsets.all(18.0),
child: Container(
width: double.infinity,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(22.r),
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.15),
spreadRadius: 2,
blurRadius: 10,
offset: const Offset(0, 8), // changes position of shadow
),
],
),
child: Padding(
padding: const EdgeInsets.fromLTRB(20.0, 30, 20, 10),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
getIcon(type),
SizedBox(
height: 16.h,
),
Text(
type == "confirm-investment" ? "Investment" : type,
style: GoogleFonts.dmSans(
color: const Color(0xFF191B1E),
fontSize: 14.sp,
fontWeight: FontWeight.w600,
),
),
SizedBox(
height: 4.h,
),
type == "confirm-investment"
? Text(
"Name of investment",
style: GoogleFonts.dmSans(
color: const Color(0xFF191B1E),
fontSize: 17.sp,
fontWeight: FontWeight.w700,
),
)
: const SizedBox(),
SizedBox(
height: 4.h,
),
Text(
'10/04/2024 22:04',
style: GoogleFonts.dmSans(
color: const Color(0xFF8D8D8D),
fontSize: 11.sp,
fontWeight: FontWeight.w500,
),
),
SizedBox(
height: 16.h,
),
Text(
'+ SAR 100,000',
style: GoogleFonts.dmSans(
color: const Color(0xFF191B1E),
fontSize: 20.sp,
fontWeight: FontWeight.w900,
),
),
type == "confirm-investment"
? Text(
"+ \$100.00",
style: GoogleFonts.dmSans(
color: const Color(0xFF363636),
fontSize: 12.sp,
fontWeight: FontWeight.w500,
),
)
: const SizedBox(),
],
),
SizedBox(
height: 35.h,
),
_buildBody(),
],
),
),
),
),
// Positioned(
// // bottom: 40,
// top: 400.h,
// // right: 30,
// child: Container(
// height: 20.r,
// decoration: const BoxDecoration(
// shape: BoxShape.circle,
// color: Colors.red,
// ),
// ),
// ),
// Align(
// alignment: Alignment.centerLeft,
// child: Container(
// height: 20.r,
// decoration: const BoxDecoration(
// shape: BoxShape.circle,
// color: Colors.red,
// ),
// ),
// )
],
),
);
}
Widget getIcon(String title) {
if (title == 'Deposit') {
return Container(
decoration: const BoxDecoration(
shape: BoxShape.circle, color: Color(0xFF0FA4A4)),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Image.asset(
'assets/images/wallet_screen/deposit_list.png',
height: 25.h,
),
),
);
} else if (title == 'Withdrawal') {
return Container(
decoration: const BoxDecoration(
shape: BoxShape.circle, color: Color(0xFFE6681F)),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Image.asset('assets/images/wallet_screen/withdraw_list.png',
height: 25.h),
),
);
} else if (title == 'Investment' || title == 'confirm-investment') {
return Container(
decoration: const BoxDecoration(
shape: BoxShape.circle, color: Color(0xFF0172CB)),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Image.asset('assets/images/wallet_screen/invest_list.png',
height: 25.h),
),
);
} else if (title == 'Yield') {
return Container(
decoration: const BoxDecoration(
shape: BoxShape.circle, color: Color(0xFF4C4AEF)),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Image.asset('assets/images/wallet_screen/yield_list.png',
height: 25.h),
),
);
} else {
return Container(
decoration: const BoxDecoration(
shape: BoxShape.circle, color: Color(0xFF0E9445)),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Image.asset('assets/images/wallet_screen/refund_list.png',
height: 25.h),
),
);
}
}
Widget _buildBody() {
// List<MapEntry<String, String>> entries;
if (type == 'Yield') {
return Container();
} else if (type == 'Refund') {
return Container();
} else if (type == 'Investment' || type == "confirm-investment") {
return Container(
width: double.infinity,
decoration: const BoxDecoration(
border: Border(
bottom: BorderSide(
color: Colors.white,
width: 1.0,
),
),
),
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 15.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
AppText.paymentMethod,
style: GoogleFonts.dmSans(
color: const Color(0xFF535353),
fontSize: 14.sp,
fontWeight: FontWeight.w500,
),
),
SizedBox(
width: 180.w,
child: Text(
'Google/Apple Pay',
textAlign: TextAlign.end,
style: GoogleFonts.dmSans(
color: const Color(0xFF191B1E),
fontSize: 14.sp,
fontWeight: FontWeight.w600,
),
),
),
],
),
),
);
} else {
return Expanded(
child: ListView.builder(
physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemCount: titles.length,
itemBuilder: (context, index) {
if (type == 'Deposit' && titles[index] == 'Status') {
return Container();
} else {
return Container(
width: double.infinity,
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: (index != titles.length - 1)
? Colors.black
: Colors.white,
width: 1.0,
),
),
),
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 15.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
titles[index],
style: GoogleFonts.dmSans(
color: const Color(0xFF535353),
fontSize: 14.sp,
fontWeight: FontWeight.w500,
),
),
Expanded(
child: Text(
values[index],
textAlign: TextAlign.end,
style: GoogleFonts.dmSans(
color: (titles[index] == 'Status')
? const Color(0xFF0172CB)
: const Color(0xFF191B1E),
fontSize: 14.sp,
fontWeight: (titles[index] == 'Status')
? FontWeight.w700
: FontWeight.w600,
),
),
),
],
),
),
);
}
},
),
);
}
}
}