diff --git a/assets/icons/calendar.svg b/assets/icons/calendar.svg new file mode 100644 index 0000000..2b55ed8 --- /dev/null +++ b/assets/icons/calendar.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/features/supervision/lib/presentation/location_details/logic.dart b/features/supervision/lib/presentation/location_details/logic.dart new file mode 100644 index 0000000..bc0a16e --- /dev/null +++ b/features/supervision/lib/presentation/location_details/logic.dart @@ -0,0 +1,34 @@ +import 'package:flutter/cupertino.dart'; +import 'package:rasadyar_core/core.dart'; + +class LocationDetailsLogic extends GetxController { + RxInt selectedSegment = 0.obs; + + // The data for the segments + final Map segments = { + 0: Container( + padding: EdgeInsets.all(10), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(50)), + child: Text('همه', style: AppFonts.yekan13), + ), + 1: Container( + padding: EdgeInsets.all(10), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(50)), + child: Text('بر اساس تاریخ', style: AppFonts.yekan13), + ), + }; + + RxBool seletected = false.obs; + + @override + void onReady() { + // TODO: implement onReady + super.onReady(); + } + + @override + void onClose() { + // TODO: implement onClose + super.onClose(); + } +} diff --git a/features/supervision/lib/presentation/location_details/view.dart b/features/supervision/lib/presentation/location_details/view.dart new file mode 100644 index 0000000..8b30656 --- /dev/null +++ b/features/supervision/lib/presentation/location_details/view.dart @@ -0,0 +1,245 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:rasadyar_core/core.dart'; +import 'package:rasadyar_core/presentation/utils/color_utils.dart'; +import 'package:rasadyar_core/presentation/widget/tabs/new_tab.dart'; + +import 'logic.dart'; + +class LocationDetailsPage extends GetView { + const LocationDetailsPage({super.key}); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + automaticallyImplyLeading: false, + actions: [ + Padding( + padding: const EdgeInsets.symmetric(horizontal: 8), + child: IconButton( + onPressed: () { + Get.back(); + }, + icon: Icon(CupertinoIcons.chevron_back), + color: AppColor.blueNormal, + ), + ), + ], + ), + body: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.symmetric(horizontal: 22), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + headerInfo(description: 'ایداگل محمدی', title: 'نام مالک'), + + headerInfo( + description: '09415115545', + title: 'شماره همراه', + background: AppColor.green1Light, + ), + + headerInfo(description: '183کیلوگرم', title: 'موجودی'), + ], + ), + ), + + Padding( + padding: const EdgeInsets.fromLTRB(22, 13, 22, 4), + child: Text( + 'نوع دریافت', + textAlign: TextAlign.center, + style: AppFonts.yekan13.copyWith(color: AppColor.blueNormal), + ), + ), + + ObxValue((data) { + return NewCupertinoSegmentedControl( + padding: EdgeInsetsDirectional.symmetric( + horizontal: 20, + vertical: 10, + ), + children: controller.segments, + groupValue: data.value, + selectedColor: AppColor.blueNormal, + unselectedColor: Colors.white, + borderColor: Colors.grey.shade300, + onValueChanged: (int value) { + data.value = value; + }, + ); + }, controller.selectedSegment), + Container( + height: 32, + margin: EdgeInsets.only(top: 10, left: 22, right: 22), + + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, + spacing: 10, + children: [ + Expanded( + child: ROutlinedElevatedIcon( + icon: Icon(Icons.calendar_month), + onPressed: () {}, + text: 'از تاریخ', + textStyle: AppFonts.yekan16.copyWith( + color: AppColor.blueNormal, + ), + ), + ), + Expanded( + child: ROutlinedElevatedIcon( + icon: Icon(Icons.calendar_month), + onPressed: () {}, + text: 'تا تاریخ', + textStyle: AppFonts.yekan16.copyWith( + color: AppColor.blueNormal, + ), + ), + ), + ], + ), + ), + SizedBox(height: 20), + Row( + children: [ + Expanded(child: Divider()), + Container( + padding: EdgeInsets.symmetric(horizontal: 10, vertical: 6), + margin: EdgeInsets.symmetric(horizontal: 2), + clipBehavior: Clip.antiAlias, + decoration: ShapeDecoration( + color: AppColor.blueNormal.disabledColor, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(60), + ), + ), + child: Text( + 'تعداد کل تراکنش ها : 0', + textAlign: TextAlign.center, + style: AppFonts.yekan10, + ), + ), + Expanded(child: Divider()), + ], + ), + + Expanded( + child: GridView.builder( + itemCount: 50, + physics: BouncingScrollPhysics(), + padding: EdgeInsets.fromLTRB(20, 14, 20, 50), + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + crossAxisSpacing: 8, + mainAxisSpacing: 8, + ), + itemBuilder: + (context, index) => Container( + clipBehavior: Clip.antiAlias, + decoration: ShapeDecoration( + color: Colors.white, + shape: RoundedRectangleBorder( + side: BorderSide( + width: 1, + color: const Color(0xFFEFEFEF), + ), + borderRadius: BorderRadius.circular(16), + ), + ), + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 22, + vertical: 25, + ), + child: Column( + spacing: 6, + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text( + '${index + 1}- تراکنش موفق', + textAlign: TextAlign.center, + style: AppFonts.yekan10, + ), + SizedBox(height: 2), + Text( + '1043/12/12', + textAlign: TextAlign.center, + style: AppFonts.yekan12, + ), + + Text( + 'محصول : مرغ', + textAlign: TextAlign.center, + style: AppFonts.yekan12.copyWith( + color: AppColor.lightGreyNormalActive, + ), + ), + Text( + 'وزن : 5555 گرم', + textAlign: TextAlign.center, + style: AppFonts.yekan12.copyWith( + color: AppColor.lightGreyNormalActive, + ), + ), + Text( + 'مبلغ : 14،000،000', + textAlign: TextAlign.center, + style: AppFonts.yekan12.copyWith( + color: AppColor.lightGreyNormalActive, + ), + ), + + Text( + 'سرویس سامان کیش', + textAlign: TextAlign.center, + style: AppFonts.yekan12.copyWith( + color: AppColor.blueNormal, + ), + ), + ], + ), + ), + ), + ), + ), + ], + ), + ); + } + + Container headerInfo({ + required String title, + required String description, + Color? background, + }) { + return Container( + clipBehavior: Clip.antiAlias, + padding: EdgeInsets.symmetric(horizontal: 16, vertical: 12), + decoration: ShapeDecoration( + color: background ?? AppColor.blueLight, + shape: RoundedRectangleBorder( + side: BorderSide(width: 1, color: AppColor.blackLightHover), + borderRadius: BorderRadius.circular(8), + ), + ), + alignment: AlignmentDirectional.center, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + spacing: 10, + children: [ + Text(title, style: AppFonts.yekan10), + + Text(description, style: AppFonts.yekan12), + ], + ), + ); + } +} diff --git a/lib/main.dart b/lib/main.dart index 5163177..0839833 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,7 +1,6 @@ import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:rasadyar_app/domain/service/user/user_service.dart'; -import 'package:rasadyar_app/infrastructure/di/di.dart'; import 'package:rasadyar_app/presentation/common/app_color.dart'; import 'package:rasadyar_app/presentation/routes/app_pages.dart'; import 'package:rasadyar_core/infrastructure/di/di.dart'; diff --git a/lib/presentation/common/assets.dart b/lib/presentation/common/assets.dart index 5eeb4c1..0859799 100644 --- a/lib/presentation/common/assets.dart +++ b/lib/presentation/common/assets.dart @@ -5,6 +5,7 @@ class Assets { static const String iconsAdd = 'assets/icons/add.svg'; static const String iconsArrowLeft = 'assets/icons/arrow_left.svg'; static const String iconsArrowRight = 'assets/icons/arrow_right.svg'; + static const String iconsCalendar = 'assets/icons/calendar.svg'; static const String iconsCall = 'assets/icons/call.svg'; static const String iconsDownload = 'assets/icons/download.svg'; static const String iconsEdit = 'assets/icons/edit.svg'; diff --git a/lib/presentation/routes/app_pages.dart b/lib/presentation/routes/app_pages.dart index f7f0771..e3b62ae 100644 --- a/lib/presentation/routes/app_pages.dart +++ b/lib/presentation/routes/app_pages.dart @@ -3,6 +3,7 @@ import 'package:rasadyar_app/presentation/pages/auth/auth_with_use_and_pass/logi import 'package:rasadyar_app/presentation/pages/auth/auth_with_use_and_pass/view.dart'; import 'package:rasadyar_app/presentation/pages/splash/logic.dart'; import 'package:rasadyar_app/presentation/pages/splash/view.dart'; +import 'package:rasadyar_app/presentation/pages/system_design/system_design.dart'; import 'package:supervision/supervision.dart'; part 'app_paths.dart'; @@ -11,8 +12,10 @@ sealed class AppPages { AppPages._(); static const String initRoutes = AppPaths.splash; + static const String initDesignSystem = AppPaths.systemDesignPage; static List pages = [ + GetPage(name: AppPaths.systemDesignPage, page: () => SystemDesignPage()), GetPage( name: AppPaths.splash, page: () => SplashPage(), diff --git a/lib/presentation/routes/app_paths.dart b/lib/presentation/routes/app_paths.dart index dd68834..f6fde78 100644 --- a/lib/presentation/routes/app_paths.dart +++ b/lib/presentation/routes/app_paths.dart @@ -6,4 +6,5 @@ sealed class AppPaths { static const String splash = '/splash'; static const String authWithUserAndPass = '/authWithUserAndPass'; static const String authWithOtp = '/authWithOtp'; + static const String systemDesignPage = '/systemDesignPage'; } diff --git a/lib/presentation/widget/buttons/outline_elevated_icon.dart b/lib/presentation/widget/buttons/outline_elevated_icon.dart new file mode 100644 index 0000000..8753779 --- /dev/null +++ b/lib/presentation/widget/buttons/outline_elevated_icon.dart @@ -0,0 +1,103 @@ +import 'package:flutter/material.dart'; +import 'package:rasadyar_app/presentation/common/app_color.dart'; +import 'package:rasadyar_app/presentation/common/app_fonts.dart'; +import 'package:rasadyar_app/presentation/utils/color_utils.dart'; + +class ROutlinedElevatedIcon extends StatefulWidget { + ROutlinedElevatedIcon({ + super.key, + required this.text, + required this.onPressed, + this.foregroundColor, + this.backgroundColor, + this.borderColor, + this.disabledBackgroundColor, + this.pressedBackgroundColor, + this.radius, + this.textStyle, + this.width = 150.0, + this.height = 56.0, + }); + + final String text; + final VoidCallback? onPressed; + final double width; + final double height; + Color? foregroundColor; + Color? backgroundColor; + + Color? borderColor; + + Color? disabledBackgroundColor; + Color? pressedBackgroundColor; + double? radius; + TextStyle? textStyle; + Widget? icon; + + @override + State createState() => _ROutlinedElevatedStateIcon(); +} + +class _ROutlinedElevatedStateIcon extends State { + @override + Widget build(BuildContext context) { + return OutlinedButton.icon( + icon: widget.icon, + label: Text(widget.text), + onPressed: widget.onPressed, + style: ButtonStyle( + side: WidgetStateProperty.resolveWith((states) { + if (states.contains(WidgetState.pressed)) { + return BorderSide( + color: widget.borderColor ?? AppColor.blueNormal, + width: 2, + ); + } else if (states.contains(WidgetState.disabled)) { + return BorderSide( + color: widget.borderColor ?? AppColor.blueNormal.withAlpha(38), + width: 2, + ); + } + return BorderSide( + color: widget.borderColor ?? AppColor.blueNormal, + width: 2, + ); + }), + backgroundColor: WidgetStateProperty.resolveWith((states) { + if (states.contains(WidgetState.pressed)) { + if (widget.pressedBackgroundColor != null) { + return widget.pressedBackgroundColor; + } + return widget.backgroundColor?.pressedColor ?? AppColor.blueNormal; + } else if (states.contains(WidgetState.hovered)) { + return widget.backgroundColor?.hoverColor ?? + AppColor.blueNormal.hoverColor; + } else if (states.contains(WidgetState.disabled)) { + return widget.backgroundColor?.disabledColor ?? Colors.transparent; + } + return widget.backgroundColor; + }), + foregroundColor: WidgetStateProperty.resolveWith((states) { + if (states.contains(WidgetState.pressed)) { + return Colors.white; + } else if (states.contains(WidgetState.disabled)) { + return AppColor.blueNormal.withAlpha(38); + } + return AppColor.blueNormal; + }), + + shape: WidgetStatePropertyAll( + RoundedRectangleBorder( + borderRadius: BorderRadius.circular(widget.radius ?? 8), + ), + ), + fixedSize: WidgetStatePropertyAll(Size(widget.width, widget.height)), + padding: WidgetStatePropertyAll(EdgeInsets.zero), + textStyle: WidgetStatePropertyAll( + widget.textStyle ?? + AppFonts.yekan24.copyWith(color: AppColor.blueNormal), + ), + ), + ); + } +} diff --git a/lib/presentation/widget/vec_widget.dart b/lib/presentation/widget/vec_widget.dart index 3fb78f1..a85e527 100644 --- a/lib/presentation/widget/vec_widget.dart +++ b/lib/presentation/widget/vec_widget.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; +import 'package:rasadyar_app/presentation/common/app_color.dart'; import 'package:vector_graphics/vector_graphics.dart'; SvgPicture vecWidget( @@ -64,3 +65,69 @@ Widget vecWidget2( ), ); } + + +class ColoredSvgButton extends StatefulWidget { + final String svgPath; + final String text; + final VoidCallback? onPressed; + + const ColoredSvgButton({ + required this.svgPath, + required this.text, + this.onPressed, + super.key, + }); + + @override + State createState() => _ColoredSvgButtonState(); +} + +class _ColoredSvgButtonState extends State { + bool _isPressed = false; + bool _isHovered = false; + + Color _getIconColor() { + if (_isPressed) return Colors.white; + if (_isHovered) return AppColor.blueNormal.withAlpha(50); + return AppColor.blueNormal; + } + + @override + Widget build(BuildContext context) { + return MouseRegion( + onEnter: (_) => setState(() => _isHovered = true), + onExit: (_) => setState(() { + _isHovered = false; + _isPressed = false; + }), + child: GestureDetector( + onTapDown: (_) => setState(() => _isPressed = true), + onTapUp: (_) => setState(() => _isPressed = false), + onTapCancel: () => setState(() => _isPressed = false), + child: OutlinedButton.icon( + icon: SvgPicture.asset( + widget.svgPath, + width: 24, + height: 24, + color: _getIconColor(), + ), + label: Text(widget.text), + onPressed: widget.onPressed, + style: OutlinedButton.styleFrom( + side: BorderSide( + color: AppColor.blueNormal, + width: 2, + ), + foregroundColor: AppColor.blueNormal, + backgroundColor: _isPressed ? AppColor.blueNormal : null, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(8), + ), + ), + ), + ), + ); + } +} + diff --git a/packages/core/lib/presentation/widget/buttons/outline_elevated.dart b/packages/core/lib/presentation/widget/buttons/outline_elevated.dart index a4b2806..3663161 100644 --- a/packages/core/lib/presentation/widget/buttons/outline_elevated.dart +++ b/packages/core/lib/presentation/widget/buttons/outline_elevated.dart @@ -6,8 +6,8 @@ import 'package:rasadyar_core/presentation/utils/color_utils.dart'; class ROutlinedElevated extends StatefulWidget { ROutlinedElevated({ super.key, - required this.text, - required this.onPressed, + this.text, + this.onPressed, this.foregroundColor, this.backgroundColor, this.borderColor, @@ -15,11 +15,12 @@ class ROutlinedElevated extends StatefulWidget { this.pressedBackgroundColor, this.radius, this.textStyle, + this.child, this.width = 150.0, this.height = 56.0, }); - final String text; + final String? text; final VoidCallback? onPressed; final double width; final double height; @@ -32,6 +33,7 @@ class ROutlinedElevated extends StatefulWidget { Color? pressedBackgroundColor; double? radius; TextStyle? textStyle; + Widget? child; @override State createState() => _ROutlinedElevatedState(); @@ -95,7 +97,7 @@ class _ROutlinedElevatedState extends State { AppFonts.yekan24.copyWith(color: AppColor.blueNormal), ), ), - child: Text(widget.text), + child: widget.child ?? Text(widget.text!, style: widget.textStyle), ); } } diff --git a/packages/core/lib/presentation/widget/buttons/outline_elevated_icon.dart b/packages/core/lib/presentation/widget/buttons/outline_elevated_icon.dart new file mode 100644 index 0000000..2503575 --- /dev/null +++ b/packages/core/lib/presentation/widget/buttons/outline_elevated_icon.dart @@ -0,0 +1,132 @@ +import 'package:flutter/material.dart'; +import 'package:rasadyar_core/core.dart'; +import 'package:rasadyar_core/data/utils.dart'; +import 'package:rasadyar_core/presentation/utils/color_utils.dart'; + +class ROutlinedElevatedIcon extends StatefulWidget { + ROutlinedElevatedIcon({ + super.key, + required this.text, + required this.onPressed, + this.foregroundColor, + this.backgroundColor, + this.borderColor, + this.disabledBackgroundColor, + this.pressedBackgroundColor, + this.radius, + this.textStyle, + this.icon, + this.width = 150.0, + this.height = 56.0, + }); + + final String text; + final VoidCallback? onPressed; + final double width; + final double height; + Color? foregroundColor; + Color? backgroundColor; + Color? borderColor; + Color? disabledBackgroundColor; + Color? pressedBackgroundColor; + double? radius; + TextStyle? textStyle; + Widget? icon; + + @override + State createState() => _ROutlinedElevatedStateIcon(); +} + +class _ROutlinedElevatedStateIcon extends State { + @override + Widget build(BuildContext context) { + return OutlinedButton.icon( + icon: widget.icon, + label: Text(widget.text), + onPressed: () {}, + style: ButtonStyle( + side: WidgetStateProperty.resolveWith((states) { + if (states.contains(WidgetState.pressed)) { + return BorderSide( + color: widget.borderColor ?? AppColor.blueNormal, + width: 2, + ); + } else if (states.contains(WidgetState.disabled)) { + return BorderSide( + color: widget.borderColor ?? AppColor.blueNormal.withAlpha(38), + width: 2, + ); + } + return BorderSide( + color: widget.borderColor ?? AppColor.blueNormal, + width: 2, + ); + }), + iconColor: WidgetStateProperty.resolveWith((states) { + if (states.contains(WidgetState.pressed)) { + return Colors.white; + } else if (states.contains(WidgetState.disabled)) { + return widget.foregroundColor?.disabledColor ?? + AppColor.blueNormal.withAlpha(38); + } else if (states.contains(WidgetState.hovered)) { + return widget.foregroundColor?.hoverColor ?? + AppColor.blueNormal.withAlpha(50); + } + return widget.foregroundColor ?? AppColor.blueNormal; + }), + backgroundColor: WidgetStateProperty.resolveWith((states) { + if (states.contains(WidgetState.pressed)) { + if (widget.pressedBackgroundColor != null) { + return widget.pressedBackgroundColor; + } + return widget.backgroundColor?.pressedColor ?? AppColor.blueNormal; + } else if (states.contains(WidgetState.hovered)) { + return widget.backgroundColor?.hoverColor ?? + AppColor.blueNormal.hoverColor; + } else if (states.contains(WidgetState.disabled)) { + return widget.backgroundColor?.disabledColor ?? Colors.transparent; + } + return widget.backgroundColor; + }), + foregroundColor: WidgetStateProperty.resolveWith((states) { + if (states.contains(WidgetState.pressed)) { + return Colors.white; + } else if (states.contains(WidgetState.disabled)) { + return widget.foregroundColor?.disabledColor ?? + AppColor.blueNormal.withAlpha(38); + } else if (states.contains(WidgetState.hovered)) { + return widget.foregroundColor?.hoverColor ?? + AppColor.blueNormal.withAlpha(50); + } + return widget.foregroundColor ?? AppColor.blueNormal; + }), + shape: WidgetStatePropertyAll( + RoundedRectangleBorder( + borderRadius: BorderRadius.circular(widget.radius ?? 8), + ), + ), + fixedSize: WidgetStatePropertyAll(Size(widget.width, widget.height)), + padding: WidgetStatePropertyAll(EdgeInsets.zero), + textStyle: WidgetStatePropertyAll( + widget.textStyle ?? + AppFonts.yekan24.copyWith(color: AppColor.blueNormal), + ), + ), + ); + } +} + +Color? _getIconColor(BuildContext context) { + var ss =WidgetStateProperty.resolveWith((states) { + if (states.contains(WidgetState.pressed)) { + return Colors.white; + } else if (states.contains(WidgetState.disabled)) { + return Colors.grey.withAlpha(38); + } else if (states.contains(WidgetState.hovered)) { + return Colors.blue.withAlpha(50); + } + return Colors.blue; + }).resolve({}); + fLog(ss); + return ss; +} diff --git a/packages/core/lib/presentation/widget/vec_widget.dart b/packages/core/lib/presentation/widget/vec_widget.dart index 4a1c313..4bf8b36 100644 --- a/packages/core/lib/presentation/widget/vec_widget.dart +++ b/packages/core/lib/presentation/widget/vec_widget.dart @@ -1,5 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; +import 'package:rasadyar_core/presentation/common/app_color.dart'; +import 'package:rasadyar_core/presentation/utils/color_utils.dart'; import 'package:vector_graphics/vector_graphics.dart'; SvgPicture vecWidget( @@ -85,3 +87,4 @@ Widget vecWidget2( ), ); } + diff --git a/packages/core/lib/presentation/widget/widget.dart b/packages/core/lib/presentation/widget/widget.dart index 076a534..22fb4a5 100644 --- a/packages/core/lib/presentation/widget/widget.dart +++ b/packages/core/lib/presentation/widget/widget.dart @@ -2,3 +2,6 @@ export 'vec_widget.dart'; export 'bottom_navigation/bottom_navigation_1.dart'; export 'draggable_bottom_sheet/draggable_bottom_sheet.dart'; export 'draggable_bottom_sheet/draggable_bottom_sheet_controller.dart'; +export 'buttons/outline_elevated_icon.dart'; +export 'buttons/outline_elevated.dart'; +