ADDED EXPORT FUNCTIONALITY
This commit is contained in:
@@ -8,9 +8,14 @@ import 'package:provider/provider.dart';
|
||||
|
||||
import 'package:frontend/values/constants.dart';
|
||||
|
||||
class ListPage extends StatelessWidget {
|
||||
class ListPage extends StatefulWidget {
|
||||
const ListPage({super.key});
|
||||
|
||||
@override
|
||||
State<ListPage> createState() => _ListPageState();
|
||||
}
|
||||
|
||||
class _ListPageState extends State<ListPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final provider = context.watch<QuoteProvider>();
|
||||
@@ -112,7 +117,7 @@ class ListPage extends StatelessWidget {
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
void _showUpdateDialog(BuildContext context, QuoteProvider provider, Quote quote) {
|
||||
final bodyController = TextEditingController(text: quote.body);
|
||||
final authorController = TextEditingController(text: quote.author);
|
||||
@@ -273,12 +278,15 @@ class ListPage extends StatelessWidget {
|
||||
ListTile(
|
||||
title: Text(Strings.exportSelectedQuotes),
|
||||
trailing: Icon(Icons.import_export),
|
||||
onTap: () {
|
||||
provider.exportQuotesToFile();
|
||||
onTap: () async {
|
||||
Navigator.pop(context);
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
final scaffoldMessenger = ScaffoldMessenger.of(context);
|
||||
final success = await provider.exportWithSAF();
|
||||
// Make sure the context is still valid
|
||||
if (!mounted) return;
|
||||
scaffoldMessenger.showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(Strings.fileExportedSuccessfully),
|
||||
content: Text(success ? Strings.fileExportedSuccessfully + provider.exportDir : "export [x]"),
|
||||
duration: const Duration(seconds: 3),
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user