feat : module page
This commit is contained in:
@@ -166,6 +166,15 @@ class AppFonts {
|
||||
height: _height,
|
||||
);
|
||||
|
||||
|
||||
static TextStyle yekan18Bold = TextStyle(
|
||||
fontFamily: yekan,
|
||||
fontWeight: bold, // Use bold weight
|
||||
fontSize: 18.sp,
|
||||
height: _height,
|
||||
);
|
||||
|
||||
|
||||
static TextStyle yekan16Bold = TextStyle(
|
||||
// Base size bold
|
||||
fontFamily: yekan,
|
||||
|
||||
@@ -211,6 +211,24 @@ class $AssetsIconsGen {
|
||||
/// File path: assets/icons/profile_user.svg
|
||||
SvgGenImage get profileUser => const SvgGenImage('assets/icons/profile_user.svg');
|
||||
|
||||
/// File path: assets/icons/rasad_ban.svg
|
||||
SvgGenImage get rasadBan => const SvgGenImage('assets/icons/rasad_ban.svg');
|
||||
|
||||
/// File path: assets/icons/rasad_bar.svg
|
||||
SvgGenImage get rasadBar => const SvgGenImage('assets/icons/rasad_bar.svg');
|
||||
|
||||
/// File path: assets/icons/rasad_bot.svg
|
||||
SvgGenImage get rasadBot => const SvgGenImage('assets/icons/rasad_bot.svg');
|
||||
|
||||
/// File path: assets/icons/rasad_dam.svg
|
||||
SvgGenImage get rasadDam => const SvgGenImage('assets/icons/rasad_dam.svg');
|
||||
|
||||
/// File path: assets/icons/rasad_nan.svg
|
||||
SvgGenImage get rasadNan => const SvgGenImage('assets/icons/rasad_nan.svg');
|
||||
|
||||
/// File path: assets/icons/rasad_toyor.svg
|
||||
SvgGenImage get rasadToyor => const SvgGenImage('assets/icons/rasad_toyor.svg');
|
||||
|
||||
/// File path: assets/icons/receipt_discount.svg
|
||||
SvgGenImage get receiptDiscount => const SvgGenImage('assets/icons/receipt_discount.svg');
|
||||
|
||||
@@ -339,6 +357,12 @@ class $AssetsIconsGen {
|
||||
profile2Outline,
|
||||
profileCircle,
|
||||
profileUser,
|
||||
rasadBan,
|
||||
rasadBar,
|
||||
rasadBot,
|
||||
rasadDam,
|
||||
rasadNan,
|
||||
rasadToyor,
|
||||
receiptDiscount,
|
||||
sale,
|
||||
scan,
|
||||
@@ -576,6 +600,24 @@ class $AssetsVecGen {
|
||||
/// File path: assets/vec/profile_user.svg.vec
|
||||
SvgGenImage get profileUserSvg => const SvgGenImage.vec('assets/vec/profile_user.svg.vec');
|
||||
|
||||
/// File path: assets/vec/rasad_ban.svg.vec
|
||||
SvgGenImage get rasadBanSvg => const SvgGenImage.vec('assets/vec/rasad_ban.svg.vec');
|
||||
|
||||
/// File path: assets/vec/rasad_bar.svg.vec
|
||||
SvgGenImage get rasadBarSvg => const SvgGenImage.vec('assets/vec/rasad_bar.svg.vec');
|
||||
|
||||
/// File path: assets/vec/rasad_bot.svg.vec
|
||||
SvgGenImage get rasadBotSvg => const SvgGenImage.vec('assets/vec/rasad_bot.svg.vec');
|
||||
|
||||
/// File path: assets/vec/rasad_dam.svg.vec
|
||||
SvgGenImage get rasadDamSvg => const SvgGenImage.vec('assets/vec/rasad_dam.svg.vec');
|
||||
|
||||
/// File path: assets/vec/rasad_nan.svg.vec
|
||||
SvgGenImage get rasadNanSvg => const SvgGenImage.vec('assets/vec/rasad_nan.svg.vec');
|
||||
|
||||
/// File path: assets/vec/rasad_toyor.svg.vec
|
||||
SvgGenImage get rasadToyorSvg => const SvgGenImage.vec('assets/vec/rasad_toyor.svg.vec');
|
||||
|
||||
/// File path: assets/vec/receipt_discount.svg.vec
|
||||
SvgGenImage get receiptDiscountSvg => const SvgGenImage.vec('assets/vec/receipt_discount.svg.vec');
|
||||
|
||||
@@ -704,6 +746,12 @@ class $AssetsVecGen {
|
||||
profile2OutlineSvg,
|
||||
profileCircleSvg,
|
||||
profileUserSvg,
|
||||
rasadBanSvg,
|
||||
rasadBarSvg,
|
||||
rasadBotSvg,
|
||||
rasadDamSvg,
|
||||
rasadNanSvg,
|
||||
rasadToyorSvg,
|
||||
receiptDiscountSvg,
|
||||
saleSvg,
|
||||
scanSvg,
|
||||
|
||||
@@ -7,38 +7,53 @@ class CardIcon extends StatelessWidget {
|
||||
required this.title,
|
||||
required this.icon,
|
||||
this.onTap,
|
||||
this.titleColor = AppColor.blueNormal,
|
||||
this.titleStyle,
|
||||
this.borderColor = AppColor.blueNormal,
|
||||
this.backgroundColor = Colors.white,
|
||||
this.borderRadius = 8,
|
||||
this.width = 110,
|
||||
this.height = 110,
|
||||
this.borderWidth = 1,
|
||||
});
|
||||
|
||||
final String title;
|
||||
final String icon;
|
||||
final VoidCallback? onTap;
|
||||
final Color titleColor;
|
||||
final TextStyle? titleStyle;
|
||||
|
||||
final Color borderColor;
|
||||
final Color backgroundColor;
|
||||
final double borderRadius;
|
||||
final double borderWidth;
|
||||
|
||||
final double width;
|
||||
final double height;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return InkWell(
|
||||
onTap: onTap,
|
||||
child: Card(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
side: const BorderSide(color: AppColor.blueNormal, width: 1),
|
||||
),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
color: Colors.white,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
SvgGenImage(icon).svg(width: 50, height: 50),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
title,
|
||||
style: AppFonts.yekan16.copyWith(color: AppColor.blueNormal),
|
||||
),
|
||||
],
|
||||
),
|
||||
return Container(
|
||||
clipBehavior: Clip.hardEdge,
|
||||
padding: EdgeInsets.fromLTRB(17.w, 10.h, 17.w, 8.h),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(borderRadius.r),
|
||||
color: backgroundColor,
|
||||
border: Border.all(color: borderColor, width: borderWidth.w),
|
||||
),
|
||||
child: InkWell(
|
||||
onTap: onTap,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(child: SvgGenImage(icon).svg(fit: BoxFit.fill)),
|
||||
SizedBox(height: 10.h),
|
||||
Text(
|
||||
title,
|
||||
textAlign: TextAlign.center,
|
||||
style: titleStyle ?? AppFonts.yekan16Bold.copyWith(color: titleColor, height: 1.20),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
45
packages/core/lib/presentation/widget/slider/logic.dart
Normal file
45
packages/core/lib/presentation/widget/slider/logic.dart
Normal file
@@ -0,0 +1,45 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
class SliderLogic extends GetxController with StateMixin<List<String>> {
|
||||
final PageController pageController = PageController(initialPage: 0, viewportFraction: .93);
|
||||
late Timer _timer;
|
||||
late Duration duration;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
|
||||
duration = Duration(seconds: randomInt(8, 18));
|
||||
}
|
||||
|
||||
void _startSliding(int itemCount) {
|
||||
_timer = Timer.periodic(duration, (timer) {
|
||||
if (pageController.hasClients) {
|
||||
int nextPage = pageController.page!.round() + 1;
|
||||
if (nextPage == itemCount) {
|
||||
nextPage = 0;
|
||||
}
|
||||
pageController.animateToPage(
|
||||
nextPage,
|
||||
duration: Duration(milliseconds: 300),
|
||||
curve: Curves.easeIn,
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
_timer.cancel();
|
||||
pageController.dispose();
|
||||
super.onClose();
|
||||
}
|
||||
|
||||
void onSuccess(List<String> data) {
|
||||
change(data, status: RxStatus.success());
|
||||
_startSliding(data.length);
|
||||
}
|
||||
}
|
||||
2
packages/core/lib/presentation/widget/slider/slider.dart
Normal file
2
packages/core/lib/presentation/widget/slider/slider.dart
Normal file
@@ -0,0 +1,2 @@
|
||||
export 'logic.dart';
|
||||
export 'view.dart';
|
||||
80
packages/core/lib/presentation/widget/slider/view.dart
Normal file
80
packages/core/lib/presentation/widget/slider/view.dart
Normal file
@@ -0,0 +1,80 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
class SliderWidget extends GetView<SliderLogic> {
|
||||
const SliderWidget({super.key, this.height = 210, this.widgetTag});
|
||||
|
||||
final int height;
|
||||
final String? widgetTag;
|
||||
|
||||
@override
|
||||
String? get tag => widgetTag;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox(
|
||||
height: height.h,
|
||||
child: controller.obx(
|
||||
(state) => Stack(
|
||||
alignment: AlignmentDirectional.bottomCenter,
|
||||
fit: StackFit.expand,
|
||||
children: [
|
||||
Positioned.fill(
|
||||
child: PageView.builder(
|
||||
controller: controller.pageController,
|
||||
itemCount: state?.length ?? 0,
|
||||
scrollDirection: Axis.horizontal,
|
||||
itemBuilder: (context, index) {
|
||||
String? image = state?[index];
|
||||
return Container(
|
||||
height: height.h,
|
||||
margin: EdgeInsets.symmetric(horizontal: 6.w),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8.r),
|
||||
image: DecorationImage(fit: BoxFit.fill, image: NetworkImage(image ?? '')),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
Visibility(
|
||||
visible: (state?.length ?? 0) > 1,
|
||||
child: Positioned(
|
||||
bottom: 5,
|
||||
child: Container(
|
||||
height: 13.36,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||
margin: const EdgeInsets.symmetric(vertical: 12),
|
||||
decoration: ShapeDecoration(
|
||||
color: Colors.white38,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(9999)),
|
||||
),
|
||||
child: SmoothPageIndicator(
|
||||
controller: controller.pageController, // PageController
|
||||
count: state?.length ?? 0,
|
||||
effect: const WormEffect(
|
||||
dotWidth: 6.0,
|
||||
dotHeight: 6.0,
|
||||
activeDotColor: Colors.white,
|
||||
dotColor: Colors.white38,
|
||||
), // your preferred effect
|
||||
onDotClicked: (index) {
|
||||
controller.pageController.animateToPage(
|
||||
index,
|
||||
duration: const Duration(milliseconds: 500),
|
||||
curve: Curves.easeIn,
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
onLoading: const Center(child: CupertinoActivityIndicator(color: AppColor.blueNormal)),
|
||||
onError: (error) => Center(child: Text('خطا در بارگذاری اسلایدر: $error')),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -32,3 +32,4 @@ export 'tabs/new_tab.dart';
|
||||
export 'tabs/r_segment.dart';
|
||||
export 'tabs/tab.dart';
|
||||
export 'vec_widget.dart';
|
||||
export 'slider/slider.dart';
|
||||
Reference in New Issue
Block a user