The problem I am having is that the CalendarView getter, month, does not seem to exist even though the getters show up in the android studio autofill. I reinstalled the package syncfusion package but I can't seem to figure out why none of the getters exist for CalendarView. And just to be clear the package is successfully installed. I can't seem to find anyone else on the internet with this problem. Thank you for any help, here's the code.
import 'package:flutter/material.dart';
import 'package:syncfusion_flutter_calendar/calendar.dart';
class CalendarView extends StatelessWidget {
const CalendarView({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.grey.shade400,
appBar: AppBar(
backgroundColor: Colors.blueAccent,
title: const Text('Settings',
style: TextStyle(
color: Colors.white
),
)
),
body: SfCalendar(
view: CalendarView.month,
),
);
}
}
CodePudding user response:
You've named your widget CalendarView
with the same name as the one in the syncfusion_flutter_calendar package. Rename it to, for example, MyCalendarView
Something like this:
class MyCalendarView extends StatelessWidget {
const MyCalendarView({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.grey.shade400,
appBar: AppBar(
backgroundColor: Colors.blueAccent,
title: const Text('Settings',
style: TextStyle(
color: Colors.white
),
)
),
body: SfCalendar(
view: CalendarView.month,
),
);
}
}
Or import the package with a prefix like this:
import 'package:syncfusion_flutter_calendar/calendar.dart' as sf;
And access SfCalendar
and CalendarView
with the sf
prefix:
body: sf.SfCalendar(
view: sf.CalendarView.month,
),