feat: new ui changes
This commit is contained in:
@@ -493,6 +493,9 @@ class $AssetsImagesGen {
|
||||
/// File path: assets/images/outter_splash.webp
|
||||
AssetGenImage get outterSplash => const AssetGenImage('assets/images/outter_splash.webp');
|
||||
|
||||
/// File path: assets/images/pattern_chicken.webp
|
||||
AssetGenImage get patternChicken => const AssetGenImage('assets/images/pattern_chicken.webp');
|
||||
|
||||
/// File path: assets/images/place_holder.png
|
||||
AssetGenImage get placeHolder => const AssetGenImage('assets/images/place_holder.png');
|
||||
|
||||
@@ -500,7 +503,7 @@ class $AssetsImagesGen {
|
||||
AssetGenImage get selectRole => const AssetGenImage('assets/images/select_role.webp');
|
||||
|
||||
/// List of all assets
|
||||
List<AssetGenImage> get values => [chicken, innerSplash, outterSplash, placeHolder, selectRole];
|
||||
List<AssetGenImage> get values => [chicken, innerSplash, outterSplash, patternChicken, placeHolder, selectRole];
|
||||
}
|
||||
|
||||
class $AssetsLogosGen {
|
||||
|
||||
@@ -6,30 +6,28 @@ class BasePage extends GetView<BaseLogic> {
|
||||
super.key,
|
||||
this.routes,
|
||||
this.routesWidget,
|
||||
this.widgets,
|
||||
this.child,
|
||||
this.scrollable = false,
|
||||
this.floatingActionButtonLocation,
|
||||
this.floatingActionButton,
|
||||
this.appBar,
|
||||
this.backGroundWidget,
|
||||
this.backGroundDecoration,
|
||||
this.onPopScopTaped,
|
||||
this.backId,
|
||||
this.onSearchChanged,
|
||||
this.onRefresh,
|
||||
});
|
||||
|
||||
final List<String>? routes;
|
||||
final Widget? routesWidget;
|
||||
final List<Widget>? widgets;
|
||||
final Widget? child;
|
||||
final bool scrollable;
|
||||
final RAppBar? appBar;
|
||||
final BackGroundWidget? backGroundWidget;
|
||||
final BoxDecoration? backGroundDecoration;
|
||||
final FloatingActionButtonLocation? floatingActionButtonLocation;
|
||||
final Widget? floatingActionButton;
|
||||
final VoidCallback? onPopScopTaped;
|
||||
final int? backId;
|
||||
final void Function(String?)? onSearchChanged;
|
||||
final RefreshCallback? onRefresh;
|
||||
|
||||
Widget _buildHeader() {
|
||||
if (appBar?.hasSearch == true) {
|
||||
@@ -49,38 +47,30 @@ class BasePage extends GetView<BaseLogic> {
|
||||
final content = [
|
||||
if (routes != null || routesWidget != null) _buildHeader(),
|
||||
if (child != null) Expanded(child: child!),
|
||||
...?widgets,
|
||||
];
|
||||
|
||||
if (scrollable) {
|
||||
if (backGroundWidget != null) {
|
||||
return Stack(
|
||||
children: [
|
||||
?backGroundWidget,
|
||||
SingleChildScrollView(
|
||||
physics: const BouncingScrollPhysics(),
|
||||
padding: EdgeInsets.symmetric(vertical: 8.h),
|
||||
child: Column(children: content),
|
||||
if (onRefresh == null) {
|
||||
return Container(
|
||||
decoration: backGroundDecoration,
|
||||
child: Column(mainAxisAlignment: MainAxisAlignment.start, children: content),
|
||||
);
|
||||
} else {
|
||||
return RefreshIndicator.adaptive(
|
||||
triggerMode: RefreshIndicatorTriggerMode.anywhere,
|
||||
edgeOffset: 16.h,
|
||||
onRefresh: onRefresh ?? () async {},
|
||||
child: CustomScrollView(
|
||||
slivers: [
|
||||
SliverFillRemaining(
|
||||
child: Container(
|
||||
decoration: backGroundDecoration,
|
||||
child: Column(mainAxisAlignment: MainAxisAlignment.start, children: content),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
return SingleChildScrollView(
|
||||
physics: const BouncingScrollPhysics(),
|
||||
padding: EdgeInsets.symmetric(vertical: 8.h),
|
||||
child: Column(children: content),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
if (backGroundWidget != null) {
|
||||
return Stack(
|
||||
children: [
|
||||
Positioned.fill(child: backGroundWidget!),
|
||||
Column(children: content),
|
||||
],
|
||||
);
|
||||
}
|
||||
return Column(children: content);
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -2,19 +2,9 @@ import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../../core.dart';
|
||||
|
||||
class BackGroundWidget extends StatelessWidget {
|
||||
const BackGroundWidget({super.key, required this.gradient, required this.vecPath});
|
||||
|
||||
final Gradient gradient;
|
||||
final String vecPath;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
width: Get.width,
|
||||
height: Get.height,
|
||||
decoration: BoxDecoration(gradient: gradient),
|
||||
child: SvgGenImage.vec(vecPath).svg(fit: BoxFit.cover),
|
||||
);
|
||||
}
|
||||
BoxDecoration backGroundDecoration({required Gradient gradient, required String backgroundPath}) {
|
||||
return BoxDecoration(
|
||||
gradient: gradient,
|
||||
image: DecorationImage(image: AssetGenImage(backgroundPath).provider(), fit: BoxFit.cover),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ class RPaginatedListView<T> extends StatelessWidget {
|
||||
required this.itemBuilder,
|
||||
required this.itemCount,
|
||||
this.separatorBuilder,
|
||||
this.onRefresh,
|
||||
required this.onLoadMore,
|
||||
this.isPaginating = false,
|
||||
this.hasMore = true,
|
||||
@@ -27,7 +26,6 @@ class RPaginatedListView<T> extends StatelessWidget {
|
||||
final Resource<PaginationModel<T>> resource;
|
||||
final NullableIndexedWidgetBuilder itemBuilder;
|
||||
final IndexedWidgetBuilder? separatorBuilder;
|
||||
final Future<void> Function()? onRefresh;
|
||||
final Future<void> Function() onLoadMore;
|
||||
final bool isPaginating;
|
||||
final bool hasMore;
|
||||
@@ -55,7 +53,7 @@ class RPaginatedListView<T> extends StatelessWidget {
|
||||
}
|
||||
|
||||
if (resource.isEmpty || resource.data?.results?.isEmpty == true) {
|
||||
return emptyWidget ?? EmptyWidget(onRefresh: onRefresh);
|
||||
return emptyWidget ?? EmptyWidget();
|
||||
}
|
||||
|
||||
final controller = scrollController ?? ScrollController();
|
||||
@@ -69,50 +67,44 @@ class RPaginatedListView<T> extends StatelessWidget {
|
||||
}
|
||||
return false;
|
||||
},
|
||||
child: RefreshIndicator(
|
||||
color: AppColor.blueNormal,
|
||||
triggerMode: RefreshIndicatorTriggerMode.anywhere,
|
||||
|
||||
onRefresh: onRefresh ?? () async {},
|
||||
child: listType == ListType.separated
|
||||
? ListView.separated(
|
||||
padding: padding,
|
||||
controller: controller,
|
||||
shrinkWrap: true,
|
||||
itemCount: itemCount + (isPaginating ? 1 : 0),
|
||||
itemBuilder: (context, index) {
|
||||
if (isPaginating && index == itemCount) {
|
||||
return SizedBox(
|
||||
height: 50,
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.all(16),
|
||||
child: Center(child: CupertinoActivityIndicator()),
|
||||
),
|
||||
);
|
||||
}
|
||||
return itemBuilder(context, index);
|
||||
},
|
||||
separatorBuilder: separatorBuilder ?? (_, __) => const SizedBox(height: 8),
|
||||
)
|
||||
: ListView.builder(
|
||||
padding: padding,
|
||||
controller: controller,
|
||||
shrinkWrap: true,
|
||||
itemCount: itemCount + (isPaginating ? 1 : 0),
|
||||
itemBuilder: (context, index) {
|
||||
if (isPaginating && index == itemCount) {
|
||||
return SizedBox(
|
||||
height: 50,
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.all(16),
|
||||
child: Center(child: CupertinoActivityIndicator()),
|
||||
),
|
||||
);
|
||||
}
|
||||
return itemBuilder(context, index);
|
||||
},
|
||||
),
|
||||
),
|
||||
child: listType == ListType.separated
|
||||
? ListView.separated(
|
||||
padding: padding,
|
||||
controller: controller,
|
||||
shrinkWrap: true,
|
||||
itemCount: itemCount + (isPaginating ? 1 : 0),
|
||||
itemBuilder: (context, index) {
|
||||
if (isPaginating && index == itemCount) {
|
||||
return SizedBox(
|
||||
height: 50,
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.all(16),
|
||||
child: Center(child: CupertinoActivityIndicator()),
|
||||
),
|
||||
);
|
||||
}
|
||||
return itemBuilder(context, index);
|
||||
},
|
||||
separatorBuilder: separatorBuilder ?? (_, __) => const SizedBox(height: 8),
|
||||
)
|
||||
: ListView.builder(
|
||||
padding: padding,
|
||||
controller: controller,
|
||||
shrinkWrap: true,
|
||||
itemCount: itemCount + (isPaginating ? 1 : 0),
|
||||
itemBuilder: (context, index) {
|
||||
if (isPaginating && index == itemCount) {
|
||||
return SizedBox(
|
||||
height: 50,
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.all(16),
|
||||
child: Center(child: CupertinoActivityIndicator()),
|
||||
),
|
||||
);
|
||||
}
|
||||
return itemBuilder(context, index);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user