chore: merge for new version #26
8 changed files with 85 additions and 105 deletions
|
@ -2,6 +2,7 @@
|
||||||
# 1.0.0-alpha+5
|
# 1.0.0-alpha+5
|
||||||
- Add tests
|
- Add tests
|
||||||
- Add searching through entries to homepage
|
- Add searching through entries to homepage
|
||||||
|
- Replace `PlatformDialog` with `AlertDialog.adaptive`
|
||||||
# 1.0.0-alpha+4
|
# 1.0.0-alpha+4
|
||||||
- Fix OCR downloads
|
- Fix OCR downloads
|
||||||
# 1.0.0-alpha+3
|
# 1.0.0-alpha+3
|
||||||
|
|
|
@ -1,31 +0,0 @@
|
||||||
// ignore_for_file: public_member_api_docs
|
|
||||||
|
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:prasule/pw/platformwidget.dart';
|
|
||||||
|
|
||||||
/// A [PlatformWidget] implementation of a dialog
|
|
||||||
class PlatformDialog extends PlatformWidget<AlertDialog, CupertinoAlertDialog> {
|
|
||||||
const PlatformDialog(
|
|
||||||
{required this.title, super.key, this.content, this.actions = const [],});
|
|
||||||
final String title;
|
|
||||||
final Widget? content;
|
|
||||||
final List<Widget> actions;
|
|
||||||
|
|
||||||
@override
|
|
||||||
AlertDialog createAndroidWidget(BuildContext context) => AlertDialog(
|
|
||||||
title: Text(title),
|
|
||||||
content:
|
|
||||||
(content != null) ? SingleChildScrollView(child: content) : null,
|
|
||||||
actions: actions,
|
|
||||||
);
|
|
||||||
|
|
||||||
@override
|
|
||||||
CupertinoAlertDialog createIosWidget(BuildContext context) =>
|
|
||||||
CupertinoAlertDialog(
|
|
||||||
title: Text(title),
|
|
||||||
content:
|
|
||||||
(content != null) ? SingleChildScrollView(child: content) : null,
|
|
||||||
actions: actions,
|
|
||||||
);
|
|
||||||
}
|
|
|
@ -21,7 +21,6 @@ import 'package:prasule/api/wallet_manager.dart';
|
||||||
import 'package:prasule/main.dart';
|
import 'package:prasule/main.dart';
|
||||||
import 'package:prasule/network/tessdata.dart';
|
import 'package:prasule/network/tessdata.dart';
|
||||||
import 'package:prasule/pw/platformbutton.dart';
|
import 'package:prasule/pw/platformbutton.dart';
|
||||||
import 'package:prasule/pw/platformdialog.dart';
|
|
||||||
import 'package:prasule/pw/platformfield.dart';
|
import 'package:prasule/pw/platformfield.dart';
|
||||||
import 'package:prasule/pw/platformroute.dart';
|
import 'package:prasule/pw/platformroute.dart';
|
||||||
import 'package:prasule/util/drawer.dart';
|
import 'package:prasule/util/drawer.dart';
|
||||||
|
@ -448,12 +447,15 @@ class _HomeViewState extends State<HomeView> {
|
||||||
.onError,
|
.onError,
|
||||||
icon: Icons.delete,
|
icon: Icons.delete,
|
||||||
onPressed: (c) {
|
onPressed: (c) {
|
||||||
showDialog(
|
showAdaptiveDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (cx) => PlatformDialog(
|
builder: (cx) =>
|
||||||
title: AppLocalizations.of(
|
AlertDialog.adaptive(
|
||||||
context,
|
title: Text(
|
||||||
).sureDialog,
|
AppLocalizations.of(
|
||||||
|
context,
|
||||||
|
).sureDialog,
|
||||||
|
),
|
||||||
content: Text(
|
content: Text(
|
||||||
AppLocalizations.of(context)
|
AppLocalizations.of(context)
|
||||||
.deleteSure,
|
.deleteSure,
|
||||||
|
@ -595,10 +597,10 @@ class _HomeViewState extends State<HomeView> {
|
||||||
final availableLanguages = await TessdataApi.getDownloadedData();
|
final availableLanguages = await TessdataApi.getDownloadedData();
|
||||||
if (availableLanguages.isEmpty) {
|
if (availableLanguages.isEmpty) {
|
||||||
if (!mounted) return;
|
if (!mounted) return;
|
||||||
await showDialog(
|
await showAdaptiveDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (c) => PlatformDialog(
|
builder: (c) => AlertDialog.adaptive(
|
||||||
title: AppLocalizations.of(context).missingOcr,
|
title: Text(AppLocalizations.of(context).missingOcr),
|
||||||
actions: [
|
actions: [
|
||||||
PlatformButton(
|
PlatformButton(
|
||||||
text: AppLocalizations.of(context).download,
|
text: AppLocalizations.of(context).download,
|
||||||
|
@ -628,10 +630,10 @@ class _HomeViewState extends State<HomeView> {
|
||||||
List<bool>.filled(availableLanguages.length, false);
|
List<bool>.filled(availableLanguages.length, false);
|
||||||
selectedLanguages[0] = true;
|
selectedLanguages[0] = true;
|
||||||
|
|
||||||
await showDialog(
|
await showAdaptiveDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (c) => StatefulBuilder(
|
builder: (c) => StatefulBuilder(
|
||||||
builder: (ctx, setState) => PlatformDialog(
|
builder: (ctx, setState) => AlertDialog.adaptive(
|
||||||
actions: [
|
actions: [
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
|
@ -652,10 +654,10 @@ class _HomeViewState extends State<HomeView> {
|
||||||
logger.i(selected);
|
logger.i(selected);
|
||||||
if (!mounted) return;
|
if (!mounted) return;
|
||||||
unawaited(
|
unawaited(
|
||||||
showDialog(
|
showAdaptiveDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (c) => PlatformDialog(
|
builder: (c) => AlertDialog.adaptive(
|
||||||
title: AppLocalizations.of(context).ocrLoading,
|
title: Text(AppLocalizations.of(context).ocrLoading),
|
||||||
),
|
),
|
||||||
barrierDismissible: false,
|
barrierDismissible: false,
|
||||||
),
|
),
|
||||||
|
@ -723,7 +725,7 @@ class _HomeViewState extends State<HomeView> {
|
||||||
child: const Text("Cancel"),
|
child: const Text("Cancel"),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
title: AppLocalizations.of(context).ocrSelect,
|
title: Text(AppLocalizations.of(context).ocrSelect),
|
||||||
content: Column(
|
content: Column(
|
||||||
children: [
|
children: [
|
||||||
...List.generate(
|
...List.generate(
|
||||||
|
|
|
@ -11,7 +11,6 @@ import 'package:prasule/api/recurring_entry.dart';
|
||||||
import 'package:prasule/api/wallet.dart';
|
import 'package:prasule/api/wallet.dart';
|
||||||
import 'package:prasule/api/wallet_manager.dart';
|
import 'package:prasule/api/wallet_manager.dart';
|
||||||
import 'package:prasule/pw/platformbutton.dart';
|
import 'package:prasule/pw/platformbutton.dart';
|
||||||
import 'package:prasule/pw/platformdialog.dart';
|
|
||||||
import 'package:prasule/pw/platformroute.dart';
|
import 'package:prasule/pw/platformroute.dart';
|
||||||
import 'package:prasule/util/drawer.dart';
|
import 'package:prasule/util/drawer.dart';
|
||||||
import 'package:prasule/util/text_color.dart';
|
import 'package:prasule/util/text_color.dart';
|
||||||
|
@ -215,9 +214,10 @@ class _RecurringEntriesViewState extends State<RecurringEntriesView> {
|
||||||
onPressed: (c) {
|
onPressed: (c) {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (cx) => PlatformDialog(
|
builder: (cx) => AlertDialog.adaptive(
|
||||||
title:
|
title: Text(
|
||||||
AppLocalizations.of(context).sureDialog,
|
AppLocalizations.of(context).sureDialog,
|
||||||
|
),
|
||||||
content: Text(
|
content: Text(
|
||||||
AppLocalizations.of(context).deleteSure,
|
AppLocalizations.of(context).deleteSure,
|
||||||
),
|
),
|
||||||
|
|
|
@ -12,7 +12,6 @@ import 'package:prasule/api/wallet.dart';
|
||||||
import 'package:prasule/api/wallet_manager.dart';
|
import 'package:prasule/api/wallet_manager.dart';
|
||||||
import 'package:prasule/main.dart';
|
import 'package:prasule/main.dart';
|
||||||
import 'package:prasule/pw/platformbutton.dart';
|
import 'package:prasule/pw/platformbutton.dart';
|
||||||
import 'package:prasule/pw/platformdialog.dart';
|
|
||||||
import 'package:prasule/pw/platformfield.dart';
|
import 'package:prasule/pw/platformfield.dart';
|
||||||
import 'package:prasule/pw/platformroute.dart';
|
import 'package:prasule/pw/platformroute.dart';
|
||||||
import 'package:prasule/util/text_color.dart';
|
import 'package:prasule/util/text_color.dart';
|
||||||
|
@ -147,9 +146,9 @@ class _EditCategoriesViewState extends State<EditCategoriesView> {
|
||||||
.getBool("useMaterialYou") ??
|
.getBool("useMaterialYou") ??
|
||||||
false;
|
false;
|
||||||
if (!context.mounted) return;
|
if (!context.mounted) return;
|
||||||
await showDialog(
|
await showAdaptiveDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (c) => PlatformDialog(
|
builder: (c) => AlertDialog.adaptive(
|
||||||
actions: [
|
actions: [
|
||||||
PlatformButton(
|
PlatformButton(
|
||||||
text: AppLocalizations.of(context).done,
|
text: AppLocalizations.of(context).done,
|
||||||
|
@ -158,8 +157,8 @@ class _EditCategoriesViewState extends State<EditCategoriesView> {
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
title:
|
title: Text(
|
||||||
AppLocalizations.of(context).pickColor,
|
AppLocalizations.of(context).pickColor),
|
||||||
content: Column(
|
content: Column(
|
||||||
children: [
|
children: [
|
||||||
ColorPicker(
|
ColorPicker(
|
||||||
|
@ -215,9 +214,9 @@ class _EditCategoriesViewState extends State<EditCategoriesView> {
|
||||||
final controller = TextEditingController(
|
final controller = TextEditingController(
|
||||||
text: selectedWallet!.categories[i].name,
|
text: selectedWallet!.categories[i].name,
|
||||||
);
|
);
|
||||||
showDialog(
|
showAdaptiveDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (c) => PlatformDialog(
|
builder: (c) => AlertDialog.adaptive(
|
||||||
actions: [
|
actions: [
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
|
@ -243,8 +242,8 @@ class _EditCategoriesViewState extends State<EditCategoriesView> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
title: AppLocalizations.of(context)
|
title: Text(AppLocalizations.of(context)
|
||||||
.setupCategoriesEditingName,
|
.setupCategoriesEditingName),
|
||||||
content: SizedBox(
|
content: SizedBox(
|
||||||
width: 400,
|
width: 400,
|
||||||
child:
|
child:
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
import 'package:prasule/pw/platformdialog.dart';
|
|
||||||
import 'package:settings_ui/settings_ui.dart';
|
import 'package:settings_ui/settings_ui.dart';
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
|
||||||
|
@ -50,10 +49,10 @@ class _GraphTypeSettingsViewState extends State<GraphTypeSettingsView> {
|
||||||
? AppLocalizations.of(context).barChart
|
? AppLocalizations.of(context).barChart
|
||||||
: AppLocalizations.of(context).lineChart,
|
: AppLocalizations.of(context).lineChart,
|
||||||
),
|
),
|
||||||
onPressed: (c) => showDialog(
|
onPressed: (c) => showAdaptiveDialog(
|
||||||
context: c,
|
context: c,
|
||||||
builder: (ctx) => PlatformDialog(
|
builder: (ctx) => AlertDialog.adaptive(
|
||||||
title: AppLocalizations.of(context).selectType,
|
title: Text(AppLocalizations.of(context).selectType),
|
||||||
content: Column(
|
content: Column(
|
||||||
children: [
|
children: [
|
||||||
SizedBox(
|
SizedBox(
|
||||||
|
@ -110,8 +109,8 @@ class _GraphTypeSettingsViewState extends State<GraphTypeSettingsView> {
|
||||||
),
|
),
|
||||||
onPressed: (c) => showDialog(
|
onPressed: (c) => showDialog(
|
||||||
context: c,
|
context: c,
|
||||||
builder: (ctx) => PlatformDialog(
|
builder: (ctx) => AlertDialog.adaptive(
|
||||||
title: AppLocalizations.of(context).selectType,
|
title: Text(AppLocalizations.of(context).selectType),
|
||||||
content: Column(
|
content: Column(
|
||||||
children: [
|
children: [
|
||||||
SizedBox(
|
SizedBox(
|
||||||
|
|
|
@ -9,7 +9,6 @@ import 'package:flutter_tesseract_ocr/flutter_tesseract_ocr.dart';
|
||||||
import 'package:prasule/main.dart';
|
import 'package:prasule/main.dart';
|
||||||
import 'package:prasule/network/tessdata.dart';
|
import 'package:prasule/network/tessdata.dart';
|
||||||
import 'package:prasule/pw/platformbutton.dart';
|
import 'package:prasule/pw/platformbutton.dart';
|
||||||
import 'package:prasule/pw/platformdialog.dart';
|
|
||||||
|
|
||||||
/// Used to manage downloaded Tessdata for OCR
|
/// Used to manage downloaded Tessdata for OCR
|
||||||
class TessdataListView extends StatefulWidget {
|
class TessdataListView extends StatefulWidget {
|
||||||
|
@ -62,10 +61,11 @@ class _TessdataListViewState extends State<TessdataListView> {
|
||||||
final lang = _tessdata[i].keys.first;
|
final lang = _tessdata[i].keys.first;
|
||||||
if (_tessdata[i][lang]!) {
|
if (_tessdata[i][lang]!) {
|
||||||
// deleting data
|
// deleting data
|
||||||
await showDialog(
|
await showAdaptiveDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => PlatformDialog(
|
builder: (context) => AlertDialog.adaptive(
|
||||||
title: AppLocalizations.of(context).sureDialog,
|
title:
|
||||||
|
Text(AppLocalizations.of(context).sureDialog),
|
||||||
content: Text(
|
content: Text(
|
||||||
AppLocalizations.of(context).deleteOcr(lang),
|
AppLocalizations.of(context).deleteOcr(lang),
|
||||||
),
|
),
|
||||||
|
@ -98,11 +98,11 @@ class _TessdataListViewState extends State<TessdataListView> {
|
||||||
final progressStream = StreamController<double>();
|
final progressStream = StreamController<double>();
|
||||||
|
|
||||||
unawaited(
|
unawaited(
|
||||||
showDialog(
|
showAdaptiveDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (c) => PlatformDialog(
|
builder: (c) => AlertDialog.adaptive(
|
||||||
title: AppLocalizations.of(context)
|
title: Text(AppLocalizations.of(context)
|
||||||
.langDownloadDialog(lang),
|
.langDownloadDialog(lang)),
|
||||||
content: StreamBuilder(
|
content: StreamBuilder(
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
if (snapshot.connectionState ==
|
if (snapshot.connectionState ==
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
// ignore_for_file: inference_failure_on_function_invocation
|
// ignore_for_file: inference_failure_on_function_invocation
|
||||||
|
|
||||||
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:currency_picker/currency_picker.dart';
|
import 'package:currency_picker/currency_picker.dart';
|
||||||
import 'package:dynamic_color/dynamic_color.dart';
|
import 'package:dynamic_color/dynamic_color.dart';
|
||||||
import 'package:flex_color_picker/flex_color_picker.dart';
|
import 'package:flex_color_picker/flex_color_picker.dart';
|
||||||
|
@ -12,7 +14,6 @@ import 'package:prasule/api/category.dart';
|
||||||
import 'package:prasule/api/wallet.dart';
|
import 'package:prasule/api/wallet.dart';
|
||||||
import 'package:prasule/api/wallet_manager.dart';
|
import 'package:prasule/api/wallet_manager.dart';
|
||||||
import 'package:prasule/pw/platformbutton.dart';
|
import 'package:prasule/pw/platformbutton.dart';
|
||||||
import 'package:prasule/pw/platformdialog.dart';
|
|
||||||
import 'package:prasule/pw/platformfield.dart';
|
import 'package:prasule/pw/platformfield.dart';
|
||||||
import 'package:prasule/pw/platformroute.dart';
|
import 'package:prasule/pw/platformroute.dart';
|
||||||
import 'package:prasule/util/show_message.dart';
|
import 'package:prasule/util/show_message.dart';
|
||||||
|
@ -118,11 +119,22 @@ class _SetupViewState extends State<SetupView> {
|
||||||
next: Text(AppLocalizations.of(context).next),
|
next: Text(AppLocalizations.of(context).next),
|
||||||
back: Text(AppLocalizations.of(context).back),
|
back: Text(AppLocalizations.of(context).back),
|
||||||
done: Text(AppLocalizations.of(context).finish),
|
done: Text(AppLocalizations.of(context).finish),
|
||||||
onDone: () {
|
onDone: () async {
|
||||||
if (name.isEmpty) {
|
if (name.isEmpty) {
|
||||||
showMessage(
|
unawaited(
|
||||||
AppLocalizations.of(context).errorEmptyName,
|
showMessage(
|
||||||
context,
|
AppLocalizations.of(context).errorEmptyName,
|
||||||
|
context,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (await WalletManager.exists(name) && context.mounted) {
|
||||||
|
unawaited(
|
||||||
|
showMessage(
|
||||||
|
AppLocalizations.of(context).walletExists,
|
||||||
|
context,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -131,25 +143,19 @@ class _SetupViewState extends State<SetupView> {
|
||||||
currency: _selectedCurrency,
|
currency: _selectedCurrency,
|
||||||
categories: categories,
|
categories: categories,
|
||||||
);
|
);
|
||||||
WalletManager.saveWallet(wallet).then(
|
await WalletManager.saveWallet(wallet);
|
||||||
(value) {
|
|
||||||
if (!value) {
|
if (widget.newWallet && context.mounted) {
|
||||||
showMessage(
|
Navigator.of(context).pop();
|
||||||
AppLocalizations.of(context).walletExists,
|
return;
|
||||||
context,
|
}
|
||||||
);
|
if (!context.mounted) return;
|
||||||
return;
|
unawaited(
|
||||||
}
|
Navigator.of(context).pushReplacement(
|
||||||
if (widget.newWallet) {
|
platformRoute(
|
||||||
Navigator.of(context).pop();
|
(c) => const HomeView(),
|
||||||
return;
|
),
|
||||||
}
|
),
|
||||||
Navigator.of(context).pushReplacement(
|
|
||||||
platformRoute(
|
|
||||||
(c) => const HomeView(),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
pages: [
|
pages: [
|
||||||
|
@ -298,9 +304,9 @@ class _SetupViewState extends State<SetupView> {
|
||||||
.getBool("useMaterialYou") ??
|
.getBool("useMaterialYou") ??
|
||||||
false;
|
false;
|
||||||
if (!context.mounted) return;
|
if (!context.mounted) return;
|
||||||
await showDialog(
|
await showAdaptiveDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (c) => PlatformDialog(
|
builder: (c) => AlertDialog.adaptive(
|
||||||
actions: [
|
actions: [
|
||||||
PlatformButton(
|
PlatformButton(
|
||||||
text: AppLocalizations.of(context)
|
text: AppLocalizations.of(context)
|
||||||
|
@ -310,8 +316,10 @@ class _SetupViewState extends State<SetupView> {
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
title: AppLocalizations.of(context)
|
title: Text(
|
||||||
.pickColor,
|
AppLocalizations.of(context)
|
||||||
|
.pickColor,
|
||||||
|
),
|
||||||
content: Column(
|
content: Column(
|
||||||
children: [
|
children: [
|
||||||
ColorPicker(
|
ColorPicker(
|
||||||
|
@ -363,9 +371,9 @@ class _SetupViewState extends State<SetupView> {
|
||||||
final controller = TextEditingController(
|
final controller = TextEditingController(
|
||||||
text: categories[i].name,
|
text: categories[i].name,
|
||||||
);
|
);
|
||||||
showDialog(
|
showAdaptiveDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (c) => PlatformDialog(
|
builder: (c) => AlertDialog.adaptive(
|
||||||
actions: [
|
actions: [
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
|
@ -390,8 +398,10 @@ class _SetupViewState extends State<SetupView> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
title: AppLocalizations.of(context)
|
title: Text(
|
||||||
.setupCategoriesEditingName,
|
AppLocalizations.of(context)
|
||||||
|
.setupCategoriesEditingName,
|
||||||
|
),
|
||||||
content: SizedBox(
|
content: SizedBox(
|
||||||
width: 400,
|
width: 400,
|
||||||
child: PlatformField(
|
child: PlatformField(
|
||||||
|
|
Loading…
Reference in a new issue