horizontal_calendar 1.0.0
horizontal_calendar: ^1.0.0 copied to clipboard
A flutter plugin to show horizontal view of calendar with date picker.
example/lib/main.dart
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:horizontal_calendar/horizontal_calendar.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Horizontal Calendar Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MyHomePage(title: 'Horizontal Calendar Demo'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({
Key? key,
this.title,
}) : super(key: key);
final String? title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title!),
),
body: HorizontalCalendar(
date: DateTime.now().add(const Duration(days: 1)),
initialDate: DateTime.now().subtract(const Duration(days: 2)),
textColor: Colors.black,
backgroundColor: Colors.white,
selectedColor: Colors.orange,
showMonth: true,
onDateSelected: (date) {
if (kDebugMode) {
print(date.toString());
}
},
),
);
}
}