removed warnings

This commit is contained in:
Vaibhav Surve 2025-12-11 17:52:34 +05:30
parent 22b61b7024
commit fc099cccb5
6 changed files with 41 additions and 43 deletions

View File

@ -33,13 +33,13 @@ class PaymentRequestController extends GetxController {
try {
final response = await ApiService.getExpensePaymentRequestFilterApi();
if (response != null && response.data != null) {
projects.assignAll(response.data!.projects ?? []);
payees.assignAll(response.data!.payees ?? []);
categories.assignAll(response.data!.expenseCategory ?? []);
currencies.assignAll(response.data!.currency ?? []);
statuses.assignAll(response.data!.status ?? []);
createdBy.assignAll(response.data!.createdBy ?? []);
if (response != null) {
projects.assignAll(response.data.projects);
payees.assignAll(response.data.payees);
categories.assignAll(response.data.expenseCategory);
currencies.assignAll(response.data.currency);
statuses.assignAll(response.data.status);
createdBy.assignAll(response.data.createdBy);
} else {
logSafe("Payment request filter API returned null",
level: LogLevel.warning);

View File

@ -5,11 +5,9 @@ import 'package:on_field_work/helpers/widgets/my_spacing.dart';
import 'package:on_field_work/helpers/widgets/my_text.dart';
import 'package:on_field_work/helpers/utils/mixins/ui_mixin.dart';
class CustomAppBar extends StatefulWidget
with UIMixin
implements PreferredSizeWidget {
class CustomAppBar extends StatefulWidget implements PreferredSizeWidget {
final String title;
final String? projectName; // If passed, show static text
final String? projectName;
final VoidCallback? onBackPressed;
final Color? backgroundColor;

View File

@ -197,7 +197,7 @@ class _ReimbursementBottomSheetState extends State<ReimbursementBottomSheet> {
return;
}
if (expenseTransactionDate != null && selectedDate != null) {
if (expenseTransactionDate != null) {
final normalizedSelected = DateTime(
selectedDate.year,
selectedDate.month,

View File

@ -538,7 +538,7 @@ class _EmployeeDetailPageState extends State<EmployeeDetailPage> with UIMixin {
if (managers.isEmpty) return '';
return managers
.map((m) =>
'${(m.firstName ?? '').trim()} ${(m.lastName ?? '').trim()}'.trim())
'${(m.firstName ).trim()} ${(m.lastName ).trim()}'.trim())
.where((name) => name.isNotEmpty)
.join(', ');
}

View File

@ -217,7 +217,7 @@ class _PaymentRequestDetailScreenState extends State<PaymentRequestDetailScreen>
return const SizedBox.shrink();
}
if (!_checkedPermission && request != null && employeeInfo != null) {
if (!_checkedPermission && employeeInfo != null) {
_checkedPermission = true;
_checkPermissionToSubmit(request);
}

View File

@ -50,13 +50,12 @@ class _TenantSelectionScreenState extends State<TenantSelectionScreen>
}
Future<void> _onTenantSelected(String tenantId) async {
await _controller.onTenantSelected(tenantId);
return _controller.onTenantSelected(tenantId);
}
@override
Widget build(BuildContext context) {
return Obx(() {
// Splash screen for auto-selection
if (_controller.isAutoSelecting.value) {
return const SplashScreen();
}
@ -91,6 +90,7 @@ class _TenantSelectionScreenState extends State<TenantSelectionScreen>
controller: _controller,
isLoading: _controller.isLoading.value,
onTenantSelected: _onTenantSelected,
primaryColor: contentTheme.primary,
),
],
),
@ -109,7 +109,6 @@ class _TenantSelectionScreenState extends State<TenantSelectionScreen>
}
}
/// Animated Logo Widget
class _AnimatedLogo extends StatelessWidget {
final Animation<double> animation;
const _AnimatedLogo({required this.animation});
@ -139,7 +138,6 @@ class _AnimatedLogo extends StatelessWidget {
}
}
/// Welcome Texts
class _WelcomeTexts extends StatelessWidget {
const _WelcomeTexts();
@ -166,7 +164,6 @@ class _WelcomeTexts extends StatelessWidget {
}
}
/// Beta Badge
class _BetaBadge extends StatelessWidget {
const _BetaBadge();
@ -188,16 +185,18 @@ class _BetaBadge extends StatelessWidget {
}
}
/// Tenant Card List
class TenantCardList extends StatelessWidget with UIMixin {
class TenantCardList extends StatelessWidget {
final TenantSelectionController controller;
final bool isLoading;
final Function(String tenantId) onTenantSelected;
final Color primaryColor;
TenantCardList({
const TenantCardList({
super.key,
required this.controller,
required this.isLoading,
required this.onTenantSelected,
required this.primaryColor,
});
@override
@ -226,18 +225,16 @@ class TenantCardList extends StatelessWidget with UIMixin {
(tenant) => _TenantCard(
tenant: tenant,
onTap: () => onTenantSelected(tenant.id),
primaryColor: primaryColor,
),
),
const SizedBox(height: 16),
TextButton.icon(
onPressed: () async {
await LocalStorage.logout();
},
icon:
Icon(Icons.arrow_back, size: 20, color: contentTheme.primary,),
onPressed: LocalStorage.logout,
icon: Icon(Icons.arrow_back, size: 20, color: primaryColor),
label: MyText(
'Back to Login',
color: contentTheme.primary,
color: primaryColor,
fontWeight: 600,
fontSize: 14,
),
@ -248,11 +245,16 @@ class TenantCardList extends StatelessWidget with UIMixin {
}
}
/// Single Tenant Card
class _TenantCard extends StatelessWidget with UIMixin {
class _TenantCard extends StatelessWidget {
final dynamic tenant;
final VoidCallback onTap;
_TenantCard({required this.tenant, required this.onTap});
final Color primaryColor;
const _TenantCard({
required this.tenant,
required this.onTap,
required this.primaryColor,
});
@override
Widget build(BuildContext context) {
@ -297,7 +299,7 @@ class _TenantCard extends StatelessWidget with UIMixin {
],
),
),
Icon(Icons.arrow_forward_ios, size: 24, color: contentTheme.primary,),
Icon(Icons.arrow_forward_ios, size: 24, color: primaryColor),
],
),
),
@ -306,7 +308,6 @@ class _TenantCard extends StatelessWidget with UIMixin {
}
}
/// Tenant Logo (supports base64 and URL)
class TenantLogo extends StatelessWidget {
final String? logoImage;
const TenantLogo({required this.logoImage});
@ -324,14 +325,13 @@ class TenantLogo extends StatelessWidget {
} catch (_) {
return Center(child: Icon(Icons.business, color: Colors.grey.shade600));
}
} else {
}
return Image.network(
logoImage!,
fit: BoxFit.cover,
errorBuilder: (_, __, ___) => Center(
child: Icon(Icons.business, color: Colors.grey.shade600),
),
errorBuilder: (_, __, ___) =>
Center(child: Icon(Icons.business, color: Colors.grey.shade600)),
);
}
}
}