feat : buy in province all
This commit is contained in:
@@ -0,0 +1,96 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'widely_used_local_model.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// TypeAdapterGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
class WidelyUsedLocalModelAdapter extends TypeAdapter<WidelyUsedLocalModel> {
|
||||||
|
@override
|
||||||
|
final typeId = 2;
|
||||||
|
|
||||||
|
@override
|
||||||
|
WidelyUsedLocalModel read(BinaryReader reader) {
|
||||||
|
final numOfFields = reader.readByte();
|
||||||
|
final fields = <int, dynamic>{
|
||||||
|
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
|
||||||
|
};
|
||||||
|
return WidelyUsedLocalModel(
|
||||||
|
hasInit: fields[0] as bool?,
|
||||||
|
items: (fields[1] as List?)?.cast<WidelyUsedLocalItem>(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void write(BinaryWriter writer, WidelyUsedLocalModel obj) {
|
||||||
|
writer
|
||||||
|
..writeByte(2)
|
||||||
|
..writeByte(0)
|
||||||
|
..write(obj.hasInit)
|
||||||
|
..writeByte(1)
|
||||||
|
..write(obj.items);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => typeId.hashCode;
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) =>
|
||||||
|
identical(this, other) ||
|
||||||
|
other is WidelyUsedLocalModelAdapter &&
|
||||||
|
runtimeType == other.runtimeType &&
|
||||||
|
typeId == other.typeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
class WidelyUsedLocalItemAdapter extends TypeAdapter<WidelyUsedLocalItem> {
|
||||||
|
@override
|
||||||
|
final typeId = 3;
|
||||||
|
|
||||||
|
@override
|
||||||
|
WidelyUsedLocalItem read(BinaryReader reader) {
|
||||||
|
final numOfFields = reader.readByte();
|
||||||
|
final fields = <int, dynamic>{
|
||||||
|
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
|
||||||
|
};
|
||||||
|
return WidelyUsedLocalItem(
|
||||||
|
title: fields[0] as String?,
|
||||||
|
iconPath: fields[1] as String?,
|
||||||
|
iconColor: (fields[2] as num?)?.toInt(),
|
||||||
|
color: (fields[3] as num?)?.toInt(),
|
||||||
|
path: fields[4] as String?,
|
||||||
|
pathId: (fields[5] as num?)?.toInt(),
|
||||||
|
index: (fields[6] as num?)?.toInt(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void write(BinaryWriter writer, WidelyUsedLocalItem obj) {
|
||||||
|
writer
|
||||||
|
..writeByte(7)
|
||||||
|
..writeByte(0)
|
||||||
|
..write(obj.title)
|
||||||
|
..writeByte(1)
|
||||||
|
..write(obj.iconPath)
|
||||||
|
..writeByte(2)
|
||||||
|
..write(obj.iconColor)
|
||||||
|
..writeByte(3)
|
||||||
|
..write(obj.color)
|
||||||
|
..writeByte(4)
|
||||||
|
..write(obj.path)
|
||||||
|
..writeByte(5)
|
||||||
|
..write(obj.pathId)
|
||||||
|
..writeByte(6)
|
||||||
|
..write(obj.index);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => typeId.hashCode;
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) =>
|
||||||
|
identical(this, other) ||
|
||||||
|
other is WidelyUsedLocalItemAdapter &&
|
||||||
|
runtimeType == other.runtimeType &&
|
||||||
|
typeId == other.typeId;
|
||||||
|
}
|
||||||
20
packages/chicken/lib/hive_registrar.g.dart
Normal file
20
packages/chicken/lib/hive_registrar.g.dart
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
// Generated by Hive CE
|
||||||
|
// Do not modify
|
||||||
|
// Check in to version control
|
||||||
|
|
||||||
|
import 'package:hive_ce/hive.dart';
|
||||||
|
import 'package:rasadyar_chicken/data/models/local/widely_used_local_model.dart';
|
||||||
|
|
||||||
|
extension HiveRegistrar on HiveInterface {
|
||||||
|
void registerAdapters() {
|
||||||
|
registerAdapter(WidelyUsedLocalItemAdapter());
|
||||||
|
registerAdapter(WidelyUsedLocalModelAdapter());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension IsolatedHiveRegistrar on IsolatedHiveInterface {
|
||||||
|
void registerAdapters() {
|
||||||
|
registerAdapter(WidelyUsedLocalItemAdapter());
|
||||||
|
registerAdapter(WidelyUsedLocalModelAdapter());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
import 'package:rasadyar_chicken/chicken.dart';
|
||||||
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
|
enum WidelyUsedType { edit, normal }
|
||||||
|
|
||||||
|
class WidelyUsedLogic extends GetxController {
|
||||||
|
Rx<WidelyUsedType> type = WidelyUsedType.normal.obs;
|
||||||
|
RootLogic rootLogic = Get.find<RootLogic>();
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onReady() {
|
||||||
|
super.onReady();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onClose() {
|
||||||
|
// TODO: implement onClose
|
||||||
|
super.onClose();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isOnEdit() => type.value == WidelyUsedType.edit;
|
||||||
|
|
||||||
|
void toggleType() {
|
||||||
|
fLog(rootLogic.widelyUsedList);
|
||||||
|
if (type.value == WidelyUsedType.edit) {
|
||||||
|
type.value = WidelyUsedType.normal;
|
||||||
|
} else {
|
||||||
|
type.value = WidelyUsedType.edit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
180
packages/chicken/lib/presentation/widget/widely_used/view.dart
Normal file
180
packages/chicken/lib/presentation/widget/widely_used/view.dart
Normal file
@@ -0,0 +1,180 @@
|
|||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:rasadyar_chicken/presentation/routes/routes.dart';
|
||||||
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
|
import 'logic.dart';
|
||||||
|
|
||||||
|
class WidelyUsedWidget extends StatelessWidget {
|
||||||
|
const WidelyUsedWidget({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final WidelyUsedLogic controller = Get.put(WidelyUsedLogic());
|
||||||
|
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: EdgeInsetsGeometry.all(6),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text('پر کاربرد ها', textAlign: TextAlign.right, style: AppFonts.yekan16),
|
||||||
|
ObxValue((data) {
|
||||||
|
return GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
controller.toggleType();
|
||||||
|
},
|
||||||
|
child: controller.isOnEdit()
|
||||||
|
? Assets.vec.checkSvg.svg(
|
||||||
|
width: 12.w,
|
||||||
|
height: 12.h,
|
||||||
|
colorFilter: ColorFilter.mode(AppColor.greenNormal, BlendMode.srcIn),
|
||||||
|
)
|
||||||
|
: Assets.vec.editSvg.svg(
|
||||||
|
width: 16.w,
|
||||||
|
height: 16.h,
|
||||||
|
colorFilter: ColorFilter.mode(AppColor.blueNormal, BlendMode.srcIn),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}, controller.type),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 2.0, vertical: 2),
|
||||||
|
child: ObxValue((data) {
|
||||||
|
return Wrap(
|
||||||
|
spacing: 4,
|
||||||
|
runSpacing: 18,
|
||||||
|
children: [
|
||||||
|
widelyUsed(
|
||||||
|
title: 'خرید خارج استان',
|
||||||
|
isOnEdit: controller.type.value == WidelyUsedType.edit,
|
||||||
|
iconPath: Assets.vec.truckFastSvg.path,
|
||||||
|
onTap: () async {
|
||||||
|
controller.rootLogic.currentPage.value = 0;
|
||||||
|
controller.rootLogic.currentPage.refresh();
|
||||||
|
await Future.delayed(Duration(milliseconds: 100));
|
||||||
|
Get.toNamed(ChickenRoutes.buysOutOfProvince, id: 0);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}, controller.type),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget widelyUsed({
|
||||||
|
required String title,
|
||||||
|
required String iconPath,
|
||||||
|
required VoidCallback onTap,
|
||||||
|
required bool isOnEdit,
|
||||||
|
}) {
|
||||||
|
return GestureDetector(
|
||||||
|
onTap: !isOnEdit ? onTap : null,
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
spacing: 4,
|
||||||
|
children: [
|
||||||
|
Stack(
|
||||||
|
clipBehavior: Clip.none,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: 48,
|
||||||
|
height: 48,
|
||||||
|
padding: EdgeInsets.all(4),
|
||||||
|
decoration: ShapeDecoration(
|
||||||
|
color: Color(0xFFBECDFF),
|
||||||
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||||
|
),
|
||||||
|
child: Container(
|
||||||
|
width: 40,
|
||||||
|
height: 40,
|
||||||
|
decoration: ShapeDecoration(
|
||||||
|
color: AppColor.blueNormal,
|
||||||
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||||
|
),
|
||||||
|
child: SvgGenImage.vec(iconPath).svg(
|
||||||
|
width: 24,
|
||||||
|
height: 24,
|
||||||
|
colorFilter: ColorFilter.mode(Colors.white, BlendMode.srcIn),
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Visibility(
|
||||||
|
visible: isOnEdit,
|
||||||
|
child: Container(
|
||||||
|
width: 48,
|
||||||
|
height: 48,
|
||||||
|
padding: EdgeInsets.all(4),
|
||||||
|
decoration: ShapeDecoration(
|
||||||
|
color: Colors.white60,
|
||||||
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
Visibility(
|
||||||
|
visible: isOnEdit,
|
||||||
|
child: Positioned(
|
||||||
|
top: -15,
|
||||||
|
left: -12,
|
||||||
|
child: SizedBox(
|
||||||
|
width: 32.w,
|
||||||
|
height: 32.h,
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () {},
|
||||||
|
behavior: HitTestBehavior.translucent,
|
||||||
|
child: Center(
|
||||||
|
child: Container(
|
||||||
|
width: 16,
|
||||||
|
height: 16,
|
||||||
|
decoration: BoxDecoration(shape: BoxShape.circle, color: Colors.white),
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: Icon(CupertinoIcons.minus, color: AppColor.error, size: 15),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Text(title, style: AppFonts.yekan10.copyWith(color: AppColor.blueNormal)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget addWidelyUsed({required VoidCallback onTap}) {
|
||||||
|
return Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
spacing: 4,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: 48,
|
||||||
|
height: 48,
|
||||||
|
padding: EdgeInsets.all(4),
|
||||||
|
decoration: ShapeDecoration(
|
||||||
|
color: const Color(0xFFD9F7F0),
|
||||||
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||||
|
),
|
||||||
|
child: Assets.vec.messageAddSvg.svg(
|
||||||
|
width: 40,
|
||||||
|
height: 40,
|
||||||
|
colorFilter: ColorFilter.mode(AppColor.greenNormal, BlendMode.srcIn),
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text('افزودن', style: AppFonts.yekan10.copyWith(color: AppColor.greenDarkHover)),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user