time_intervals 0.0.1 copy "time_intervals: ^0.0.1" to clipboard
time_intervals: ^0.0.1 copied to clipboard

outdated

A new Flutter package that can create time interval from TimeOfDate in between.

This package can create a time interval of list in map of [from and to] means it can create a gap nof time or break the time in small time intervals.

Features #

  1. you can get time interval in list of map .

  2. you can get time interval in TimeOfDate formate.

  3. This include null safty also.

Getting started #

  • To use this you must have

[] starting time (in TimeOfDate) [] ending time (in TimeOfDate) [] gap time from (in TimeOfDate) [] gap time to (in TimeOfDate) [*] interval (in int)

== Now, Just call generateTimeIntervals ==

Usage #

add :

dependencies: time_intervals: ==<...version>==


import 'package:time_intervals/time_intervals.dart';


List<Map<String,TimeOfDay>>? timing;
 
  // --- Services timing ---
   TimeOfDay _openingTime = const TimeOfDay(
    hour: 08,
    minute: 00,
  );
  TimeOfDay _closingTime = const TimeOfDay(
    hour: 16,
    minute: 00,
  );
  TimeOfDay _lunchTimeTo = const TimeOfDay(
    hour: 14,
    minute: 00,
  );
  TimeOfDay _lunchTimeFrom = const TimeOfDay(
    hour: 13,
    minute: 00,
  );
  int _avgTime = 10;

 @override
  void initState() {
    // TODO: implement initState
    getIntervalOfServices();
    super.initState();
  }

 void getIntervalOfServices(){
  timing =  generateTimeIntervals(avgTime: _avgTime,closingTime: _closingTime,openingTime: _openingTime,lunchTimeFrom: _lunchTimeFrom,lunchTimeTo: _lunchTimeTo ); 
 }

  Container(
            width: size.width,
            height: 200 ,
            padding: const EdgeInsets.symmetric(vertical: 8.0),
            decoration: const BoxDecoration(
            color: Colors.white,
              boxShadow: [
               BoxShadow(
              offset: Offset(0.0, 2.5),
              blurRadius: 3.5,
              color: Colors.black54,
              )
              ]
            ),
            child: GridView.builder(
              itemCount: timing.length,
              gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
                crossAxisCount: 4,
                crossAxisSpacing: 0.5,
                mainAxisSpacing: 0.5,
                 childAspectRatio: 2.5,
                ),
              scrollDirection: Axis.vertical,
              itemBuilder: (context, index) => Chip(label:  Text(
            "${timing[index]["from"].format(context)}-${timing[index]["to"].format(context)}",
            style: const TextStyle(fontSize: 8.0),
          ),padding: const EdgeInsets.only(left:0,right:0),elevation: 1.5,backgroundColor: const Color.fromARGB(133, 237, 236, 236), ),
            ),
          );
 

Examples - #

Example 1 - #

[alt loading]

Example 1 - #

[alt loading]

Example 1 - #

[alt loading]

Example 1 - #

[alt loading]

Example 1 - #

[alt loading]

Additional information #

This package can create a time interval of list in map of [from and to] means it can create a gap nof time or break the time in small time intervals.

2
likes
0
points
4
downloads

Publisher

unverified uploader

Weekly Downloads

A new Flutter package that can create time interval from TimeOfDate in between.

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on time_intervals