diff --git a/lib/screens/library/library_content_view.dart b/lib/screens/library/library_content_view.dart index 79d2ee7..b91b6a2 100644 --- a/lib/screens/library/library_content_view.dart +++ b/lib/screens/library/library_content_view.dart @@ -1,4 +1,3 @@ -import 'package:confirm_dialog/confirm_dialog.dart'; import 'package:flutter/material.dart'; import 'package:get_it/get_it.dart'; import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart'; @@ -39,6 +38,26 @@ class _LibraryContentViewState extends State { super.dispose(); } + Future _confirm(BuildContext context, {required Widget content}) async { + return await showDialog( + context: context, + builder: (context) => AlertDialog( + content: content, + actions: [ + TextButton( + onPressed: () => Navigator.pop(context, false), + child: const Text('Cancel'), + ), + TextButton( + onPressed: () => Navigator.pop(context, true), + child: const Text('OK'), + ), + ], + ), + ) ?? + false; + } + @override Widget build(BuildContext context) { return Scaffold( @@ -49,7 +68,7 @@ class _LibraryContentViewState extends State { onPressed: () async { final entryCount = widget.library.totalCount; if (!context.mounted) return; - final bool userIsSure = await confirm( + final bool userIsSure = await _confirm( context, content: Text( 'Are you sure that you want to clear all $entryCount entries?', diff --git a/lib/screens/settings.dart b/lib/screens/settings.dart index b558b87..07f1381 100644 --- a/lib/screens/settings.dart +++ b/lib/screens/settings.dart @@ -1,6 +1,5 @@ import 'dart:io'; -import 'package:confirm_dialog/confirm_dialog.dart'; import 'package:file_picker/file_picker.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; @@ -32,6 +31,29 @@ class _SettingsViewState extends State { bool dataExportIsLoading = false; bool dataImportIsLoading = false; + Future confirm( + BuildContext context, { + required Widget content, + }) async { + return await showDialog( + context: context, + builder: (context) => AlertDialog( + content: content, + actions: [ + TextButton( + onPressed: () => Navigator.pop(context, false), + child: const Text('Cancel'), + ), + TextButton( + onPressed: () => Navigator.pop(context, true), + child: const Text('OK'), + ), + ], + ), + ) ?? + false; + } + Future clearHistory(BuildContext context) async { final historyCount = await GetIt.instance .get() diff --git a/pubspec.lock b/pubspec.lock index 5363908..7c3a274 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -97,14 +97,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.19.1" - confirm_dialog: - dependency: "direct main" - description: - name: confirm_dialog - sha256: "99b431d2f13bf64a6056fc8f1b2b85a1fc7be572da3f28a17f8a009438542327" - url: "https://pub.dev" - source: hosted - version: "1.0.4" cross_file: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index b885fdb..e39b4d5 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -12,7 +12,6 @@ dependencies: cupertino_icons: ^1.0.8 animated_size_and_fade: ^5.1.1 collection: ^1.19.0 - confirm_dialog: ^1.0.4 division: ^0.9.0 file_picker: ^10.2.0 flutter_bloc: ^9.1.0