chore: fix 273+ analysis issues and repair corrupted core files

This commit is contained in:
2026-03-20 21:05:23 +05:30
parent d3159bc2ae
commit 39263a4af5
59 changed files with 265 additions and 3268 deletions

View File

@@ -9,7 +9,6 @@ import 'package:krow_domain/krow_domain.dart'
AppException,
BaseApiService,
ClientSession,
NetworkException,
PasswordMismatchException,
SignInFailedException,
SignUpFailedException,
@@ -111,19 +110,11 @@ class AuthRepositoryImpl implements AuthRepositoryInterface {
} on AppException {
rethrow;
} catch (e) {
// Map common Firebase-originated errors from the V2 API response
// to domain exceptions.
if (e is AppException) rethrow;
// Extract error code if available from the API response
final String errorMessage = e.toString();
if (errorMessage.contains('EMAIL_EXISTS') ||
errorMessage.contains('email-already-in-use')) {
throw AccountExistsException(technicalMessage: errorMessage);
} else if (errorMessage.contains('WEAK_PASSWORD') ||
errorMessage.contains('weak-password')) {
throw WeakPasswordException(technicalMessage: errorMessage);
} else if (errorMessage.contains('network-request-failed')) {
throw NetworkException(technicalMessage: errorMessage);
}
throw SignUpFailedException(technicalMessage: 'Unexpected error: $e');
_throwSignUpError('SIGN_UP_ERROR', errorMessage);
}
}

View File

@@ -1,9 +1,26 @@
import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart';
import 'package:flutter_modular/flutter_modular.dart';
import 'package:krow_core/core.dart';
class ClientIntroPage extends StatelessWidget {
class ClientIntroPage extends StatefulWidget {
const ClientIntroPage({super.key});
@override
State<ClientIntroPage> createState() => _ClientIntroPageState();
}
class _ClientIntroPageState extends State<ClientIntroPage> {
@override
void initState() {
super.initState();
Future<void>.delayed(const Duration(seconds: 2), () {
if (mounted && Modular.to.path == ClientPaths.root) {
Modular.to.toClientGetStartedPage();
}
});
}
@override
Widget build(BuildContext context) {
return Scaffold(

View File

@@ -11,14 +11,14 @@ import 'package:client_home/src/presentation/blocs/client_home_state.dart';
///
/// Shows an error message with a retry button when data fails to load.
class ClientHomeErrorState extends StatelessWidget {
/// The current home state containing error information.
final ClientHomeState state;
/// Creates a [ClientHomeErrorState].
const ClientHomeErrorState({
required this.state,
super.key,
});
/// The current home state containing error information.
final ClientHomeState state;
@override
Widget build(BuildContext context) {

View File

@@ -8,14 +8,14 @@ import 'package:client_home/src/presentation/widgets/dashboard_widget_builder.da
///
/// Shows visible dashboard widgets in a vertical scrollable list with dividers.
class ClientHomeNormalModeBody extends StatelessWidget {
/// The current home state.
final ClientHomeState state;
/// Creates a [ClientHomeNormalModeBody].
const ClientHomeNormalModeBody({
required this.state,
super.key,
});
/// The current home state.
final ClientHomeState state;
@override
Widget build(BuildContext context) {

View File

@@ -24,7 +24,7 @@ class CoverageBloc extends Bloc<CoverageEvent, CoverageState>
Emitter<CoverageState> emit,
) async {
await handleError(
emit: emit,
emit: emit.call,
action: () async {
emit(CoverageLoading());
final CoverageReport report = await _getCoverageReportUseCase.call(

View File

@@ -1,4 +1,4 @@
import 'package:equatable/equatable.dart';
import 'package:equatable/equatable.dart';
import 'package:krow_domain/krow_domain.dart';
/// Base state for the coverage report BLoC.

View File

@@ -24,7 +24,7 @@ class DailyOpsBloc extends Bloc<DailyOpsEvent, DailyOpsState>
Emitter<DailyOpsState> emit,
) async {
await handleError(
emit: emit,
emit: emit.call,
action: () async {
emit(DailyOpsLoading());
final DailyOpsReport report = await _getDailyOpsReportUseCase.call(

View File

@@ -1,4 +1,4 @@
import 'package:equatable/equatable.dart';
import 'package:equatable/equatable.dart';
import 'package:krow_domain/krow_domain.dart';
/// Base state for the daily operations report BLoC.

View File

@@ -24,7 +24,7 @@ class ForecastBloc extends Bloc<ForecastEvent, ForecastState>
Emitter<ForecastState> emit,
) async {
await handleError(
emit: emit,
emit: emit.call,
action: () async {
emit(ForecastLoading());
final ForecastReport report = await _getForecastReportUseCase.call(

View File

@@ -1,4 +1,4 @@
import 'package:equatable/equatable.dart';
import 'package:equatable/equatable.dart';
import 'package:krow_domain/krow_domain.dart';
/// Base state for the forecast report BLoC.

View File

@@ -24,7 +24,7 @@ class NoShowBloc extends Bloc<NoShowEvent, NoShowState>
Emitter<NoShowState> emit,
) async {
await handleError(
emit: emit,
emit: emit.call,
action: () async {
emit(NoShowLoading());
final NoShowReport report = await _getNoShowReportUseCase.call(

View File

@@ -1,4 +1,4 @@
import 'package:equatable/equatable.dart';
import 'package:equatable/equatable.dart';
import 'package:krow_domain/krow_domain.dart';
/// Base state for the no-show report BLoC.

View File

@@ -25,7 +25,7 @@ class PerformanceBloc extends Bloc<PerformanceEvent, PerformanceState>
Emitter<PerformanceState> emit,
) async {
await handleError(
emit: emit,
emit: emit.call,
action: () async {
emit(PerformanceLoading());
final PerformanceReport report = await _getPerformanceReportUseCase.call(

View File

@@ -1,4 +1,4 @@
import 'package:equatable/equatable.dart';
import 'package:equatable/equatable.dart';
import 'package:krow_domain/krow_domain.dart';
/// Base state for the performance report BLoC.

View File

@@ -24,7 +24,7 @@ class SpendBloc extends Bloc<SpendEvent, SpendState>
Emitter<SpendState> emit,
) async {
await handleError(
emit: emit,
emit: emit.call,
action: () async {
emit(SpendLoading());
final SpendReport report = await _getSpendReportUseCase.call(

View File

@@ -1,4 +1,4 @@
import 'package:equatable/equatable.dart';
import 'package:equatable/equatable.dart';
import 'package:krow_domain/krow_domain.dart';
/// Base state for the spend report BLoC.

View File

@@ -26,7 +26,7 @@ class ReportsSummaryBloc
Emitter<ReportsSummaryState> emit,
) async {
await handleError(
emit: emit,
emit: emit.call,
action: () async {
emit(ReportsSummaryLoading());
final ReportSummary summary = await _getReportsSummaryUseCase.call(

View File

@@ -71,7 +71,7 @@ class _CoverageReportPageState extends State<CoverageReportPage> {
width: 40,
height: 40,
decoration: BoxDecoration(
color: UiColors.white.withOpacity(0.2),
color: UiColors.white.withValues(alpha: 0.2),
shape: BoxShape.circle,
),
child: const Icon(
@@ -95,7 +95,7 @@ class _CoverageReportPageState extends State<CoverageReportPage> {
context.t.client_reports.coverage_report
.subtitle,
style: UiTypography.body3r.copyWith(
color: UiColors.white.withOpacity(0.7),
color: UiColors.white.withValues(alpha: 0.7),
),
),
],
@@ -203,7 +203,7 @@ class _CoverageSummaryCard extends StatelessWidget {
borderRadius: BorderRadius.circular(16),
boxShadow: <BoxShadow>[
BoxShadow(
color: UiColors.black.withOpacity(0.04),
color: UiColors.black.withValues(alpha: 0.04),
blurRadius: 10,
),
],
@@ -214,7 +214,7 @@ class _CoverageSummaryCard extends StatelessWidget {
Container(
padding: const EdgeInsets.all(8),
decoration: BoxDecoration(
color: color.withOpacity(0.1),
color: color.withValues(alpha: 0.1),
shape: BoxShape.circle,
),
child: Icon(icon, size: 16, color: color),

View File

@@ -101,7 +101,7 @@ class _DailyOpsReportPageState extends State<DailyOpsReportPage> {
width: 40,
height: 40,
decoration: BoxDecoration(
color: UiColors.white.withOpacity(0.2),
color: UiColors.white.withValues(alpha: 0.2),
shape: BoxShape.circle,
),
child: const Icon(
@@ -126,7 +126,7 @@ class _DailyOpsReportPageState extends State<DailyOpsReportPage> {
context.t.client_reports.daily_ops_report
.subtitle,
style: UiTypography.body3r.copyWith(
color: UiColors.white.withOpacity(0.7),
color: UiColors.white.withValues(alpha: 0.7),
),
),
],
@@ -155,7 +155,7 @@ class _DailyOpsReportPageState extends State<DailyOpsReportPage> {
borderRadius: BorderRadius.circular(12),
boxShadow: <BoxShadow>[
BoxShadow(
color: UiColors.black.withOpacity(0.06),
color: UiColors.black.withValues(alpha: 0.06),
blurRadius: 4,
),
],
@@ -390,7 +390,7 @@ class _OpsStatCard extends StatelessWidget {
vertical: 3,
),
decoration: BoxDecoration(
color: color.withOpacity(0.12),
color: color.withValues(alpha: 0.12),
borderRadius: BorderRadius.circular(4),
),
child: Text(
@@ -451,7 +451,7 @@ class _ShiftListItem extends StatelessWidget {
borderRadius: BorderRadius.circular(12),
boxShadow: <BoxShadow>[
BoxShadow(
color: UiColors.black.withOpacity(0.02),
color: UiColors.black.withValues(alpha: 0.02),
blurRadius: 2,
),
],
@@ -497,7 +497,7 @@ class _ShiftListItem extends StatelessWidget {
margin: const EdgeInsets.only(left: 8),
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
decoration: BoxDecoration(
color: statusColor.withOpacity(0.1),
color: statusColor.withValues(alpha: 0.1),
borderRadius: BorderRadius.circular(6),
),
child: Text(

View File

@@ -119,7 +119,7 @@ class _ForecastReportPageState extends State<ForecastReportPage> {
width: 40,
height: 40,
decoration: BoxDecoration(
color: UiColors.white.withOpacity(0.2),
color: UiColors.white.withValues(alpha: 0.2),
shape: BoxShape.circle,
),
child: const Icon(
@@ -141,7 +141,7 @@ class _ForecastReportPageState extends State<ForecastReportPage> {
Text(
context.t.client_reports.forecast_report.subtitle,
style: UiTypography.body2m.copyWith(
color: UiColors.white.withOpacity(0.7),
color: UiColors.white.withValues(alpha: 0.7),
),
),
],
@@ -213,7 +213,7 @@ class _ForecastReportPageState extends State<ForecastReportPage> {
borderRadius: BorderRadius.circular(16),
boxShadow: <BoxShadow>[
BoxShadow(
color: UiColors.black.withOpacity(0.04),
color: UiColors.black.withValues(alpha: 0.04),
blurRadius: 10,
),
],
@@ -289,7 +289,7 @@ class _MetricCard extends StatelessWidget {
borderRadius: BorderRadius.circular(16),
boxShadow: <BoxShadow>[
BoxShadow(
color: UiColors.black.withOpacity(0.04),
color: UiColors.black.withValues(alpha: 0.04),
blurRadius: 8,
),
],
@@ -469,7 +469,7 @@ class _ForecastChart extends StatelessWidget {
),
belowBarData: BarAreaData(
show: true,
color: UiColors.tagPending.withOpacity(0.5),
color: UiColors.tagPending.withValues(alpha: 0.5),
),
),
],

View File

@@ -74,7 +74,7 @@ class _NoShowReportPageState extends State<NoShowReportPage> {
width: 40,
height: 40,
decoration: BoxDecoration(
color: UiColors.white.withOpacity(0.15),
color: UiColors.white.withValues(alpha: 0.15),
shape: BoxShape.circle,
),
child: const Icon(
@@ -97,7 +97,7 @@ class _NoShowReportPageState extends State<NoShowReportPage> {
Text(
context.t.client_reports.no_show_report.subtitle,
style: UiTypography.body3r.copyWith(
color: UiColors.white.withOpacity(0.6),
color: UiColors.white.withValues(alpha: 0.6),
),
),
],
@@ -225,7 +225,7 @@ class _SummaryChip extends StatelessWidget {
borderRadius: BorderRadius.circular(12),
boxShadow: <BoxShadow>[
BoxShadow(
color: UiColors.black.withOpacity(0.06),
color: UiColors.black.withValues(alpha: 0.06),
blurRadius: 8,
offset: const Offset(0, 2),
),
@@ -302,7 +302,7 @@ class _WorkerCard extends StatelessWidget {
borderRadius: BorderRadius.circular(12),
boxShadow: <BoxShadow>[
BoxShadow(
color: UiColors.black.withOpacity(0.04),
color: UiColors.black.withValues(alpha: 0.04),
blurRadius: 6,
),
],

View File

@@ -157,7 +157,7 @@ class _PerformanceReportPageState extends State<PerformanceReportPage> {
width: 40,
height: 40,
decoration: BoxDecoration(
color: UiColors.white.withOpacity(0.2),
color: UiColors.white.withValues(alpha: 0.2),
shape: BoxShape.circle,
),
child: const Icon(
@@ -182,7 +182,7 @@ class _PerformanceReportPageState extends State<PerformanceReportPage> {
context.t.client_reports.performance_report
.subtitle,
style: UiTypography.body3r.copyWith(
color: UiColors.white.withOpacity(0.7),
color: UiColors.white.withValues(alpha: 0.7),
),
),
],
@@ -212,7 +212,7 @@ class _PerformanceReportPageState extends State<PerformanceReportPage> {
borderRadius: BorderRadius.circular(16),
boxShadow: <BoxShadow>[
BoxShadow(
color: UiColors.black.withOpacity(0.04),
color: UiColors.black.withValues(alpha: 0.04),
blurRadius: 10,
offset: const Offset(0, 4),
),
@@ -270,7 +270,7 @@ class _PerformanceReportPageState extends State<PerformanceReportPage> {
borderRadius: BorderRadius.circular(16),
boxShadow: <BoxShadow>[
BoxShadow(
color: UiColors.black.withOpacity(0.04),
color: UiColors.black.withValues(alpha: 0.04),
blurRadius: 10,
),
],
@@ -387,7 +387,7 @@ class _KpiRow extends StatelessWidget {
width: 36,
height: 36,
decoration: BoxDecoration(
color: kpi.iconColor.withOpacity(0.1),
color: kpi.iconColor.withValues(alpha: 0.1),
borderRadius: BorderRadius.circular(8),
),
child: Icon(kpi.icon, size: 18, color: kpi.iconColor),

View File

@@ -1,4 +1,4 @@
import 'package:client_reports/src/presentation/blocs/summary/reports_summary_bloc.dart';
import 'package:client_reports/src/presentation/blocs/summary/reports_summary_bloc.dart';
import 'package:client_reports/src/presentation/blocs/summary/reports_summary_event.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';

View File

@@ -81,7 +81,7 @@ class _SpendReportPageState extends State<SpendReportPage> {
width: 40,
height: 40,
decoration: BoxDecoration(
color: UiColors.white.withOpacity(0.2),
color: UiColors.white.withValues(alpha: 0.2),
shape: BoxShape.circle,
),
child: const Icon(
@@ -104,7 +104,7 @@ class _SpendReportPageState extends State<SpendReportPage> {
Text(
context.t.client_reports.spend_report.subtitle,
style: UiTypography.body3r.copyWith(
color: UiColors.white.withOpacity(0.7),
color: UiColors.white.withValues(alpha: 0.7),
),
),
],
@@ -164,7 +164,7 @@ class _SpendReportPageState extends State<SpendReportPage> {
borderRadius: BorderRadius.circular(16),
boxShadow: <BoxShadow>[
BoxShadow(
color: UiColors.black.withOpacity(0.04),
color: UiColors.black.withValues(alpha: 0.04),
blurRadius: 10,
offset: const Offset(0, 4),
),
@@ -358,7 +358,7 @@ class _SpendStatCard extends StatelessWidget {
borderRadius: BorderRadius.circular(16),
boxShadow: <BoxShadow>[
BoxShadow(
color: UiColors.black.withOpacity(0.06),
color: UiColors.black.withValues(alpha: 0.06),
blurRadius: 8,
offset: const Offset(0, 4),
),
@@ -392,7 +392,7 @@ class _SpendStatCard extends StatelessWidget {
Container(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
decoration: BoxDecoration(
color: themeColor.withOpacity(0.1),
color: themeColor.withValues(alpha: 0.1),
borderRadius: BorderRadius.circular(6),
),
child: Text(
@@ -424,7 +424,7 @@ class _SpendByCategoryCard extends StatelessWidget {
borderRadius: BorderRadius.circular(16),
boxShadow: <BoxShadow>[
BoxShadow(
color: UiColors.black.withOpacity(0.04),
color: UiColors.black.withValues(alpha: 0.04),
blurRadius: 10,
offset: const Offset(0, 4),
),

View File

@@ -1,4 +1,4 @@
import 'package:client_reports/src/presentation/widgets/reports_page/report_card.dart';
import 'package:client_reports/src/presentation/widgets/reports_page/report_card.dart';
import 'package:core_localization/core_localization.dart';
import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart';

View File

@@ -44,7 +44,7 @@ class ReportCard extends StatelessWidget {
borderRadius: BorderRadius.circular(12),
boxShadow: <BoxShadow>[
BoxShadow(
color: UiColors.black.withOpacity(0.02),
color: UiColors.black.withValues(alpha: 0.02),
blurRadius: 2,
),
],

View File

@@ -51,7 +51,7 @@ class ReportsHeader extends StatelessWidget {
width: 40,
height: 40,
decoration: BoxDecoration(
color: UiColors.white.withOpacity(0.2),
color: UiColors.white.withValues(alpha: 0.2),
shape: BoxShape.circle,
),
child: const Icon(
@@ -84,7 +84,7 @@ class ReportsHeader extends StatelessWidget {
height: 44,
padding: const EdgeInsets.all(4),
decoration: BoxDecoration(
color: UiColors.white.withOpacity(0.2),
color: UiColors.white.withValues(alpha: 0.2),
borderRadius: BorderRadius.circular(12),
),
child: TabBar(

View File

@@ -176,104 +176,4 @@ class _QuickLinkItem extends StatelessWidget {
}
}
class _NotificationsSettingsCard extends StatelessWidget {
@override
Widget build(BuildContext context) {
return BlocBuilder<ClientSettingsBloc, ClientSettingsState>(
builder: (BuildContext context, ClientSettingsState state) {
return Card(
elevation: 0,
shape: RoundedRectangleBorder(
borderRadius: UiConstants.radiusLg,
side: const BorderSide(color: UiColors.border),
),
color: UiColors.white,
child: Padding(
padding: const EdgeInsets.all(UiConstants.space4),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
context.t.client_settings.preferences.title,
style: UiTypography.footnote1b.textPrimary,
),
const SizedBox(height: UiConstants.space2),
_NotificationToggle(
icon: UiIcons.bell,
title: context.t.client_settings.preferences.push,
value: state.pushEnabled,
onChanged: (bool val) =>
ReadContext(context).read<ClientSettingsBloc>().add(
ClientSettingsNotificationToggled(
type: 'push',
isEnabled: val,
),
),
),
_NotificationToggle(
icon: UiIcons.mail,
title: context.t.client_settings.preferences.email,
value: state.emailEnabled,
onChanged: (bool val) =>
ReadContext(context).read<ClientSettingsBloc>().add(
ClientSettingsNotificationToggled(
type: 'email',
isEnabled: val,
),
),
),
_NotificationToggle(
icon: UiIcons.phone,
title: context.t.client_settings.preferences.sms,
value: state.smsEnabled,
onChanged: (bool val) =>
ReadContext(context).read<ClientSettingsBloc>().add(
ClientSettingsNotificationToggled(
type: 'sms',
isEnabled: val,
),
),
),
],
),
),
);
},
);
}
}
class _NotificationToggle extends StatelessWidget {
const _NotificationToggle({
required this.icon,
required this.title,
required this.value,
required this.onChanged,
});
final IconData icon;
final String title;
final bool value;
final ValueChanged<bool> onChanged;
@override
Widget build(BuildContext context) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Row(
children: <Widget>[
Icon(icon, size: 20, color: UiColors.iconSecondary),
const SizedBox(width: UiConstants.space3),
Text(title, style: UiTypography.footnote1m.textPrimary),
],
),
Switch.adaptive(
value: value,
activeColor: UiColors.primary,
onChanged: onChanged,
),
],
);
}
}

View File

@@ -18,7 +18,7 @@ class SettingsProfileHeader extends StatelessWidget {
final String businessName = session?.businessName ?? 'Your Company';
final String email = session?.email ?? 'client@example.com';
// V2 session does not include a photo URL; show letter avatar.
final String? photoUrl = null;
const String? photoUrl = null;
final String avatarLetter = businessName.trim().isNotEmpty
? businessName.trim()[0].toUpperCase()
: 'C';