feat :
1 - empty_widget 2- loading_widget 3 - use this widget in list_view widget 4 - fix some bug in list_view_widget 5 - add some feature in list_view_widget
This commit is contained in:
@@ -0,0 +1,15 @@
|
|||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
class BuyInProvinceLogic extends GetxController {
|
||||||
|
@override
|
||||||
|
void onReady() {
|
||||||
|
// TODO: implement onReady
|
||||||
|
super.onReady();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onClose() {
|
||||||
|
// TODO: implement onClose
|
||||||
|
super.onClose();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
import 'logic.dart';
|
||||||
|
|
||||||
|
class BuyInProvincePage extends GetView<BuyInProvinceLogic> {
|
||||||
|
const BuyInProvincePage({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
|
||||||
|
return Container(
|
||||||
|
color: Colors.amberAccent,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
21
packages/chicken/lib/presentation/widget/search/logic.dart
Normal file
21
packages/chicken/lib/presentation/widget/search/logic.dart
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
|
class SearchLogic extends GetxController {
|
||||||
|
final RxBool isSearchSelected = false.obs;
|
||||||
|
|
||||||
|
final RxnString searchValue = RxnString();
|
||||||
|
|
||||||
|
void setSearchCallback(void Function(String)? onSearchChanged) {
|
||||||
|
debounce<String?>(searchValue, (val) {
|
||||||
|
if (val != null && val.trim().isNotEmpty) {
|
||||||
|
onSearchChanged?.call(val);
|
||||||
|
}
|
||||||
|
}, time: const Duration(milliseconds: 600));
|
||||||
|
}
|
||||||
|
|
||||||
|
void toggleSearch() {
|
||||||
|
isSearchSelected.value = !isSearchSelected.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
55
packages/chicken/lib/presentation/widget/search/view.dart
Normal file
55
packages/chicken/lib/presentation/widget/search/view.dart
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
|
import 'logic.dart';
|
||||||
|
|
||||||
|
class SearchWidget extends StatefulWidget {
|
||||||
|
const SearchWidget({super.key, this.onSearchChanged});
|
||||||
|
|
||||||
|
final void Function(String)? onSearchChanged;
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<SearchWidget> createState() => _SearchWidgetState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _SearchWidgetState extends State<SearchWidget> {
|
||||||
|
late final SearchLogic controller;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
controller = Get.find<SearchLogic>();
|
||||||
|
controller.setSearchCallback(widget.onSearchChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return ObxValue((data) {
|
||||||
|
return AnimatedContainer(
|
||||||
|
duration: const Duration(milliseconds: 300),
|
||||||
|
padding: const EdgeInsets.only(top: 5),
|
||||||
|
curve: Curves.easeInOut,
|
||||||
|
height: data.value ? 50 : 0,
|
||||||
|
child: Visibility(
|
||||||
|
visible: data.value,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||||
|
child: RTextField(
|
||||||
|
suffixIcon: Padding(
|
||||||
|
padding: const EdgeInsets.all(12.0),
|
||||||
|
child: Assets.vec.searchSvg.svg(
|
||||||
|
width: 10,
|
||||||
|
height: 10,
|
||||||
|
colorFilter: ColorFilter.mode(AppColor.blueNormal, BlendMode.srcIn),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
hintText: 'جستجو',
|
||||||
|
controller: TextEditingController(),
|
||||||
|
onChanged: (val) => controller.searchValue.value = val,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}, controller.isSearchSelected);
|
||||||
|
}
|
||||||
|
}
|
||||||
21
packages/core/lib/presentation/widget/empty_widget.dart
Normal file
21
packages/core/lib/presentation/widget/empty_widget.dart
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
|
class EmptyWidget extends StatelessWidget {
|
||||||
|
const EmptyWidget({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Expanded(
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Row(),
|
||||||
|
Assets.icons.empty.svg(width: 156.w, height: 156.h),
|
||||||
|
Text('داده ای یافت نشد', style: AppFonts.yekan20.copyWith(color: AppColor.textColor)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
|
||||||
|
export 'r_shimmer_list.dart';
|
||||||
|
export 'r_paginated_list_view.dart';
|
||||||
14
packages/core/lib/presentation/widget/loading_widget.dart
Normal file
14
packages/core/lib/presentation/widget/loading_widget.dart
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
|
class LoadingWidget extends StatelessWidget {
|
||||||
|
const LoadingWidget({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Expanded(child: Center(child: Assets.anim.loading.lottie(
|
||||||
|
width: 120.w,
|
||||||
|
height: 120.h,
|
||||||
|
)));
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user