Untitled
unknown
plain_text
a year ago
7.3 kB
14
Indexable
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:loanconnect/base/base/base_screen.dart';
import 'package:loanconnect/common/constants/assets.dart';
import 'package:loanconnect/common/widgets/buttons/custom_button.dart';
import 'package:loanconnect/common/widgets/images/svg_image_with_size.dart';
import 'package:loanconnect/common/widgets/text/common_text.dart';
import 'package:loanconnect/generated/locales.g.dart';
import 'package:loanconnect/presentation/dashboard/view/component/loan_type_component.dart';
import 'package:loanconnect/presentation/dashboard/view/component/loan_walkthrough_component.dart';
import 'package:loanconnect/presentation/dashboard/view/dashboard_controller.dart';
import 'package:loanconnect/utils/colors/app_colors.dart';
import 'package:loanconnect/utils/utils.dart';
class LoanTypeData {
final String icon;
final String title;
final String description;
LoanTypeData({
required this.icon,
required this.title,
required this.description,
});
}
class DashboardScreen extends BaseScreen {
const DashboardScreen({super.key});
@override
State<StatefulWidget> createState() => _DashboardScreenState();
}
class _DashboardScreenState
extends BaseScreenState<DashboardScreen, DashboardController>
with SingleTickerProviderStateMixin {
final List<Color> backgroundColors = [
AppColors.to.textColorC7DEFE,
AppColors.colore7effa,
];
@override
Widget buildWidget() {
// TODO: implement buildWidget
return Scaffold(
backgroundColor: AppColors.to.primaryColor,
body: SafeArea(
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
///Header Component
Padding(
padding: EdgeInsets.only(top: 8.h, left: 16.w),
child: SvgImageWithSize(
imagePath: Assets.icons.icAppLogo,
height: 25.w,
width: 25.w,
),
),
10.verticalSpace,
/// Body Component
LoanWalkthroughComponent(),
16.verticalSpace,
/// Footer Component
Center(
child: GestureDetector(
onTap: () {
showSnackBar("Hello" ?? "", true);
print("hello");
//controller.selectLoan(index);
},
child: CommonTextWidget(
title: LocaleKeys.availableLoanType.tr,
color: AppColors.to.textColor093176,
fontSize: 22.sp,
fontWeight: FontWeight.w600,
),
),
),
16.verticalSpace,
Obx(
() => GestureDetector(
onTap: () {
showSnackBar("Hello" ?? "", true);
print("hello");
//controller.selectLoan(index);
},
child: ListView.builder(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemCount: controller.loanTypes.length,
itemBuilder: (context, index) {
final loan = controller.loanTypes[index];
final bgColor =
backgroundColors[index % backgroundColors.length];
final isSelected =
controller.selectedLoanIndex.value == index;
return GestureDetector(
onTap: () {
showSnackBar("Hello" ?? "", true);
print("hello");
controller.selectLoan(index);
},
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 6.w),
child: AnimatedContainer(
duration: const Duration(milliseconds: 300),
curve: Curves.easeOutBack,
margin: EdgeInsets.only(
bottom: 16.h,
left: isSelected ? 10.w : 16.w,
right: isSelected ? 10.w : 16.w,
),
padding: EdgeInsets.fromLTRB(
isSelected ? 30.w : 26.w,
isSelected ? 24.h : 20.h,
isSelected ? 30.w : 26.w,
isSelected ? 34.h : 30.h,
),
decoration: BoxDecoration(
color: bgColor,
borderRadius: BorderRadius.circular(14.r),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Center(
child: SvgImageWithSize(
imagePath: loan.icon,
height: 80.w,
width: 80.w,
),
),
10.verticalSpace,
CommonTextWidget(
title: loan.title.tr,
color: AppColors.color093176,
fontWeight: FontWeight.w600,
fontSize: 16.sp,
),
10.verticalSpace,
CommonTextWidget(
title: loan.description.tr,
color: AppColors.to.textColor545151,
fontWeight: FontWeight.w500,
fontSize: 12.sp,
),
14.verticalSpace,
CustomButton(
title: LocaleKeys.getNow.tr,
onPressed: () {
/// You can also handle navigation or API call here
debugPrint(
"Selected Loan: ${loan.title.tr} at index $index",
);
},
trailingIcon: Icons.arrow_forward_rounded,
trailingIconColor: Colors.white,
),
],
),
),
),
);
},
),
),
),
],
),
),
),
);
}
}
Editor is loading...
Leave a Comment