Refactor widgets & imports; add krow_domain
Add local krow_domain dependency to client, staff apps and client home package. Numerous UI/widget cleanups across features: add const where applicable, use explicit List<Widget> types and List<Widget>.generate, add super.key to constructors, tighten BlocProvider generics, replace some Containers with SizedBox, and simplify InputDecoration/Border constructors. Fix API error handler to return a const UnknownException. Update internal imports to package-style paths (staff_home, staff_payments, staff_main repository interface) and normalize Flutter imports (use material.dart). Add missing braces for early returns in tax form pages. Mostly formatting and small API/typing refactors with no behavioral changes intended.
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
import 'package:design_system/design_system.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'quick_actions_skeleton.dart';
|
||||
import 'recommended_section_skeleton.dart';
|
||||
import 'shift_section_skeleton.dart';
|
||||
import 'skeleton_divider.dart';
|
||||
import 'package:staff_home/src/presentation/widgets/home_page/home_page_skeleton/quick_actions_skeleton.dart';
|
||||
import 'package:staff_home/src/presentation/widgets/home_page/home_page_skeleton/recommended_section_skeleton.dart';
|
||||
import 'package:staff_home/src/presentation/widgets/home_page/home_page_skeleton/shift_section_skeleton.dart';
|
||||
import 'package:staff_home/src/presentation/widgets/home_page/home_page_skeleton/skeleton_divider.dart';
|
||||
|
||||
/// Shimmer loading skeleton for the staff home page.
|
||||
///
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import 'package:design_system/design_system.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'shift_card_skeleton.dart';
|
||||
import 'package:staff_home/src/presentation/widgets/home_page/home_page_skeleton/shift_card_skeleton.dart';
|
||||
|
||||
/// Skeleton for a shift section (section header + 2 shift card placeholders).
|
||||
class ShiftSectionSkeleton extends StatelessWidget {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import 'package:design_system/design_system.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'section_header.dart';
|
||||
import 'package:staff_home/src/presentation/widgets/home_page/section_header.dart';
|
||||
|
||||
/// A common layout widget for home page sections.
|
||||
///
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import 'package:flutter/src/widgets/framework.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
import 'package:krow_core/core.dart';
|
||||
import 'package:krow_domain/krow_domain.dart';
|
||||
|
||||
import 'package:staff_payments/src/data/repositories/payments_repository_impl.dart';
|
||||
import 'package:staff_payments/src/domain/repositories/payments_repository.dart';
|
||||
import 'package:staff_payments/src/domain/usecases/get_payment_chart_usecase.dart';
|
||||
|
||||
@@ -27,7 +27,7 @@ class EarlyPayPage extends StatelessWidget {
|
||||
border: Border.all(color: UiColors.primary.withValues(alpha: 0.1)),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Text(
|
||||
context.t.staff_payments.early_pay.available_label,
|
||||
style: UiTypography.body2m.textSecondary,
|
||||
@@ -65,13 +65,13 @@ class EarlyPayPage extends StatelessWidget {
|
||||
border: Border.all(color: UiColors.separatorPrimary),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
const Icon(UiIcons.bank, size: 24, color: UiColors.primary),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Text('Chase Bank', style: UiTypography.body2b.textPrimary),
|
||||
Text('Ending in 4321', style: UiTypography.footnote2r.textSecondary),
|
||||
],
|
||||
|
||||
@@ -18,13 +18,13 @@ class PaymentItemSkeleton extends StatelessWidget {
|
||||
borderRadius: UiConstants.radiusLg,
|
||||
),
|
||||
child: const Row(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
UiShimmerCircle(size: 40),
|
||||
SizedBox(width: UiConstants.space3),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
UiShimmerLine(width: 140, height: 14),
|
||||
SizedBox(height: UiConstants.space2),
|
||||
UiShimmerLine(width: 100, height: 12),
|
||||
|
||||
@@ -16,12 +16,12 @@ class PaymentsPageSkeleton extends StatelessWidget {
|
||||
return UiShimmer(
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
// Header section with gradient
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
colors: <Color>[
|
||||
UiColors.primary,
|
||||
UiColors.primary.withValues(alpha: 0.8),
|
||||
],
|
||||
@@ -37,7 +37,7 @@ class PaymentsPageSkeleton extends StatelessWidget {
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
// Title placeholder
|
||||
const UiShimmerLine(width: 120, height: 24),
|
||||
const SizedBox(height: UiConstants.space6),
|
||||
@@ -45,7 +45,7 @@ class PaymentsPageSkeleton extends StatelessWidget {
|
||||
// Balance center
|
||||
const Center(
|
||||
child: Column(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
UiShimmerLine(width: 100, height: 14),
|
||||
SizedBox(height: UiConstants.space1),
|
||||
UiShimmerLine(width: 160, height: 36),
|
||||
@@ -73,7 +73,7 @@ class PaymentsPageSkeleton extends StatelessWidget {
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
// Earnings graph placeholder
|
||||
UiShimmerBox(
|
||||
width: double.infinity,
|
||||
@@ -83,10 +83,10 @@ class PaymentsPageSkeleton extends StatelessWidget {
|
||||
const SizedBox(height: UiConstants.space6),
|
||||
|
||||
// Quick stats row
|
||||
Row(
|
||||
children: [
|
||||
const Row(
|
||||
children: <Widget>[
|
||||
Expanded(child: UiShimmerStatsCard()),
|
||||
const SizedBox(width: UiConstants.space3),
|
||||
SizedBox(width: UiConstants.space3),
|
||||
Expanded(child: UiShimmerStatsCard()),
|
||||
],
|
||||
),
|
||||
@@ -99,7 +99,7 @@ class PaymentsPageSkeleton extends StatelessWidget {
|
||||
// Payment history items
|
||||
UiShimmerList(
|
||||
itemCount: 4,
|
||||
itemBuilder: (index) => const PaymentItemSkeleton(),
|
||||
itemBuilder: (int index) => const PaymentItemSkeleton(),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -26,9 +26,9 @@ class MenuSectionSkeleton extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
// Section title placeholder
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: UiConstants.space1),
|
||||
child: const UiShimmerLine(width: 100, height: 12),
|
||||
const Padding(
|
||||
padding: EdgeInsets.only(left: UiConstants.space1),
|
||||
child: UiShimmerLine(width: 100, height: 12),
|
||||
),
|
||||
const SizedBox(height: UiConstants.space3),
|
||||
// Menu items grid
|
||||
|
||||
@@ -25,18 +25,18 @@ class ProfileHeaderSkeleton extends StatelessWidget {
|
||||
bottom: Radius.circular(UiConstants.space6),
|
||||
),
|
||||
),
|
||||
child: SafeArea(
|
||||
child: const SafeArea(
|
||||
bottom: false,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
// Avatar placeholder
|
||||
const UiShimmerCircle(size: 112),
|
||||
const SizedBox(height: UiConstants.space4),
|
||||
UiShimmerCircle(size: 112),
|
||||
SizedBox(height: UiConstants.space4),
|
||||
// Name placeholder
|
||||
const UiShimmerLine(width: 160, height: 20),
|
||||
const SizedBox(height: UiConstants.space2),
|
||||
UiShimmerLine(width: 160, height: 20),
|
||||
SizedBox(height: UiConstants.space2),
|
||||
// Level badge placeholder
|
||||
const UiShimmerBox(width: 100, height: 24),
|
||||
UiShimmerBox(width: 100, height: 24),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -26,13 +26,11 @@ class ProfilePageSkeleton extends StatelessWidget {
|
||||
// Content offset to overlap the header bottom radius
|
||||
Transform.translate(
|
||||
offset: const Offset(0, -UiConstants.space6),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: UiConstants.space5,
|
||||
),
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: UiConstants.space5),
|
||||
child: Column(
|
||||
spacing: UiConstants.space6,
|
||||
children: const <Widget>[
|
||||
children: <Widget>[
|
||||
// Reliability stats row (5 items)
|
||||
ReliabilityStatsSkeleton(),
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import 'package:core_localization/core_localization.dart';
|
||||
/// Widget for certificate metadata input fields (name, issuer, number).
|
||||
class CertificateMetadataFields extends StatelessWidget {
|
||||
const CertificateMetadataFields({
|
||||
super.key,
|
||||
required this.nameController,
|
||||
required this.issuerController,
|
||||
required this.numberController,
|
||||
@@ -32,9 +33,7 @@ class CertificateMetadataFields extends StatelessWidget {
|
||||
enabled: isNewCertificate,
|
||||
decoration: InputDecoration(
|
||||
hintText: t.staff_certificates.upload_modal.name_hint,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: UiConstants.radiusLg,
|
||||
),
|
||||
border: OutlineInputBorder(borderRadius: UiConstants.radiusLg),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: UiConstants.space4),
|
||||
@@ -50,27 +49,20 @@ class CertificateMetadataFields extends StatelessWidget {
|
||||
enabled: isNewCertificate,
|
||||
decoration: InputDecoration(
|
||||
hintText: t.staff_certificates.upload_modal.issuer_hint,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: UiConstants.radiusLg,
|
||||
),
|
||||
border: OutlineInputBorder(borderRadius: UiConstants.radiusLg),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: UiConstants.space4),
|
||||
|
||||
// Certificate Number Field
|
||||
Text(
|
||||
'Certificate Number',
|
||||
style: UiTypography.body2m.textPrimary,
|
||||
),
|
||||
Text('Certificate Number', style: UiTypography.body2m.textPrimary),
|
||||
const SizedBox(height: UiConstants.space2),
|
||||
TextField(
|
||||
controller: numberController,
|
||||
enabled: isNewCertificate,
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Enter number if applicable',
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: UiConstants.radiusLg,
|
||||
),
|
||||
border: OutlineInputBorder(borderRadius: UiConstants.radiusLg),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -8,6 +8,7 @@ import '../../blocs/certificate_upload/certificate_upload_cubit.dart';
|
||||
/// Widget for attestation checkbox and action buttons in certificate upload form.
|
||||
class CertificateUploadActions extends StatelessWidget {
|
||||
const CertificateUploadActions({
|
||||
super.key,
|
||||
required this.isAttested,
|
||||
required this.isFormValid,
|
||||
required this.isUploading,
|
||||
@@ -34,10 +35,9 @@ class CertificateUploadActions extends StatelessWidget {
|
||||
children: <Widget>[
|
||||
Checkbox(
|
||||
value: isAttested,
|
||||
onChanged: (bool? val) =>
|
||||
BlocProvider.of<CertificateUploadCubit>(context).setAttested(
|
||||
val ?? false,
|
||||
),
|
||||
onChanged: (bool? val) => BlocProvider.of<CertificateUploadCubit>(
|
||||
context,
|
||||
).setAttested(val ?? false),
|
||||
activeColor: UiColors.primary,
|
||||
),
|
||||
Expanded(
|
||||
@@ -54,17 +54,11 @@ class CertificateUploadActions extends StatelessWidget {
|
||||
onPressed: isFormValid ? onUploadPressed : null,
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: UiColors.primary,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: UiConstants.space4,
|
||||
),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: UiConstants.radiusLg,
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(vertical: UiConstants.space4),
|
||||
shape: RoundedRectangleBorder(borderRadius: UiConstants.radiusLg),
|
||||
),
|
||||
child: isUploading
|
||||
? const CircularProgressIndicator(
|
||||
color: Colors.white,
|
||||
)
|
||||
? const CircularProgressIndicator(color: Colors.white)
|
||||
: Text(
|
||||
t.staff_certificates.upload_modal.save,
|
||||
style: UiTypography.body1m.white,
|
||||
@@ -87,9 +81,7 @@ class CertificateUploadActions extends StatelessWidget {
|
||||
),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: UiConstants.radiusLg,
|
||||
side: const BorderSide(
|
||||
color: UiColors.destructive,
|
||||
),
|
||||
side: const BorderSide(color: UiColors.destructive),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -6,6 +6,7 @@ import 'package:core_localization/core_localization.dart';
|
||||
/// Widget for selecting certificate expiry date.
|
||||
class ExpiryDateField extends StatelessWidget {
|
||||
const ExpiryDateField({
|
||||
super.key,
|
||||
required this.selectedDate,
|
||||
required this.onTap,
|
||||
});
|
||||
|
||||
@@ -12,23 +12,23 @@ class CertificatesHeaderSkeleton extends StatelessWidget {
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(UiConstants.space5),
|
||||
decoration: const BoxDecoration(color: UiColors.primary),
|
||||
child: SafeArea(
|
||||
child: const SafeArea(
|
||||
bottom: false,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
const SizedBox(height: UiConstants.space4),
|
||||
const UiShimmerCircle(size: 64),
|
||||
const SizedBox(height: UiConstants.space3),
|
||||
SizedBox(height: UiConstants.space4),
|
||||
UiShimmerCircle(size: 64),
|
||||
SizedBox(height: UiConstants.space3),
|
||||
UiShimmerLine(
|
||||
width: 120,
|
||||
height: 14,
|
||||
),
|
||||
const SizedBox(height: UiConstants.space2),
|
||||
SizedBox(height: UiConstants.space2),
|
||||
UiShimmerLine(
|
||||
width: 80,
|
||||
height: 12,
|
||||
),
|
||||
const SizedBox(height: UiConstants.space6),
|
||||
SizedBox(height: UiConstants.space6),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -178,8 +178,9 @@ class _FormI9PageState extends State<FormI9Page> {
|
||||
}
|
||||
},
|
||||
builder: (BuildContext context, FormI9State state) {
|
||||
if (state.status == FormI9Status.success)
|
||||
if (state.status == FormI9Status.success) {
|
||||
return _buildSuccessView(i18n);
|
||||
}
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: UiColors.background,
|
||||
|
||||
@@ -180,8 +180,9 @@ class _FormW4PageState extends State<FormW4Page> {
|
||||
}
|
||||
},
|
||||
builder: (BuildContext context, FormW4State state) {
|
||||
if (state.status == FormW4Status.success)
|
||||
if (state.status == FormW4Status.success) {
|
||||
return _buildSuccessView(i18n);
|
||||
}
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: UiColors.background,
|
||||
|
||||
@@ -39,11 +39,11 @@ class TappableRow extends StatelessWidget {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
spacing: UiConstants.space3,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
FieldLabel(text: i18n.locations_label),
|
||||
GestureDetector(
|
||||
onTap: enabled ? onTap : null,
|
||||
child: Container(
|
||||
child: SizedBox(
|
||||
width: double.infinity,
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import 'package:krow_core/core.dart';
|
||||
import 'package:krow_domain/krow_domain.dart';
|
||||
|
||||
import '../../domain/repositories/staff_main_repository_interface.dart';
|
||||
import 'package:staff_main/src/domain/repositories/staff_main_repository_interface.dart';
|
||||
|
||||
/// V2 API implementation of [StaffMainRepositoryInterface].
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user