fix: add ignore_for_file to data connect Repos and modify CI to avoid analyzing deleted files

This commit is contained in:
2026-02-20 19:51:44 +05:30
parent 24835f127e
commit 474be43448
259 changed files with 1810 additions and 1714 deletions

View File

@@ -4,12 +4,12 @@ import 'package:krow_domain/krow_domain.dart';
/// Arguments for adding a bank account.
class AddBankAccountParams extends UseCaseArgument with EquatableMixin {
final StaffBankAccount account;
const AddBankAccountParams({required this.account});
final StaffBankAccount account;
@override
List<Object?> get props => [account];
List<Object?> get props => <Object?>[account];
@override
bool? get stringify => true;

View File

@@ -4,9 +4,9 @@ import '../arguments/add_bank_account_params.dart';
/// Use case to add a bank account.
class AddBankAccountUseCase implements UseCase<AddBankAccountParams, void> {
final BankAccountRepository _repository;
AddBankAccountUseCase(this._repository);
final BankAccountRepository _repository;
@override
Future<void> call(AddBankAccountParams params) {

View File

@@ -4,9 +4,9 @@ import '../repositories/bank_account_repository.dart';
/// Use case to fetch bank accounts.
class GetBankAccountsUseCase implements NoInputUseCase<List<StaffBankAccount>> {
final BankAccountRepository _repository;
GetBankAccountsUseCase(this._repository);
final BankAccountRepository _repository;
@override
Future<List<StaffBankAccount>> call() {

View File

@@ -8,8 +8,6 @@ import 'bank_account_state.dart';
class BankAccountCubit extends Cubit<BankAccountState>
with BlocErrorHandler<BankAccountState> {
final GetBankAccountsUseCase _getBankAccountsUseCase;
final AddBankAccountUseCase _addBankAccountUseCase;
BankAccountCubit({
required GetBankAccountsUseCase getBankAccountsUseCase,
@@ -17,6 +15,8 @@ class BankAccountCubit extends Cubit<BankAccountState>
}) : _getBankAccountsUseCase = getBankAccountsUseCase,
_addBankAccountUseCase = addBankAccountUseCase,
super(const BankAccountState());
final GetBankAccountsUseCase _getBankAccountsUseCase;
final AddBankAccountUseCase _addBankAccountUseCase;
Future<void> loadAccounts() async {
emit(state.copyWith(status: BankAccountStatus.loading));

View File

@@ -4,18 +4,18 @@ import 'package:krow_domain/krow_domain.dart';
enum BankAccountStatus { initial, loading, loaded, error, accountAdded }
class BankAccountState extends Equatable {
const BankAccountState({
this.status = BankAccountStatus.initial,
this.accounts = const <StaffBankAccount>[],
this.errorMessage,
this.showForm = false,
});
final BankAccountStatus status;
final List<StaffBankAccount> accounts;
final String? errorMessage;
final bool showForm;
const BankAccountState({
this.status = BankAccountStatus.initial,
this.accounts = const [],
this.errorMessage,
this.showForm = false,
});
BankAccountState copyWith({
BankAccountStatus? status,
List<StaffBankAccount>? accounts,
@@ -31,5 +31,5 @@ class BankAccountState extends Equatable {
}
@override
List<Object?> get props => [status, accounts, errorMessage, showForm];
List<Object?> get props => <Object?>[status, accounts, errorMessage, showForm];
}

View File

@@ -8,7 +8,6 @@ import 'package:krow_domain/krow_domain.dart';
import '../blocs/bank_account_cubit.dart';
import '../blocs/bank_account_state.dart';
import 'package:krow_core/core.dart';
import '../widgets/add_account_form.dart';
class BankAccountPage extends StatelessWidget {

View File

@@ -1,15 +1,13 @@
import 'package:flutter/material.dart';
import 'package:flutter_modular/flutter_modular.dart';
import 'package:design_system/design_system.dart';
import '../blocs/bank_account_cubit.dart';
class AddAccountForm extends StatefulWidget {
const AddAccountForm({super.key, required this.strings, required this.onSubmit, required this.onCancel});
final dynamic strings;
final Function(String bankName, String routing, String account, String type) onSubmit;
final VoidCallback onCancel;
const AddAccountForm({super.key, required this.strings, required this.onSubmit, required this.onCancel});
@override
State<AddAccountForm> createState() => _AddAccountFormState();
}

View File

@@ -1,3 +1,3 @@
library staff_bank_account;
library;
export 'src/staff_bank_account_module.dart';

View File

@@ -8,11 +8,11 @@ import '../../domain/repositories/time_card_repository.dart';
/// Implementation of [TimeCardRepository] using Firebase Data Connect.
class TimeCardRepositoryImpl implements TimeCardRepository {
final dc.DataConnectService _service;
/// Creates a [TimeCardRepositoryImpl].
TimeCardRepositoryImpl({dc.DataConnectService? service})
: _service = service ?? dc.DataConnectService.instance;
final dc.DataConnectService _service;
@override
Future<List<TimeCard>> getTimeCards(DateTime month) async {

View File

@@ -2,11 +2,11 @@ import 'package:krow_core/core.dart';
/// Arguments for the GetTimeCardsUseCase.
class GetTimeCardsArguments extends UseCaseArgument {
const GetTimeCardsArguments(this.month);
/// The month to fetch time cards for.
final DateTime month;
const GetTimeCardsArguments(this.month);
@override
List<Object?> get props => [month];
List<Object?> get props => <Object?>[month];
}

View File

@@ -5,9 +5,9 @@ import '../repositories/time_card_repository.dart';
/// UseCase to retrieve time cards for a given month.
class GetTimeCardsUseCase extends UseCase<GetTimeCardsArguments, List<TimeCard>> {
final TimeCardRepository repository;
GetTimeCardsUseCase(this.repository);
final TimeCardRepository repository;
/// Executes the use case.
///

View File

@@ -11,12 +11,12 @@ part 'time_card_state.dart';
/// BLoC to manage Time Card state.
class TimeCardBloc extends Bloc<TimeCardEvent, TimeCardState>
with BlocErrorHandler<TimeCardState> {
final GetTimeCardsUseCase getTimeCards;
TimeCardBloc({required this.getTimeCards}) : super(TimeCardInitial()) {
on<LoadTimeCards>(_onLoadTimeCards);
on<ChangeMonth>(_onChangeMonth);
}
final GetTimeCardsUseCase getTimeCards;
/// Handles fetching time cards for the requested month.
Future<void> _onLoadTimeCards(
@@ -25,7 +25,7 @@ class TimeCardBloc extends Bloc<TimeCardEvent, TimeCardState>
) async {
emit(TimeCardLoading());
await handleError(
emit: emit,
emit: emit.call,
action: () async {
final List<TimeCard> cards = await getTimeCards(
GetTimeCardsArguments(event.month),

View File

@@ -3,21 +3,21 @@ part of 'time_card_bloc.dart';
abstract class TimeCardEvent extends Equatable {
const TimeCardEvent();
@override
List<Object?> get props => [];
List<Object?> get props => <Object?>[];
}
class LoadTimeCards extends TimeCardEvent {
final DateTime month;
const LoadTimeCards(this.month);
final DateTime month;
@override
List<Object?> get props => [month];
List<Object?> get props => <Object?>[month];
}
class ChangeMonth extends TimeCardEvent {
final DateTime month;
const ChangeMonth(this.month);
final DateTime month;
@override
List<Object?> get props => [month];
List<Object?> get props => <Object?>[month];
}

View File

@@ -3,16 +3,12 @@ part of 'time_card_bloc.dart';
abstract class TimeCardState extends Equatable {
const TimeCardState();
@override
List<Object?> get props => [];
List<Object?> get props => <Object?>[];
}
class TimeCardInitial extends TimeCardState {}
class TimeCardLoading extends TimeCardState {}
class TimeCardLoaded extends TimeCardState {
final List<TimeCard> timeCards;
final DateTime selectedMonth;
final double totalHours;
final double totalEarnings;
const TimeCardLoaded({
required this.timeCards,
@@ -20,13 +16,17 @@ class TimeCardLoaded extends TimeCardState {
required this.totalHours,
required this.totalEarnings,
});
final List<TimeCard> timeCards;
final DateTime selectedMonth;
final double totalHours;
final double totalEarnings;
@override
List<Object?> get props => [timeCards, selectedMonth, totalHours, totalEarnings];
List<Object?> get props => <Object?>[timeCards, selectedMonth, totalHours, totalEarnings];
}
class TimeCardError extends TimeCardState {
final String message;
const TimeCardError(this.message);
final String message;
@override
List<Object?> get props => [message];
List<Object?> get props => <Object?>[message];
}

View File

@@ -27,7 +27,7 @@ class _TimeCardPageState extends State<TimeCardPage> {
@override
Widget build(BuildContext context) {
final t = Translations.of(context);
final Translations t = Translations.of(context);
return BlocProvider.value(
value: _bloc,
child: Scaffold(
@@ -49,7 +49,7 @@ class _TimeCardPageState extends State<TimeCardPage> {
),
),
body: BlocConsumer<TimeCardBloc, TimeCardState>(
listener: (context, state) {
listener: (BuildContext context, TimeCardState state) {
if (state is TimeCardError) {
UiSnackbar.show(
context,
@@ -58,7 +58,7 @@ class _TimeCardPageState extends State<TimeCardPage> {
);
}
},
builder: (context, state) {
builder: (BuildContext context, TimeCardState state) {
if (state is TimeCardLoading) {
return const Center(child: CircularProgressIndicator());
} else if (state is TimeCardError) {
@@ -79,7 +79,7 @@ class _TimeCardPageState extends State<TimeCardPage> {
vertical: UiConstants.space6,
),
child: Column(
children: [
children: <Widget>[
MonthSelector(
selectedDate: state.selectedMonth,
onPreviousMonth: () => _bloc.add(ChangeMonth(

View File

@@ -4,9 +4,6 @@ import 'package:design_system/design_system.dart';
/// A widget that allows the user to navigate between months.
class MonthSelector extends StatelessWidget {
final DateTime selectedDate;
final VoidCallback onPreviousMonth;
final VoidCallback onNextMonth;
const MonthSelector({
super.key,
@@ -14,6 +11,9 @@ class MonthSelector extends StatelessWidget {
required this.onPreviousMonth,
required this.onNextMonth,
});
final DateTime selectedDate;
final VoidCallback onPreviousMonth;
final VoidCallback onNextMonth;
@override
Widget build(BuildContext context) {
@@ -26,7 +26,7 @@ class MonthSelector extends StatelessWidget {
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
children: <Widget>[
IconButton(
icon: const Icon(UiIcons.chevronLeft, color: UiColors.iconSecondary),
onPressed: onPreviousMonth,

View File

@@ -6,15 +6,15 @@ import 'timesheet_card.dart';
/// Displays the list of shift history or an empty state.
class ShiftHistoryList extends StatelessWidget {
final List<TimeCard> timesheets;
const ShiftHistoryList({super.key, required this.timesheets});
final List<TimeCard> timesheets;
@override
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
children: <Widget>[
Text(
t.staff_time_card.shift_history,
style: UiTypography.title2b.copyWith(
@@ -27,7 +27,7 @@ class ShiftHistoryList extends StatelessWidget {
child: Padding(
padding: const EdgeInsets.symmetric(vertical: UiConstants.space12),
child: Column(
children: [
children: <Widget>[
const Icon(UiIcons.clock, size: 48, color: UiColors.iconSecondary),
const SizedBox(height: UiConstants.space3),
Text(
@@ -39,7 +39,7 @@ class ShiftHistoryList extends StatelessWidget {
),
)
else
...timesheets.map((ts) => TimesheetCard(timesheet: ts)),
...timesheets.map((TimeCard ts) => TimesheetCard(timesheet: ts)),
],
);
}

View File

@@ -4,19 +4,19 @@ import 'package:core_localization/core_localization.dart';
/// Displays the total hours worked and total earnings for the selected month.
class TimeCardSummary extends StatelessWidget {
final double totalHours;
final double totalEarnings;
const TimeCardSummary({
super.key,
required this.totalHours,
required this.totalEarnings,
});
final double totalHours;
final double totalEarnings;
@override
Widget build(BuildContext context) {
return Row(
children: [
children: <Widget>[
Expanded(
child: _SummaryCard(
icon: UiIcons.clock,
@@ -38,15 +38,15 @@ class TimeCardSummary extends StatelessWidget {
}
class _SummaryCard extends StatelessWidget {
final IconData icon;
final String label;
final String value;
const _SummaryCard({
required this.icon,
required this.label,
required this.value,
});
final IconData icon;
final String label;
final String value;
@override
Widget build(BuildContext context) {
@@ -59,9 +59,9 @@ class _SummaryCard extends StatelessWidget {
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
children: <Widget>[
Row(
children: [
children: <Widget>[
Icon(icon, size: 16, color: UiColors.primary),
const SizedBox(width: UiConstants.space2),
Text(

View File

@@ -6,13 +6,13 @@ import 'package:krow_domain/krow_domain.dart';
/// A card widget displaying details of a single shift/timecard.
class TimesheetCard extends StatelessWidget {
final TimeCard timesheet;
const TimesheetCard({super.key, required this.timesheet});
final TimeCard timesheet;
@override
Widget build(BuildContext context) {
final status = timesheet.status;
final TimeCardStatus status = timesheet.status;
Color statusBg;
Color statusColor;
String statusText;
@@ -40,7 +40,7 @@ class TimesheetCard extends StatelessWidget {
break;
}
final dateStr = DateFormat('EEE, MMM d').format(timesheet.date);
final String dateStr = DateFormat('EEE, MMM d').format(timesheet.date);
return Container(
margin: const EdgeInsets.only(bottom: UiConstants.space3),
@@ -51,14 +51,14 @@ class TimesheetCard extends StatelessWidget {
border: Border.all(color: UiColors.border),
),
child: Column(
children: [
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
children: <Widget>[
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
children: <Widget>[
Text(
timesheet.shiftTitle,
style: UiTypography.body1m.textPrimary,
@@ -91,7 +91,7 @@ class TimesheetCard extends StatelessWidget {
Wrap(
spacing: UiConstants.space3,
runSpacing: UiConstants.space1,
children: [
children: <Widget>[
_IconText(icon: UiIcons.calendar, text: dateStr),
_IconText(
icon: UiIcons.clock,
@@ -109,7 +109,7 @@ class TimesheetCard extends StatelessWidget {
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
children: <Widget>[
Text(
'${timesheet.totalHours.toStringAsFixed(1)} ${t.staff_time_card.hours} @ \$${timesheet.hourlyRate.toStringAsFixed(2)}${t.staff_time_card.per_hr}',
style: UiTypography.body2r.textSecondary,
@@ -130,9 +130,9 @@ class TimesheetCard extends StatelessWidget {
String _formatTime(String t) {
if (t.isEmpty) return '--:--';
try {
final parts = t.split(':');
final List<String> parts = t.split(':');
if (parts.length >= 2) {
final dt = DateTime(2000, 1, 1, int.parse(parts[0]), int.parse(parts[1]));
final DateTime dt = DateTime(2000, 1, 1, int.parse(parts[0]), int.parse(parts[1]));
return DateFormat('h:mm a').format(dt);
}
return t;
@@ -143,16 +143,16 @@ class TimesheetCard extends StatelessWidget {
}
class _IconText extends StatelessWidget {
final IconData icon;
final String text;
const _IconText({required this.icon, required this.text});
final IconData icon;
final String text;
@override
Widget build(BuildContext context) {
return Row(
mainAxisSize: MainAxisSize.min,
children: [
children: <Widget>[
Icon(icon, size: 14, color: UiColors.iconSecondary),
const SizedBox(width: UiConstants.space1),
Text(

View File

@@ -1,4 +1,4 @@
library staff_time_card;
library;
import 'package:flutter/widgets.dart';
import 'package:flutter_modular/flutter_modular.dart';