I have this flutter code
import 'package:intl/intl.dart'; import 'package:law_diary/widgets/customAppBar.dart'; import 'package:law_diary/widgets/sideBar.dart'; import 'package:table_calendar/table_calendar.dart'; import 'package:http/http.dart' as http; import 'dart:convert'; void main() { runApp(MaterialApp( debugShowCheckedModeBanner: false, home: CalendarPage(), )); } class CalendarPage extends StatefulWidget { const CalendarPage({super.key}); @override State<CalendarPage> createState() => _CalendarPageState(); } class _CalendarPageState extends State<CalendarPage> { DateTime today = DateTime.now(); int currentMonth = DateTime.now().month; int currentYear = DateTime.now().year; List<Map<String, dynamic>> records = []; Map<DateTime, List<String>> events = {}; bool isLoadingData = true; @override void initState() { super.initState(); fetchData(); } Future<void> fetchData() async { final String apiUrl = 'https://legaldiary.000webhostapp.com/android/diary/dailyCalendar.php'; try { final response = await http.post( Uri.parse(apiUrl), body: { 'year': currentYear.toString(), 'month': currentMonth.toString(), }, ); if (response.statusCode == 200) { setState(() { records = List<Map<String, dynamic>>.from(json.decode(response.body)); events = convertListToMap(records); print(events); isLoadingData = false; }); // print(records); if (records.isNotEmpty) { records.forEach((record) { // print(record); }); } else { print('No records found for the selected case ID.'); } } else { print('API request failed with status code: ${response.statusCode}'); } } catch (error) { print('Error: $error'); } } Map<DateTime, List<String>> convertListToMap( List<Map<String, dynamic>> inputList) { Map<DateTime, List<String>> resultMap = {}; for (Map<String, dynamic> map in inputList) { String dateString = map['caseDate']; DateTime timestamp = DateTime.parse(dateString).toLocal(); String casesCount = map['cases_count'] .toString(); // Ensure cases_count is treated as a string if (resultMap.containsKey(timestamp)) { resultMap[timestamp]!.add(casesCount); } else { resultMap[timestamp] = [casesCount]; } } return resultMap; } void _onDaySelected(DateTime day, DateTime focusedDay) { setState(() { today = DateTime(day.year, day.month, day.day); }); } @override Widget build(BuildContext context) { return Scaffold( appBar: CustomAppBar(), body: isLoadingData ? Center(child: CircularProgressIndicator()) : content(), ); } Widget content() { return SingleChildScrollView( padding: const EdgeInsets.all(8.0), child: ListView( shrinkWrap: true, physics: ClampingScrollPhysics(), children: [ // Expanded( // child: SingleChildScrollView( // child: TableCalendar( locale: "en_IN", rowHeight: 80, headerStyle: HeaderStyle( formatButtonVisible: false, titleCentered: true, titleTextStyle: TextStyle(fontSize: 20, fontWeight: FontWeight.bold), headerPadding: EdgeInsets.all(8.0), leftChevronPadding: EdgeInsets.symmetric(vertical: 20, horizontal: 16), rightChevronPadding: EdgeInsets.symmetric(vertical: 20, horizontal: 16), ), availableGestures: AvailableGestures.all, selectedDayPredicate: (day) => isSameDay(day, today), focusedDay: today, firstDay: DateTime.utc(currentYear, currentMonth, 1), lastDay: DateTime.utc(currentYear + 1, 1, 31), onDaySelected: _onDaySelected, calendarBuilders: CalendarBuilders( defaultBuilder: (context, day, focusedDay) { for (DateTime d in events.keys) { if (isSameDay(day, d)) { List<String> casesCounts = events[d] ?? []; String casesCountText = casesCounts .join(', '); // Join cases_count values if multiple return Container( decoration: BoxDecoration( // Customize day cell appearance borderRadius: BorderRadius.circular(8.0), border: isSameDay(day, today) ? Border.all(color: Colors.blueAccent) : Border.all(color: Colors.white), ), child: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ Text( '${day.day}', style: TextStyle( fontSize: 16, fontWeight: FontWeight.bold, color: isSameDay(day, today) ? Colors.white : Colors.black, ), ), Container( padding: EdgeInsets.all(8.0), decoration: BoxDecoration( color: Colors.lightGreen.shade400, borderRadius: BorderRadius.circular( 10.0), // Adjust the border radius as needed ), child: Row( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, children: [ Icon( Icons.calendar_month_sharp, size: 14, color: Colors.white, ), SizedBox(width: 5), Text( casesCountText, style: const TextStyle( color: Colors.white, fontSize: 14, ), ), ], ), ) ], ), ), ); } } return null; }, ), ), // ), // ), SizedBox(height: 15), Text( 'Selected Day: ' + DateFormat('dd-MMM-yyyy').format(today).toString(), style: TextStyle(fontSize: 16)), Text( '${events[today]?.isNotEmpty ?? false ? 'Number of Cases: ${events[today]!.join(', ')}' : 'No cases found'}', style: TextStyle(fontSize: 16), ), ], ), ); } } I have tried everything but the page does not scroll.
In the portrait mode it does not need scrolling but when i rotate the screen to landscape mode, it needs scrolling but the page does not scroll.
i have tried using both listview and singlechildscrollview but nothing works
I referred this link as well but nothing works.
physics: NeverScrollPhysics()instead `physics: ClampingScrollPhysics()' .