feat : new UI
This commit is contained in:
@@ -10,16 +10,17 @@
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart' as _svg;
|
||||
import 'package:lottie/lottie.dart' as _lottie;
|
||||
import 'package:vector_graphics/vector_graphics.dart' as _vg;
|
||||
|
||||
class $AssetsAnimGen {
|
||||
const $AssetsAnimGen();
|
||||
|
||||
/// File path: assets/anim/loading.json
|
||||
String get loading => 'assets/anim/loading.json';
|
||||
LottieGenImage get loading => const LottieGenImage('assets/anim/loading.json');
|
||||
|
||||
/// List of all assets
|
||||
List<String> get values => [loading];
|
||||
List<LottieGenImage> get values => [loading];
|
||||
}
|
||||
|
||||
class $AssetsIconsGen {
|
||||
@@ -733,3 +734,69 @@ class SvgGenImage {
|
||||
|
||||
String get keyName => _assetName;
|
||||
}
|
||||
|
||||
class LottieGenImage {
|
||||
const LottieGenImage(this._assetName, {this.flavors = const {}});
|
||||
|
||||
final String _assetName;
|
||||
final Set<String> flavors;
|
||||
|
||||
_lottie.LottieBuilder lottie({
|
||||
Animation<double>? controller,
|
||||
bool? animate,
|
||||
_lottie.FrameRate? frameRate,
|
||||
bool? repeat,
|
||||
bool? reverse,
|
||||
_lottie.LottieDelegates? delegates,
|
||||
_lottie.LottieOptions? options,
|
||||
void Function(_lottie.LottieComposition)? onLoaded,
|
||||
_lottie.LottieImageProviderFactory? imageProviderFactory,
|
||||
Key? key,
|
||||
AssetBundle? bundle,
|
||||
Widget Function(BuildContext, Widget, _lottie.LottieComposition?)? frameBuilder,
|
||||
ImageErrorWidgetBuilder? errorBuilder,
|
||||
double? width,
|
||||
double? height,
|
||||
BoxFit? fit,
|
||||
AlignmentGeometry? alignment,
|
||||
String? package,
|
||||
bool? addRepaintBoundary,
|
||||
FilterQuality? filterQuality,
|
||||
void Function(String)? onWarning,
|
||||
_lottie.LottieDecoder? decoder,
|
||||
_lottie.RenderCache? renderCache,
|
||||
bool? backgroundLoading,
|
||||
}) {
|
||||
return _lottie.Lottie.asset(
|
||||
_assetName,
|
||||
controller: controller,
|
||||
animate: animate,
|
||||
frameRate: frameRate,
|
||||
repeat: repeat,
|
||||
reverse: reverse,
|
||||
delegates: delegates,
|
||||
options: options,
|
||||
onLoaded: onLoaded,
|
||||
imageProviderFactory: imageProviderFactory,
|
||||
key: key,
|
||||
bundle: bundle,
|
||||
frameBuilder: frameBuilder,
|
||||
errorBuilder: errorBuilder,
|
||||
width: width,
|
||||
height: height,
|
||||
fit: fit,
|
||||
alignment: alignment,
|
||||
package: package,
|
||||
addRepaintBoundary: addRepaintBoundary,
|
||||
filterQuality: filterQuality,
|
||||
onWarning: onWarning,
|
||||
decoder: decoder,
|
||||
renderCache: renderCache,
|
||||
backgroundLoading: backgroundLoading,
|
||||
);
|
||||
}
|
||||
|
||||
String get path => _assetName;
|
||||
|
||||
String get keyName => _assetName;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_core/utils/network/resource.dart';
|
||||
|
||||
import 'r_shimmer_list.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
enum ListType { builder, separated }
|
||||
|
||||
@@ -21,7 +19,9 @@ class RPaginatedListView<T> extends StatelessWidget {
|
||||
this.emptyWidget,
|
||||
this.errorWidget,
|
||||
this.scrollController,
|
||||
this.padding = const EdgeInsets.all(8.0),
|
||||
this.listType = ListType.builder,
|
||||
this.physics = const BouncingScrollPhysics(),
|
||||
});
|
||||
|
||||
final Resource<List<T>> resource;
|
||||
@@ -37,11 +37,17 @@ class RPaginatedListView<T> extends StatelessWidget {
|
||||
final Widget? errorWidget;
|
||||
final ScrollController? scrollController;
|
||||
final ListType listType;
|
||||
final EdgeInsets padding;
|
||||
final ScrollPhysics physics;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (resource.isLoading) {
|
||||
/* if (resource.isLoading) {
|
||||
return loadingWidget ?? RShimmerList(isSeparated: listType == ListType.separated);
|
||||
}*/
|
||||
|
||||
if (resource.isLoading) {
|
||||
return loadingWidget ?? const LoadingWidget();
|
||||
}
|
||||
|
||||
if (resource.isError) {
|
||||
@@ -49,23 +55,28 @@ class RPaginatedListView<T> extends StatelessWidget {
|
||||
}
|
||||
|
||||
if (resource.isEmpty || resource.data?.isEmpty == true) {
|
||||
return emptyWidget ?? const Center(child: Text('آیتمی یافت نشد'));
|
||||
return emptyWidget ?? const EmptyWidget();
|
||||
}
|
||||
|
||||
final controller = scrollController ?? ScrollController();
|
||||
|
||||
return NotificationListener<ScrollNotification>(
|
||||
onNotification: (ScrollNotification scrollInfo) {
|
||||
if (!isPaginating && hasMore && scrollInfo.metrics.pixels >= scrollInfo.metrics.maxScrollExtent - 100) {
|
||||
if (!isPaginating &&
|
||||
hasMore &&
|
||||
scrollInfo.metrics.pixels >= scrollInfo.metrics.maxScrollExtent - 100) {
|
||||
onLoadMore();
|
||||
}
|
||||
return false;
|
||||
},
|
||||
child: RefreshIndicator(
|
||||
color: AppColor.blueNormal,
|
||||
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) {
|
||||
@@ -79,7 +90,9 @@ class RPaginatedListView<T> extends StatelessWidget {
|
||||
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) {
|
||||
|
||||
@@ -1,23 +1,27 @@
|
||||
export 'app_bar/r_app_bar.dart';
|
||||
export 'bottom_navigation/r_bottom_navigation.dart';
|
||||
export 'bottom_navigation/wave_bottom_navigation.dart';
|
||||
export 'bottom_sheet/base_bottom_sheet.dart';
|
||||
export 'buttons/elevated.dart';
|
||||
export 'buttons/fab.dart';
|
||||
export 'buttons/outline_elevated.dart';
|
||||
export 'buttons/outline_elevated_icon.dart';
|
||||
export 'buttons/text_button.dart';
|
||||
export 'card/card_with_icon_with_border.dart';
|
||||
export 'chips/r_chips.dart';
|
||||
export 'draggable_bottom_sheet/bottom_sheet_manger.dart';
|
||||
export 'draggable_bottom_sheet/draggable_bottom_sheet.dart';
|
||||
export 'draggable_bottom_sheet/draggable_bottom_sheet2.dart';
|
||||
export 'draggable_bottom_sheet/draggable_bottom_sheet_controller.dart';
|
||||
export 'draggable_bottom_sheet/bottom_sheet_manger.dart';
|
||||
export 'inputs/input_fixed_hint.dart';
|
||||
export 'inputs/r_input.dart';
|
||||
export 'list_view/list_view.dart';
|
||||
export 'overlay_dropdown_widget/view.dart';
|
||||
export 'pagination/pagination_from_until.dart';
|
||||
export 'pagination/show_more.dart';
|
||||
export 'tabs/new_tab.dart';
|
||||
export 'tabs/tab.dart';
|
||||
export 'vec_widget.dart';
|
||||
export 'card/card_with_icon_with_border.dart';
|
||||
export 'chips/r_chips.dart';
|
||||
export 'overlay_dropdown_widget/view.dart';
|
||||
export 'inputs/input_fixed_hint.dart';
|
||||
export 'bottom_sheet/base_bottom_sheet.dart';
|
||||
export 'buttons/fab.dart';
|
||||
export 'empty_widget.dart';
|
||||
export 'loading_widget.dart';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user