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,25 +1,21 @@
|
||||
import 'package:design_system/design_system.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
import 'package:client_home/src/presentation/blocs/client_home_bloc.dart';
|
||||
import 'package:client_home/src/presentation/blocs/client_home_event.dart';
|
||||
import 'package:client_home/src/presentation/blocs/client_home_state.dart';
|
||||
import 'package:client_home/src/presentation/widgets/dashboard_widget_builder.dart';
|
||||
import 'package:design_system/design_system.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
/// Widget that displays the home dashboard in edit mode with drag-and-drop support.
|
||||
///
|
||||
/// Allows users to reorder and rearrange dashboard widgets.
|
||||
class ClientHomeEditModeBody extends StatelessWidget {
|
||||
/// Creates a [ClientHomeEditModeBody].
|
||||
const ClientHomeEditModeBody({required this.state, super.key});
|
||||
|
||||
/// The current home state.
|
||||
final ClientHomeState state;
|
||||
|
||||
/// Creates a [ClientHomeEditModeBody].
|
||||
const ClientHomeEditModeBody({
|
||||
required this.state,
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ReorderableListView(
|
||||
@@ -30,18 +26,15 @@ class ClientHomeEditModeBody extends StatelessWidget {
|
||||
100,
|
||||
),
|
||||
onReorder: (int oldIndex, int newIndex) {
|
||||
BlocProvider.of<ClientHomeBloc>(context)
|
||||
.add(ClientHomeWidgetReordered(oldIndex, newIndex));
|
||||
BlocProvider.of<ClientHomeBloc>(
|
||||
context,
|
||||
).add(ClientHomeWidgetReordered(oldIndex, newIndex));
|
||||
},
|
||||
children: state.widgetOrder.map((String id) {
|
||||
return Container(
|
||||
key: ValueKey<String>(id),
|
||||
margin: const EdgeInsets.only(bottom: UiConstants.space4),
|
||||
child: DashboardWidgetBuilder(
|
||||
id: id,
|
||||
state: state,
|
||||
isEditMode: true,
|
||||
),
|
||||
child: DashboardWidgetBuilder(id: id, state: state, isEditMode: true),
|
||||
);
|
||||
}).toList(),
|
||||
);
|
||||
|
||||
@@ -10,7 +10,7 @@ class ClientHomeHeaderSkeleton extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return UiShimmer(
|
||||
return const UiShimmer(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(
|
||||
UiConstants.space4,
|
||||
@@ -18,14 +18,14 @@ class ClientHomeHeaderSkeleton extends StatelessWidget {
|
||||
UiConstants.space4,
|
||||
UiConstants.space3,
|
||||
),
|
||||
child: Row(
|
||||
child: const Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
children: <Widget>[
|
||||
children: const <Widget>[
|
||||
const Row(
|
||||
children: const <Widget>[
|
||||
const UiShimmerCircle(size: UiConstants.space10),
|
||||
const SizedBox(width: UiConstants.space3),
|
||||
Column(
|
||||
const Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: const <Widget>[
|
||||
UiShimmerLine(width: 80, height: 12),
|
||||
@@ -35,7 +35,7 @@ class ClientHomeHeaderSkeleton extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
const Row(
|
||||
spacing: UiConstants.space2,
|
||||
children: const <Widget>[
|
||||
UiShimmerBox(width: 36, height: 36),
|
||||
|
||||
@@ -10,7 +10,7 @@ class ReorderSectionSkeleton extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
return const Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: const <Widget>[
|
||||
UiShimmerSectionHeader(),
|
||||
|
||||
@@ -20,7 +20,8 @@ dependencies:
|
||||
path: ../../../design_system
|
||||
core_localization:
|
||||
path: ../../../core_localization
|
||||
krow_domain: ^0.0.1
|
||||
krow_domain:
|
||||
path: ../../../domain
|
||||
krow_core:
|
||||
path: ../../../core
|
||||
|
||||
|
||||
Reference in New Issue
Block a user