added fab icon

This commit is contained in:
Vaibhav Surve 2025-11-05 17:37:32 +05:30
parent 0954e46c61
commit 42c2739d0c

View File

@ -111,38 +111,49 @@ class _FinanceScreenState extends State<FinanceScreen>
child: _buildFinanceModulesCompact(),
),
),
floatingActionButton: FloatingActionButton(
onPressed: () {
showPaymentRequestBottomSheet();
},
backgroundColor: contentTheme.primary,
child: const Icon(Icons.add),
tooltip: "Create Payment Request",
),
);
}
// --- Finance Modules (Single Row, Equally Spaced) ---
// --- Finance Modules (Compact Dashboard-style) ---
Widget _buildFinanceModulesCompact() {
final stats = [
_FinanceStatItem(LucideIcons.badge_dollar_sign, "Expense",
contentTheme.info, "/dashboard/expense-main-page"),
_FinanceStatItem(LucideIcons.receipt_text, "Payment Request",
contentTheme.primary, "/dashboard/payment-request"),
_FinanceStatItem(LucideIcons.wallet, "Advance Payment",
contentTheme.warning, "/dashboard/advance-payment"),
_FinanceStatItem(
LucideIcons.wallet, "Advance Payment", contentTheme.warning, "/dashboard/advance-payment"),
];
final projectSelected = projectController.selectedProject != null;
return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: stats.map((stat) {
return Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 8),
child: _buildFinanceModuleCard(stat, projectSelected),
),
);
}).toList(),
);
return LayoutBuilder(builder: (context, constraints) {
int crossAxisCount = (constraints.maxWidth ~/ 80).clamp(2, 4);
double cardWidth =
(constraints.maxWidth - (crossAxisCount - 1) * 6) / crossAxisCount;
return Wrap(
spacing: 6,
runSpacing: 6,
alignment: WrapAlignment.start,
children: stats
.map((stat) =>
_buildFinanceModuleCard(stat, projectSelected, cardWidth))
.toList(),
);
});
}
Widget _buildFinanceModuleCard(
_FinanceStatItem stat, bool isProjectSelected) {
_FinanceStatItem stat, bool isProjectSelected, double width) {
final bool isEnabled = isProjectSelected;
return Opacity(
@ -153,32 +164,33 @@ class _FinanceScreenState extends State<FinanceScreen>
onTap: () => _onCardTap(stat, isEnabled),
borderRadius: BorderRadius.circular(5),
child: MyCard.bordered(
height: 80,
paddingAll: 5,
width: width,
height: 60,
paddingAll: 4,
borderRadiusAll: 5,
border: Border.all(color: Colors.grey.withOpacity(0.15)),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
padding: const EdgeInsets.all(6),
padding: const EdgeInsets.all(4),
decoration: BoxDecoration(
color: stat.color.withOpacity(0.1),
borderRadius: BorderRadius.circular(4),
),
child: Icon(
stat.icon,
size: 20,
size: 16,
color: stat.color,
),
),
MySpacing.height(6),
MySpacing.height(4),
Flexible(
child: Text(
stat.title,
textAlign: TextAlign.center,
style: const TextStyle(
fontSize: 12,
fontSize: 10,
overflow: TextOverflow.ellipsis,
),
maxLines: 2,
@ -197,7 +209,8 @@ class _FinanceScreenState extends State<FinanceScreen>
if (!isEnabled) {
Get.defaultDialog(
title: "No Project Selected",
middleText: "Please select a project before accessing this section.",
middleText:
"Please select a project before accessing this section.",
confirm: ElevatedButton(
onPressed: () => Get.back(),
child: const Text("OK"),