feat: Add shimmer loading skeletons for various pages and components
- Implemented `ClientHomePageSkeleton` for the client home page to display a loading state with shimmer effects. - Created `OrderFormSkeleton` to mimic the layout of the order creation form while data is being fetched. - Added `ViewOrdersPageSkeleton` to represent the loading state of the view orders page with placeholders for order cards. - Updated `ClientHomeBody` to show the skeleton during loading states. - Enhanced shimmer effects in `UiShimmerListItem`, `UiShimmerStatsCard`, and other UI components for consistency. - Introduced `isDataLoaded` state in order-related BLoCs to manage loading states effectively.
This commit is contained in:
@@ -12,26 +12,25 @@ class UiShimmerListItem extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
return const Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
vertical: UiConstants.space2,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
const UiShimmerCircle(size: UiConstants.space10),
|
||||
const SizedBox(width: UiConstants.space3),
|
||||
spacing: UiConstants.space3,
|
||||
children: <Widget>[
|
||||
UiShimmerCircle(size: UiConstants.space10),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const UiShimmerLine(width: 160),
|
||||
const SizedBox(height: UiConstants.space2),
|
||||
const UiShimmerLine(width: 100, height: 12),
|
||||
spacing: UiConstants.space2,
|
||||
children: <Widget>[
|
||||
UiShimmerLine(width: 160),
|
||||
UiShimmerLine(width: 100, height: 12),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(width: UiConstants.space3),
|
||||
const UiShimmerBox(width: 48, height: 24),
|
||||
UiShimmerBox(width: 48, height: 24),
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -56,14 +55,14 @@ class UiShimmerStatsCard extends StatelessWidget {
|
||||
borderRadius: UiConstants.radiusLg,
|
||||
color: UiColors.cardViewBackground,
|
||||
),
|
||||
child: Column(
|
||||
child: const Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const UiShimmerCircle(size: UiConstants.space8),
|
||||
const SizedBox(height: UiConstants.space3),
|
||||
const UiShimmerLine(width: 80, height: 12),
|
||||
const SizedBox(height: UiConstants.space2),
|
||||
const UiShimmerLine(width: 120, height: 20),
|
||||
children: <Widget>[
|
||||
UiShimmerCircle(size: UiConstants.space8),
|
||||
SizedBox(height: UiConstants.space3),
|
||||
UiShimmerLine(width: 80, height: 12),
|
||||
SizedBox(height: UiConstants.space2),
|
||||
UiShimmerLine(width: 120, height: 20),
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -110,9 +109,9 @@ class UiShimmerList extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final gap = spacing ?? UiConstants.space3;
|
||||
final double gap = spacing ?? UiConstants.space3;
|
||||
return Column(
|
||||
children: List.generate(itemCount, (index) {
|
||||
children: List<Widget>.generate(itemCount, (int index) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(bottom: index < itemCount - 1 ? gap : 0),
|
||||
child: itemBuilder(index),
|
||||
|
||||
Reference in New Issue
Block a user