calendar_view_pt 1.0.2
calendar_view_pt: ^1.0.2 copied to clipboard
Pacote flutter com calendário em português. Versão portuguesa do calendar_view.
import 'dart:ui';
import 'package:calendar_view_pt/calendar_view.dart';
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:syncfusion_localizations/syncfusion_localizations.dart';
import 'model/event.dart';
import 'pages/mobile/mobile_home_page.dart';
import 'pages/web/web_home_page.dart';
import 'widgets/responsive_widget.dart';
DateTime get _now => DateTime.now();
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return CalendarControllerProvider<Event>(
controller: EventController<Event>()..addAll(_events),
child: MaterialApp(
title: 'Flutter Calendar Page Demo',
localizationsDelegates: [
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
SfGlobalLocalizations.delegate
],
supportedLocales: [Locale('pt', 'BR')],
locale: Locale('pt'),
debugShowCheckedModeBanner: false,
theme: ThemeData.light(),
scrollBehavior: ScrollBehavior().copyWith(
dragDevices: {
PointerDeviceKind.trackpad,
PointerDeviceKind.mouse,
PointerDeviceKind.touch,
},
),
home: ResponsiveWidget(
mobileWidget: MobileHomePage(),
webWidget: WebHomePage(),
),
),
);
}
}
List<CalendarEventData<Event>> _events = [
CalendarEventData(
date: _now,
event: Event(title: "Joe's Birthday"),
title: "Project meeting",
description: "Today is project meeting.",
startTime: DateTime(_now.year, _now.month, _now.day, 18, 30),
endTime: DateTime(_now.year, _now.month, _now.day, 22),
),
CalendarEventData(
date: _now.add(Duration(days: 1)),
startTime: DateTime(_now.year, _now.month, _now.day, 18),
endTime: DateTime(_now.year, _now.month, _now.day, 19),
event: Event(title: "Wedding anniversary"),
title: "Wedding anniversary",
description: "Attend uncle's wedding anniversary.",
),
CalendarEventData(
date: _now,
startTime: DateTime(_now.year, _now.month, _now.day, 14),
endTime: DateTime(_now.year, _now.month, _now.day, 17),
event: Event(title: "Football Tournament"),
title: "Football Tournament",
description: "Go to football tournament.",
),
CalendarEventData(
date: _now.add(Duration(days: 3)),
startTime: DateTime(_now.add(Duration(days: 3)).year,
_now.add(Duration(days: 3)).month, _now.add(Duration(days: 3)).day, 10),
endTime: DateTime(_now.add(Duration(days: 3)).year,
_now.add(Duration(days: 3)).month, _now.add(Duration(days: 3)).day, 14),
event: Event(title: "Sprint Meeting."),
title: "Sprint Meeting.",
description: "Last day of project submission for last year.",
),
CalendarEventData(
date: _now.subtract(Duration(days: 2)),
startTime: DateTime(
_now.subtract(Duration(days: 2)).year,
_now.subtract(Duration(days: 2)).month,
_now.subtract(Duration(days: 2)).day,
14),
endTime: DateTime(
_now.subtract(Duration(days: 2)).year,
_now.subtract(Duration(days: 2)).month,
_now.subtract(Duration(days: 2)).day,
16),
event: Event(title: "Team Meeting"),
title: "Team Meeting",
description: "Team Meeting",
),
CalendarEventData(
date: _now.subtract(Duration(days: 2)),
startTime: DateTime(
_now.subtract(Duration(days: 2)).year,
_now.subtract(Duration(days: 2)).month,
_now.subtract(Duration(days: 2)).day,
10),
endTime: DateTime(
_now.subtract(Duration(days: 2)).year,
_now.subtract(Duration(days: 2)).month,
_now.subtract(Duration(days: 2)).day,
12),
event: Event(title: "Chemistry Viva"),
title: "Chemistry Viva",
description: "Today is Joe's birthday.",
),
];