Hunter  Krajcik

Hunter Krajcik

1659727860

Asx_calendar: Highly Customizable, Feature-packed Calendar Widget

Asx_calendar

Highly customizable, feature-packed calendar widget for Flutter

Installing

Use this package as a library

Depend on it

Run this command:

With Flutter:

 $ flutter pub add asx_calendar

This will add a line like this to your package's pubspec.yaml (and run an implicit flutter pub get):

dependencies:
  asx_calendar: ^1.0.1

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

Import it

Now in your Dart code, you can use:

import 'package:asx_calendar/asx_calendar.dart';

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:intl/date_symbol_data_local.dart';

import 'pages/basics_example.dart';

void main() {
  initializeDateFormatting().then((_) => runApp(MyApp()));
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'TableCalendar Example',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: StartPage(),
    );
  }
}

class StartPage extends StatefulWidget {
  @override
  _StartPageState createState() => _StartPageState();
}

class _StartPageState extends State<StartPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('TableCalendar Example'),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            const SizedBox(height: 20.0),
            ElevatedButton(
              child: Text('Basics'),
              onPressed: () => Navigator.push(
                context,
                MaterialPageRoute(builder: (_) => TableBasicsExample()),
              ),
            ),
          ],
        ),
      ),
    );
  }
}

Original article source at: https://pub.dev/packages/asx_calendar

 #flutter #dart #calendar 

Asx_calendar: Highly Customizable, Feature-packed Calendar Widget
Mike  Kozey

Mike Kozey

1659218220

Flutter Heatmap Calendar inspired By Github Contribution Chart

Flutter Heatmap Calendar

Flutter Heatmap Calendar inspired by github contribution chart.

Flutter Heatmap Calendar provides traditional contribution chart called HeatMap and calendar version of it called HeatMapCalendar.

HeatMap HeatMapCalendar

Getting started

Depend on it.

flutter pub add flutter_heatmap_calendar

or

Add below line to your personal package's pubspec.yaml.

dependencies:
  flutter_heatmap_calendar: ^1.0.3

And run flutter pub get to install.

Import it.

import 'package:flutter_heatmap_calendar/flutter_heatmap_calendar.dart';

Props

HeatMap

PropsTypesDefaultDescription
startDateDateTime?1 year before of the endDateStart date of HeatMap.
endDateDateTime?Today
( DateTime.now() )
Last day of HeatMap.
datasetsMap<DateTime, int>?nullSets of data which to be displayed.
colorsetsMap<int, Color>requiredSets of color values for its thresholds key value.
At least one Color is required.
Be aware that only first color will be used if ColorMode is ColorMode.opacity.
defaultColorColor?#F8F9FA Color(0xFFF8F9FA)Default color of every block.
textColorColor?#8A8A8A Color(0xFF8A8A8A)Color value of every text.
colorModeColorModeColorMode.opacityColorMode.opacity requires just one colorsets value and changes color dynamically based on hightest value of datasets.
ColorMode.color changes colors based on colorsets thresholds key value.
sizedouble?20The size of every block.
fontSizedouble?nullThe size of every text.
onClickFunction(DateTime)?nullCallback function which will be called if user clicks the block.
marginEdgeInsets?EdgeInsets.all(2)The margin value of block.
borderRadiusdouble?5Border radius value of block.
scrollableboolfalseMake HeatMap scrollable if scrollable is true.
showTextbool?falseShow day text in every block if showText is true.
showColorTipbool?trueShow color tip if showColorTip is true.
colorTipHelperList<Widget?>?nullWidgets which are shown at left and right side of colorTip.
First value is the left side widget and second value is the right side widget.
Give null value makes default 'less' and 'more' text.
colorTipCountint?7Length of colorTip block.
colorTipSizedouble?10The size of colorTip.

HeatMapCalendar

PropsTypesDefaultDescription
initDateDateTime?Today
( DateTime.now() )
Initialized Year/Month value of HeatMapCalendar.
datasetsMap<DateTime, int>?nullSets of data which to be displayed.
colorsetsMap<int, Color>requiredSets of color values for its thresholds key value.
At least one Color is required.
Be aware that only first color will be used if ColorMode is ColorMode.opacity.
defaultColorColor?#F8F9FA Color(0xFFF8F9FA)Default color of every block.
textColorColor?#8A8A8A Color(0xFF8A8A8A)Color value of every text.
colorModeColorModeColorMode.opacityColorMode.opacity requires just one colorsets value and changes color dynamically based on hightest value of datasets.
ColorMode.color changes colors based on colorsets thresholds key value.
sizedouble?42The size of every block.
fontSizedouble?nullThe size of every text.
monthFontSizedouble?12The size of month label.
weekFontSizedouble?12The size of week label.
weekTextColorColor?#758EA1 Color(0xFF758EA1)Default color of every block.
onClickFunction(DateTime)?nullCallback function which will be called if user clicks the block.
marginEdgeInsetsEdgeInsets.all(2)The margin value of block.
borderRadiusdouble?5Border radius value of block.
flexiblebool?falseMakes HeatMapCalendar's size dynamically fit on screen.
If flexible is true then, size props will be ignored.
showColorTipbool?trueShow color tip if showColorTip is true.
colorTipHelperList<Widget?>?nullWidgets which are shown at left and right side of colorTip.
First value is the left side widget and second value is the right side widget.
Give null value makes default 'less' and 'more' text.
colorTipCountint?7Length of colorTip block.
colorTipSizedouble?10The size of colorTip.

Example

HeatMap

import 'package:flutter_heatmap_calendar/flutter_heatmap_calendar.dart';
...
HeatMap(
  datasets: {
    DateTime(2021, 1, 6): 3,
    DateTime(2021, 1, 7): 7,
    DateTime(2021, 1, 8): 10,
    DateTime(2021, 1, 9): 13,
    DateTime(2021, 1, 13): 6,
  },
  colorMode: ColorMode.opacity,
  showText: false,
  scrollable: true,
  colorsets: {
    1: Colors.red,
    3: Colors.orange,
    5: Colors.yellow,
    7: Colors.green,
    9: Colors.blue,
    11: Colors.indigo,
    13: Colors.purple,
  },
  onClick: (value) {
    ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text(value.toString())));
  },
);

HeatMapCalendar

import 'package:flutter_heatmap_calendar/flutter_heatmap_calendar.dart';
...
HeatMapCalendar(
  defaultColor: Colors.white,
  flexible: true,
  colorMode: ColorMode.color,
  datasets: {
    DateTime(2021, 1, 6): 3,
    DateTime(2021, 1, 7): 7,
    DateTime(2021, 1, 8): 10,
    DateTime(2021, 1, 9): 13,
    DateTime(2021, 1, 13): 6,
  },
  colorsets: const {
    1: Colors.red,
    3: Colors.orange,
    5: Colors.yellow,
    7: Colors.green,
    9: Colors.blue,
    11: Colors.indigo,
    13: Colors.purple,
  },
  onClick: (value) {
    ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text(value.toString())));
  },
);

Installing

Use this package as a library

Depend on it

Run this command:

With Flutter:

 $ flutter pub add flutter_heatmap_calendar

This will add a line like this to your package's pubspec.yaml (and run an implicit flutter pub get):

dependencies:
  flutter_heatmap_calendar: ^1.0.4

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

Import it

Now in your Dart code, you can use:

import 'package:flutter_heatmap_calendar/flutter_heatmap_calendar.dart';

example/lib/main.dart

import 'package:flutter/material.dart';
import 'pages/heatmap_calendar_example.dart';
import 'pages/heatmap_example.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Heatmap Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      initialRoute: '/',
      routes: {
        '/': (context) => const MyHomePage(),
        '/heatmap_calendar': (context) => const HeatMapCalendarExample(),
        '/heatmap': (context) => const HeatMapExample(),
      },
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key}) : super(key: key);

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Flutter heatmap example')),
      body: SafeArea(
        child: ListView(
          children: <Widget>[
            ListTile(
              title: const Text('Heatmap calendar'),
              onTap: () => Navigator.of(context).pushNamed('/heatmap_calendar'),
            ),
            ListTile(
              title: const Text('Heatmap'),
              onTap: () => Navigator.of(context).pushNamed('/heatmap'),
            ),
          ],
        ),
      ),
    );
  }
}

Author: Devappmin
Source Code: https://github.com/devappmin/flutter_heatmap_calendar 
License: MIT license

#flutter #calendar #dart 

Flutter Heatmap Calendar inspired By Github Contribution Chart
Mike  Kozey

Mike Kozey

1658504040

Calendar_builder: Fully Customizable Calendar Package for Flutter

calendar_builder

Fully customizable calendar package for flutter. Also supports for disabling dates, highlighting dates and displaying events inside calendar.

Features

  • Fully customisable widgets
  • Add Events
  • Highlight dates
  • Disable dates
  • Starting week can be changed
  • ✅ MonthBuilder
  • [TODO] DayBuilder
  • [TODO] WeekBuilder
Month BuilderCustomised Month Builder
Custom Month BuilderMonth Builder with callbacks

Support Light and Dark theme

Installation

In your pubspec.yaml file within your Flutter Project:

dependencies:
  calendar_builder: <latest_version>

How to use

import 'package:calendar_builder/calendar_builder.dart';
import 'package:flutter/material.dart';

class MonthBuilderScreen extends StatelessWidget {
  const MonthBuilderScreen({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: SafeArea(
        child: Column(
          children: [
            Expanded(
              child: CbMonthBuilder(
                cbConfig: CbConfig(
                  startDate: DateTime(2020),
                  endDate: DateTime(2026),
                  selectedDate: DateTime(2021,3,4),
                  selectedYear: DateTime(2021),
                ),
              ),
            )
          ],
        ),
      ),
    );
  }
}

Demo

Customised Month Builder


Output


code


CbMonthBuilder(
      cbConfig: CbConfig(
          startDate: DateTime(2020),
          endDate: DateTime(2123),
          selectedDate: DateTime(2022, 3, 4),
          selectedYear: DateTime(2022),
          weekStartsFrom: WeekStartsFrom.wednesday,
          disabledDates: [
            DateTime(2022, 1, 7),
            DateTime(2022, 1, 9),
          ],
          eventDates: [
            DateTime(2022, 1, 2),
            DateTime(2022, 1, 2),
            DateTime(2022, 1, 3)
          ],
          highlightedDates: [
            DateTime(2022, 1, 6),
            DateTime(2022, 1, 3)
          ]),
      monthCustomizer: MonthCustomizer(
          padding: const EdgeInsets.all(20),
          monthHeaderCustomizer: MonthHeaderCustomizer(
            textStyle: const TextStyle(
              color: Colors.red,
              fontSize: 22,
              fontWeight: FontWeight.bold,
            ),
          ),
          monthButtonCustomizer: MonthButtonCustomizer(
              currentDayColor: Colors.orange,
              borderStrokeWidth: 2,
              textStyleOnDisabled: const TextStyle(color: Colors.red),
              highlightedColor: const Color.fromARGB(255, 255, 174, 0)),
          monthWeekCustomizer: MonthWeekCustomizer(
              textStyle:
                  const TextStyle(color: Color.fromARGB(255, 255, 174, 0)))
          // monthWidth: 500,
          // monthHeight: 200
          ),
      yearDropDownCustomizer: YearDropDownCustomizer(
          yearButtonCustomizer: YearButtonCustomizer(
            borderColorOnSelected: Colors.red,
          ),
          yearHeaderCustomizer: YearHeaderCustomizer(
              titleTextStyle:
                  const TextStyle(color: Color.fromARGB(255, 255, 174, 0)))),
      onYearHeaderExpanded: (isExpanded) {
        print('isExpanded ' + isExpanded.toString());
      },
      onDateClicked: (onDateClicked) {
        print('selected date' +
            onDateClicked.selectedDate.toString() +
            '\n' +
            'isSelected ' +
            onDateClicked.isSelected.toString() +
            '\n' +
            'isHighlighted ' +
            onDateClicked.isHighlighted.toString() +
            '\n' +
            'hasEvent ' +
            onDateClicked.hasEvent.toString() +
            '\n' +
            'isCurrentDate ' +
            onDateClicked.isCurrentDate.toString() +
            '\n' +
            'isDisabled ' +
            onDateClicked.isDisabled.toString());
      },
      onYearButtonClicked: (year, isSelected) {
        print('selected year ' +
            year.toString() +
            '\n' +
            'isSelected ' +
            isSelected.toString());
      },
    )

Custom Month Builder


Output


code



CbMonthBuilder(
      cbConfig: CbConfig(
          startDate: DateTime(2020),
          endDate: DateTime(2123),
          selectedDate: DateTime(2022),
          selectedYear: DateTime(2022),
          weekStartsFrom: WeekStartsFrom.sunday,
          eventDates: [
            DateTime(2022, 1, 2),
            DateTime(2022, 1, 2),
            DateTime(2022, 1, 3)
          ],
          highlightedDates: [
            DateTime(2022, 1, 6),
            DateTime(2022, 1, 3)
          ]),
      yearDropDownCustomizer: YearDropDownCustomizer(
        yearHeaderBuilder:
            (isYearPickerExpanded, selectedDate, selectedYear, year) {
          return Container(
            height: 40,
            color: Colors.yellow,
            child: Row(
              mainAxisAlignment: MainAxisAlignment.center,
              crossAxisAlignment: CrossAxisAlignment.center,
              children: [
                Text(
                  year,
                  style: const TextStyle(fontWeight: FontWeight.bold),
                ),
                Icon(!isYearPickerExpanded
                    ? Icons.arrow_drop_down_outlined
                    : Icons.arrow_drop_up_outlined)
              ],
            ),
          );
        },
      ),
      monthCustomizer: MonthCustomizer(
        montMinhHeight: 200,
        monthMinWidth: 450,
        padding: const EdgeInsets.all(20),
        monthHeaderBuilder: (month, headerHeight, headerWidth, paddingLeft) {
          return Container(
            color: Colors.grey[200],
            height: headerHeight,
            width: headerWidth,
            child: Padding(
              padding: EdgeInsets.only(left: paddingLeft),
              child: Align(
                alignment: Alignment.center,
                child: Text(
                  month,
                  style: const TextStyle(
                    fontSize: 22,
                    fontWeight: FontWeight.w600,
                  ),
                ),
              ),
            ),
          );
        },
        monthWeekBuilder: (index, weeks, weekHeight, weekWidth) {
          return SizedBox(
            height: weekHeight,
            width: weekWidth,
            child: Padding(
              padding: const EdgeInsets.all(4.0),
              child: Container(
                decoration: BoxDecoration(
                    color: Colors.red.withOpacity(0.1),
                    borderRadius: BorderRadius.circular(10),
                    border: Border.all(color: Colors.red)),
                child: Align(
                  child: Text(
                    weeks,
                    style: const TextStyle(
                      fontSize: 14,
                      color: Colors.red,
                      fontWeight: FontWeight.w500,
                    ),
                    overflow: TextOverflow.ellipsis,
                    maxLines: 1,
                  ),
                ),
              ),
            ),
          );
        },
        monthButtonBuilder: (dateTime, childHeight, childWidth, isSelected,
            isDisabled, hasEvent, isHighlighted, isCurrentDay) {
          //Text Theme
          final txtTheme = Theme.of(context).textTheme;
          //color theme
          final colorTheme = Theme.of(context);

          var daysText = Align(
            child: Text(
              '${dateTime.day}',
              style: isDisabled
                  ? txtTheme.caption
                  : isSelected
                      ? txtTheme.bodyText1!.copyWith(
                          fontWeight: FontWeight.bold,
                          color: colorTheme.brightness == Brightness.dark
                              ? Colors.black
                              : Colors.white)
                      : isHighlighted
                          ? txtTheme.bodyText2 //Highlighted TextStyle
                          : isCurrentDay
                              ? txtTheme.bodyText2 //CurrentDay TextStyle
                              : txtTheme.bodyText2,
            ),
          );
          if (isSelected) {
            return Container(
              decoration: const BoxDecoration(
                color: Colors.red,
                shape: BoxShape.rectangle,
              ),
              margin: const EdgeInsets.all(2),
              child: daysText,
            );
          }
          return Container(
            decoration: BoxDecoration(
                color: isDisabled ? Colors.grey[200] : Colors.yellow,
                shape: BoxShape.rectangle,
                border: hasEvent || isHighlighted
                    ? Border.all(
                        color: isHighlighted ? Colors.red : Colors.blue,
                        width: 2)
                    : null),
            margin: const EdgeInsets.all(2),
            child: daysText,
          );
        },
      ),
    )

Installing

Use this package as a library

Depend on it

Run this command:

With Flutter:

 $ flutter pub add calendar_builder

This will add a line like this to your package's pubspec.yaml (and run an implicit flutter pub get):

dependencies:
  calendar_builder: ^0.0.6

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

Import it

Now in your Dart code, you can use:

import 'package:calendar_builder/calendar_builder.dart';

example/lib/main.dart

import 'package:calendar_builder/calendar_builder.dart';
import 'package:example/custom_month_builder.dart';
import 'package:example/customized_month_builder.dart';
import 'package:example/month_builder.dart';

import 'package:flutter/material.dart';

void main() {
  CalendarGlobals.showLogs = true;
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Calendar builder Demo',
      // theme: ThemeData(brightness: Brightness.dark),
      // themeMode: ThemeMode.dark,
      // darkTheme: ThemeData.dark(),
      routes: {
        '/month_builder': (context) => const MonthBuilderScreen(),
        '/customized_month_builder': (context) =>
            const CustomizedMonthBuilderScreen(),
        '/custom_month_builder': (context) => const CustomMonthBuilderScreen(),
        // '/fromAsset': (context) => const PlayVideoFromAsset(),
        // '/fromNetwork': (context) => const PlayVideoFromNetwork(),
        // '/customVideo': (context) => const CustomVideoControlls(),
      },
      home: const MainPage(),
    );
  }
}

class MainPage extends StatefulWidget {
  const MainPage({Key? key}) : super(key: key);

  @override
  State<MainPage> createState() => _MainPageState();
}

class _MainPageState extends State<MainPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: ListView(
          shrinkWrap: true,
          children: [
            // _button('Play video from File'),
            _button(
              'Default / Simple Month Builder',
              onPressed: () =>
                  Navigator.of(context).pushNamed('/month_builder'),
            ),
            _button(
              'Customized Month Builder',
              onPressed: () =>
                  Navigator.of(context).pushNamed('/customized_month_builder'),
            ),
            _button(
              'Custom Month Builder',
              onPressed: () =>
                  Navigator.of(context).pushNamed('/custom_month_builder'),
            ),
          ],
        ),
      ),
    );
  }

  Widget _button(String text, {void Function()? onPressed}) {
    return Center(
      child: Padding(
        padding: const EdgeInsets.all(20),
        child: OutlinedButton(
          onPressed: onPressed ?? () {},
          child: Text(
            text,
            style: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
          ),
        ),
      ),
    );
  }
}

Author: newtaDev
Source Code: https://github.com/newtaDev/calendar_builder 
License: MIT license

#flutter #dart #calendar 

Calendar_builder: Fully Customizable Calendar Package for Flutter
Rocio  O'Keefe

Rocio O'Keefe

1657326840

Sliver_calendar: Display A Calendar View for Flutter

Calendar

Shows a scrolling calendar list of events. This is still relatively basic, it always assumes that the getEvents returns the entire list of calendar events (mostly ignoring the values passed into the source). It does work however :) Optionally, you can use an image as a background for the calendar header and another image for the month header.

The calendar uses slivers to display the widgets in the view and lets you scroll forward and backward through the events. The header widget will drop down and open up the days of the month, letting you select specific days as well as move back and forth between the months. By default it displays a list of events and not a day view, the day view code is all just a stub right now.

Here is how to use the calendar widget itself:

new CalendarWidget(
              initialDate: new TZDateTime.now(local),
              buildItem: buildItem,
              getEvents: getEvents,
            );

How to setup a source for the calendar widget.

...
  List<Game> _listToShow;
  StreamSubscription<UpdateReason> _listening;

  @override
  Widget buildItem(BuildContext context, CalendarEvent event) {
    return new GameCard(_listToShow[event.index]);
  }

  @override
  List<CalendarEvent> getEvents(DateTime start, DateTime end) {
    if (_listToShow == null) {
      _listToShow = UserDatabaseData.instance.games.values.toList();
    }
    if (_listToShow == null) {
      return [];
    }
    List<CalendarEvent> events = new List<CalendarEvent>();
    int pos = 0;
    _listToShow.forEach((Game g) => events.add(new CalendarEvent(
        instant: g.tzTime, instantEnd: g.tzEndTime, index: pos++)));
    return events;
  }
...

Example of the calendar widget in action:

Installing

Use this package as a library

Depend on it

Run this command:

With Flutter:

 $ flutter pub add sliver_calendar

This will add a line like this to your package's pubspec.yaml (and run an implicit flutter pub get):

dependencies:
  sliver_calendar: ^1.0.0

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

Import it

Now in your Dart code, you can use:

import 'package:sliver_calendar/sliver_calendar.dart';

example/lib/main.dart

import 'dart:math';

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_native_timezone/flutter_native_timezone.dart';
import 'package:sliver_calendar/sliver_calendar.dart';
import 'package:timezone/timezone.dart';
import 'package:timezone/data/latest_all.dart' if (kIsWeb) 'package:timezone/browser.dart' as tz;


void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  if (kIsWeb) {
     tz.initializeTimeZones();
  } else {
    tz.initializeTimeZones();
  }

  var localTimeZone = await FlutterNativeTimezone.getLocalTimezone();
  if (localTimeZone == 'Etc/UTC') {

  }
  var loc = getLocation(localTimeZone);
  runApp(MyApp(loc));
}

class MyApp extends StatelessWidget {
  final Location loc;

  MyApp(this.loc);



  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Calendar',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      debugShowCheckedModeBanner: false,
      localizationsDelegates: const <
          LocalizationsDelegate<MaterialLocalizations>>[
        GlobalMaterialLocalizations.delegate
      ],
      supportedLocales: const <Locale>[
        Locale('en', ''),
        Locale('fr', ''),
      ],
      home: MyHomePage(title: 'Flutter Calendar demo', loc: loc),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key? key, required this.title, required this.loc})
      : super(key: key);
  final String title;
  final Location loc;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  List<CalendarEvent> events = <CalendarEvent>[];
  Random random = Random();
  TZDateTime nowDate = TZDateTime.utc(2021);

  @override
  void initState() {
    super.initState();
    nowDate = TZDateTime.now(widget.loc);
  }

  Widget buildItem(BuildContext context, CalendarEvent e) {
    return Card(
      child: ListTile(
        title: Text("Event ${e.index}"),
        subtitle: Text("Yay for events"),
        leading: const Icon(Icons.gamepad),
      ),
    );
  }

  List<CalendarEvent> getEvents(DateTime start, DateTime end) {
    if (events.isEmpty) {
      TZDateTime nowTime =
          TZDateTime.now(widget.loc).subtract(Duration(days: 5));
      for (int i = 0; i < 20; i++) {
        TZDateTime start = nowTime.add(Duration(days: i + random.nextInt(10)));
        events.add(CalendarEvent(
            index: i,
            instant: start,
            instantEnd: start.add(Duration(minutes: 30))));
      }
    }
    return events;
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Column(children: <Widget>[
        Expanded(
          child: CalendarWidget(
            initialDate: nowDate,
            location: widget.loc,
            buildItem: buildItem,
            getEvents: getEvents,
            bannerHeader: AssetImage("assets/images/calendarheader.png"),
            monthHeader: AssetImage("assets/images/calendarbanner.jpg"),
            weekBeginsWithDay:
                1, // Sunday = 0, Monday = 1, Tuesday = 2, ..., Saturday = 6
          ),
        ),
      ]),
    );
  }
}

Getting Started

For help getting started with Flutter, view our online documentation.

For help on editing package code, view the documentation.

Author: Pinkfish
Source Code: https://github.com/pinkfish/flutter_calendar 
License: BSD-2-Clause license

#flutter #dart #calendar 

Sliver_calendar: Display A Calendar View for Flutter
Mike  Kozey

Mike Kozey

1656799920

A calendar widget special design for Cupertino UI in Flutter

Cupertino Calenar

A calendar widget special design for Cupertino UI in Flutter

Supported function

  • Highlight selected date
  • List DateRemind on selected date
    • Handlers when pressing or long pressing DateRemind
  • Layout arrangment when Orientation changed
  • Display date of Holiday

Installing

Use this package as a library

Depend on it

Run this command:

With Flutter:

 $ flutter pub add cupertino_calendar

This will add a line like this to your package's pubspec.yaml (and run an implicit flutter pub get):

dependencies:
  cupertino_calendar: ^1.0.0

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

Import it

Now in your Dart code, you can use:

import 'package:cupertino_calendar/cupertino_calendar.dart';

example/lib/main.dart

import 'package:flutter/cupertino.dart';
import 'package:cupertino_calendar/cupertino_calendar.dart';

void main() => runApp(CupertinoCalendarExample());

class CupertinoCalendarExample extends StatelessWidget {
  @override
  Widget build(BuildContext context) =>
      CupertinoApp(home: CupertinoCalendarIndex());
}

class CupertinoCalendarIndex extends StatefulWidget {
  @override
  State<StatefulWidget> createState() => _CupertinoCalendarIndex();
}

class _CupertinoCalendarIndex extends State<CupertinoCalendarIndex> {
  @override
  Widget build(BuildContext context) => CupertinoPageScaffold(
      navigationBar: CupertinoNavigationBar(),
      child: CupertinoCalendar(
          YearMonthRange(
              YearMonth.dateTime(DateTime.now().subtract(Duration(days: 120))),
              YearMonth.dateTime(DateTime.now().add(Duration(days: 120)))),
          dateReminds: DateRemindList([
            Holiday(
                name: "Sample holiday",
                date: DateTime.now().add(Duration(days: 2))),
            Events(
                name: "Sample event",
                from: DateTime.now().add(Duration(hours: 2)),
                to: DateTime.now().add(Duration(hours: 3))),
            Events(
                name: "Sample event 2",
                from: DateTime.now().add(Duration(days: 2)),
                to: DateTime.now().add(Duration(days: 2, hours: 1)))
          ])));
}

Pending function

  • Add dot when has event

Original article source at: https://pub.dev/packages/cupertino_calendar 

#flutter #dart #calendar 

A calendar widget special design for Cupertino UI in Flutter

Cakephp-calendar: CakePHP Calendar Plugin

CakePHP Calendar plugin

A plugin to render simple calendars.

This branch is for CakePHP 4.2+. For details see version map.

Features

  • Simple and robust
  • No JS needed, more responsive than solutions like fullcalendar
  • Persistent year/month URL pieces (copy-paste and link/redirect friendly)
  • IcalView class for .ics calendar file output.

Setup

composer require dereuromark/cakephp-calendar

Then make sure the plugin is loaded in bootstrap:

bin/cake plugin load Calendar

Demo

See the demo Calendar example at the sandbox.

Usage

See Documentation.

Author: Dereuromark
Source Code: https://github.com/dereuromark/cakephp-calendar 
License: MIT license

#php #cakephp #calendar #files 

Cakephp-calendar: CakePHP Calendar Plugin
Lawrence  Lesch

Lawrence Lesch

1652412600

React-big-calendar: Gcal/outlook Like Calendar Component

react-big-calendar

An events calendar component built for React and made for modern browsers (read: IE10+) and uses flexbox over the classic tables-ception approach.

Use and Setup

yarn add react-big-calendar or npm install --save react-big-calendar

Include react-big-calendar/lib/css/react-big-calendar.css for styles, and make sure your calendar's container element has a height, or the calendar won't be visible. To provide your own custom styling, see the Custom Styling topic.

Starters

Run examples locally

$ git clone git@github.com:jquense/react-big-calendar.git
$ cd react-big-calendar
$ yarn
$ yarn examples

Localization and Date Formatting

react-big-calendar includes three options for handling the date formatting and culture localization, depending on your preference of DateTime libraries. You can use either the Moment.js, Globalize.js or date-fns localizers.

Regardless of your choice, you must choose a localizer to use this library:

Moment.js

import { Calendar, momentLocalizer } from 'react-big-calendar'
import moment from 'moment'

const localizer = momentLocalizer(moment)

const MyCalendar = props => (
  <div>
    <Calendar
      localizer={localizer}
      events={myEventsList}
      startAccessor="start"
      endAccessor="end"
      style={{ height: 500 }}
    />
  </div>
)

Globalize.js v0.1.1

import { Calendar, globalizeLocalizer } from 'react-big-calendar'
import globalize from 'globalize'

const localizer = globalizeLocalizer(globalize)

const MyCalendar = props => (
  <div>
    <Calendar
      localizer={localizer}
      events={myEventsList}
      startAccessor="start"
      endAccessor="end"
      style={{ height: 500 }}
    />
  </div>
)

date-fns v2

import { Calendar, dateFnsLocalizer } from 'react-big-calendar'
import format from 'date-fns/format'
import parse from 'date-fns/parse'
import startOfWeek from 'date-fns/startOfWeek'
import getDay from 'date-fns/getDay'
import enUS from 'date-fns/locale/en-US'

const locales = {
  'en-US': enUS,
}

const localizer = dateFnsLocalizer({
  format,
  parse,
  startOfWeek,
  getDay,
  locales,
})

const MyCalendar = props => (
  <div>
    <Calendar
      localizer={localizer}
      events={myEventsList}
      startAccessor="start"
      endAccessor="end"
      style={{ height: 500 }}
    />
  </div>
)

Custom Styling

Out of the box, you can include the compiled CSS files and be up and running. But, sometimes, you may want to style Big Calendar to match your application styling. For this reason, SASS files are included with Big Calendar.

  @import 'react-big-calendar/lib/sass/styles';
  @import 'react-big-calendar/lib/addons/dragAndDrop/styles'; // if using DnD

SASS implementation provides a variables file containing color and sizing variables that you can update to fit your application. Note: Changing and/or overriding styles can cause rendering issues with your Big Calendar. Carefully test each change accordingly.

Join us on Reactiflux Discord

Join us on Reactiflux Discord community under the channel #libraries if you have any questions.

DEMO and Docs

Inspired by Full Calendar.

Author: jquense
Source Code: https://github.com/jquense/react-big-calendar 
License: MIT license

#react #calendar #javascript 

React-big-calendar: Gcal/outlook Like Calendar Component
Lawrence  Lesch

Lawrence Lesch

1652405160

An Easily internationalizable, Mobile-friendly Datepicker Library

react-dates Version Badge

An easily internationalizable, accessible, mobile-friendly datepicker library for the web.

react-dates in action

Live Playground

For examples of the datepicker in action, go to react-dates.github.io.

OR

To run that demo on your own computer:

Getting Started

Install dependencies

Ensure packages are installed with correct version numbers by running (from your command line):

(
  export PKG=react-dates;
  npm info "$PKG" peerDependencies --json | command sed 's/[\{\},]//g ; s/: /@/g; s/ *//g' | xargs npm install --save "$PKG"
)

Which produces and runs a command like:

npm install --save react-dates moment@>=#.## react@>=#.## react-dom@>=#.##

If you are running Windows, that command will not work, but if you are running npm 5 or higher, you can run npx install-peerdeps react-dates on any platform

Initialize

import 'react-dates/initialize';

As of v13.0.0 of react-dates, this project relies on react-with-styles. If you want to continue using CSS stylesheets and classes, there is a little bit of extra set-up required to get things going. As such, you need to import react-dates/initialize to set up class names on our components. This import should go at the top of your application as you won't be able to import any react-dates components without it.

Note: This component assumes box-sizing: border-box is set globally in your page's CSS.

Include component

import { DateRangePicker, SingleDatePicker, DayPickerRangeController } from 'react-dates';

Webpack

Using Webpack with CSS loader, add the following import to your app:

import 'react-dates/lib/css/_datepicker.css';

Without Webpack:

Create a CSS file with the contents of require.resolve('react-dates/lib/css/_datepicker.css') and include it in your html <head> section.

To see this in action, you can check out https://github.com/majapw/react-dates-demo which adds react-dates on top of a simple create-react-app setup.

Overriding Base Class

By default react-dates will use PureComponent conditionally if it is available. However, it is possible to override this setting and use Component and shouldComponentUpdate instead. It is also possible to override the logic in build/util/baseClass if you know that you are using a React version with PureComponent.

  import React from 'react';
  export default React.PureComponent;
  export const pureComponentAvailable = true;

Overriding styles

Right now, the easiest way to tweak react-dates to your heart's content is to create another stylesheet to override the default react-dates styles. For example, you could create a file named react_dates_overrides.css with the following contents (Make sure when you import said file to your app.js, you import it after the react-dates styles):

// NOTE: the order of these styles DO matter

// Will edit everything selected including everything between a range of dates
.CalendarDay__selected_span {
  background: #82e0aa; //background
  color: white; //text
  border: 1px solid $light-red; //default styles include a border
}

// Will edit selected date or the endpoints of a range of dates
.CalendarDay__selected {
  background: $dark-red;
  color: white;
}

// Will edit when hovered over. _span style also has this property
.CalendarDay__selected:hover {
  background: orange;
  color: white;
}

// Will edit when the second date (end date) in a range of dates
// is not yet selected. Edits the dates between your mouse and said date
.CalendarDay__hovered_span:hover,
.CalendarDay__hovered_span {
  background: brown;
}

This would override the background and text colors applied to highlighted calendar days. You can use this method with the default set-up to override any aspect of the calendar to have it better fit to your particular needs. If there are any styles that you need that aren't listed here, you can always check the source css of each element.

Make some awesome datepickers

We provide a handful of components for your use. If you supply essential props to each component, you'll get a full featured interactive date picker. With additional optional props, you can customize the look and feel of the inputs, calendar, etc. You can see what each of the props do in the live demo or explore how to properly wrap the pickers in the examples folder.

DateRangePicker

The DateRangePicker is a fully controlled component that allows users to select a date range. You can control the selected dates using the startDate, endDate, and onDatesChange props as shown below. The DateRangePicker also manages internal state for partial dates entered by typing (although onDatesChange will not trigger until a date has been entered completely in that case). Similarly, you can control which input is focused as well as calendar visibility (the calendar is only visible if focusedInput is defined) with the focusedInput and onFocusChange props as shown below.

Here is the minimum REQUIRED setup you need to get the DateRangePicker working:

<DateRangePicker
  startDate={this.state.startDate} // momentPropTypes.momentObj or null,
  startDateId="your_unique_start_date_id" // PropTypes.string.isRequired,
  endDate={this.state.endDate} // momentPropTypes.momentObj or null,
  endDateId="your_unique_end_date_id" // PropTypes.string.isRequired,
  onDatesChange={({ startDate, endDate }) => this.setState({ startDate, endDate })} // PropTypes.func.isRequired,
  focusedInput={this.state.focusedInput} // PropTypes.oneOf([START_DATE, END_DATE]) or null,
  onFocusChange={focusedInput => this.setState({ focusedInput })} // PropTypes.func.isRequired,
/>

The following is a list of other OPTIONAL props you may provide to the DateRangePicker to customize appearance and behavior to your heart's desire. All constants (indicated by ALL_CAPS) are provided as named exports in react-dates/constants. Please explore the storybook for more information on what each of these props do.

// input related props
startDatePlaceholderText: PropTypes.string,
endDatePlaceholderText: PropTypes.string,
startDateAriaLabel: PropTypes.string,
endDateAriaLabel: PropTypes.string,
startDateTitleText: PropTypes.string,
endDateTitleText: PropTypes.string,
disabled: PropTypes.oneOfType([PropTypes.bool, PropTypes.oneOf([START_DATE, END_DATE])]),
required: PropTypes.bool,
readOnly: PropTypes.bool,
screenReaderInputMessage: PropTypes.string,
showClearDates: PropTypes.bool,
showDefaultInputIcon: PropTypes.bool,
customInputIcon: PropTypes.node,
customArrowIcon: PropTypes.node,
customCloseIcon: PropTypes.node,
inputIconPosition: PropTypes.oneOf([ICON_BEFORE_POSITION, ICON_AFTER_POSITION]),
noBorder: PropTypes.bool,
block: PropTypes.bool,
small: PropTypes.bool,
regular: PropTypes.bool,
autoComplete: PropTypes.string,

// calendar presentation and interaction related props
renderMonthText: mutuallyExclusiveProps(PropTypes.func, 'renderMonthText', 'renderMonthElement'), // (month) => PropTypes.string,
orientation: PropTypes.oneOf([HORIZONTAL_ORIENTATION, VERTICAL_ORIENTATION]),
anchorDirection: PropTypes.oneOf([ANCHOR_LEFT, ANCHOR_RIGHT]),
openDirection: PropTypes.oneOf([OPEN_DOWN, OPEN_UP]),
horizontalMargin: PropTypes.number,
withPortal: PropTypes.bool,
withFullScreenPortal: PropTypes.bool,
appendToBody: PropTypes.bool,
disableScroll: PropTypes.bool,
daySize: nonNegativeInteger,
isRTL: PropTypes.bool,
initialVisibleMonth: PropTypes.func,
firstDayOfWeek: PropTypes.oneOf([0, 1, 2, 3, 4, 5, 6]),
numberOfMonths: PropTypes.number,
keepOpenOnDateSelect: PropTypes.bool,
reopenPickerOnClearDates: PropTypes.bool,
renderCalendarInfo: PropTypes.func,
renderMonthElement: mutuallyExclusiveProps(PropTypes.func, 'renderMonthText', 'renderMonthElement'), PropTypes.func, // ({ month, onMonthSelect, onYearSelect, isVisible }) => PropTypes.node,
hideKeyboardShortcutsPanel: PropTypes.bool,
verticalSpacing: PropTypes.number,

// navigation related props
navPrev: PropTypes.node,
navNext: PropTypes.node,
onPrevMonthClick: PropTypes.func,
onNextMonthClick: PropTypes.func,
onClose: PropTypes.func,
transitionDuration: nonNegativeInteger, // milliseconds

// day presentation and interaction related props
renderCalendarDay: PropTypes.func,
renderDayContents: PropTypes.func,
minimumNights: PropTypes.number,
minDate: momentPropTypes.momentObj,
maxDate: momentPropTypes.momentObj,
enableOutsideDays: PropTypes.bool,
isDayBlocked: PropTypes.func,
isOutsideRange: PropTypes.func,
isDayHighlighted: PropTypes.func,

// internationalization props
displayFormat: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
monthFormat: PropTypes.string,
weekDayFormat: PropTypes.string,
phrases: PropTypes.shape(getPhrasePropTypes(DateRangePickerPhrases)),
dayAriaLabelFormat: PropTypes.string,

SingleDatePicker

The SingleDatePicker is a fully controlled component that allows users to select a single date. You can control the selected date using the date and onDateChange props as shown below. The SingleDatePicker also manages internal state for partial dates entered by typing (although onDateChange will not trigger until a date has been entered completely in that case). Similarly, you can control whether or not the input is focused (calendar visibility is also controlled with the same props) with the focused and onFocusChange props as shown below.

Here is the minimum REQUIRED setup you need to get the SingleDatePicker working:

<SingleDatePicker
  date={this.state.date} // momentPropTypes.momentObj or null
  onDateChange={date => this.setState({ date })} // PropTypes.func.isRequired
  focused={this.state.focused} // PropTypes.bool
  onFocusChange={({ focused }) => this.setState({ focused })} // PropTypes.func.isRequired
  id="your_unique_id" // PropTypes.string.isRequired,
/>

The following is a list of other OPTIONAL props you may provide to the SingleDatePicker to customize appearance and behavior to your heart's desire. All constants (indicated by ALL_CAPS) are provided as named exports in react-dates/constants. Please explore the storybook for more information on what each of these props do.

// input related props
placeholder: PropTypes.string,
ariaLabel: PropTypes.string,
titleText: PropTypes.string,
disabled: PropTypes.bool,
required: PropTypes.bool,
readOnly: PropTypes.bool,
screenReaderInputMessage: PropTypes.string,
showClearDate: PropTypes.bool,
customCloseIcon: PropTypes.node,
showDefaultInputIcon: PropTypes.bool,
customInputIcon: PropTypes.node,
inputIconPosition: PropTypes.oneOf([ICON_BEFORE_POSITION, ICON_AFTER_POSITION]),
noBorder: PropTypes.bool,
block: PropTypes.bool,
small: PropTypes.bool,
regular: PropTypes.bool,
autoComplete: PropTypes.string,

// calendar presentation and interaction related props
renderMonthText: mutuallyExclusiveProps(PropTypes.func, 'renderMonthText', 'renderMonthElement'), // (month) => PropTypes.string,
orientation: PropTypes.oneOf([HORIZONTAL_ORIENTATION, VERTICAL_ORIENTATION]),
anchorDirection: PropTypes.oneOf([ANCHOR_LEFT, ANCHOR_RIGHT]),
openDirection: PropTypes.oneOf([OPEN_DOWN, OPEN_UP]),
horizontalMargin: PropTypes.number,
withPortal: PropTypes.bool,
withFullScreenPortal: PropTypes.bool,
appendToBody: PropTypes.bool,
disableScroll: PropTypes.bool,
initialVisibleMonth: PropTypes.func,
firstDayOfWeek: PropTypes.oneOf([0, 1, 2, 3, 4, 5, 6]),
numberOfMonths: PropTypes.number,
keepOpenOnDateSelect: PropTypes.bool,
reopenPickerOnClearDate: PropTypes.bool,
renderCalendarInfo: PropTypes.func,
renderMonthElement: mutuallyExclusiveProps(PropTypes.func, 'renderMonthText', 'renderMonthElement'), // ({ month, onMonthSelect, onYearSelect, isVisible }) => PropTypes.node,
hideKeyboardShortcutsPanel: PropTypes.bool,
daySize: nonNegativeInteger,
isRTL: PropTypes.bool,
verticalSpacing: PropTypes.number,

// navigation related props
navPrev: PropTypes.node,
navNext: PropTypes.node,
onPrevMonthClick: PropTypes.func,
onNextMonthClick: PropTypes.func,
onClose: PropTypes.func,
transitionDuration: nonNegativeInteger, // milliseconds

// day presentation and interaction related props
renderCalendarDay: PropTypes.func,
renderDayContents: PropTypes.func,
enableOutsideDays: PropTypes.bool,
isDayBlocked: PropTypes.func,
isOutsideRange: PropTypes.func,
isDayHighlighted: PropTypes.func,

// internationalization props
displayFormat: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
monthFormat: PropTypes.string,
weekDayFormat: PropTypes.string,
phrases: PropTypes.shape(getPhrasePropTypes(SingleDatePickerPhrases)),
dayAriaLabelFormat: PropTypes.string,

DayPickerRangeController

The DayPickerRangeController is a calendar-only version of the DateRangePicker. There are no inputs (which also means that currently, it is not keyboard accessible) and the calendar is always visible, but you can select a date range much in the same way you would with the DateRangePicker. You can control the selected dates using the startDate, endDate, and onDatesChange props as shown below. Similarly, you can control which input is focused with the focusedInput and onFocusChange props as shown below. The user will only be able to select a date if focusedInput is provided.

Here is the minimum REQUIRED setup you need to get the DayPickerRangeController working:

<DayPickerRangeController
  startDate={this.state.startDate} // momentPropTypes.momentObj or null,
  endDate={this.state.endDate} // momentPropTypes.momentObj or null,
  onDatesChange={({ startDate, endDate }) => this.setState({ startDate, endDate })} // PropTypes.func.isRequired,
  focusedInput={this.state.focusedInput} // PropTypes.oneOf([START_DATE, END_DATE]) or null,
  onFocusChange={focusedInput => this.setState({ focusedInput })} // PropTypes.func.isRequired,
  initialVisibleMonth={() => moment().add(2, "M")} // PropTypes.func or null,
/>

The following is a list of other OPTIONAL props you may provide to the DayPickerRangeController to customize appearance and behavior to your heart's desire. Again, please explore the storybook for more information on what each of these props do.

  // calendar presentation and interaction related props
  enableOutsideDays: PropTypes.bool,
  numberOfMonths: PropTypes.number,
  orientation: ScrollableOrientationShape,
  withPortal: PropTypes.bool,
  initialVisibleMonth: PropTypes.func,
  renderCalendarInfo: PropTypes.func,
  renderMonthElement: mutuallyExclusiveProps(PropTypes.func, 'renderMonthText', 'renderMonthElement'), // ({ month, onMonthSelect, onYearSelect, isVisible }) => PropTypes.node,
  onOutsideClick: PropTypes.func,
  keepOpenOnDateSelect: PropTypes.bool,
  noBorder: PropTypes.bool,

  // navigation related props
  navPrev: PropTypes.node,
  navNext: PropTypes.node,
  onPrevMonthClick: PropTypes.func,
  onNextMonthClick: PropTypes.func,
  transitionDuration: nonNegativeInteger, // milliseconds

  // day presentation and interaction related props
  renderCalendarDay: PropTypes.func,
  renderDayContents: PropTypes.func,
  minimumNights: PropTypes.number,
  isOutsideRange: PropTypes.func,
  isDayBlocked: PropTypes.func,
  isDayHighlighted: PropTypes.func,

  // internationalization props
  monthFormat: PropTypes.string,
  weekDayFormat: PropTypes.string,
  phrases: PropTypes.shape(getPhrasePropTypes(DayPickerPhrases)),
  dayAriaLabelFormat: PropTypes.string,
/>

Localization

Moment.js is a peer dependency of react-dates. The latter then uses a single instance of moment which is imported in one’s project. Loading a locale is done by calling moment.locale(..) in the component where moment is imported, with the locale key of choice. For instance:

moment.locale('pl'); // Polish

However, this only solves date localization. For complete internationalization of the components, react-dates defines a certain amount of user interface strings in English which can be changed through the phrases prop (explore the storybook for examples). For accessibility and usability concerns, all these UI elements should be translated.

Advanced

react-dates no longer relies strictly on CSS, but rather relies on react-with-styles as an abstraction layer between how styles are applied and how they are written. The instructions above will get the project working out of the box, but there's a lot more customization that can be done.

Interfaces

The react-dates/initialize script actually relies on react-with-styles-interface-css under the hood. If you are interested in a different solution for styling in your project, you can do your own initialization of a another interface. At Airbnb, for instance, we rely on Aphrodite under the hood and therefore use the Aphrodite interface for react-with-styles. If you want to do the same, you would use the following pattern:

import ThemedStyleSheet from 'react-with-styles/lib/ThemedStyleSheet';
import aphroditeInterface from 'react-with-styles-interface-aphrodite';
import DefaultTheme from 'react-dates/lib/theme/DefaultTheme';

ThemedStyleSheet.registerInterface(aphroditeInterface);
ThemedStyleSheet.registerTheme(DefaultTheme);

The above code has to be run before any react-dates component is imported. Otherwise, you will get an error. Also note that if you register any custom interface manually, you must also manually register a theme.

Theming

react-dates also now supports a different way to theme. You can see the default theme values in this file and you would override them in the following manner:

import ThemedStyleSheet from 'react-with-styles/lib/ThemedStyleSheet';
import aphroditeInterface from 'react-with-styles-interface-aphrodite';
import DefaultTheme from 'react-dates/lib/theme/DefaultTheme';

ThemedStyleSheet.registerInterface(aphroditeInterface);
ThemedStyleSheet.registerTheme({
  reactDates: {
    ...DefaultTheme.reactDates,
    color: {
      ...DefaultTheme.reactDates.color,
      highlighted: {
        backgroundColor: '#82E0AA',
        backgroundColor_active: '#58D68D',
        backgroundColor_hover: '#58D68D',
        color: '#186A3B',
        color_active: '#186A3B',
        color_hover: '#186A3B',
      },
    },
  },
});

The above code would use shades of green instead of shades of yellow for the highlight color on CalendarDay components. Note that you must register an interface if you manually register a theme. One will not work without the other.

A note on using react-with-styles-interface-css

The default interface that react-dates ships with is the CSS interface. If you want to use this interface along with the theme registration method, you will need to rebuild the core _datepicker.css file. We do not currently expose a utility method to build this file, but you can follow along with the code in https://github.com/react-dates/react-dates/blob/HEAD/scripts/buildCSS.js to build your own custom themed CSS file.

Author: React-dates
Source Code: https://github.com/react-dates/react-dates 
License: MIT license

#react #javascript #calendar 

An Easily internationalizable, Mobile-friendly Datepicker Library

Cupertino Calendar Data Structre Flutter Package

Cupertino Calendar data structre Flutter package

Specific designed data structre which using in Cupertino Calendar

Use this package as a library

Depend on it

Run this command:

With Dart:

 $ dart pub add cupertino_calendar_structre

With Flutter:

 $ flutter pub add cupertino_calendar_structre

This will add a line like this to your package's pubspec.yaml (and run an implicit dart pub get):

dependencies:
  cupertino_calendar_structre: ^1.1.1

Alternatively, your editor might support dart pub get or flutter pub get. Check the docs for your editor to learn more.

Import it

Now in your Dart code, you can use:

import 'package:cupertino_calendar_structre/structre.dart';
import 'package:cupertino_calendar_structre/structre_tools.dart'; 

example/main.dart

import 'package:cupertino_calendar_structre/structre.dart';

void main() {
  // YearMonth demo
  YearMonth ym1 = YearMonth(2021, 2);

  // There are 28 days in Feb 2021
  print("Date in ${ym1.formatString()}: ${ym1.allDaysInMonth.length}");

  // It is greater than January
  print(ym1 > YearMonth(2021, 1));

  FirstDayOfWeek fdow = FirstDayOfWeek.sun;

  // Get placeholder in this month
  print(
      "In ${ym1.formatString()}, it swifted ${fdow.calculatePlaceholderFromStart(ym1)} from begin and ${fdow.calculatePlaceholderFromEnd(ym1)} from end if Sunday is the first day of the week");

  // Date remind section
  Events sampleEvent = Events(
      name: "Sample events",
      from: DateTime(2021, 8, 1, 13, 0, 0),
      to: DateTime(2021, 8, 1, 15, 0, 0));

  print(
      "Event '${sampleEvent.name}' is ongoing: ${sampleEvent.isOngoing(DateTime.now())}");
} 

Download Details:

Author: rk0cc

Source Code: https://github.com/rk0cc/cupertino_calendar

#calendar #flutter 

Cupertino Calendar Data Structre Flutter Package

Customizable Flutter Calendar inspired By Google Calendar App

CrCalendar

Customizable Flutter calendar inspired by Google Calendar app.

Features:

  • CrCalendar widget for displaying horizontally scrollable month view, with events lines over days.
  • date selection dialog (uses CrCalendar widget in range selection mode) with customization of buttons, texts and look of the CrCalendar widget.

Screenshots of example app:

Installation

Add cr_calendar as a dependency in pubspec.yaml.

Then import it to your project:

import 'package:cr_calendar/src/cr_calendar.dart';


Usage of CrCalendar

CrCalendar parameters:

TypeNameDescriptionDefault value
CrCalendarControllercontrollerCalendar controller-
DateTimeinitialDateInitial date to be showed when calendar created-
OnTapCallbackonDayClickedCallback fired when calendar day is tapped in calendar with TouchMode.singleTap touch mode.-
WeekDaysfirstDayOfWeekSets day from which week beginsWeekDays.sunday
WeekDaysBuilderweekDaysBuilderBuilder for customization week days row at top of the calendar widget.-
DayItemBuilderdayItemBuilderBuilder for customization of days cells.-
boolforceSixWeekForce calendar to display sixth row in month view even if this week is not in current month.false
ColorbackgroundColorBackground color of the calendar-
intmaxEventLinesNumber of events widgets to be displayed over day item cell4
EventBuildereventBuilderEvent widget builder-
TouchModetouchModeTouch mode of calendar.-
doubleeventsTopPaddingPadding over events widgets to for correction of their alignment.-
OnRangeSelectedCallbackonRangeSelectedCallback for receiving selected range when calendar is used as date picker.-
intonSwipeCallbackDebounceMsTime in milliseconds for debounce CrCalendarController onSwipe callback.-
DateTimeminDateEarliest allowable date.-
DateTimemaxDateLatest allowable date.-

Base usage:

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  CrCalendarController _controller = CrCalendarController();

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: CrCalendar(
          initialDate: DateTime.now(),
          controller: _controller,
        ),
      ),
    );
  }
}

Usage of CrCalendar date picker dialog

DatePickerProperties parameters:

TypeNameDescriptionDefault value
ColorbackgroundColorBackground color for date picker dialog and year selection widget.Colors.white
DateTimeinitialPickerDateInitial date to be opened on dialog creation.-
EdgeInsetspaddingPicker dialog padding.EdgeInsets.all(8)
DayItemBuilderdayItemBuilderBuilder for day item in dialog.-
TouchModepickerModePicker selection mode.-
WeekDaysBuilderweekDaysBuilderBuilder for row of days over month view.-
DateTitleBuilderpickerTitleBuilderTitle builder for widget on top of picker dialog.-
AlignmentpickerTitleAlignInLandscapeAlignment of picker title in landscape mode.Alignment.centerLeft
WidgetbackButtonBack button for picker control bar.-
WidgetforwardButtonForward button for picker control bar.-
DateTitleBuildercontrolBarTitleBuilderBuilder for control bar title showed between backButton and forwardButton.-
boolshowControlBarOption for hiding control bar.true
YearPickerItemBuilderyearPickerItemBuilderBuilder for confirm selection button.-
PickerButtonBuilderokButtonBuilderBuilder for confirm selection button.-
PickerButtonBuildercancelButtonBuilderBuilder for cancel button.-
boolforceSixWeekForce showing six week rows in month view.false
WeekDaysfirstWeekDayFirst day of date picker calendar.WeekDays.sunday
DateTimeminDateEarliest allowable date.-
DateTimemaxDateLatest allowable date.-
LandscapeDaysResizeModelandscapeDaysResizeModeLandscapeDaysResizeMode.adaptive - days cells will change their height according to parent height LandscapeDaysResizeMode.scrollable - days cells will change their height according to parent height as long as it is larger than the cells width. The month scrolls if there is not enough spaceLandscapeDaysResizeMode.adaptive

Base usage:

  /// Show calendar in pop up dialog for selecting date range for calendar event.
  void _showDatePicker(BuildContext context) {
    showCrDatePicker(
      context,
      properties: DatePickerProperties(
        firstWeekDay: WeekDays.monday,
        okButtonBuilder: (onPress) =>
            ElevatedButton(child: const Text('OK'), onPressed: onPress),
        cancelButtonBuilder: (onPress) =>
            OutlinedButton(child: const Text('CANCEL'), onPressed: onPress),
        initialPickerDate: DateTime.now(),
      ),
    );
  }

Use this package as a library

Depend on it

Run this command:

With Flutter:

 $ flutter pub add cr_calendar

This will add a line like this to your package's pubspec.yaml (and run an implicit flutter pub get):

dependencies:
  cr_calendar: ^0.0.10

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

Import it

Now in your Dart code, you can use:

import 'package:cr_calendar/cr_calendar.dart';

example/lib/main.dart

import 'package:cr_calendar_example/pages/calendar_page.dart';
import 'package:cr_calendar_example/res/colors.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      /// Example app theme.
      theme: ThemeData(
        floatingActionButtonTheme:
            const FloatingActionButtonThemeData(backgroundColor: violet),
        primaryColor: violet,
        colorScheme: ColorScheme.fromSwatch().copyWith(secondary: violet),
        iconTheme: const IconThemeData(color: violet),
        outlinedButtonTheme: OutlinedButtonThemeData(
          style: OutlinedButton.styleFrom(
            textStyle: const TextStyle(
              color: violet,
              fontSize: 16,
              fontWeight: FontWeight.w500,
            ),
            primary: violet,
            shape: const RoundedRectangleBorder(
                borderRadius: BorderRadius.all(Radius.circular(8))),
          ),
        ),
        elevatedButtonTheme: ElevatedButtonThemeData(
          style: ElevatedButton.styleFrom(
            textStyle: const TextStyle(
              fontSize: 16,
              fontWeight: FontWeight.w500,
            ),
            shadowColor: Colors.transparent,
            elevation: 0,
            primary: violet,
            shape: const RoundedRectangleBorder(
                borderRadius: BorderRadius.all(Radius.circular(8))),
          ),
        ),
        dialogTheme: const DialogTheme(
          shape: RoundedRectangleBorder(
              borderRadius: BorderRadius.all(Radius.circular(12))),
        ),
      ),
      home: const CalendarPage(),
    );
  }
} 

Download Details:

Author: Cleveroad

Source Code: https://github.com/Cleveroad/cr_calendar

#flutter #calendar #android 

Customizable Flutter Calendar inspired By Google Calendar App

TimeOff Management: Web Application for Managing Employee Absences

TimeOff.Management

Web application for managing employee absences.

Features

Multiple views of staff absences

Calendar view, Team view, or Just plain list.

Tune application to fit into your company policy

Add custom absence types: Sickness, Maternity, Working from home, Birthday etc. Define if each uses vacation allowance.

Optionally limit the amount of days employees can take for each Leave type. E.g. no more than 10 Sick days per year.

Setup public holidays as well as company specific days off.

Group employees by departments: bring your organisational structure, set the supervisor for every department.

Customisable working schedule for company and individuals.

Third Party Calendar Integration

Broadcast employee whereabouts into external calendar providers: MS Outlook, Google Calendar, and iCal.

Create calendar feeds for individuals, departments or entire company.

Three Steps Workflow

Employee requests time off or revokes existing one.

Supervisor gets email notification and decides about upcoming employee absence.

Absence is accounted. Peers are informed via team view or calendar feeds.

Access control

There are following types of users: employees, supervisors, and administrators.

Optional LDAP authentication: configure application to use your LDAP server for user authentication.

Ability to extract leave data into CSV

Ability to back up entire company leave data into CSV file. So it could be used in any spreadsheet applications.

Works on mobile phones

The most used customer paths are mobile friendly:

employee is able to request new leave from mobile device

supervisor is able to record decision from the mobile as well.

Lots of other little things that would make life easier

Manually adjust employee allowances e.g. employee has extra day in lieu.

Upon creation employee receives pro-rated vacation allowance, depending on start date.

Email notification to all involved parties.

Optionally allow employees to see the time off information of entire company regardless of department structure.

Screenshots

TimeOff.Management Screenshot

Installation

Cloud hosting

Visit http://timeoff.management/

Create company account and use cloud based version.

Self hosting

Install TimeOff.Management application within your infrastructure:

(make sure you have Node.js (>=4.0.0) and SQLite installed)

git clone https://github.com/timeoff-management/application.git timeoff-management
cd timeoff-management
npm install
npm start

Open http://localhost:3000/ in your browser.

Run tests

We have quite a wide test coverage, to make sure that the main user paths work as expected.

Please run them frequently while developing the project.

Make sure you have Chrome driver installed in your path and Chrome browser for your platform.

If you want to see the browser execute the interactions prefix with SHOW_CHROME=1

USE_CHROME=1 npm test

(make sure that application with default settings is up and running)

Any bug fixes or enhancements should have good test coverage to get them into "master" branch.

Updating existing instance with new code

In case one needs to patch existing instance of TimeOff.Managenent application with new version:

git fetch
git pull origin master
npm install
npm run-script db-update
npm start

How to?

There are some customizations available.

How to amend or extend colours available for colour picker?

Follow instructions on this page.

Customization

There are few options to configure an installation.

Make sorting sensitive to particular locale

Given the software could be installed for company with employees with non-English names there might be a need to respect the alphabet while sorting customer entered content.

For that purpose the application config file has locale_code_for_sorting entry. By default the value is en (English). One can override it with other locales such as cs, fr, de etc.

Use Redis as a sessions storage

Follow instructions on this page.

Feedback

Please report any issues or feedback to twitter or Email: pavlo at timeoff.management

Author: Timeoff-management
Source Code: https://github.com/timeoff-management/timeoff-management-application 
License: MIT License

#node #calendar #time 

TimeOff Management: Web Application for Managing Employee Absences

A Package That Allows The Creation of Event-based Project Calendars

This package allows the creation of event-based project calendars.

 

Installing:

In your pubspec.yaml

dependencies:
  bar_calendar: ^0.0.8
import 'package:bar_calendar/bar_calendar.dart';

Basic Usage:

    BarCalendar(
        backgroundColor: Colors.grey.withOpacity(.4),
        events: [
          CalendarEvent(
              title: 'First Event',
              start: DateTime.now(),
              end: DateTime.now().add(const Duration(days: 8))),
          CalendarEvent(
              title: 'Second Event',
              start: DateTime.now(),
              end: DateTime.now().add(const Duration(days: 8))),
          CalendarEvent(
              title: 'Third Event',
              eventBarSize: EventBarSize.large,
              start: DateTime.now().subtract(const Duration(days: 3)),
              end: DateTime.now().add(const Duration(days: 10)))
        ],
      )

BarCalendar

CalendarEvent objects must be wrapped in a BarCalendar.

PropertiesDescription
Color backgroundColorThe background color of the calendar.
CalendarHeaderDecoration headerDecorationAn object that allows full header customisation.
List<CalendarEvent> eventsA list of events to display.
double borderRadiusDefined the border radius for the calendar.

## CalendarHeaderDecoration An object that allows full header customisation.

PropertiesDescription
Color? backgroundColorThe background color of the header (default: Colors.white).
TextStyle? dayTextStyle applied to the day of month (number).
TextStyle? dayTextStyle applied to the day of (letter).
TextStyle? dayTextStyle applied to the month of (when calendar is in condensed view).

CalendarEvent

The CalendarEvent object includes information on the events displayed in the calendar.

PropertiesDescription
String titleThe event title, displayed on the calendar.
Color? colorThe background color for the event bar (default: Colors.white).
DateTime? startEvent start date - if set to null, it is assumed the event has an indefinite start date in the past.
DateTime? endEvent end date - if set to null, it is assumed the event has an indefinite end date in the future.
EventBarDecoration? decorationAn object that allows further customisation of the event bar.
EventBarSize eventBarSizeDefines whether the event should be shown in a large or small bar.
List<CalendarEvent> eventsA list of events to display.

EventBarDecoration

An object that allows further customisation of an event bar.

PropertiesDescription
TextStyle? mainTextStyle for the event tytle.
TextStyle? datesTextStyle for the event subtitle.
Icon? iconAn icon to show before the event subtitle (default: Icons.flag).
Color? progressionBarColorColor of the event progression bar.

Use this package as a library

Depend on it

Run this command:

With Flutter:

 $ flutter pub add bar_calendar

This will add a line like this to your package's pubspec.yaml (and run an implicit flutter pub get):

dependencies:
  bar_calendar: ^0.0.8

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

Import it

Now in your Dart code, you can use:

import 'package:bar_calendar/bar_calendar.dart'; 

example/lib/main.dart

import 'package:bar_calendar/bar_calendar.dart';
import 'package:flutter/material.dart';

main() {
  runApp(const MaterialApp(
    debugShowCheckedModeBanner: false,
    home: Scaffold(
      body: HomePage(),
    ),
  ));
}

class HomePage extends StatelessWidget {
  const HomePage({
    Key? key,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Center(
        child: SizedBox(
      height: 600,
      width: 600,
      child: BarCalendar(
        backgroundColor: const Color(0xFFE2F1FF),
        headerDecoration:
            CalendarHeaderDecoration(backgroundColor: const Color(0xFFBADFFF)),
        events: [
          CalendarEvent(
              title: 'Introducing: Boxing.',
              start: DateTime(2022, 3, 4),
              end: DateTime(2022, 3, 23)),
          CalendarEvent(
              title: 'hitlist', end: DateTime(2022, 5, 31), start: null),
          CalendarEvent(title: 'update', start: null, end: null),
          CalendarEvent(
              title: 'Curated Content For You',
              start: DateTime(2022, 3, 4),
              end: DateTime(2022, 3, 31)),
          CalendarEvent(
              title: 'Parkrun Launch',
              start: DateTime(2059, 1, 31),
              end: DateTime(2022, 3, 4)),
        ],
      ),
    ));
  }
} 

Download Details:

Author: karimafas

Source Code: https://github.com/karimafas/bar-calendar

#flutter #calendar #android 

A Package That Allows The Creation of Event-based Project Calendars
Rowena  Cox

Rowena Cox

1649060700

Beautiful, Extensive and FREE Calendar Control for Xamarin.Forms

In this video I introduce you to the XCalendar plugin for Xamarin.Forms. This brand new control allows you to add a beautiful calendar to your app and has very extensive functionalities!

⏱ Timestamps
00:00 - Introducing XCalendar for Xamarin.Forms
00:15 - XCalendar GitHub Repository
01:51 - Install Plugin.XCalendar NuGet
04:13 - Consume XCalendar in XAML
05:59 - Getting Started with XCalendar APIs
08:56 - XCalendar Sample App Overview
10:35 - More Plugins? Check This!

#xamarinforms #plugin #calendar 

Beautiful, Extensive and FREE Calendar Control for Xamarin.Forms

Package of Hours of Day for Flutter

Day Calendar

github-smallgithub-small
Day calendar with custom stylesDay calendar with all day feature

Usage

Make sure to check out example project.

Installation

Attention use of package flutter_localizations is required

Add to pubspec.yaml:

dependencies:
  day_calendar_flutter: ^1.1.0

flutter_localizations:
  sdk: flutter

Implements the code below in your MaterialApp

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      localizationsDelegates: [
        GlobalMaterialLocalizations.delegate,
        GlobalWidgetsLocalizations.delegate,
      ],
      supportedLocales: [const Locale('pt', 'BR')],
      locale: Locale('pt', 'BR'),
    );
  }

Import the package in your projetct

import 'package:day_calendar_flutter/day_calendar_flutter.dart';

Use the package in your project

@override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Column(
        children: <Widget>[
          DayCalendarFlutter(
            currentDate: DateTime.now(),
            initialHour: 06,
            finalHour: 22,
            events: [
              new Event(
                color: Colors.cyan,
                initialDate: DateTime(2020, 05, 26, 13, 00),
                finalDate:  DateTime(2020, 05, 26, 13, 30),
                title: "Reunião",
                eventTitleStyle: TextStyle(
                  fontSize: 22,
                  fontWeight: FontWeight.bold,
                ),
                showHours: true,
                allDay: true,
                onEventTap: (event) {
                  print(event)
                }
              ),
            ],
            onTap: (date) {
              print(DateFormat('HH:mm').format(date));
            },
          ),
        ]
      )
    );
  }

Use this package as a library

Depend on it

Run this command:

With Flutter:

 $ flutter pub add day_calendar_flutter

This will add a line like this to your package's pubspec.yaml (and run an implicit flutter pub get):

dependencies:
  day_calendar_flutter: ^1.1.2

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

Import it

Now in your Dart code, you can use:

import 'package:day_calendar_flutter/day_calendar_flutter.dart'; 

example/lib/main.dart

import 'package:example/app/app_widget.dart';
import 'package:flutter/material.dart';
import 'package:flutter_modular/flutter_modular.dart';

import 'app/app_module.dart';

void main() => runApp(ModularApp(
      module: AppModule(),
      child: AppWidget(),
    ));

Download Details:

Author: RodolfoBonis

Source Code: https://github.com/RodolfoBonis/DayCalendar

#flutter #calendar 

Package of Hours of Day for Flutter

Go-sunrise: Calculate The Sunrise & Sunset Times for A Given Location

go-sunrise

Go package for calculating the sunrise and sunset times for a given location based on this method.

Usage

To calculate sunrise and sunset times, you will need the following information:

  • the date for which you wish to calculate the times
  • the latitude and longitudinal coordinates of the location

Begin by importing the package:

import "github.com/nathan-osman/go-sunrise"

Next, feed the information into the SunriseSunset() method:

rise, set := sunrise.SunriseSunset(
    43.65, -79.38,          // Toronto, CA
    2000, time.January, 1,  // 2000-01-01
)

The two return values will be the sunrise and sunset times for the location on the given day as time.Time values. If sun does not rise or set, both return values will be time.Time{}.

Author: Nathan-osman
Source Code: https://github.com/nathan-osman/go-sunrise 
License: MIT License

#go #golang #calendar 

Go-sunrise: Calculate The Sunrise & Sunset Times for A Given Location