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