simple_horizontal_calendar 0.0.2 copy "simple_horizontal_calendar: ^0.0.2" to clipboard
simple_horizontal_calendar: ^0.0.2 copied to clipboard

Flutter UI package to interact with canelder in horizontal view. This package also supports custom header and chile element.

example/lib/main.dart

import 'package:flutter/material.dart';

import 'package:simple_horizontal_calendar/horizontal_calendar.dart';
import 'package:simple_horizontal_calendar/utils/app_color.dart';
import 'package:intl/intl.dart';

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

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String selectedDate = "";

  @override
  void initState() {
    WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
      setState(() {
        selectedDate = DateFormat('dd MMMM, yyyy').format(DateTime.now());
      });
    });
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          backgroundColor: AppColor.purplePrimaryColor,
          title: const Text(
            'Horizontal Calender',
            style: TextStyle(
              color: Colors.white,
              fontWeight: FontWeight.bold,
            ),
          ),
        ),
        body: Padding(
          padding: const EdgeInsets.all(20.0),
          child: Column(
            children: [
              HorizontalCalender(
                onSelected: (DateTime date) {
                  setState(() {
                    selectedDate = DateFormat('dd MMMM, yyyy').format(date);
                  });
                },
              ),
              const SizedBox(
                height: 40,
              ),
              const Text(
                "Selected Date:",
                style: TextStyle(
                  fontWeight: FontWeight.w600,
                  fontSize: 15,
                ),
                textAlign: TextAlign.center,
              ),
              Text(
                selectedDate,
                style: const TextStyle(
                  fontWeight: FontWeight.bold,
                  fontSize: 20,
                ),
                textAlign: TextAlign.center,
              ),
            ],
          ),
        ),
      ),
    );
  }
}
9
likes
150
pub points
66%
popularity

Publisher

verified publisherhustlecreatives.dev

Flutter UI package to interact with canelder in horizontal view. This package also supports custom header and chile element.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, flutter_web_plugins, intl

More

Packages that depend on simple_horizontal_calendar