fix : ui changes

This commit is contained in:
2025-09-30 09:56:22 +03:30
parent 21a8e34427
commit 0d946b500c
5 changed files with 69 additions and 15 deletions

View File

@@ -38,7 +38,7 @@ class InspectionPoultryScienceLogic extends GetxController {
super.onInit();
routesName.value = ['اقدام'].toList();
routesName.add(selectedSegmentIndex.value == 0 ? 'بازرسی' : 'بایگانی');
ever(selectedSegmentIndex, (callback) {
routesName.removeLast();
routesName.add(callback == 0 ? 'بازرسی' : 'بایگانی');

View File

@@ -23,7 +23,7 @@ class InspectionPoultrySciencePage extends GetView<InspectionPoultryScienceLogic
},
onSearchChanged: (data) => controller.setSearchValue(data),
backId: poultryFirstKey,
routes: controller.routesName,
routesWidget: ContainerBreadcrumb(rxRoutes: controller.routesName),
widgets: [
SizedBox(height: 50, child: segmentWidget()),
ObxValue((data) {
@@ -514,13 +514,23 @@ class InspectionPoultrySciencePage extends GetView<InspectionPoultryScienceLogic
itemBuilder: (context, index) => Container(
height: 100.h,
clipBehavior: Clip.hardEdge,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.r),
image: DecorationImage(
image: NetworkImage(item.image?[index] ?? ''),
fit: BoxFit.cover,
),
child: Image.network(
item.image?[index] ?? '',
loadingBuilder: (context, child, loadingProgress) {
if (loadingProgress == null) return child;
return Padding(padding: EdgeInsetsGeometry.all(80),
child: CircularProgressIndicator(
color: AppColor.blueDark,
value: loadingProgress.expectedTotalBytes != null
? loadingProgress.cumulativeBytesLoaded /
(loadingProgress.expectedTotalBytes ?? 1)
: null,
),
);
},
),
decoration: BoxDecoration(borderRadius: BorderRadius.circular(8.r)),
),
),
),

View File

@@ -50,7 +50,7 @@ class ChickenBasePage extends GetView<BaseLogic> {
final VoidCallback? onNotificationTap;
final List<String>? routes;
final Breadcrumb? routesWidget;
final Widget? routesWidget;
final List<Widget>? widgets;
final Widget? child;
final bool scrollable;

View File

@@ -19,7 +19,7 @@ class BasePage extends GetView<BaseLogic> {
});
final List<String>? routes;
final Breadcrumb? routesWidget;
final Widget? routesWidget;
final List<Widget>? widgets;
final Widget? child;
final bool scrollable;

View File

@@ -2,13 +2,14 @@ import 'package:flutter/material.dart';
import 'package:rasadyar_core/core.dart';
abstract class Breadcrumb extends StatelessWidget {
const Breadcrumb({super.key, this.routes});
const Breadcrumb({super.key, this.routes, this.rxRoutes});
final List<String>? routes;
final RxList<String>? rxRoutes;
}
class TextBreadcrumb extends Breadcrumb {
const TextBreadcrumb({super.key, super.routes});
const TextBreadcrumb({super.key, super.routes, super.rxRoutes});
@override
Widget build(BuildContext context) {
@@ -23,14 +24,22 @@ class TextBreadcrumb extends Breadcrumb {
}
class ContainerBreadcrumb extends Breadcrumb {
const ContainerBreadcrumb({super.key, super.routes});
const ContainerBreadcrumb({super.key, super.routes, super.rxRoutes})
: assert(
(routes != null && rxRoutes == null) || (routes == null && rxRoutes != null),
'Only one of routes or rxRoutes should be provided',
);
@override
Widget build(BuildContext context) {
if (routes?.isEmpty ?? true) {
if ((routes?.isEmpty ?? true) && (rxRoutes?.isEmpty ?? true)) {
return SizedBox.shrink();
}
return buildContainerPageRoute(routes!);
if (rxRoutes != null) {
return buildRXContainerPageRoute(rxRoutes!);
} else {
return buildContainerPageRoute(routes!);
}
}
Widget buildContainerPageRoute(List<String> route) {
@@ -62,4 +71,39 @@ class ContainerBreadcrumb extends Breadcrumb {
],
);
}
Widget buildRXContainerPageRoute(RxList<String> routes) {
return Row(
children: [
Container(
height: 24.h,
margin: EdgeInsets.symmetric(horizontal: 8.w, vertical: 4.h),
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(2.r)),
padding: EdgeInsets.symmetric(horizontal: 6.w),
child: ObxValue((data) {
return ListView.separated(
scrollDirection: Axis.horizontal,
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemBuilder: (context, index) {
var tmp = data[index];
return Center(
child: Text(
tmp,
style: AppFonts.yekan14.copyWith(color: AppColor.labelTextColor),
),
);
},
separatorBuilder: (context, index) => Assets.vec.arrowLeftSvg.svg(
height: 24.h,
fit: BoxFit.fitHeight,
colorFilter: ColorFilter.mode(Color(0xFFD6DEEE), BlendMode.srcIn),
),
itemCount: data.length,
);
}, routes),
),
],
);
}
}