novaday-co / flutter_event_calendar

Gregorian and Jalali Event calendar for flutter with options for change style
https://pub.dev/packages/flutter_event_calendar
MIT License
41 stars 17 forks source link

setstate ontap event #40

Closed mojtabamn22 closed 1 year ago

mojtabamn22 commented 1 year ago

سلام توی متد ontap ایونت من یه state رو ست میکنم. اما وقتی روی ایونت کلیک میکنم تاریخ برمیگرده به امروز مثلا من ایونت های پس فردا رو میارم و روی یکی از ایونت ها کلیک میکنم برمیگرده به امروز Event( onTap: (listIndex) { setState(() { clickedIndex = listIndex; }); }, child: Padding( padding: const EdgeInsets.only(bottom: 10.0), child: Material( elevation: 2.0, borderRadius: BorderRadius.circular(5.0), color: (clickedIndex == k) ? const Color(0xffff6f00) : Colors.white, child: InkWell( borderRadius: BorderRadius.circular(5.0), child: SizedBox( child: Center( child: Padding( padding: EdgeInsets.all(2.0.h), child: Text( availableTimes[i], style: (clickedIndex == k) ? Theme.of(context).textTheme.bodyMedium!.copyWith( color: Colors.white) : Theme.of(context).textTheme.bodyMedium!.copyWith( color: Colors.black87 ), ), ), ), )), ), ), dateTime: CalendarDateTime( year: int.parse(dateComponents[0]), month: int.parse(dateComponents[1]), day: int.parse(dateComponents[2]), calendarType: CalendarType.JALALI, ), )

مثل این فیلم https://www.uplooder.net//files/5d4286c5e25d1bda65854ddf70fb9b78/Video-2023-04-04-225415.wmv.html

AmirJabbari commented 1 year ago

سلام دوست عزیز وقتتون بخیر این موردی که اشاره کردید بهش باگ نیستش و شما باید خودتون هندل کنید که من یک روش این زیر میزارم استفاده کنید ازش یک پارامتری داریم به نام dateTime شما میتونید با این هندل کنید که چه تاریخی در حال حاضر سلکت هستش و یک پارامتر داریم onChangeDateTime که تاریخی که روش کلیک میکنیم رو برمیگردونه شما با این دو مورد میتونید هندل کنید مثال زیر رو نگاه کنید

CalendarDateTime? calendarDateTime=CalendarDateTime.parseDateTime(DateTime.now().toString(), CalendarType.JALALI);
  @override
  Widget build(BuildContext context) {
    // than having to individually change instances of widgets.
    return Scaffold(
      body: EventCalendar(
        calendarType: CalendarType.JALALI,
        calendarLanguage: 'fa',
        dateTime: calendarDateTime,
        onChangeDateTime: (selectedDate) {
          calendarDateTime=selectedDate;
        },
        calendarOptions: CalendarOptions(viewType: ViewType.MONTHLY),
        events: [
          Event(
            child: InkWell(
                onTap: () => setState(() {}),
                child: const Text('Laravel Event')),
            dateTime: CalendarDateTime(
              year: 1402,
              month: 1,
              day: 23,
              calendarType: CalendarType.JALALI,
            ),
          ),
        ],
      ),
    );
mojtabamn22 commented 1 year ago

درود مهندس فقط این خط تاریخ میلادی ایجاد میکنه و تقویم رو میبره به تیر 2023 CalendarDateTime? calendarDateTime=CalendarDateTime.parseDateTime(DateTime.now().toString(), CalendarType.JALALI);

On Thu, Apr 6, 2023 at 5:57 PM Amir Jabbari @.***> wrote:

Closed #40 https://github.com/novaday-co/flutter_event_calendar/issues/40 as completed.

— Reply to this email directly, view it on GitHub https://github.com/novaday-co/flutter_event_calendar/issues/40#event-8946615417, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMI6UI5VRXJKPGQ5DA6ZGCLW73HGVANCNFSM6AAAAAAWTEOHS4 . You are receiving this because you authored the thread.Message ID: @.*** com>

mojtabamn22 commented 1 year ago

این سولوشن رو قبلا رفتم فقط نمیدونستم چطور تاریخ رو بهش پاس بدم. الان این امکان توی پکیج وجود داره که تاریخ امروز گرفته بشه که دیگه پکیج دیگه ای نصب نکنم؟

On Fri, Apr 7, 2023 at 9:23 PM Mojtaba Kamarkhani < @.***> wrote:

درود مهندس فقط این خط تاریخ میلادی ایجاد میکنه و تقویم رو میبره به تیر 2023 CalendarDateTime? calendarDateTime=CalendarDateTime.parseDateTime(DateTime.now().toString(), CalendarType.JALALI);

On Thu, Apr 6, 2023 at 5:57 PM Amir Jabbari @.***> wrote:

Closed #40 https://github.com/novaday-co/flutter_event_calendar/issues/40 as completed.

— Reply to this email directly, view it on GitHub https://github.com/novaday-co/flutter_event_calendar/issues/40#event-8946615417, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMI6UI5VRXJKPGQ5DA6ZGCLW73HGVANCNFSM6AAAAAAWTEOHS4 . You are receiving this because you authored the thread.Message ID: @.*** .com>