FLUTTER ECOSYSTEM

MohamedAbd0/time_slot

지정된 시간 간격 또는 날짜 및 시간 목록을 사용하여 시간 슬롯을 만들고 시간의 시간대 이름을 얻는 데 도움이 되는 새로운 Flutter 패키지이며, ar 및 en에 대한 로컬라이제이션을 지원합니다.

시간대 프로젝트 이미지
Stars
8
Forks
7
최근 푸시(UTC)
2025. 1. 12.
프로젝트 상태
활성
 Mohamed Abdo Elnashar GitHub avatar
GITHUB User

Mohamed Abdo Elnashar ↗

Senior Flutter Developer I am a software engineer with 7+ years of experience, interested in mobile applications for more than 6 years, studying for a master's

Dscale.ioDubai, UAE
언어DartC++CMakeSwiftCHTMLKotlinObjective-C

이 저장소가 배포한 패키지

사용 중인 의존성

의존성 목록 4 개
  • flutter{"sdk":"flutter"}
  • intl^0.19.0
  • flutter_test개발 의존성{"sdk":"flutter"}
  • flutter_lints개발 의존성

원본 README

아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.

README 펼치기 / 접기

time_slot

A new Flutter package which helps in creating time slots with given time interval or list of date times and get day part name of time, and this package allow localization ar and en.

Pub Version

Demo gif

image

Installation

  1. Add this to your package's pubspec.yaml file:
dependencies:
  time_slot: any
  1. Get the package using your IDE's GUI or via command line with
$ pub get
  1. Import the time_slot.dart file in your app
import 'package:time_slot/time_slot.dart';

Features

  • Creating time slots with given time interval
  • Creating time slots with given list date times
  • Get day part name of time
  • Support for multiple selection
  • Support different display options

Usage

DayPartController image

  DayPartController dayPartController = DayPartController();

to get day part of time

  DayParts dayPart = dayPartController.getDayPartOfTime(
    time: DateTime(2023, 1, 1, 10, 30),
  ); ///  DayParts.morning

to get day part name from DayParts

  DayParts dayPart = dayPartController.getDayPartName(dayPart: dayPart),);
  /// morning

TimesSlotGridViewFromInterval

to build time slot grid view from interval (10:00 AM to 10:00 PM) every hour

image

            TimesSlotGridViewFromInterval(
                locale: "en",
                initTime: selectTime,
                crossAxisCount: 4,
                timeSlotInterval: const TimeSlotInterval(
                  start: TimeOfDay(hour: 10, minute: 00),
                  end: TimeOfDay(hour: 22, minute: 0),
                  interval: Duration(hours: 1, minutes: 0),
                ),
                onChange: (value) {
                  setState(() {
                    selectTime = value;
                  });
                },
              ),

locale = "ar",

                TimesSlotGridViewFromInterval(
                locale: "ar",
                initTime: selectTime,
                crossAxisCount: 4,
                timeSlotInterval: const TimeSlotInterval(
                  start: TimeOfDay(hour: 10, minute: 00),
                  end: TimeOfDay(hour: 22, minute: 0),
                  interval: Duration(hours: 1, minutes: 0),
                ),
                onChange: (value) {
                  setState(() {
                    selectTime = value;
                  });
                },
              ),

TimesSlotGridViewFromList

to build time slot grid view from list date.

image

            TimesSlotGridViewFromList(
                locale: "en",
                initTime: selectTime,
                crossAxisCount: 4,
                listDates: [
                  DateTime(2023, 1, 1, 10, 30),
                  DateTime(2023, 1, 1, 11, 30),
                  DateTime(2023, 1, 1, 12, 30),
                  DateTime(2023, 1, 1, 13, 30),
                  DateTime(2023, 1, 1, 14, 30),
                  DateTime(2023, 1, 1, 15, 30)
                ],
                onChange: (value) {
                  setState(() {
                    selectTime = value;
                  });
                },
              ),

locale = "ar",

                TimesSlotGridViewFromList(
                locale: "ar",
                initTime: selectTime,
                crossAxisCount: 4,
                listDates: [
                  DateTime(2023, 1, 1, 10, 30),
                  DateTime(2023, 1, 1, 11, 30),
                  DateTime(2023, 1, 1, 12, 30),
                  DateTime(2023, 1, 1, 13, 30),
                  DateTime(2023, 1, 1, 14, 30),
                  DateTime(2023, 1, 1, 15, 30)
                ],
                onChange: (value) {
                  setState(() {
                    selectTime = value;
                  });
                },
              ),