Resolve all lints and deprecation warnings
This commit is contained in:
@@ -24,28 +24,40 @@ class ExportDataScreen extends ConsumerWidget {
|
||||
ListTile(
|
||||
leading: const Icon(Icons.picture_as_pdf),
|
||||
title: const Text('Export as PDF'),
|
||||
subtitle: const Text('Generate a printable PDF report of your cycle data.'),
|
||||
subtitle: const Text(
|
||||
'Generate a printable PDF report of your cycle data.'),
|
||||
trailing: const Icon(Icons.chevron_right),
|
||||
onTap: () async {
|
||||
try {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('Generating PDF report...')),
|
||||
);
|
||||
await PdfService.generateCycleReport(userProfile, cycleEntries);
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('PDF report generated successfully!')),
|
||||
);
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text('Generating PDF report...')),
|
||||
);
|
||||
}
|
||||
await PdfService.generateCycleReport(
|
||||
userProfile, cycleEntries);
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content:
|
||||
Text('PDF report generated successfully!')),
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text('Failed to generate PDF: $e')),
|
||||
);
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text('Failed to generate PDF: $e')),
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.sync),
|
||||
title: const Text('Sync with Calendar'),
|
||||
subtitle: const Text('Export to Apple, Google, or Outlook Calendar.'),
|
||||
subtitle: const Text(
|
||||
'Export to Apple, Google, or Outlook Calendar.'),
|
||||
trailing: const Icon(Icons.chevron_right),
|
||||
onTap: () async {
|
||||
// Show options dialog
|
||||
@@ -53,7 +65,8 @@ class ExportDataScreen extends ConsumerWidget {
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: const Text('Calendar Sync Options'),
|
||||
content: const Text('Would you like to include predicted future periods for the next 12 months?'),
|
||||
content: const Text(
|
||||
'Would you like to include predicted future periods for the next 12 months?'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context, false),
|
||||
@@ -67,26 +80,37 @@ class ExportDataScreen extends ConsumerWidget {
|
||||
),
|
||||
);
|
||||
|
||||
if (includePredictions == null) return; // User cancelled dialog (though I didn't add cancel button, tapping outside returns null)
|
||||
if (includePredictions == null) {
|
||||
return; // User cancelled dialog
|
||||
}
|
||||
|
||||
try {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('Generating calendar file...')),
|
||||
);
|
||||
|
||||
await IcsService.generateCycleCalendar(
|
||||
cycleEntries,
|
||||
user: userProfile,
|
||||
includePredictions: includePredictions
|
||||
);
|
||||
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('Calendar file generated! Open it to add to your calendar.')),
|
||||
);
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text('Generating calendar file...')),
|
||||
);
|
||||
}
|
||||
|
||||
await IcsService.generateCycleCalendar(cycleEntries,
|
||||
user: userProfile,
|
||||
includePredictions: includePredictions);
|
||||
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text(
|
||||
'Calendar file generated! Open it to add to your calendar.')),
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text('Failed to generate calendar file: $e')),
|
||||
);
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content:
|
||||
Text('Failed to generate calendar file: $e')),
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user