diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
deleted file mode 100644
index 3ae41771..00000000
--- a/.github/workflows/ci.yaml
+++ /dev/null
@@ -1,51 +0,0 @@
-name: Flutter CI
-
-# This workflow is triggered on pushes to the repository.
-
-on: [pull_request, workflow_dispatch]
-
-# on: push # Default will running for every branch.
-
-jobs:
- build:
- # This job will run on ubuntu virtual machine
- runs-on: ubuntu-latest
- steps:
- - name: Decode Keystore
- id: decode_keystore
- uses: timheuer/base64-to-file@v1
- with:
- fileName: 'upload-keystore.keystore'
- encodedString: ${{ secrets.KEYSTORE }}
-
- # Setup Java environment in order to build the Android app.
- - uses: actions/checkout@v3
- - uses: actions/setup-java@v2
- with:
- distribution: 'zulu' # Open jdk
- java-version: '11'
-
- # Setup the flutter environment.
- - uses: subosito/flutter-action@v2
- with:
- #channel: 'stable' # 'dev', 'alpha', default to: 'stable'
- flutter-version: '3.7.0'
-
-
- # Getting flutter dependencies
- - run: flutter clean
- - run: flutter pub get
-
- # Build apk.
- - run: flutter build apk --release
- env:
- SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }}
- SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
- SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }}
- KEYSTORE_PATH: ${{ steps.decode_keystore.outputs.filePath }}
-
- # Upload generated apk to the artifacts.
- - uses: actions/upload-artifact@v1
- with:
- name: release-apk
- path: build/app/outputs/flutter-apk/app-release.apk
\ No newline at end of file
diff --git a/.github/workflows/dart_code_metrics.yaml b/.github/workflows/dart_code_metrics.yaml
deleted file mode 100644
index 99bddef8..00000000
--- a/.github/workflows/dart_code_metrics.yaml
+++ /dev/null
@@ -1,22 +0,0 @@
-name: Dart Code Metrics
-
-on: [pull_request, workflow_dispatch]
-
-jobs:
- check:
- name: dart-code-metrics-action
-
- runs-on: ubuntu-latest
-
- steps:
- - uses: actions/checkout@v3
-
- - name: dart-code-metrics
- uses: dart-code-checker/dart-code-metrics-action@v3.0.0
- with:
- github_token: ${{ secrets.GITHUB_TOKEN }}
- pull_request_comment: true
- fatal_warnings: true
- fatal_performance: true
- fatal_style: true
- check_unused_files: false
diff --git a/README.md b/README.md
index e08d9aae..f08c927a 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# threedpass
+# Threedpass
3Dpass mobile light wallet for Android and iOS. [Read more](https://3dpass.org/mobile-wallet) about its features.
@@ -32,16 +32,22 @@ Follow this short instruction:
2. Add locale info in ```lib/main.dart```
```
EasyLocalization(
- supportedLocales: const [Locale('en')], // Add new locale here
- ...
+ supportedLocales: const [
+ Locale('en'),
+ Locale('es'),
+ Locale('sr'),
+ // Add new locale here
+ ],
)
```
3. Add LANG_CODE in ```ios/Runner/Info.plist``` as described here:
```
CFBundleLocalizations
- en
- nb
+ en
+ es
+ sr
+ // Add new locale here
```
diff --git a/assets/translations/en.json b/assets/translations/en.json
index 8cb40254..80df0787 100644
--- a/assets/translations/en.json
+++ b/assets/translations/en.json
@@ -293,5 +293,15 @@
"@2.7.2":{
},
"choose_transfer_keep_alive": "Keep sender alive",
- "transfer_keep_alive_help": "With the keep-alive option set, the account is protected against removal due to low balances."
+ "transfer_keep_alive_help": "With the keep-alive option set, the account is protected against removal due to low balances.",
+
+ "@2.8.0":{
+ },
+ "notifications_titile": "Transactions",
+ "transfer_status": "Transfer status:",
+ "status_pending": "Pending",
+ "status_success": "Success",
+ "status_failed": "Failed",
+ "status_error": "Error",
+ "error_wrong_amount_int": "A positive integer expected"
}
\ No newline at end of file
diff --git a/lib/core/polkawallet/app_service.dart b/lib/core/polkawallet/app_service.dart
index f70349ef..75d19c7a 100644
--- a/lib/core/polkawallet/app_service.dart
+++ b/lib/core/polkawallet/app_service.dart
@@ -50,6 +50,9 @@ class AppService {
plugin.sdk.api.account.unsubscribeBalance();
+ // plugin.sdk.webView.
+ // serviceRoot.webView!.addMsgHandler(msgId, onStatusChange);
+
if (address != null) {
unawaited(
plugin.sdk.api.account.subscribeBalance(
diff --git a/lib/core/polkawallet/bloc/app_service_cubit.dart b/lib/core/polkawallet/bloc/app_service_cubit.dart
index 03b1b2ab..fcf2ba54 100644
--- a/lib/core/polkawallet/bloc/app_service_cubit.dart
+++ b/lib/core/polkawallet/bloc/app_service_cubit.dart
@@ -11,6 +11,7 @@ import 'package:threedpass/core/polkawallet/constants.dart';
import 'package:threedpass/core/polkawallet/plugins/d3p_core_plugin.dart';
import 'package:threedpass/core/polkawallet/plugins/d3p_live_net_plugin.dart';
import 'package:threedpass/core/polkawallet/plugins/d3p_test_net_plugin.dart';
+import 'package:threedpass/core/polkawallet/utils/tx_update_event_logs_handler.dart';
import 'package:threedpass/features/accounts/domain/account_info.dart';
import 'package:threedpass/features/settings_page/bloc/settings_page_cubit.dart';
import 'package:threedpass/features/settings_page/domain/entities/global_settings.dart';
@@ -147,7 +148,8 @@ class AppServiceLoaderCubit extends Cubit {
state.keyring.setCurrent(keyPairData);
- final pseudoNewState = state.copyWith();
+ final pseudoNewState =
+ state.copyWith(status: AppServiceInitStatus.connected);
await pseudoNewState.subscribeToBalance();
@@ -194,4 +196,13 @@ class AppServiceLoaderCubit extends Cubit {
),
);
}
+
+ void addHandler(
+ final String msgId,
+ final void Function(String) setTransactionResult,
+ ) {
+ state.plugin.sdk.webView!.addGlobalHandler(
+ TxUpdateEventLogsHandler(msgId, setTransactionResult),
+ );
+ }
}
diff --git a/lib/core/polkawallet/utils/balance_utils.dart b/lib/core/polkawallet/utils/balance_utils.dart
index 42859e97..744ee6e9 100644
--- a/lib/core/polkawallet/utils/balance_utils.dart
+++ b/lib/core/polkawallet/utils/balance_utils.dart
@@ -1,9 +1,7 @@
import 'dart:math';
import 'package:intl/intl.dart';
-import 'package:logger/logger.dart';
import 'package:polkawallet_sdk/api/types/balanceData.dart';
-import 'package:threedpass/setup.dart';
class BalanceUtils {
static BigInt balanceTotal(final BalanceData? balance) {
@@ -100,8 +98,8 @@ class BalanceUtils {
}
/// Just to use it as double
- static double balanceToDouble(final String balance) {
- return double.parse(balance.replaceAll(',', ''));
+ static double balanceToDouble(final String raw, final int decimals) {
+ return bigIntToDouble(balanceInt(raw), decimals);
}
}
diff --git a/lib/core/polkawallet/utils/tx_update_event_logs_handler.dart b/lib/core/polkawallet/utils/tx_update_event_logs_handler.dart
new file mode 100644
index 00000000..107f0e77
--- /dev/null
+++ b/lib/core/polkawallet/utils/tx_update_event_logs_handler.dart
@@ -0,0 +1,49 @@
+import 'dart:convert';
+
+import 'package:polkawallet_sdk/utils/web_logs_handler.dart';
+
+class TxUpdateEventLogsHandler extends WebLogsHandler {
+ const TxUpdateEventLogsHandler(
+ this.msgId,
+ this.setTransactionResult,
+ );
+
+ final String msgId;
+
+ /// @param {String} is extrinsicSuccess or message
+ final void Function(String) setTransactionResult;
+
+ static const String extrinsicSuccess = 'ok';
+
+ @override
+ void handle(final String data) {
+ final dynamic rawData = jsonDecode(data);
+
+ if (!(rawData is Map &&
+ rawData.keys.contains('path') &&
+ rawData.keys.contains('data'))) {
+ return;
+ }
+
+ final dynamic path = rawData['path'];
+
+ if (!(path is String && path.contains('txUpdateEvent|msgId=$msgId'))) {
+ return;
+ }
+
+ final dynamic dataSection = rawData['data'];
+
+ if (!(dataSection is Map &&
+ dataSection.keys.contains('title') &&
+ dataSection.keys.contains('message'))) {
+ return;
+ }
+
+ final String title = dataSection['title'] as String;
+ if (title == "system.ExtrinsicSuccess") {
+ setTransactionResult(extrinsicSuccess);
+ } else if (title == 'system.ExtrinsicFailed') {
+ setTransactionResult(dataSection['message'] as String);
+ }
+ }
+}
diff --git a/lib/core/theme/d3p_special_colors.dart b/lib/core/theme/d3p_special_colors.dart
index 30060b13..708648d2 100644
--- a/lib/core/theme/d3p_special_colors.dart
+++ b/lib/core/theme/d3p_special_colors.dart
@@ -68,3 +68,9 @@ extension PinCodeColors on CustomColors {
? D3pColors.lightScaffoldBackground
: D3pColors.alternativeDarkBackground;
}
+
+extension NotificationCard on CustomColors {
+ Color get errorCardBGColor => brightness == Brightness.light
+ ? Colors.red.shade100
+ : Colors.red.shade900;
+}
diff --git a/lib/core/widgets/buttons/custom_back_button.dart b/lib/core/widgets/buttons/custom_back_button.dart
index eb148294..a30f2a24 100644
--- a/lib/core/widgets/buttons/custom_back_button.dart
+++ b/lib/core/widgets/buttons/custom_back_button.dart
@@ -34,8 +34,7 @@ class CustomBackButton extends StatelessWidget {
@override
Widget build(final BuildContext context) {
- final needSpecialPop =
- !context.router.canNavigateBack; // TODO CHECK BACKBUTTON
+ final needSpecialPop = !context.router.canNavigateBack;
final theme = Theme.of(context);
return PlatformIconButton(
diff --git a/lib/core/widgets/buttons/enum_button.dart b/lib/core/widgets/buttons/enum_button.dart
index 5f05176f..bd05e27b 100644
--- a/lib/core/widgets/buttons/enum_button.dart
+++ b/lib/core/widgets/buttons/enum_button.dart
@@ -60,10 +60,8 @@ class EnumButton extends StatelessWidget {
shape: MaterialStateProperty.all(border),
),
),
- cupertino: (final context, final platform) => CupertinoTextButtonData(
- // color: mainColor,
- padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 8),
- ),
+ cupertino: (final context, final platform) =>
+ _CupertinoTextButtonData(),
),
),
);
@@ -84,27 +82,9 @@ class _Icon extends StatelessWidget {
}
}
-// class _ListTileMaterial {
-// final ThemeData themeData;
-// final Color? backgroundColor;
-// final RoundedRectangleBorder border;
-
-// _ListTileMaterial({
-// required this.themeData,
-// required this.backgroundColor,
-// required this.border,
-// });
-
-// MaterialTextButtonData style() {
-// return MaterialTextButtonData(
-// style: themeData.textButtonTheme.style!.copyWith(
-// // padding: MaterialStateProperty.all(EdgeInsets.zero),
-// backgroundColor: MaterialStateProperty.all(
-// backgroundColor ?? themeData.cardColor,
-// ),
-// tapTargetSize: MaterialTapTargetSize.shrinkWrap,
-// shape: MaterialStateProperty.all(border),
-// ),
-// );
-// }
-// }
+class _CupertinoTextButtonData extends CupertinoTextButtonData {
+ _CupertinoTextButtonData()
+ : super(
+ padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 8),
+ );
+}
diff --git a/lib/core/widgets/buttons/icon_button.dart b/lib/core/widgets/buttons/icon_button.dart
index 16467892..50a5757b 100644
--- a/lib/core/widgets/buttons/icon_button.dart
+++ b/lib/core/widgets/buttons/icon_button.dart
@@ -7,6 +7,8 @@ class D3pIconButton extends StatelessWidget {
this.onPressed,
this.iconColor,
this.size,
+ this.splashRadius,
+ this.emptyContraints = false,
super.key,
});
@@ -15,12 +17,16 @@ class D3pIconButton extends StatelessWidget {
}) : iconData = Icons.abc,
size = null,
iconColor = Colors.transparent,
+ emptyContraints = false,
+ splashRadius = null,
onPressed = null;
final IconData iconData;
final Color? iconColor;
final void Function()? onPressed;
final double? size;
+ final bool emptyContraints;
+ final double? splashRadius;
@override
Widget build(final BuildContext context) {
@@ -31,8 +37,11 @@ class D3pIconButton extends StatelessWidget {
color: iconColor,
),
onPressed: onPressed,
- material: (final _, final __) =>
- MaterialIconButtonData(padding: EdgeInsets.zero),
+ material: (final _, final __) => MaterialIconButtonData(
+ padding: EdgeInsets.zero,
+ constraints: emptyContraints ? const BoxConstraints() : null,
+ splashRadius: splashRadius,
+ ),
);
}
}
diff --git a/lib/core/widgets/buttons/list_tile_button.dart b/lib/core/widgets/buttons/list_tile_button.dart
index a3f94007..88381d5e 100644
--- a/lib/core/widgets/buttons/list_tile_button.dart
+++ b/lib/core/widgets/buttons/list_tile_button.dart
@@ -5,44 +5,44 @@ import 'package:threedpass/core/theme/d3p_theme.dart';
import 'package:threedpass/core/widgets/other/right_chevron.dart';
class ListTileButton extends StatelessWidget {
- const ListTileButton.bottom({
- required this.text,
- this.onPressed,
- this.backgroundColor,
- this.padding,
- final Key? key,
- }) : border = const RoundedRectangleBorder(
- borderRadius: BorderRadius.only(
- bottomLeft: buttonRadius,
- bottomRight: buttonRadius,
- ),
- ),
- super(key: key);
+ // const ListTileButton.bottom({
+ // required this.text,
+ // this.onPressed,
+ // this.backgroundColor,
+ // this.padding,
+ // final Key? key,
+ // }) : border = const RoundedRectangleBorder(
+ // borderRadius: BorderRadius.only(
+ // bottomLeft: buttonRadius,
+ // bottomRight: buttonRadius,
+ // ),
+ // ),
+ // super(key: key);
- const ListTileButton.middle({
- required this.text,
- final Key? key,
- this.onPressed,
- this.backgroundColor,
- this.padding,
- }) : border = const RoundedRectangleBorder(
- borderRadius: BorderRadius.zero,
- ),
- super(key: key);
+ // const ListTileButton.middle({
+ // required this.text,
+ // final Key? key,
+ // this.onPressed,
+ // this.backgroundColor,
+ // this.padding,
+ // }) : border = const RoundedRectangleBorder(
+ // borderRadius: BorderRadius.zero,
+ // ),
+ // super(key: key);
- const ListTileButton.top({
- required this.text,
- final Key? key,
- this.onPressed,
- this.backgroundColor,
- this.padding,
- }) : border = const RoundedRectangleBorder(
- borderRadius: BorderRadius.only(
- topLeft: buttonRadius,
- topRight: buttonRadius,
- ),
- ),
- super(key: key);
+ // const ListTileButton.top({
+ // required this.text,
+ // final Key? key,
+ // this.onPressed,
+ // this.backgroundColor,
+ // this.padding,
+ // }) : border = const RoundedRectangleBorder(
+ // borderRadius: BorderRadius.only(
+ // topLeft: buttonRadius,
+ // topRight: buttonRadius,
+ // ),
+ // ),
+ // super(key: key);
const ListTileButton.usual({
required this.text,
@@ -50,6 +50,7 @@ class ListTileButton extends StatelessWidget {
this.onPressed,
this.backgroundColor,
this.padding,
+ this.icon,
}) : border = const RoundedRectangleBorder(),
super(key: key);
@@ -61,12 +62,20 @@ class ListTileButton extends StatelessWidget {
final String text;
final EdgeInsetsGeometry? padding;
+ // final ListTileButtonType iconType;
+ final Widget? icon;
+
@override
Widget build(final BuildContext context) {
final theme = Theme.of(context);
final mainColor =
onPressed != null ? D3pThemeData.mainColor : theme.disabledColor;
+ final trailingIcon = icon ??
+ RightChevron(
+ color: mainColor,
+ );
+
return Padding(
padding: padding ?? EdgeInsets.zero,
child: SizedBox(
@@ -83,9 +92,7 @@ class ListTileButton extends StatelessWidget {
style: theme.customTextStyles.d3plabelLarge
.copyWith(color: mainColor),
),
- RightChevron(
- color: mainColor,
- ),
+ trailingIcon,
],
),
),
diff --git a/lib/core/widgets/text/d3p_body_medium_text.dart b/lib/core/widgets/text/d3p_body_medium_text.dart
index 007ab75b..547e9804 100644
--- a/lib/core/widgets/text/d3p_body_medium_text.dart
+++ b/lib/core/widgets/text/d3p_body_medium_text.dart
@@ -5,18 +5,23 @@ import 'package:threedpass/core/widgets/text/d3p_basic_text.dart';
class D3pBodyMediumText extends StatelessWidget {
final String text;
final bool translate;
+ final Color? color;
const D3pBodyMediumText(
this.text, {
super.key,
this.translate = true,
+ this.color,
});
@override
Widget build(final BuildContext context) {
return D3pBasicText(
text,
- style: Theme.of(context).customTextStyles.d3pBodyMedium,
+ style: Theme.of(context)
+ .customTextStyles
+ .d3pBodyMedium
+ .copyWith(color: color),
translate: translate,
);
}
diff --git a/lib/features/accounts/presentation/pages/create_account/create_account_wrapper.dart b/lib/features/accounts/presentation/pages/create_account/create_account_wrapper.dart
index 1d9975c1..7621fbc6 100644
--- a/lib/features/accounts/presentation/pages/create_account/create_account_wrapper.dart
+++ b/lib/features/accounts/presentation/pages/create_account/create_account_wrapper.dart
@@ -15,20 +15,6 @@ class CreateAccountPageWrapper extends StatelessWidget
final Key? key,
}) : super(key: key);
- static void pushToGenerateRandom(final BuildContext context) {
- Navigator.of(context).pop();
- context.router.pushNamed(
- RoutePaths.createAccountMain + RoutePaths.createAccountRandomMnemonic,
- );
- }
-
- static void pushToImportType(final BuildContext context) {
- Navigator.of(context).pop();
- context.router.pushNamed(
- RoutePaths.createAccountMain + RoutePaths.createAccountChooseType,
- );
- }
-
@override
Widget wrappedRoute(final BuildContext context) {
final appService = BlocProvider.of(context).state;
diff --git a/lib/features/compare_page/presentation/pages/compare_page.dart b/lib/features/compare_page/presentation/pages/compare_page.dart
index b51187cd..e685b350 100644
--- a/lib/features/compare_page/presentation/pages/compare_page.dart
+++ b/lib/features/compare_page/presentation/pages/compare_page.dart
@@ -1,16 +1,7 @@
import 'package:flutter/material.dart';
-import 'package:flutter_bloc/flutter_bloc.dart';
-import 'package:threedpass/core/utils/cut_string.dart';
-import 'package:threedpass/core/widgets/buttons/dropdown_button.dart';
import 'package:threedpass/core/widgets/d3p_scaffold.dart';
-import 'package:threedpass/core/widgets/text/d3p_body_large_text.dart';
-import 'package:threedpass/features/compare_page/bloc/compare_cubit.dart';
+import 'package:threedpass/features/compare_page/presentation/widgets/compare_row.dart';
import 'package:threedpass/features/compare_page/presentation/widgets/compare_table/compare_table.dart';
-import 'package:threedpass/features/hashes_list/domain/entities/snapshot.dart';
-
-part '../widgets/orig_obj_title.dart';
-part '../widgets/compare_row.dart';
-part '../widgets/choose_list.dart';
class ComparePage extends StatelessWidget {
const ComparePage({
diff --git a/lib/features/compare_page/presentation/widgets/choose_list.dart b/lib/features/compare_page/presentation/widgets/choose_list.dart
index 52489e7e..18e7ba6f 100644
--- a/lib/features/compare_page/presentation/widgets/choose_list.dart
+++ b/lib/features/compare_page/presentation/widgets/choose_list.dart
@@ -1,14 +1,14 @@
-part of '../pages/compare_page.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter_bloc/flutter_bloc.dart';
+import 'package:threedpass/core/widgets/buttons/dropdown_button.dart';
+import 'package:threedpass/features/compare_page/bloc/compare_cubit.dart';
+import 'package:threedpass/features/hashes_list/domain/entities/snapshot.dart';
class ChooseList extends StatelessWidget {
const ChooseList({
final Key? key,
}) : super(key: key);
- // final List list;
- // final Snapshot chosen;
- // final void Function(Snapshot?) onChoose;
-
@override
Widget build(final BuildContext context) {
return BlocBuilder(
diff --git a/lib/features/compare_page/presentation/widgets/compare_row.dart b/lib/features/compare_page/presentation/widgets/compare_row.dart
index 73c4b441..fa262a96 100644
--- a/lib/features/compare_page/presentation/widgets/compare_row.dart
+++ b/lib/features/compare_page/presentation/widgets/compare_row.dart
@@ -1,4 +1,11 @@
-part of '../pages/compare_page.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter_bloc/flutter_bloc.dart';
+import 'package:threedpass/core/utils/cut_string.dart';
+import 'package:threedpass/core/widgets/text/d3p_body_large_text.dart';
+import 'package:threedpass/features/compare_page/bloc/compare_cubit.dart';
+import 'package:threedpass/features/compare_page/presentation/widgets/choose_list.dart';
+
+part 'orig_obj_title.dart';
class CompareRow extends StatelessWidget {
const CompareRow({
diff --git a/lib/features/compare_page/presentation/widgets/orig_obj_title.dart b/lib/features/compare_page/presentation/widgets/orig_obj_title.dart
index 75503aae..acb7f12c 100644
--- a/lib/features/compare_page/presentation/widgets/orig_obj_title.dart
+++ b/lib/features/compare_page/presentation/widgets/orig_obj_title.dart
@@ -1,4 +1,4 @@
-part of '../pages/compare_page.dart';
+part of './compare_row.dart';
class _OrigObjectTitle extends StatelessWidget {
const _OrigObjectTitle();
diff --git a/lib/features/settings_page/presentation/widgets/app_settings/show_zero_assets.dart b/lib/features/settings_page/presentation/widgets/app_settings/show_zero_assets.dart
index 8909a486..aa61873d 100644
--- a/lib/features/settings_page/presentation/widgets/app_settings/show_zero_assets.dart
+++ b/lib/features/settings_page/presentation/widgets/app_settings/show_zero_assets.dart
@@ -18,15 +18,18 @@ class ShowZeroAssets extends StatelessWidget {
@override
Widget build(final BuildContext context) {
- return DefaultSettingsButton.boolean(
- text: 'show_zero_assets_label',
- iconData: Icons.exposure_zero_outlined,
- iconColor: Colors.green,
- initialValue: BlocProvider.of(context)
- .state
- .appSettings
- .showZeroAssets,
- onPressedBool: (final bool p0) => onChanged(p0, context),
+ return BlocBuilder(
+ buildWhen: (final previous, final current) =>
+ previous.appSettings.showZeroAssets !=
+ current.appSettings.showZeroAssets ||
+ previous.appSettings.darkTheme != current.appSettings.darkTheme,
+ builder: (final context, final state) => DefaultSettingsButton.boolean(
+ text: 'show_zero_assets_label',
+ iconData: Icons.exposure_zero_outlined,
+ iconColor: Colors.green,
+ initialValue: state.appSettings.showZeroAssets,
+ onPressedBool: (final bool p0) => onChanged(p0, context),
+ ),
);
}
}
diff --git a/lib/features/settings_page/presentation/widgets/default_settings_button.dart b/lib/features/settings_page/presentation/widgets/default_settings_button.dart
index ce9e0af3..a30606ba 100644
--- a/lib/features/settings_page/presentation/widgets/default_settings_button.dart
+++ b/lib/features/settings_page/presentation/widgets/default_settings_button.dart
@@ -52,43 +52,109 @@ class DefaultSettingsButton extends StatelessWidget {
@override
Widget build(final BuildContext context) {
- final child = Padding(
- padding: const EdgeInsets.symmetric(vertical: 16, horizontal: 16),
- child: _SettingsButtonContent(
+ return _WrapCard(
+ _ArgumentsDTO(
iconColor: iconColor,
iconData: iconData,
text: text,
- value: textValue,
- boolValue: initialValue,
isBoolean: isBoolean,
onPressedBool: onPressedBool,
+ textValue: textValue,
+ initialValue: initialValue,
+ onPressed: onPressed,
),
);
+ }
+}
- final wrappedChild = isBoolean
- ? child
- : InkWell(
- onTap: onPressed != null ? () => onPressed!() : null,
- child: child,
- );
+class _ArgumentsDTO {
+ const _ArgumentsDTO({
+ required this.iconColor,
+ required this.iconData,
+ required this.text,
+ required this.isBoolean,
+ required this.onPressedBool,
+ required this.textValue,
+ required this.initialValue,
+ required this.onPressed,
+ });
+
+ final IconData iconData;
+ final Color iconColor;
+ final String text;
+ final String? textValue;
+ final bool isBoolean;
+ final bool? initialValue;
+ final void Function(bool) onPressedBool;
+ final void Function()? onPressed;
+}
+
+class _WrapCard extends StatelessWidget {
+ const _WrapCard(this.args);
+
+ final _ArgumentsDTO args;
+
+ @override
+ Widget build(final BuildContext context) {
+ final wrappedInkWell = _WrappedInkWellBase(args);
switch (Theme.of(context).platform) {
case TargetPlatform.android:
case TargetPlatform.fuchsia:
case TargetPlatform.linux:
case TargetPlatform.windows:
- return wrappedChild;
+ return wrappedInkWell;
case TargetPlatform.iOS:
case TargetPlatform.macOS:
return Card(
margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 0),
- child: wrappedChild,
+ child: wrappedInkWell,
);
// return _IOSSettingsIcon(iconColor: iconColor, iconData: iconData);
}
}
}
+class _WrappedInkWellBase extends StatelessWidget {
+ const _WrappedInkWellBase(this.args);
+
+ final _ArgumentsDTO args;
+
+ @override
+ Widget build(final BuildContext context) {
+ final child = _ButtonBase(args);
+
+ return args.isBoolean
+ ? child
+ : InkWell(
+ onTap: args.onPressed != null ? () => args.onPressed!() : null,
+ child: child,
+ );
+ }
+}
+
+class _ButtonBase extends StatelessWidget {
+ const _ButtonBase(this.args);
+
+ final _ArgumentsDTO args;
+
+ @override
+ Widget build(final BuildContext context) {
+ return Padding(
+ padding: const EdgeInsets.symmetric(vertical: 16, horizontal: 16),
+ child: _SettingsButtonContent(
+ iconColor: args.iconColor,
+ iconData: args.iconData,
+ text: args.text,
+ value: args.textValue,
+ boolValue: args.initialValue,
+ isBoolean: args.isBoolean,
+ onPressedBool: args.onPressedBool,
+ ),
+ );
+ }
+}
+
class _SettingsButtonContent extends StatelessWidget {
const _SettingsButtonContent({
required this.iconColor,
diff --git a/lib/features/settings_page/presentation/widgets/preview_settings/antialias_switch.dart b/lib/features/settings_page/presentation/widgets/preview_settings/antialias_switch.dart
index 85bfc13b..d1b834c7 100644
--- a/lib/features/settings_page/presentation/widgets/preview_settings/antialias_switch.dart
+++ b/lib/features/settings_page/presentation/widgets/preview_settings/antialias_switch.dart
@@ -19,15 +19,18 @@ class AntialiasSwitch extends StatelessWidget {
@override
Widget build(final BuildContext context) {
- return DefaultSettingsButton.boolean(
- text: 'antialias_button_label',
- iconData: UniconsLine.adjust_alt,
- iconColor: Colors.green,
- initialValue: BlocProvider.of(context)
- .state
- .previewSettings
- .antialias,
- onPressedBool: (final bool p0) => onChanged(p0, context),
+ return BlocBuilder(
+ buildWhen: (final previous, final current) =>
+ previous.previewSettings.antialias !=
+ current.previewSettings.antialias ||
+ previous.appSettings.darkTheme != current.appSettings.darkTheme,
+ builder: (final context, final state) => DefaultSettingsButton.boolean(
+ text: 'antialias_button_label',
+ iconData: UniconsLine.adjust_alt,
+ iconColor: Colors.green,
+ initialValue: state.previewSettings.antialias,
+ onPressedBool: (final bool p0) => onChanged(p0, context),
+ ),
);
}
}
diff --git a/lib/features/wallet_screen/bloc/notifications_cubit.dart b/lib/features/wallet_screen/bloc/notifications_cubit.dart
new file mode 100644
index 00000000..cfb831e9
--- /dev/null
+++ b/lib/features/wallet_screen/bloc/notifications_cubit.dart
@@ -0,0 +1,94 @@
+import 'package:copy_with_extension/copy_with_extension.dart';
+import 'package:flutter_bloc/flutter_bloc.dart';
+import 'package:threedpass/features/wallet_screen/domain/entities/transfer_history_ui.dart';
+
+part 'notifications_cubit.g.dart';
+
+enum NotificationType { transfer, vote }
+
+@CopyWith()
+class NotificationDTO {
+ final List? fromAddresses;
+ final List? toAddresses;
+ final String? amount;
+ final NotificationType type;
+ final ExtrisincStatus status;
+ final String? message;
+ final String? symbols;
+ final DateTime? blockDateTime;
+
+ const NotificationDTO({
+ required this.type,
+ required this.status,
+ this.amount,
+ this.fromAddresses,
+ this.toAddresses,
+ this.message,
+ this.symbols,
+ this.blockDateTime,
+ });
+}
+
+@CopyWith()
+class NotificationsState {
+ final List notifications;
+ final bool isLoading;
+
+ const NotificationsState({
+ required this.notifications,
+ this.isLoading = false,
+ });
+
+ const NotificationsState.initial()
+ : notifications = const [],
+ isLoading = true;
+}
+
+class NotificationsCubit extends Cubit {
+ NotificationsCubit() : super(const NotificationsState.initial());
+
+ Future init() async {
+ // final test = [
+ // const NotificationDTO(
+ // amount: '1231.23 P3D',
+ // fromAddresses: ['d1D8TcfAy9UWY92uFsoeiMKCvyTgLgUPvyM5gMrBGtWY86oxF'],
+ // toAddresses: ['d1D8TcfAy9UWY92uFsoeiMKCvyTgLgUPvyM5gMrBGtWY86oxF'],
+ // status: ExtrisincStatus.loading,
+ // type: NotificationType.transfer,
+ // symbols: 'P3D',
+ // ),
+ // const NotificationDTO(
+ // amount: '1231.23 P3D',
+ // fromAddresses: ['d1D8TcfAy9UWY92uFsoeiMKCvyTgLgUPvyM5gMrBGtWY86oxF'],
+ // toAddresses: ['d1D8TcfAy9UWY92uFsoeiMKCvyTgLgUPvyM5gMrBGtWY86oxF'],
+ // status: ExtrisincStatus.success,
+ // type: NotificationType.transfer,
+ // symbols: 'P3D',
+ // ),
+ // const NotificationDTO(
+ // amount: '1231.23 P3D',
+ // fromAddresses: ['d1D8TcfAy9UWY92uFsoeiMKCvyTgLgUPvyM5gMrBGtWY86oxF'],
+ // toAddresses: ['d1D8TcfAy9UWY92uFsoeiMKCvyTgLgUPvyM5gMrBGtWY86oxF'],
+ // status: ExtrisincStatus.failed,
+ // type: NotificationType.transfer,
+ // symbols: 'P3D',
+ // ),
+ // ];
+
+ // final newList = List.from(state.notifications);
+ // newList.addAll(test);
+ // emit(state.copyWith(notifications: newList));
+ }
+
+ void add(final NotificationDTO notification) {
+ final newList = List.from(state.notifications);
+ newList.insert(0, notification);
+ emit(state.copyWith(notifications: newList));
+ }
+
+ void replace(final NotificationDTO oldN, final NotificationDTO newN) {
+ final newList = List.from(state.notifications);
+ newList[newList.indexOf(oldN)] = newN;
+ emit(state.copyWith(notifications: newList));
+ }
+}
diff --git a/lib/features/wallet_screen/bloc/notifications_cubit.g.dart b/lib/features/wallet_screen/bloc/notifications_cubit.g.dart
new file mode 100644
index 00000000..f8d3e76b
--- /dev/null
+++ b/lib/features/wallet_screen/bloc/notifications_cubit.g.dart
@@ -0,0 +1,199 @@
+// GENERATED CODE - DO NOT MODIFY BY HAND
+
+part of 'notifications_cubit.dart';
+
+// **************************************************************************
+// CopyWithGenerator
+// **************************************************************************
+
+abstract class _$NotificationDTOCWProxy {
+ NotificationDTO type(NotificationType type);
+
+ NotificationDTO status(ExtrisincStatus status);
+
+ NotificationDTO amount(String? amount);
+
+ NotificationDTO fromAddresses(List? fromAddresses);
+
+ NotificationDTO toAddresses(List? toAddresses);
+
+ NotificationDTO message(String? message);
+
+ NotificationDTO symbols(String? symbols);
+
+ NotificationDTO blockDateTime(DateTime? blockDateTime);
+
+ /// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `NotificationDTO(...).copyWith.fieldName(...)` to override fields one at a time with nullification support.
+ ///
+ /// Usage
+ /// ```dart
+ /// NotificationDTO(...).copyWith(id: 12, name: "My name")
+ /// ````
+ NotificationDTO call({
+ NotificationType? type,
+ ExtrisincStatus? status,
+ String? amount,
+ List? fromAddresses,
+ List? toAddresses,
+ String? message,
+ String? symbols,
+ DateTime? blockDateTime,
+ });
+}
+
+/// Proxy class for `copyWith` functionality. This is a callable class and can be used as follows: `instanceOfNotificationDTO.copyWith(...)`. Additionally contains functions for specific fields e.g. `instanceOfNotificationDTO.copyWith.fieldName(...)`
+class _$NotificationDTOCWProxyImpl implements _$NotificationDTOCWProxy {
+ const _$NotificationDTOCWProxyImpl(this._value);
+
+ final NotificationDTO _value;
+
+ @override
+ NotificationDTO type(NotificationType type) => this(type: type);
+
+ @override
+ NotificationDTO status(ExtrisincStatus status) => this(status: status);
+
+ @override
+ NotificationDTO amount(String? amount) => this(amount: amount);
+
+ @override
+ NotificationDTO fromAddresses(List? fromAddresses) =>
+ this(fromAddresses: fromAddresses);
+
+ @override
+ NotificationDTO toAddresses(List? toAddresses) =>
+ this(toAddresses: toAddresses);
+
+ @override
+ NotificationDTO message(String? message) => this(message: message);
+
+ @override
+ NotificationDTO symbols(String? symbols) => this(symbols: symbols);
+
+ @override
+ NotificationDTO blockDateTime(DateTime? blockDateTime) =>
+ this(blockDateTime: blockDateTime);
+
+ @override
+
+ /// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `NotificationDTO(...).copyWith.fieldName(...)` to override fields one at a time with nullification support.
+ ///
+ /// Usage
+ /// ```dart
+ /// NotificationDTO(...).copyWith(id: 12, name: "My name")
+ /// ````
+ NotificationDTO call({
+ Object? type = const $CopyWithPlaceholder(),
+ Object? status = const $CopyWithPlaceholder(),
+ Object? amount = const $CopyWithPlaceholder(),
+ Object? fromAddresses = const $CopyWithPlaceholder(),
+ Object? toAddresses = const $CopyWithPlaceholder(),
+ Object? message = const $CopyWithPlaceholder(),
+ Object? symbols = const $CopyWithPlaceholder(),
+ Object? blockDateTime = const $CopyWithPlaceholder(),
+ }) {
+ return NotificationDTO(
+ type: type == const $CopyWithPlaceholder() || type == null
+ ? _value.type
+ // ignore: cast_nullable_to_non_nullable
+ : type as NotificationType,
+ status: status == const $CopyWithPlaceholder() || status == null
+ ? _value.status
+ // ignore: cast_nullable_to_non_nullable
+ : status as ExtrisincStatus,
+ amount: amount == const $CopyWithPlaceholder()
+ ? _value.amount
+ // ignore: cast_nullable_to_non_nullable
+ : amount as String?,
+ fromAddresses: fromAddresses == const $CopyWithPlaceholder()
+ ? _value.fromAddresses
+ // ignore: cast_nullable_to_non_nullable
+ : fromAddresses as List?,
+ toAddresses: toAddresses == const $CopyWithPlaceholder()
+ ? _value.toAddresses
+ // ignore: cast_nullable_to_non_nullable
+ : toAddresses as List?,
+ message: message == const $CopyWithPlaceholder()
+ ? _value.message
+ // ignore: cast_nullable_to_non_nullable
+ : message as String?,
+ symbols: symbols == const $CopyWithPlaceholder()
+ ? _value.symbols
+ // ignore: cast_nullable_to_non_nullable
+ : symbols as String?,
+ blockDateTime: blockDateTime == const $CopyWithPlaceholder()
+ ? _value.blockDateTime
+ // ignore: cast_nullable_to_non_nullable
+ : blockDateTime as DateTime?,
+ );
+ }
+}
+
+extension $NotificationDTOCopyWith on NotificationDTO {
+ /// Returns a callable class that can be used as follows: `instanceOfNotificationDTO.copyWith(...)` or like so:`instanceOfNotificationDTO.copyWith.fieldName(...)`.
+ // ignore: library_private_types_in_public_api
+ _$NotificationDTOCWProxy get copyWith => _$NotificationDTOCWProxyImpl(this);
+}
+
+abstract class _$NotificationsStateCWProxy {
+ NotificationsState notifications(List notifications);
+
+ NotificationsState isLoading(bool isLoading);
+
+ /// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `NotificationsState(...).copyWith.fieldName(...)` to override fields one at a time with nullification support.
+ ///
+ /// Usage
+ /// ```dart
+ /// NotificationsState(...).copyWith(id: 12, name: "My name")
+ /// ````
+ NotificationsState call({
+ List? notifications,
+ bool? isLoading,
+ });
+}
+
+/// Proxy class for `copyWith` functionality. This is a callable class and can be used as follows: `instanceOfNotificationsState.copyWith(...)`. Additionally contains functions for specific fields e.g. `instanceOfNotificationsState.copyWith.fieldName(...)`
+class _$NotificationsStateCWProxyImpl implements _$NotificationsStateCWProxy {
+ const _$NotificationsStateCWProxyImpl(this._value);
+
+ final NotificationsState _value;
+
+ @override
+ NotificationsState notifications(List notifications) =>
+ this(notifications: notifications);
+
+ @override
+ NotificationsState isLoading(bool isLoading) => this(isLoading: isLoading);
+
+ @override
+
+ /// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `NotificationsState(...).copyWith.fieldName(...)` to override fields one at a time with nullification support.
+ ///
+ /// Usage
+ /// ```dart
+ /// NotificationsState(...).copyWith(id: 12, name: "My name")
+ /// ````
+ NotificationsState call({
+ Object? notifications = const $CopyWithPlaceholder(),
+ Object? isLoading = const $CopyWithPlaceholder(),
+ }) {
+ return NotificationsState(
+ notifications:
+ notifications == const $CopyWithPlaceholder() || notifications == null
+ ? _value.notifications
+ // ignore: cast_nullable_to_non_nullable
+ : notifications as List,
+ isLoading: isLoading == const $CopyWithPlaceholder() || isLoading == null
+ ? _value.isLoading
+ // ignore: cast_nullable_to_non_nullable
+ : isLoading as bool,
+ );
+ }
+}
+
+extension $NotificationsStateCopyWith on NotificationsState {
+ /// Returns a callable class that can be used as follows: `instanceOfNotificationsState.copyWith(...)` or like so:`instanceOfNotificationsState.copyWith.fieldName(...)`.
+ // ignore: library_private_types_in_public_api
+ _$NotificationsStateCWProxy get copyWith =>
+ _$NotificationsStateCWProxyImpl(this);
+}
diff --git a/lib/features/wallet_screen/bloc/transfer_info_cubit.dart b/lib/features/wallet_screen/bloc/transfer_info_cubit.dart
index ab82579f..f5b64938 100644
--- a/lib/features/wallet_screen/bloc/transfer_info_cubit.dart
+++ b/lib/features/wallet_screen/bloc/transfer_info_cubit.dart
@@ -4,7 +4,9 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:polkawallet_sdk/api/types/txInfoData.dart';
import 'package:threedpass/core/polkawallet/app_service.dart';
+import 'package:threedpass/core/polkawallet/bloc/app_service_cubit.dart';
import 'package:threedpass/core/polkawallet/utils/transfer_type.dart';
+import 'package:threedpass/features/wallet_screen/bloc/notifications_cubit.dart';
import 'package:threedpass/features/wallet_screen/domain/entities/transfer.dart';
import 'package:threedpass/features/wallet_screen/domain/entities/transfer_meta_dto.dart';
@@ -12,7 +14,7 @@ part 'transfer_info_cubit.g.dart';
class TransferInfoCubit extends Cubit {
TransferInfoCubit({
- required final String balance,
+ required final double balance,
required this.metaDTO,
required this.appService,
}) : super(
@@ -27,22 +29,17 @@ class TransferInfoCubit extends Cubit {
final AppService appService;
Future init() async {
- // final params = [
- // appService.keyring.allWithContacts.first.address,
- // '10000000000',
- // ];
-
- // final txInfo = TxInfoData(
- // 'balances',
- // TransferTypeValue(state.type).toString(),
- // appService.userSenderData,
+ // final txInfo = metaDTO.getTxInfo(state.type);
+ // final params = metaDTO.getParams(
+ // '10',
+ // appService.userSenderData.address.toString(),
// );
- // This line throws error:
- // {"path":"log","data":{"call":"uid=8;keyring.txFeeEstimate","error":"t.rpc.payment.queryInfo is not a function"}}
- // Firstly there were wring types in dart code.
- // I fixed them here: https://github.com/L3odr0id/polkawallet_sdk/commit/ccafe364cb231c7d1888648257f5f3002ebb8b2b
- // But it turned out that there is a problem with the JS code deep inside.
+ // // This line throws error:
+ // // {"path":"log","data":{"call":"uid=8;keyring.txFeeEstimate","error":"t.rpc.payment.queryInfo is not a function"}}
+ // // Firstly there were wring types in dart code.
+ // // I fixed them here: https://github.com/L3odr0id/polkawallet_sdk/commit/ccafe364cb231c7d1888648257f5f3002ebb8b2b
+ // // But it turned out that there is a problem with the JS code deep inside.
// final fee = await appService.plugin.sdk.api.tx.estimateFees(txInfo, params);
// print(appService.networkStateData.tokenDecimals);
@@ -52,6 +49,19 @@ class TransferInfoCubit extends Cubit {
// final b = 1 + 1;
// emit(state.copyWith(fees: fee));
+
+ // print(
+ // BalanceUtils.balance(state.fees?.partialFee.toString(), 12),
+ // );
+ // print(
+ // BalanceUtils.balanceInt(state.fees?.partialFee.toString()),
+ // );
+ // print(
+ // BalanceUtils.balanceToDouble(state.fees!.partialFee.toString(), 12),
+ // );
+ // print(
+ // BalanceUtils.balance(state.fees?.weight.toString(), 12),
+ // );
}
Future sendTransfer({
@@ -61,25 +71,31 @@ class TransferInfoCubit extends Cubit {
required final String password,
required final GlobalKey formKey,
}) async {
- try {
- final txInfo = metaDTO.getTxInfo(state.type);
- final params = metaDTO.getParams(
- amount,
- toAddress,
- );
+ final txInfo = metaDTO.getTxInfo(state.type);
+ final params = metaDTO.getParams(
+ amount,
+ toAddress,
+ );
+
+ final notificationsCubit = BlocProvider.of(context);
+ final appServiceCubit = BlocProvider.of(context);
+
+ // print(metaDTO.getName());
- await Transfer(
- txInfo: txInfo,
- params: params,
- appService: appService,
- context: context,
- toAddress: toAddress,
- password: password,
- formKey: formKey,
- ).sendFunds();
- } on Exception catch (e) {
- await Fluttertoast.showToast(msg: e.toString());
- }
+ await Transfer(
+ txInfo: txInfo,
+ params: params,
+ appService: appService,
+ context: context,
+ toAddress: toAddress,
+ password: password,
+ formKey: formKey,
+ notificationsCubit: notificationsCubit,
+ addHandler: appServiceCubit.addHandler,
+ symbols: metaDTO.getName(),
+ decimals: metaDTO.decimals,
+ amountNotification: amount,
+ ).sendFunds();
}
void updateTransferType(final TransferType type) {
@@ -90,7 +106,7 @@ class TransferInfoCubit extends Cubit {
@CopyWith()
class TransferInfo {
// Max avaliable balance in wallet in human-readable double format
- final String balance;
+ final double balance;
final TxFeeEstimateResult? fees;
final TransferType type;
diff --git a/lib/features/wallet_screen/bloc/transfer_info_cubit.g.dart b/lib/features/wallet_screen/bloc/transfer_info_cubit.g.dart
index ec765495..ae8b1976 100644
--- a/lib/features/wallet_screen/bloc/transfer_info_cubit.g.dart
+++ b/lib/features/wallet_screen/bloc/transfer_info_cubit.g.dart
@@ -7,7 +7,7 @@ part of 'transfer_info_cubit.dart';
// **************************************************************************
abstract class _$TransferInfoCWProxy {
- TransferInfo balance(String balance);
+ TransferInfo balance(double balance);
TransferInfo fees(TxFeeEstimateResult? fees);
@@ -20,7 +20,7 @@ abstract class _$TransferInfoCWProxy {
/// TransferInfo(...).copyWith(id: 12, name: "My name")
/// ````
TransferInfo call({
- String? balance,
+ double? balance,
TxFeeEstimateResult? fees,
TransferType? type,
});
@@ -33,7 +33,7 @@ class _$TransferInfoCWProxyImpl implements _$TransferInfoCWProxy {
final TransferInfo _value;
@override
- TransferInfo balance(String balance) => this(balance: balance);
+ TransferInfo balance(double balance) => this(balance: balance);
@override
TransferInfo fees(TxFeeEstimateResult? fees) => this(fees: fees);
@@ -58,7 +58,7 @@ class _$TransferInfoCWProxyImpl implements _$TransferInfoCWProxy {
balance: balance == const $CopyWithPlaceholder() || balance == null
? _value.balance
// ignore: cast_nullable_to_non_nullable
- : balance as String,
+ : balance as double,
fees: fees == const $CopyWithPlaceholder()
? _value.fees
// ignore: cast_nullable_to_non_nullable
diff --git a/lib/features/wallet_screen/domain/entities/transfer.dart b/lib/features/wallet_screen/domain/entities/transfer.dart
index f646b879..de14346d 100644
--- a/lib/features/wallet_screen/domain/entities/transfer.dart
+++ b/lib/features/wallet_screen/domain/entities/transfer.dart
@@ -7,11 +7,14 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:polkawallet_sdk/api/types/txInfoData.dart';
import 'package:threedpass/core/polkawallet/app_service.dart';
+import 'package:threedpass/core/polkawallet/utils/tx_update_event_logs_handler.dart';
import 'package:threedpass/core/widgets/default_loading_dialog.dart';
import 'package:threedpass/features/home_page/bloc/home_context_cubit.dart';
+import 'package:threedpass/features/wallet_screen/bloc/notifications_cubit.dart';
+import 'package:threedpass/features/wallet_screen/domain/entities/transfer_history_ui.dart';
class Transfer {
- const Transfer({
+ Transfer({
required this.txInfo,
required this.params,
required this.appService,
@@ -19,6 +22,11 @@ class Transfer {
required this.formKey,
required this.password,
required this.toAddress,
+ required this.notificationsCubit,
+ required this.addHandler,
+ required this.symbols,
+ required this.decimals,
+ required this.amountNotification,
});
// final String amount;
@@ -29,6 +37,13 @@ class Transfer {
final GlobalKey formKey;
final String password;
final String toAddress;
+ final NotificationsCubit notificationsCubit;
+ final void Function(String, void Function(String)) addHandler;
+ final String symbols;
+ final int decimals;
+ final String amountNotification;
+
+ bool isFinished = false;
Future checkAddressAndNotify() async {
final addressCorrect =
@@ -63,28 +78,99 @@ class Transfer {
DefaultLoadingDialog.show(globalContext, 'transfer_loader_text'.tr());
+ final tmpN = NotificationDTO(
+ type: NotificationType.transfer,
+ status: ExtrisincStatus.loading,
+ toAddresses: [toAddress],
+ fromAddresses: [txInfo.sender?.address ?? ''],
+ amount:
+ amountNotification, //BalanceUtils.balanceToDouble(params[1], decimals).toString(),
+ symbols: symbols,
+ blockDateTime: null,
+ );
+ // int i = 0;
+
+ notificationsCubit.add(tmpN);
+
try {
- final __ = await appService.plugin.sdk.api.tx.signAndSend(
+ final d1 = await appService.plugin.sdk.api.tx.signAndSend(
txInfo,
params,
password,
onStatusChange: (final p0) {
// There are two calls of this callback: p0 == 'Ready' and p0 == 'Broadcast'
// print(p0 + ' ' + params.toString());
- if (p0 == 'Ready') {
- DefaultLoadingDialog.hide(globalContext);
- context.router.pop();
- Fluttertoast.showToast(msg: 'transfer_success_text'.tr());
+ switch (p0) {
+ case 'Ready':
+ // final readN = tmpN.copyWith(status: TransactionStatus.pending,);
+ // notificationsCubit.replace(tmpN, readN);
+ // tmpN = readN;
+
+ DefaultLoadingDialog.hide(globalContext);
+ context.router.pop();
+ Fluttertoast.showToast(msg: 'transfer_success_text'.tr());
+ break;
+
+ case 'Broadcast':
+ // i++;
+
+ // final readN = tmpN.copyWith(status:TransactionStatus.pending,);
+ // notificationsCubit.replace(tmpN, readN);
+ // tmpN = readN;
+
+ print('Broadcast');
+
+ default:
+ print(p0);
}
},
+ msgIdCallback: (final String msgId) {
+ print('SET MSG ID');
+ print(msgId);
+ addHandler(
+ msgId,
+ (final String p0) {
+ isFinished = true;
+ final finishedTransaction = tmpN.copyWith(
+ status: p0 == TxUpdateEventLogsHandler.extrinsicSuccess
+ ? ExtrisincStatus.success
+ : ExtrisincStatus.failed,
+ message: p0,
+ blockDateTime: DateTime.now().toUtc(),
+ );
+ notificationsCubit.replace(tmpN, finishedTransaction);
+ },
+ );
+ },
+ uidCallback: (final String msgId) {
+ print('SET UID');
+ print(msgId);
+ },
);
// final b = 1 + 1;
+ print('Finished');
} on Object catch (e) {
+ // print('aaaaaaaaaaaa');
+ // final a = globalContext.router.stack;
+
try {
+ final ___ = context.router.stack;
DefaultLoadingDialog.hide(globalContext);
+ // DIALOG WAS NOT CLOSED
} on Object catch (e) {
- unawaited(Fluttertoast.showToast(msg: e.toString()));
+ // DIALOG WAS CLOSED
+ debugPrint('dialog was closed');
}
+
+ if (!isFinished) {
+ final finishedTransaction = tmpN.copyWith(
+ status: ExtrisincStatus.error,
+ message: e.toString(),
+ blockDateTime: DateTime.now().toUtc(),
+ );
+ notificationsCubit.replace(tmpN, finishedTransaction);
+ }
+
unawaited(Fluttertoast.showToast(msg: e.toString()));
}
}
diff --git a/lib/features/wallet_screen/domain/entities/transfer_history_ui.dart b/lib/features/wallet_screen/domain/entities/transfer_history_ui.dart
index 6f7de6e9..94f60bd4 100644
--- a/lib/features/wallet_screen/domain/entities/transfer_history_ui.dart
+++ b/lib/features/wallet_screen/domain/entities/transfer_history_ui.dart
@@ -3,7 +3,7 @@ class TransferHistoryUI {
required this.amount,
required this.blockDateTime,
required this.fromAddress,
- required this.isFrom,
+ required this.direction,
required this.symbols,
required this.toAddress,
required this.extrisincStatus,
@@ -16,12 +16,14 @@ class TransferHistoryUI {
final String toAddress;
/// This item is about fact that tokens were send FROM THIS account TO ANOTHER
- final bool isFrom;
+ final TransferDirection direction;
final int decimals;
- final DateTime blockDateTime;
+ final DateTime? blockDateTime;
final ExtrisincStatus? extrisincStatus;
}
-enum ExtrisincStatus { error, loading, success, fail }
+enum ExtrisincStatus { error, loading, success, failed }
+
+enum TransferDirection { from, to, all }
diff --git a/lib/features/wallet_screen/domain/entities/transfer_meta_dto.dart b/lib/features/wallet_screen/domain/entities/transfer_meta_dto.dart
index bf6346d6..402f8bf1 100644
--- a/lib/features/wallet_screen/domain/entities/transfer_meta_dto.dart
+++ b/lib/features/wallet_screen/domain/entities/transfer_meta_dto.dart
@@ -10,7 +10,7 @@ abstract class TransferMetaDTO {
const TransferMetaDTO();
MetaInfoType get type;
- String getBalance();
+ double getBalance();
String getName();
TxInfoData getTxInfo(final TransferType transferType);
@@ -18,6 +18,8 @@ abstract class TransferMetaDTO {
final String? amount,
final String toAddress,
);
+
+ int get decimals;
}
class CoinsTransferMetaDTO extends TransferMetaDTO {
@@ -36,13 +38,16 @@ class CoinsTransferMetaDTO extends TransferMetaDTO {
MetaInfoType get type => MetaInfoType.coin;
@override
- String getBalance() {
- return BalanceUtils.balance(
- appService.chosenAccountBalance.value.availableBalance as String?,
+ double getBalance() {
+ return BalanceUtils.balanceToDouble(
+ appService.chosenAccountBalance.value.availableBalance as String,
appService.networkStateData.safeDecimals,
);
}
+ @override
+ int get decimals => appService.networkStateData.safeDecimals;
+
@override
String getName() {
return coinName;
@@ -78,9 +83,9 @@ class AssetTransferMetaDTO extends TransferMetaDTO {
MetaInfoType get type => MetaInfoType.asset;
@override
- String getBalance() {
- return BalanceUtils.balance(
- tokenBalanceData.amount,
+ double getBalance() {
+ return BalanceUtils.balanceToDouble(
+ tokenBalanceData.amount!,
tokenBalanceData.decimals ?? 12,
);
}
@@ -95,6 +100,9 @@ class AssetTransferMetaDTO extends TransferMetaDTO {
return txInfoValue.txInfo(transferType);
}
+ @override
+ int get decimals => tokenBalanceData.decimals ?? 12;
+
@override
List getParams(
final String? amount,
diff --git a/lib/features/wallet_screen/presentation/assets_page/assets_page.dart b/lib/features/wallet_screen/presentation/assets_page/assets_page.dart
index 58cf7952..8b10e48c 100644
--- a/lib/features/wallet_screen/presentation/assets_page/assets_page.dart
+++ b/lib/features/wallet_screen/presentation/assets_page/assets_page.dart
@@ -34,7 +34,8 @@ class AssetsPage extends StatelessWidget {
body: const Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
- SizedBoxH24(),
+ // SizedBoxH24(),
+ SizedBoxH8(),
CoinsBalance(),
SizedBoxH16(),
AssetPageButtonsPanel(),
diff --git a/lib/features/wallet_screen/presentation/assets_page/widgets/account_actions.dart b/lib/features/wallet_screen/presentation/assets_page/widgets/account_actions.dart
deleted file mode 100644
index f300bfd8..00000000
--- a/lib/features/wallet_screen/presentation/assets_page/widgets/account_actions.dart
+++ /dev/null
@@ -1,57 +0,0 @@
-import 'package:easy_localization/easy_localization.dart';
-import 'package:flutter/material.dart';
-import 'package:flutter_bloc/flutter_bloc.dart';
-import 'package:flutter_platform_widgets/flutter_platform_widgets.dart';
-import 'package:threedpass/core/polkawallet/app_service.dart';
-import 'package:threedpass/core/polkawallet/bloc/app_service_cubit.dart';
-import 'package:threedpass/core/theme/d3p_special_colors.dart';
-import 'package:threedpass/features/preview_page/bloc/outer_context_cubit.dart';
-import 'package:threedpass/features/wallet_screen/presentation/assets_page/remove_account_dialog.dart';
-
-class AccountActions extends StatelessWidget {
- const AccountActions({final Key? key}) : super(key: key);
-
- Future onSelected(final int? value, final BuildContext context) async {
- final outerContext = BlocProvider.of(context).state;
- switch (value) {
- case 1:
- await showPlatformDialog(
- context: outerContext,
- builder: (final _) => const RemoveAccountDialog(),
- );
- break;
- }
- }
-
- @override
- Widget build(final BuildContext context) {
- return BlocBuilder(
- builder: (final context, final state) {
- return PlatformPopupMenu(
- icon: Icon(
- Icons.more_horiz_outlined,
- color: Theme.of(context).customColors.appBarButton,
- ),
- options: [
- PopupMenuOption(
- label: 'remove_account_button_label'.tr(),
- onTap: (final _) => onSelected(1, context),
- cupertino: (final _, final __) => CupertinoPopupMenuOptionData(
- isDestructiveAction: true,
- ),
- ),
- ],
- );
- },
- );
- }
-}
-
-// class _RemoveAccountMenuItem extends PopupMenuItem {
-// _RemoveAccountMenuItem({required final AppService appService})
-// : super(
-// enabled: appService.status == AppServiceInitStatus.connected,
-// value: 1,
-// child: Text('remove_account_button_label'.tr()),
-// );
-// }
diff --git a/lib/features/wallet_screen/presentation/assets_page/widgets/accounts_drawer.dart b/lib/features/wallet_screen/presentation/assets_page/widgets/accounts_drawer.dart
index e742fc9b..ef1ad09b 100644
--- a/lib/features/wallet_screen/presentation/assets_page/widgets/accounts_drawer.dart
+++ b/lib/features/wallet_screen/presentation/assets_page/widgets/accounts_drawer.dart
@@ -1,12 +1,20 @@
+import 'package:auto_route/auto_route.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
+import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_platform_widgets/flutter_platform_widgets.dart';
import 'package:polkawallet_sdk/storage/types/keyPairData.dart';
import 'package:threedpass/core/polkawallet/bloc/app_service_cubit.dart';
import 'package:threedpass/core/theme/d3p_special_colors.dart';
+import 'package:threedpass/core/widgets/buttons/icon_button.dart';
import 'package:threedpass/core/widgets/buttons/list_tile_button.dart';
import 'package:threedpass/core/widgets/buttons/text_button.dart';
-import 'package:threedpass/features/accounts/presentation/pages/create_account/create_account_wrapper.dart';
+import 'package:threedpass/core/widgets/paddings.dart';
+import 'package:threedpass/features/preview_page/bloc/outer_context_cubit.dart';
+import 'package:threedpass/features/wallet_screen/presentation/assets_page/remove_account_dialog.dart';
+import 'package:threedpass/router/route_paths.dart';
+
+part './accounts_drawer/account_text_button.dart';
class AccountsDrawer extends Drawer {
AccountsDrawer({
@@ -25,7 +33,6 @@ class AccountsDrawer extends Drawer {
PlatformAppBar(
title: Text(
'choose_account_assets_page_drawer'.tr(),
- // style: theme.customTextStyles.appBarText,
),
material: (final _, final __) => MaterialAppBarData(
automaticallyImplyLeading: false,
@@ -38,22 +45,18 @@ class AccountsDrawer extends Drawer {
backgroundColor: theme.customColors.appBarBackground,
),
),
- const SizedBox(height: 4),
- D3pTextButton(
- padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
- mainAxisAlignment: MainAxisAlignment.start,
+ const SizedBoxH4(),
+ const _AccountTextButton(
icon: Icons.add_circle,
- text: 'create_account_button_label'.tr(),
- onPressed: () =>
- CreateAccountPageWrapper.pushToGenerateRandom(context),
+ text: 'create_account_button_label',
+ path: RoutePaths.createAccountMain +
+ RoutePaths.createAccountRandomMnemonic,
),
- D3pTextButton(
- padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
- mainAxisAlignment: MainAxisAlignment.start,
+ const _AccountTextButton(
icon: Icons.import_export,
- text: 'import_account_button_label'.tr(),
- onPressed: () =>
- CreateAccountPageWrapper.pushToImportType(context),
+ text: 'import_account_button_label',
+ path: RoutePaths.createAccountMain +
+ RoutePaths.createAccountChooseType,
),
const Divider(),
Flexible(
@@ -70,10 +73,28 @@ class AccountsDrawer extends Drawer {
.changeAccount(accounts[index]);
Navigator.of(context).pop();
},
+ icon: accounts[index].address == current.address
+ ? D3pIconButton(
+ iconData: Icons.delete,
+ iconColor: Colors.red,
+ onPressed: () => deleteAccount(context),
+ emptyContraints: true,
+ splashRadius: 22,
+ )
+ : null,
),
),
),
],
),
);
+
+ static Future deleteAccount(final BuildContext context) async {
+ final outerContext = BlocProvider.of(context).state;
+
+ await showPlatformDialog(
+ context: outerContext,
+ builder: (final _) => const RemoveAccountDialog(),
+ );
+ }
}
diff --git a/lib/features/wallet_screen/presentation/assets_page/widgets/accounts_drawer/account_text_button.dart b/lib/features/wallet_screen/presentation/assets_page/widgets/accounts_drawer/account_text_button.dart
new file mode 100644
index 00000000..88f2babb
--- /dev/null
+++ b/lib/features/wallet_screen/presentation/assets_page/widgets/accounts_drawer/account_text_button.dart
@@ -0,0 +1,31 @@
+part of '../accounts_drawer.dart';
+
+class _AccountTextButton extends StatelessWidget {
+ const _AccountTextButton({
+ required this.icon,
+ required this.text,
+ required this.path,
+ });
+
+ final IconData icon;
+ final String text;
+ final String path;
+
+ void onPressed(final BuildContext context) {
+ Navigator.of(context).pop();
+ context.router.pushNamed(
+ path,
+ );
+ }
+
+ @override
+ Widget build(final BuildContext context) {
+ return D3pTextButton(
+ padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
+ mainAxisAlignment: MainAxisAlignment.start,
+ icon: icon,
+ text: text.tr(),
+ onPressed: () => onPressed(context),
+ );
+ }
+}
diff --git a/lib/features/wallet_screen/presentation/assets_page/widgets/asset_page_appbar.dart b/lib/features/wallet_screen/presentation/assets_page/widgets/asset_page_appbar.dart
index 22ff46f5..b29cf07f 100644
--- a/lib/features/wallet_screen/presentation/assets_page/widgets/asset_page_appbar.dart
+++ b/lib/features/wallet_screen/presentation/assets_page/widgets/asset_page_appbar.dart
@@ -7,8 +7,8 @@ import 'package:threedpass/core/theme/d3p_special_colors.dart';
import 'package:threedpass/core/theme/d3p_special_styles.dart';
import 'package:threedpass/core/utils/copy_and_notify.dart';
import 'package:threedpass/core/utils/formatters.dart';
-import 'package:threedpass/features/wallet_screen/presentation/assets_page/widgets/account_actions.dart';
-import 'package:threedpass/features/wallet_screen/presentation/assets_page/widgets/connetction_indicator.dart';
+import 'package:threedpass/core/widgets/buttons/icon_button.dart';
+import 'package:threedpass/features/wallet_screen/presentation/assets_page/widgets/notifications_icon_button.dart';
class AssetPageAppbar extends AppBar {
AssetPageAppbar({
@@ -18,63 +18,57 @@ class AssetPageAppbar extends AppBar {
}) : super(
key: key,
backgroundColor: const D3pAppBarTheme().backgroundColor,
- // material: (_, __) => MaterialAppBarData(
centerTitle: true,
- // ),
leading: Builder(
- builder: (final context) => IconButton(
+ builder: (final context) => D3pIconButton(
+ iconData: Icons.switch_account_rounded,
+ iconColor: themeData.customColors.appBarButton,
onPressed: () => Scaffold.of(context).openDrawer(),
- icon: Icon(
- Icons.switch_account_rounded,
- color: themeData.customColors.appBarButton,
- ),
),
),
title: SizedBox(
height: kToolbarHeight,
- child: GestureDetector(
- onTap: account.address != null
- ? () => copyAndNotify(
- textToCopy: account.address!,
- textToShow: 'address_copied_to_clipboard'.tr(),
- )
- : null,
- child: Row(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- D3pAddressIcon(
- account.address,
- svg: account.icon,
- ),
- const SizedBox(width: 16),
- Column(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- Text(
- Fmt.shorterAddress(account.address),
- style: themeData.customTextStyles.accountAddress,
- ),
- const SizedBox(height: 4),
- Text(
- account.name ?? 'Anonymous',
- style: themeData.customTextStyles.accountName,
- ),
- ],
- ),
- const SizedBox(width: 16),
- const SizedBox(
- width: D3pAddressIcon.defaultSize,
- child: Center(
- child: ConnectionIndicator(),
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ D3pAddressIcon(
+ account.address,
+ svg: account.icon,
+ ),
+ const SizedBox(width: 16),
+ Column(
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ Text(
+ Fmt.shorterAddress(account.address),
+ style: themeData.customTextStyles.accountAddress,
+ ),
+ const SizedBox(height: 4),
+ Text(
+ account.name ?? 'Anonymous',
+ style: themeData.customTextStyles.accountName,
),
- ), // placeholder for AddressIcon
- ],
- ),
+ ],
+ ),
+ const SizedBox(width: 16),
+ SizedBox(
+ width: D3pAddressIcon.defaultSize,
+ child: D3pIconButton(
+ emptyContraints: true,
+ iconData: Icons.copy,
+ size: 20,
+ iconColor: themeData.customColors.appBarButton,
+ onPressed: () => copyAndNotify(
+ textToCopy: account.address!,
+ textToShow: 'address_copied_to_clipboard'.tr(),
+ ),
+ ),
+ ),
+ ],
),
),
actions: const [
- AccountActions(),
- SizedBox(width: 16),
+ NotificationsIconButton(),
],
);
}
diff --git a/lib/features/wallet_screen/presentation/assets_page/widgets/connetction_indicator.dart b/lib/features/wallet_screen/presentation/assets_page/widgets/connetction_indicator.dart
deleted file mode 100644
index 06f3a442..00000000
--- a/lib/features/wallet_screen/presentation/assets_page/widgets/connetction_indicator.dart
+++ /dev/null
@@ -1,55 +0,0 @@
-import 'package:flutter/material.dart';
-import 'package:flutter_bloc/flutter_bloc.dart';
-import 'package:threedpass/core/polkawallet/app_service.dart';
-import 'package:threedpass/core/polkawallet/bloc/app_service_cubit.dart';
-import 'package:threedpass/core/theme/d3p_special_colors.dart';
-
-class ConnectionIndicator extends StatelessWidget {
- const ConnectionIndicator({final Key? key}) : super(key: key);
-
- @override
- Widget build(final BuildContext context) {
- return BlocBuilder(
- builder: (final context, final state) {
- final customColors = Theme.of(context).customColors;
-
- switch (state.status) {
- case AppServiceInitStatus.init:
- case AppServiceInitStatus.connecting:
- return _SmallCircle(
- color: customColors.uncertainIcon,
- );
- case AppServiceInitStatus.connected:
- return _SmallCircle(
- color: customColors.positiveIcon,
- );
- case AppServiceInitStatus.error:
- return _SmallCircle(
- color: customColors.errorIcon,
- );
- }
- },
- );
- }
-}
-
-class _SmallCircle extends StatelessWidget {
- const _SmallCircle({
- required this.color,
- final Key? key,
- }) : super(key: key);
-
- final Color color;
-
- @override
- Widget build(final BuildContext context) {
- return Container(
- height: 10,
- width: 10,
- decoration: BoxDecoration(
- shape: BoxShape.circle,
- color: color,
- ),
- );
- }
-}
diff --git a/lib/features/wallet_screen/presentation/assets_page/widgets/non_native_tokens/assets_column.dart b/lib/features/wallet_screen/presentation/assets_page/widgets/non_native_tokens/assets_column.dart
index 0993e5a7..1b6b768d 100644
--- a/lib/features/wallet_screen/presentation/assets_page/widgets/non_native_tokens/assets_column.dart
+++ b/lib/features/wallet_screen/presentation/assets_page/widgets/non_native_tokens/assets_column.dart
@@ -17,7 +17,7 @@ class _AssetsColumn extends StatelessWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- const SizedBoxH36(),
+ const SizedBoxH24(),
const D3pTitleLargeText('assets_title'),
Flexible(
child: ListView.builder(
diff --git a/lib/features/wallet_screen/presentation/assets_page/widgets/notifications_icon_button.dart b/lib/features/wallet_screen/presentation/assets_page/widgets/notifications_icon_button.dart
new file mode 100644
index 00000000..7422a546
--- /dev/null
+++ b/lib/features/wallet_screen/presentation/assets_page/widgets/notifications_icon_button.dart
@@ -0,0 +1,68 @@
+import 'package:auto_route/auto_route.dart';
+import 'package:badges/badges.dart';
+import 'package:badges/badges.dart' as badges;
+import 'package:flutter/material.dart';
+import 'package:flutter_bloc/flutter_bloc.dart';
+import 'package:threedpass/core/theme/d3p_special_styles.dart';
+import 'package:threedpass/core/theme/d3p_theme.dart';
+import 'package:threedpass/core/widgets/buttons/icon_button.dart';
+import 'package:threedpass/features/wallet_screen/bloc/notifications_cubit.dart';
+import 'package:threedpass/features/wallet_screen/domain/entities/transfer_history_ui.dart';
+import 'package:threedpass/router/router.gr.dart';
+
+class NotificationsIconButton extends StatelessWidget {
+ const NotificationsIconButton({super.key});
+
+ void onPressed(final BuildContext context) {
+ // final outerContext = BlocProvider.of(context).state;
+
+ context.router.push(const NotificationsRoute());
+ }
+
+ @override
+ Widget build(final BuildContext context) {
+ final customTextStyles = Theme.of(context).customTextStyles;
+ // final customColors = Theme.of(context).customColors;
+
+ return BlocBuilder(
+ builder: (final context, final state) {
+ if (state.notifications.isEmpty) {
+ return SizedBox(
+ height: kToolbarHeight,
+ child: D3pIconButton(
+ iconData: Icons.notifications_none_outlined,
+ onPressed: () => onPressed(context),
+ ),
+ );
+ }
+ bool hasErrors = false;
+ for (final notification in state.notifications) {
+ if (notification.status == ExtrisincStatus.failed ||
+ notification.status == ExtrisincStatus.error) {
+ hasErrors = true;
+ }
+ }
+
+ final String badgeText = state.notifications.length.toString();
+ final badgeColor = hasErrors ? Colors.red : D3pThemeData.mainColor;
+
+ return badges.Badge(
+ badgeContent: Text(
+ badgeText,
+ style: customTextStyles.d3pBodyMedium.copyWith(color: Colors.white),
+ ),
+ position: badges.BadgePosition.topEnd(top: 2, end: 2),
+ badgeAnimation: const BadgeAnimation.scale(),
+ badgeStyle: BadgeStyle(badgeColor: badgeColor),
+ child: SizedBox(
+ height: kToolbarHeight,
+ child: D3pIconButton(
+ iconData: Icons.notifications,
+ onPressed: () => onPressed(context),
+ ),
+ ),
+ );
+ },
+ );
+ }
+}
diff --git a/lib/features/wallet_screen/presentation/no_accounts_page/widgets/create_account_button.dart b/lib/features/wallet_screen/presentation/no_accounts_page/widgets/create_account_button.dart
index 8e94943e..0e963545 100644
--- a/lib/features/wallet_screen/presentation/no_accounts_page/widgets/create_account_button.dart
+++ b/lib/features/wallet_screen/presentation/no_accounts_page/widgets/create_account_button.dart
@@ -1,10 +1,11 @@
+import 'package:auto_route/auto_route.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:threedpass/core/polkawallet/app_service.dart';
import 'package:threedpass/core/polkawallet/bloc/app_service_cubit.dart';
import 'package:threedpass/core/widgets/buttons/card_elevated_button.dart';
-import 'package:threedpass/features/accounts/presentation/pages/create_account/create_account_wrapper.dart';
+import 'package:threedpass/router/route_paths.dart';
class CreateAccountButton extends StatelessWidget {
const CreateAccountButton({
@@ -18,7 +19,12 @@ class CreateAccountButton extends StatelessWidget {
iconData: Icons.add,
text: 'create_account_button_label'.tr(),
onPressed: state.status == AppServiceInitStatus.connected
- ? () => CreateAccountPageWrapper.pushToGenerateRandom(context)
+ ? () {
+ context.router.pushNamed(
+ RoutePaths.createAccountMain +
+ RoutePaths.createAccountRandomMnemonic,
+ );
+ }
: null,
),
);
diff --git a/lib/features/wallet_screen/presentation/no_accounts_page/widgets/import_account_button.dart b/lib/features/wallet_screen/presentation/no_accounts_page/widgets/import_account_button.dart
index 744af78b..cbd40793 100644
--- a/lib/features/wallet_screen/presentation/no_accounts_page/widgets/import_account_button.dart
+++ b/lib/features/wallet_screen/presentation/no_accounts_page/widgets/import_account_button.dart
@@ -1,10 +1,11 @@
+import 'package:auto_route/auto_route.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:threedpass/core/polkawallet/app_service.dart';
import 'package:threedpass/core/polkawallet/bloc/app_service_cubit.dart';
import 'package:threedpass/core/widgets/buttons/card_elevated_button.dart';
-import 'package:threedpass/features/accounts/presentation/pages/create_account/create_account_wrapper.dart';
+import 'package:threedpass/router/route_paths.dart';
class ImportAccountButton extends StatelessWidget {
const ImportAccountButton({
@@ -18,7 +19,12 @@ class ImportAccountButton extends StatelessWidget {
iconData: Icons.import_export_outlined,
text: 'import_account_button_label'.tr(),
onPressed: state.status == AppServiceInitStatus.connected
- ? () => CreateAccountPageWrapper.pushToImportType(context)
+ ? () {
+ context.router.pushNamed(
+ RoutePaths.createAccountMain +
+ RoutePaths.createAccountChooseType,
+ );
+ }
: null,
),
);
diff --git a/lib/features/wallet_screen/presentation/non_native_token_screen/domain/entities/asset_history_transfer.dart b/lib/features/wallet_screen/presentation/non_native_token_screen/domain/entities/asset_history_transfer.dart
index b69f976d..0fed694a 100644
--- a/lib/features/wallet_screen/presentation/non_native_token_screen/domain/entities/asset_history_transfer.dart
+++ b/lib/features/wallet_screen/presentation/non_native_token_screen/domain/entities/asset_history_transfer.dart
@@ -30,7 +30,7 @@ class AssetHistoryTransfer extends NonNativeTokenHistoryAtomBase {
amount: value,
blockDateTime: blockDatetime,
fromAddress: authorAddress,
- isFrom: isFrom,
+ direction: isFrom ? TransferDirection.from : TransferDirection.to,
symbols: symbols,
toAddress: targetAddress,
extrisincStatus: extrisincStatus,
diff --git a/lib/features/wallet_screen/presentation/non_native_token_screen/domain/entities/success_event_type.dart b/lib/features/wallet_screen/presentation/non_native_token_screen/domain/entities/success_event_type.dart
index 88129825..dc917fd1 100644
--- a/lib/features/wallet_screen/presentation/non_native_token_screen/domain/entities/success_event_type.dart
+++ b/lib/features/wallet_screen/presentation/non_native_token_screen/domain/entities/success_event_type.dart
@@ -13,7 +13,7 @@ class SuccessEvenType {
?.firstWhere((final p0) => p0.eventModule == 'System');
switch (ex?.eventName ?? '') {
case 'ExtrinsicFailed':
- return ExtrisincStatus.fail;
+ return ExtrisincStatus.failed;
case 'ExtrinsicSuccess':
return ExtrisincStatus.success;
default:
diff --git a/lib/features/wallet_screen/presentation/notifications_page/notifications_page.dart b/lib/features/wallet_screen/presentation/notifications_page/notifications_page.dart
new file mode 100644
index 00000000..3b0e00a1
--- /dev/null
+++ b/lib/features/wallet_screen/presentation/notifications_page/notifications_page.dart
@@ -0,0 +1,17 @@
+import 'package:auto_route/auto_route.dart';
+import 'package:flutter/material.dart';
+import 'package:threedpass/core/widgets/d3p_scaffold.dart';
+import 'package:threedpass/features/wallet_screen/presentation/notifications_page/widgets/notifications_list.dart';
+
+@RoutePage()
+class NotificationsPage extends StatelessWidget {
+ const NotificationsPage({super.key});
+
+ @override
+ Widget build(final BuildContext context) {
+ return const D3pScaffold(
+ body: NotificationsList(),
+ appbarTitle: 'notifications_titile',
+ );
+ }
+}
diff --git a/lib/features/wallet_screen/presentation/notifications_page/widgets/notifcation_transfer.dart b/lib/features/wallet_screen/presentation/notifications_page/widgets/notifcation_transfer.dart
new file mode 100644
index 00000000..601916b2
--- /dev/null
+++ b/lib/features/wallet_screen/presentation/notifications_page/widgets/notifcation_transfer.dart
@@ -0,0 +1,128 @@
+import 'package:flutter/material.dart';
+import 'package:shimmer/shimmer.dart';
+import 'package:threedpass/core/theme/d3p_special_colors.dart';
+import 'package:threedpass/core/widgets/paddings.dart';
+import 'package:threedpass/core/widgets/text/d3p_body_large_text.dart';
+import 'package:threedpass/core/widgets/text/d3p_body_medium_text.dart';
+import 'package:threedpass/features/wallet_screen/bloc/notifications_cubit.dart';
+import 'package:threedpass/features/wallet_screen/domain/entities/transfer_history_ui.dart';
+import 'package:threedpass/features/wallet_screen/presentation/widgets/transaction_item.dart';
+
+class NotificationTransferCard extends StatelessWidget {
+ final NotificationDTO notificationDTO;
+
+ const NotificationTransferCard(this.notificationDTO, {super.key});
+
+ @override
+ Widget build(final BuildContext context) {
+ final cardBG = notificationDTO.status == ExtrisincStatus.failed ||
+ notificationDTO.status == ExtrisincStatus.error
+ ? Theme.of(context).customColors.errorCardBGColor
+ : null;
+
+ return Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 16),
+ child: Card(
+ color: cardBG,
+ child: Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 8),
+ child: SizedBox(
+ width: double.infinity,
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Row(
+ children: [
+ const D3pBodyMediumText('transfer_status'),
+ const SizedBox(width: 8),
+ _TransferStatus(notificationDTO.status),
+ ],
+ ),
+ const SizedBoxH4(),
+ _Message(notificationDTO.message, notificationDTO.status),
+ TransactionItem(
+ object: TransferHistoryUI(
+ amount: notificationDTO.amount ?? 'error amount',
+ decimals: 1,
+ symbols: notificationDTO.symbols ?? 'error symbol',
+ direction: TransferDirection
+ .all, // Transfers are always "from", but from different accounts
+ blockDateTime: notificationDTO.blockDateTime,
+ fromAddress: notificationDTO.fromAddresses!.first,
+ toAddress: notificationDTO.toAddresses!.first,
+ extrisincStatus: null,
+ ),
+ ),
+ ],
+ ),
+ ),
+ ),
+ ),
+ );
+ }
+}
+
+class _TransferStatus extends StatelessWidget {
+ const _TransferStatus(this.status);
+
+ final ExtrisincStatus status;
+
+ @override
+ Widget build(final BuildContext context) {
+ switch (status) {
+ case ExtrisincStatus.loading:
+ return Shimmer.fromColors(
+ baseColor: Colors.grey.shade400,
+ highlightColor: Colors.grey.shade100,
+ enabled: true,
+ child: const Row(
+ children: [
+ D3pBodyMediumText('status_pending'),
+ SizedBox(width: 8),
+ Icon(
+ Icons.access_time_outlined,
+ size: 16,
+ ),
+ ],
+ ),
+ );
+ case ExtrisincStatus.success:
+ return const D3pBodyMediumText(
+ 'status_success',
+ color: Colors.green,
+ );
+ case ExtrisincStatus.error:
+ return const D3pBodyMediumText(
+ 'status_error',
+ );
+ case ExtrisincStatus.failed:
+ return const D3pBodyMediumText(
+ 'status_failed',
+ );
+ }
+ }
+}
+
+class _Message extends StatelessWidget {
+ final String? message;
+ final ExtrisincStatus? status;
+
+ const _Message(this.message, this.status);
+
+ @override
+ Widget build(final BuildContext context) {
+ if (message != null && status != ExtrisincStatus.success) {
+ return Column(
+ children: [
+ D3pBodyLargeText(
+ message!,
+ translate: false,
+ ),
+ const SizedBoxH4(),
+ ],
+ );
+ } else {
+ return const SizedBox();
+ }
+ }
+}
diff --git a/lib/features/wallet_screen/presentation/notifications_page/widgets/notification_card.dart b/lib/features/wallet_screen/presentation/notifications_page/widgets/notification_card.dart
new file mode 100644
index 00000000..e3e2c9f7
--- /dev/null
+++ b/lib/features/wallet_screen/presentation/notifications_page/widgets/notification_card.dart
@@ -0,0 +1,19 @@
+import 'package:flutter/material.dart';
+import 'package:threedpass/features/wallet_screen/bloc/notifications_cubit.dart';
+import 'package:threedpass/features/wallet_screen/presentation/notifications_page/widgets/notifcation_transfer.dart';
+
+class NotificationCard extends StatelessWidget {
+ const NotificationCard({required this.notificationDTO, super.key});
+
+ final NotificationDTO notificationDTO;
+
+ @override
+ Widget build(final BuildContext context) {
+ switch (notificationDTO.type) {
+ case NotificationType.transfer:
+ return NotificationTransferCard(notificationDTO);
+ case NotificationType.vote:
+ return Text('Not implemented yet');
+ }
+ }
+}
diff --git a/lib/features/wallet_screen/presentation/notifications_page/widgets/notifications_list.dart b/lib/features/wallet_screen/presentation/notifications_page/widgets/notifications_list.dart
new file mode 100644
index 00000000..889e41fb
--- /dev/null
+++ b/lib/features/wallet_screen/presentation/notifications_page/widgets/notifications_list.dart
@@ -0,0 +1,26 @@
+import 'package:flutter/material.dart';
+import 'package:flutter_bloc/flutter_bloc.dart';
+import 'package:threedpass/features/wallet_screen/bloc/notifications_cubit.dart';
+import 'package:threedpass/features/wallet_screen/presentation/notifications_page/widgets/notification_card.dart';
+
+class NotificationsList extends StatelessWidget {
+ const NotificationsList({super.key});
+
+ @override
+ Widget build(final BuildContext context) {
+ return BlocBuilder(
+ builder: (final context, final state) {
+ return ListView.builder(
+ padding: const EdgeInsets.only(top: 8),
+ itemCount: state.notifications.length,
+ shrinkWrap: true,
+ itemBuilder: (final _, final index) {
+ return NotificationCard(
+ notificationDTO: state.notifications[index],
+ );
+ },
+ );
+ },
+ );
+ }
+}
diff --git a/lib/features/wallet_screen/presentation/transactions_history/domain/entities/mapper_transfer_item.dart b/lib/features/wallet_screen/presentation/transactions_history/domain/entities/mapper_transfer_item.dart
index 514988a0..cac65744 100644
--- a/lib/features/wallet_screen/presentation/transactions_history/domain/entities/mapper_transfer_item.dart
+++ b/lib/features/wallet_screen/presentation/transactions_history/domain/entities/mapper_transfer_item.dart
@@ -1,4 +1,5 @@
import 'package:polkawallet_sdk/api/types/networkStateData.dart';
+import 'package:threedpass/core/polkawallet/utils/balance_utils.dart';
import 'package:threedpass/core/polkawallet/utils/network_state_data_extension.dart';
import 'package:threedpass/features/wallet_screen/domain/entities/transfer_history_ui.dart';
import 'package:threedpass/features/wallet_screen/presentation/transactions_history/domain/entities/transfer_item.dart';
@@ -9,14 +10,18 @@ class MapperTransferItemToUI {
required final NetworkStateData data,
required final bool isFrom,
}) {
+ final moneyStr = BalanceUtils.balance(
+ item.autoGeneratedObject.value?.toInt().toString() ?? '',
+ data.safeDecimals,
+ );
return TransferHistoryUI(
- amount: item.autoGeneratedObject.value?.toInt().toString() ?? '',
+ amount: moneyStr,
blockDateTime:
DateTime.parse(item.autoGeneratedObject.blockDatetime?.value ?? ''),
fromAddress: item.fromAddress.toString(),
toAddress: item.toAddress.toString(),
symbols: data.tokenSymbol?.first ?? '',
- isFrom: isFrom,
+ direction: isFrom ? TransferDirection.from : TransferDirection.to,
extrisincStatus: null,
decimals: data.safeDecimals,
);
diff --git a/lib/features/wallet_screen/presentation/transfer_page/transfer_page.dart b/lib/features/wallet_screen/presentation/transfer_page/transfer_page.dart
index 74a2570d..f3ec464e 100644
--- a/lib/features/wallet_screen/presentation/transfer_page/transfer_page.dart
+++ b/lib/features/wallet_screen/presentation/transfer_page/transfer_page.dart
@@ -2,8 +2,6 @@ import 'package:auto_route/auto_route.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
-import 'package:flutter_platform_widgets/flutter_platform_widgets.dart';
-import 'package:logger/logger.dart';
import 'package:threedpass/core/polkawallet/app_service.dart';
import 'package:threedpass/core/polkawallet/bloc/app_service_cubit.dart';
import 'package:threedpass/core/polkawallet/utils/balance_utils.dart';
@@ -13,17 +11,15 @@ import 'package:threedpass/core/widgets/buttons/elevated_button.dart';
import 'package:threedpass/core/widgets/d3p_scaffold.dart';
import 'package:threedpass/core/widgets/input/textformfield/textformfield.dart';
import 'package:threedpass/core/widgets/paddings.dart';
-import 'package:threedpass/core/widgets/text/d3p_body_large_text.dart';
import 'package:threedpass/features/wallet_screen/bloc/transfer_info_cubit.dart';
+import 'package:threedpass/features/wallet_screen/domain/entities/transfer_meta_dto.dart';
import 'package:threedpass/features/wallet_screen/presentation/transfer_page/widgets/transfer_type_dropdown.dart';
-import 'package:threedpass/setup.dart';
part './widgets/make_transfer_button.dart';
part 'widgets/from_address_textfield.dart';
part 'widgets/to_address_textfield.dart';
part 'widgets/amount_textfield.dart';
part 'widgets/password_textfield.dart';
-part 'widgets/fees_text.dart';
@RoutePage()
class TransferPage extends StatelessWidget {
@@ -65,6 +61,7 @@ class TransferPage extends StatelessWidget {
const SizedBoxH24(),
_AmountTextFieldBuilder(
amountController: amountController,
+ transferMetaDTO: transferInfo.metaDTO,
),
const SizedBoxH24(),
_PasswordTextField(
@@ -73,7 +70,7 @@ class TransferPage extends StatelessWidget {
const SizedBoxH24(),
const TransferTypeDropdown(),
// const SizedBox(height: 24),
- // const _FeesText(),
+ // const FeesText(),
const SizedBox(height: 36),
],
),
diff --git a/lib/features/wallet_screen/presentation/transfer_page/widgets/amount_textfield.dart b/lib/features/wallet_screen/presentation/transfer_page/widgets/amount_textfield.dart
index b6b3c3cc..f184ab67 100644
--- a/lib/features/wallet_screen/presentation/transfer_page/widgets/amount_textfield.dart
+++ b/lib/features/wallet_screen/presentation/transfer_page/widgets/amount_textfield.dart
@@ -3,10 +3,12 @@ part of '../transfer_page.dart';
class _AmountTextFieldBuilder extends StatelessWidget {
const _AmountTextFieldBuilder({
required this.amountController,
+ required this.transferMetaDTO,
final Key? key,
}) : super(key: key);
final TextEditingController amountController;
+ final TransferMetaDTO transferMetaDTO;
@override
Widget build(final BuildContext context) {
@@ -16,6 +18,7 @@ class _AmountTextFieldBuilder extends StatelessWidget {
builder: (final context, final state) => _AmountTextField(
amountController: amountController,
balance: state.balance,
+ transferMetaDTO: transferMetaDTO,
),
);
}
@@ -25,46 +28,92 @@ class _AmountTextField extends StatelessWidget {
const _AmountTextField({
required this.amountController,
required this.balance,
+ required this.transferMetaDTO,
final Key? key,
}) : super(key: key);
final TextEditingController amountController;
- final String balance;
+ final TransferMetaDTO transferMetaDTO;
+ final double balance;
- String? _amountValidator(final String? v) {
+ String? Function(String? v) validator() {
+ switch (transferMetaDTO.type) {
+ case MetaInfoType.coin:
+ return _DoubleValidator(balance).amountValidator;
+ case MetaInfoType.asset:
+ return _IntValidator(balance).amountValidator;
+ }
+ }
+
+ @override
+ Widget build(final BuildContext context) {
+ return D3pTextFormField(
+ labelText: 'amount_label'.tr(
+ args: [
+ BalanceUtils.doubleFormat(balance),
+ ],
+ ),
+ controller: amountController,
+ hintText: 'amount_hint'.tr(),
+ validator: validator(),
+ keyboardType: TextInputType.number,
+ );
+ }
+}
+
+abstract class _Validator {
+ const _Validator();
+
+ String? amountValidator(final String? v);
+}
+
+class _DoubleValidator extends _Validator {
+ const _DoubleValidator(this.balance);
+
+ final double balance;
+
+ @override
+ String? amountValidator(final String? v) {
if (v != null) {
try {
- final inputD = BalanceUtils.balanceToDouble(v);
+ final inputD = double.parse(v);
- if (inputD <= BalanceUtils.balanceToDouble(balance)) {
+ if (inputD <= balance && inputD >= 0) {
return null;
} else {
- getIt().e(
- '_amountValidator. input > balance. input: $v, balance: $balance',
- );
return 'error_wrong_amount'.tr();
}
} on Exception catch (_) {
- getIt().e('_amountValidator. v is NOT double');
return 'error_wrong_amount'.tr();
}
} else {
- getIt().e('_amountValidator. v is null');
return 'error_wrong_amount'.tr();
}
}
+}
+
+class _IntValidator extends _Validator {
+ const _IntValidator(this.balance);
+
+ final double balance;
@override
- Widget build(final BuildContext context) {
- return D3pTextFormField(
- labelText: 'amount_label'.tr(
- args: [
- balance,
- ],
- ),
- controller: amountController,
- hintText: 'amount_hint'.tr(),
- validator: _amountValidator,
- );
+ String? amountValidator(final String? v) {
+ if (v != null) {
+ try {
+ final inputD = int.parse(v);
+
+ if (inputD <= balance && inputD >= 0) {
+ // if (true) {
+ return null;
+ } else {
+ return 'error_wrong_amount_int'.tr();
+ }
+ } on Exception catch (_) {
+ return 'error_wrong_amount_int'.tr();
+ }
+ } else {
+ return 'error_wrong_amount_int'.tr();
+ }
}
}
diff --git a/lib/features/wallet_screen/presentation/transfer_page/widgets/fees_text.dart b/lib/features/wallet_screen/presentation/transfer_page/widgets/fees_text.dart
index 1eab6273..1eaf9563 100644
--- a/lib/features/wallet_screen/presentation/transfer_page/widgets/fees_text.dart
+++ b/lib/features/wallet_screen/presentation/transfer_page/widgets/fees_text.dart
@@ -1,7 +1,13 @@
-part of '../transfer_page.dart';
+import 'package:easy_localization/easy_localization.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter_bloc/flutter_bloc.dart';
+import 'package:flutter_platform_widgets/flutter_platform_widgets.dart';
+import 'package:threedpass/core/polkawallet/utils/balance_utils.dart';
+import 'package:threedpass/core/widgets/text/d3p_body_large_text.dart';
+import 'package:threedpass/features/wallet_screen/bloc/transfer_info_cubit.dart';
-class _FeesText extends StatelessWidget {
- const _FeesText({
+class FeesText extends StatelessWidget {
+ const FeesText({
final Key? key,
}) : super(key: key);
@@ -9,7 +15,6 @@ class _FeesText extends StatelessWidget {
Widget build(final BuildContext context) {
return BlocBuilder(
builder: (final context, final state) {
- print(state.fees?.partialFee);
return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
diff --git a/lib/features/wallet_screen/presentation/wallet_page/wallet_page_wrapper.dart b/lib/features/wallet_screen/presentation/wallet_page/wallet_page_wrapper.dart
index 25234b78..6dd66969 100644
--- a/lib/features/wallet_screen/presentation/wallet_page/wallet_page_wrapper.dart
+++ b/lib/features/wallet_screen/presentation/wallet_page/wallet_page_wrapper.dart
@@ -2,6 +2,7 @@ import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:threedpass/features/preview_page/bloc/outer_context_cubit.dart';
+import 'package:threedpass/features/wallet_screen/bloc/notifications_cubit.dart';
@RoutePage()
class WalletPageWrapper extends StatelessWidget implements AutoRouteWrapper {
@@ -18,6 +19,9 @@ class WalletPageWrapper extends StatelessWidget implements AutoRouteWrapper {
create: (final _) => OuterContextCubit(context),
lazy: false,
),
+ BlocProvider(
+ create: (_) => NotificationsCubit()..init(),
+ ),
],
child: this,
);
diff --git a/lib/features/wallet_screen/presentation/widgets/block_datetime_w.dart b/lib/features/wallet_screen/presentation/widgets/block_datetime_w.dart
index 1076486a..017fbfb3 100644
--- a/lib/features/wallet_screen/presentation/widgets/block_datetime_w.dart
+++ b/lib/features/wallet_screen/presentation/widgets/block_datetime_w.dart
@@ -4,15 +4,19 @@ import 'package:threedpass/core/widgets/text/d3p_body_medium_text.dart';
class BlockDateTimeW extends StatelessWidget {
const BlockDateTimeW(this.dateTime, {super.key});
- // final GDateTime dateTime;
- final DateTime dateTime;
+
+ final DateTime? dateTime;
@override
Widget build(final BuildContext context) {
// final dt = DateTime.parse(dateTime.value);
- final fmt = DateFormat('kk:mm – dd-MM-yyyy').format(dateTime);
- return D3pBodyMediumText(
- fmt,
- translate: false,
- );
+ if (dateTime != null) {
+ final fmt = DateFormat('kk:mm – dd-MM-yyyy').format(dateTime!);
+ return D3pBodyMediumText(
+ fmt,
+ translate: false,
+ );
+ } else {
+ return const SizedBox();
+ }
}
}
diff --git a/lib/features/wallet_screen/presentation/widgets/extrinsic_status_icon.dart b/lib/features/wallet_screen/presentation/widgets/extrinsic_status_icon.dart
index cff1945e..88ddf041 100644
--- a/lib/features/wallet_screen/presentation/widgets/extrinsic_status_icon.dart
+++ b/lib/features/wallet_screen/presentation/widgets/extrinsic_status_icon.dart
@@ -26,7 +26,7 @@ class ExtrinsicStatusIcon extends StatelessWidget {
Icons.check,
color: Colors.green,
);
- case ExtrisincStatus.fail:
+ case ExtrisincStatus.failed:
return const Icon(
Icons.close,
color: Colors.red,
diff --git a/lib/features/wallet_screen/presentation/widgets/transaction_item.dart b/lib/features/wallet_screen/presentation/widgets/transaction_item.dart
index 28275bf4..f40102cb 100644
--- a/lib/features/wallet_screen/presentation/widgets/transaction_item.dart
+++ b/lib/features/wallet_screen/presentation/widgets/transaction_item.dart
@@ -1,7 +1,4 @@
-// part of '../transactions_history_page.dart';
-
import 'package:flutter/material.dart';
-import 'package:threedpass/core/polkawallet/utils/balance_utils.dart';
import 'package:threedpass/core/widgets/paddings.dart';
import 'package:threedpass/core/widgets/text/d3p_body_large_text.dart';
import 'package:threedpass/features/wallet_screen/domain/entities/transfer_history_ui.dart';
@@ -28,13 +25,13 @@ class TransactionItem extends StatelessWidget {
ShortAddress(
prefix: 'From:',
address: object.fromAddress,
- colorSecondary: object.isFrom,
+ colorSecondary: object.direction == TransferDirection.from,
),
const SizedBoxH4(),
ShortAddress(
prefix: 'To:',
address: object.toAddress,
- colorSecondary: !object.isFrom,
+ colorSecondary: object.direction == TransferDirection.to,
),
const SizedBoxH8(),
BlockDateTimeW(
@@ -53,24 +50,18 @@ class _AmountRow extends StatelessWidget {
@override
Widget build(final BuildContext context) {
- return object.extrisincStatus != null
- ? Row(
- children: [
- _TransactionAmount(
- object.amount,
- object.symbols,
- object.decimals,
- ),
- const SizedBox(width: 16),
- ExtrinsicStatusIcon(object.extrisincStatus!),
- ],
- )
- : _TransactionAmount(
- object.amount,
- object.symbols,
- object.decimals,
- // object.autoGeneratedObject.value!.toInt().toString(),
- );
+ return Row(
+ children: [
+ _TransactionAmount(
+ object.amount,
+ object.symbols,
+ object.decimals,
+ ),
+ const SizedBox(width: 16),
+ if (object.extrisincStatus != null)
+ ExtrinsicStatusIcon(object.extrisincStatus!),
+ ],
+ );
}
}
@@ -88,12 +79,9 @@ class _TransactionAmount extends StatelessWidget {
@override
Widget build(final BuildContext context) {
// final appService = BlocProvider.of(context).state;
- final moneyStr = BalanceUtils.balance(
- amount,
- decimals,
- );
+
return D3pBodyLargeText(
- '$moneyStr $symbols',
+ '$amount $symbols',
translate: false,
);
}
diff --git a/lib/features/wallet_screen/router/wallet_page_route.dart b/lib/features/wallet_screen/router/wallet_page_route.dart
index bafd7992..25ee17fe 100644
--- a/lib/features/wallet_screen/router/wallet_page_route.dart
+++ b/lib/features/wallet_screen/router/wallet_page_route.dart
@@ -24,19 +24,18 @@ AutoRoute walletPageRoute = AutoRoute(
),
AutoRoute(
page: RecieveRoute.page,
- // name: RouteNames.recievePage,
+ ),
+ AutoRoute(
+ page: NotificationsRoute.page,
),
AutoRoute(
page: TransactionsHistoryRouteWrapper.page,
- // name: RouteNames.transactionsHistoryPage,
),
AutoRoute(
page: NonNativeTokenRouteWrapper.page,
- // name: RouteNames.nonNativeTokenScreen,
),
CustomRoute(
page: RemoveAccountRoute.page,
- // name: RouteNames.removeAccountDialog,
customRouteBuilder: dialogBuilder,
),
],
diff --git a/lib/router/router.gr.dart b/lib/router/router.gr.dart
index 189a25f9..a9e5448a 100644
--- a/lib/router/router.gr.dart
+++ b/lib/router/router.gr.dart
@@ -8,37 +8,37 @@
// coverage:ignore-file
// ignore_for_file: no_leading_underscores_for_library_prefixes
-import 'package:auto_route/auto_route.dart' as _i43;
-import 'package:flutter/material.dart' as _i44;
-import 'package:flutter/widgets.dart' as _i50;
+import 'package:auto_route/auto_route.dart' as _i44;
+import 'package:flutter/material.dart' as _i45;
+import 'package:flutter/widgets.dart' as _i51;
import 'package:threedpass/core/widgets/default_loading_dialog.dart' as _i2;
import 'package:threedpass/core/widgets/error_page.dart' as _i1;
import 'package:threedpass/features/accounts/presentation/pages/create_account/create_account_credentials.dart'
- as _i30;
+ as _i31;
import 'package:threedpass/features/accounts/presentation/pages/create_account/create_account_from_object/create_account_from_object.dart'
- as _i25;
+ as _i26;
import 'package:threedpass/features/accounts/presentation/pages/create_account/create_account_info_page.dart'
- as _i27;
+ as _i28;
import 'package:threedpass/features/accounts/presentation/pages/create_account/create_account_loader.dart'
- as _i32;
+ as _i33;
import 'package:threedpass/features/accounts/presentation/pages/create_account/create_account_mnemonic_backup.dart'
- as _i28;
-import 'package:threedpass/features/accounts/presentation/pages/create_account/create_account_mnemonic_confirm.dart'
as _i29;
+import 'package:threedpass/features/accounts/presentation/pages/create_account/create_account_mnemonic_confirm.dart'
+ as _i30;
import 'package:threedpass/features/accounts/presentation/pages/create_account/create_account_type.dart'
- as _i31;
+ as _i32;
import 'package:threedpass/features/accounts/presentation/pages/create_account/create_account_wrapper.dart'
- as _i24;
+ as _i25;
import 'package:threedpass/features/accounts/presentation/pages/create_account/import_mnemonic_form.dart'
- as _i26;
+ as _i27;
import 'package:threedpass/features/accounts/presentation/pages/no_stable_hash_dialog.dart'
- as _i33;
+ as _i34;
import 'package:threedpass/features/compare_page/presentation/pages/compare_page_wrapper.dart'
as _i3;
import 'package:threedpass/features/hashes_list/domain/entities/hash_object.dart'
- as _i46;
+ as _i47;
import 'package:threedpass/features/hashes_list/domain/entities/snapshot.dart'
- as _i45;
+ as _i46;
import 'package:threedpass/features/home_page/presentation/home_page.dart'
as _i14;
import 'package:threedpass/features/home_page/presentation/login_page.dart'
@@ -46,7 +46,7 @@ import 'package:threedpass/features/home_page/presentation/login_page.dart'
import 'package:threedpass/features/home_page/router/empty_initial_route.dart'
as _i15;
import 'package:threedpass/features/preview_page/bloc/preview_page_cubit.dart'
- as _i47;
+ as _i48;
import 'package:threedpass/features/preview_page/presentation/preview_page.dart'
as _i5;
import 'package:threedpass/features/preview_page/presentation/preview_page_wrapper.dart'
@@ -66,54 +66,56 @@ import 'package:threedpass/features/scan_page/presentation/pages/scan_page_wrapp
import 'package:threedpass/features/scan_page/presentation/widgets/calc_hash_loading_dialog.dart'
as _i12;
import 'package:threedpass/features/settings_page/domain/entities/global_settings.dart'
- as _i51;
+ as _i52;
import 'package:threedpass/features/settings_page/presentation/settings_page.dart'
- as _i34;
+ as _i35;
import 'package:threedpass/features/settings_page/presentation/settings_sub_page/choose_algorithm_subpage.dart'
- as _i40;
+ as _i41;
import 'package:threedpass/features/settings_page/presentation/settings_sub_page/grid_size_subpage.dart'
- as _i37;
-import 'package:threedpass/features/settings_page/presentation/settings_sub_page/pixel_ratio_subpage.dart'
as _i38;
+import 'package:threedpass/features/settings_page/presentation/settings_sub_page/pixel_ratio_subpage.dart'
+ as _i39;
import 'package:threedpass/features/settings_page/presentation/settings_sub_page/sections_subpage.dart'
- as _i35;
+ as _i36;
import 'package:threedpass/features/settings_page/presentation/settings_sub_page/stable_hash_subpage.dart'
- as _i41;
+ as _i42;
import 'package:threedpass/features/settings_page/presentation/settings_sub_page/trans_bytes_subpage.dart'
- as _i36;
+ as _i37;
import 'package:threedpass/features/settings_page/presentation/settings_sub_page/wallet_node_subpage.dart'
- as _i39;
+ as _i40;
import 'package:threedpass/features/settings_page/router/empty_settings_route.dart'
- as _i42;
+ as _i43;
import 'package:threedpass/features/wallet_screen/domain/entities/transfer_meta_dto.dart'
- as _i48;
+ as _i49;
import 'package:threedpass/features/wallet_screen/presentation/assets_page/remove_account_dialog.dart'
as _i16;
import 'package:threedpass/features/wallet_screen/presentation/non_native_token_screen/domain/entities/get_extrinsics_usecase_params.dart'
- as _i49;
+ as _i50;
import 'package:threedpass/features/wallet_screen/presentation/non_native_token_screen/presentation/non_native_token_wrapper.dart'
- as _i22;
+ as _i23;
+import 'package:threedpass/features/wallet_screen/presentation/notifications_page/notifications_page.dart'
+ as _i18;
import 'package:threedpass/features/wallet_screen/presentation/recieve_page/recieve_page.dart'
as _i17;
import 'package:threedpass/features/wallet_screen/presentation/transactions_history/presentation/transactions_history_wrapper.dart'
- as _i23;
+ as _i24;
import 'package:threedpass/features/wallet_screen/presentation/transfer_page/transfer_page.dart'
- as _i21;
+ as _i22;
import 'package:threedpass/features/wallet_screen/presentation/transfer_page/transfer_page_wrapper.dart'
- as _i20;
+ as _i21;
import 'package:threedpass/features/wallet_screen/presentation/wallet_page/wallet_page.dart'
- as _i18;
-import 'package:threedpass/features/wallet_screen/presentation/wallet_page/wallet_page_wrapper.dart'
as _i19;
+import 'package:threedpass/features/wallet_screen/presentation/wallet_page/wallet_page_wrapper.dart'
+ as _i20;
-abstract class $RootRouter extends _i43.RootStackRouter {
+abstract class $RootRouter extends _i44.RootStackRouter {
$RootRouter({super.navigatorKey});
@override
- final Map pagesMap = {
+ final Map pagesMap = {
ErrorRoute.name: (routeData) {
final args = routeData.argsAs();
- return _i43.AutoRoutePage(
+ return _i44.AutoRoutePage(
routeData: routeData,
child: _i1.ErrorPage(
error: args.error,
@@ -124,7 +126,7 @@ abstract class $RootRouter extends _i43.RootStackRouter {
DefaultLoadingRoute.name: (routeData) {
final args = routeData.argsAs(
orElse: () => const DefaultLoadingRouteArgs());
- return _i43.AutoRoutePage(
+ return _i44.AutoRoutePage(
routeData: routeData,
child: _i2.DefaultLoadingDialog(
key: args.key,
@@ -134,7 +136,7 @@ abstract class $RootRouter extends _i43.RootStackRouter {
},
CompareRouteWrapper.name: (routeData) {
final args = routeData.argsAs();
- return _i43.AutoRoutePage(
+ return _i44.AutoRoutePage(
routeData: routeData,
child: _i3.ComparePageWrapper(
origObj: args.origObj,
@@ -145,9 +147,9 @@ abstract class $RootRouter extends _i43.RootStackRouter {
},
PreviewRouteWrapper.name: (routeData) {
final args = routeData.argsAs();
- return _i43.AutoRoutePage(
+ return _i44.AutoRoutePage(
routeData: routeData,
- child: _i43.WrappedRoute(
+ child: _i44.WrappedRoute(
child: _i4.PreviewPageWrapper(
hashObject: args.hashObject,
snapshot: args.snapshot,
@@ -157,14 +159,14 @@ abstract class $RootRouter extends _i43.RootStackRouter {
);
},
PreviewRoute.name: (routeData) {
- return _i43.AutoRoutePage(
+ return _i44.AutoRoutePage(
routeData: routeData,
child: const _i5.PreviewPage(),
);
},
RenameSnapshotRoute.name: (routeData) {
final args = routeData.argsAs();
- return _i43.AutoRoutePage(
+ return _i44.AutoRoutePage(
routeData: routeData,
child: _i6.RenameSnapshotDialog(
snapshot: args.snapshot,
@@ -175,7 +177,7 @@ abstract class $RootRouter extends _i43.RootStackRouter {
},
SaveHashRoute.name: (routeData) {
final args = routeData.argsAs();
- return _i43.AutoRoutePage(
+ return _i44.AutoRoutePage(
routeData: routeData,
child: _i7.SaveHashDialog(
snapshot: args.snapshot,
@@ -186,7 +188,7 @@ abstract class $RootRouter extends _i43.RootStackRouter {
},
SaveTopHashesRoute.name: (routeData) {
final args = routeData.argsAs();
- return _i43.AutoRoutePage(
+ return _i44.AutoRoutePage(
routeData: routeData,
child: _i8.SaveTopHashesDialog(
pageCubitState: args.pageCubitState,
@@ -196,7 +198,7 @@ abstract class $RootRouter extends _i43.RootStackRouter {
},
SaveObjectRoute.name: (routeData) {
final args = routeData.argsAs();
- return _i43.AutoRoutePage(
+ return _i44.AutoRoutePage(
routeData: routeData,
child: _i9.SaveObjectDialog(
snapshot: args.snapshot,
@@ -205,19 +207,19 @@ abstract class $RootRouter extends _i43.RootStackRouter {
);
},
ScanRouteWrapper.name: (routeData) {
- return _i43.AutoRoutePage(
+ return _i44.AutoRoutePage(
routeData: routeData,
- child: _i43.WrappedRoute(child: const _i10.ScanPageWrapper()),
+ child: _i44.WrappedRoute(child: const _i10.ScanPageWrapper()),
);
},
ScanRoute.name: (routeData) {
- return _i43.AutoRoutePage(
+ return _i44.AutoRoutePage(
routeData: routeData,
child: const _i11.ScanPage(),
);
},
CalcHashLoadingRoute.name: (routeData) {
- return _i43.AutoRoutePage(
+ return _i44.AutoRoutePage(
routeData: routeData,
child: const _i12.CalcHashLoadingDialog(),
);
@@ -225,7 +227,7 @@ abstract class $RootRouter extends _i43.RootStackRouter {
LoginRoute.name: (routeData) {
final args = routeData.argsAs(
orElse: () => const LoginRouteArgs());
- return _i43.AutoRoutePage(
+ return _i44.AutoRoutePage(
routeData: routeData,
child: _i13.LoginPage(
key: args.key,
@@ -234,47 +236,53 @@ abstract class $RootRouter extends _i43.RootStackRouter {
);
},
HomeRoute.name: (routeData) {
- return _i43.AutoRoutePage(
+ return _i44.AutoRoutePage(
routeData: routeData,
child: const _i14.HomePage(),
);
},
InitialWrapperRoute.name: (routeData) {
- return _i43.AutoRoutePage(
+ return _i44.AutoRoutePage(
routeData: routeData,
child: const _i15.EmptyInitialRoute(),
);
},
RemoveAccountRoute.name: (routeData) {
- return _i43.AutoRoutePage(
+ return _i44.AutoRoutePage(
routeData: routeData,
child: const _i16.RemoveAccountDialog(),
);
},
RecieveRoute.name: (routeData) {
- return _i43.AutoRoutePage(
+ return _i44.AutoRoutePage(
routeData: routeData,
child: const _i17.RecievePage(),
);
},
+ NotificationsRoute.name: (routeData) {
+ return _i44.AutoRoutePage(
+ routeData: routeData,
+ child: const _i18.NotificationsPage(),
+ );
+ },
WalletRoute.name: (routeData) {
- return _i43.AutoRoutePage(
+ return _i44.AutoRoutePage(
routeData: routeData,
- child: const _i18.WalletPage(),
+ child: const _i19.WalletPage(),
);
},
WalletRouteWrapper.name: (routeData) {
- return _i43.AutoRoutePage(
+ return _i44.AutoRoutePage(
routeData: routeData,
- child: _i43.WrappedRoute(child: const _i19.WalletPageWrapper()),
+ child: _i44.WrappedRoute(child: const _i20.WalletPageWrapper()),
);
},
TransferRouteWrapper.name: (routeData) {
final args = routeData.argsAs();
- return _i43.AutoRoutePage(
+ return _i44.AutoRoutePage(
routeData: routeData,
- child: _i43.WrappedRoute(
- child: _i20.TransferPageWrapper(
+ child: _i44.WrappedRoute(
+ child: _i21.TransferPageWrapper(
metadata: args.metadata,
key: args.key,
)),
@@ -283,104 +291,104 @@ abstract class $RootRouter extends _i43.RootStackRouter {
TransferRoute.name: (routeData) {
final args = routeData.argsAs(
orElse: () => const TransferRouteArgs());
- return _i43.AutoRoutePage(
+ return _i44.AutoRoutePage(
routeData: routeData,
- child: _i21.TransferPage(key: args.key),
+ child: _i22.TransferPage(key: args.key),
);
},
NonNativeTokenRouteWrapper.name: (routeData) {
final args = routeData.argsAs();
- return _i43.AutoRoutePage(
+ return _i44.AutoRoutePage(
routeData: routeData,
- child: _i22.NonNativeTokenPageWrapper(
+ child: _i23.NonNativeTokenPageWrapper(
args.params,
key: args.key,
),
);
},
TransactionsHistoryRouteWrapper.name: (routeData) {
- return _i43.AutoRoutePage(
+ return _i44.AutoRoutePage(
routeData: routeData,
- child: const _i23.TransactionsHistoryPageWrapper(),
+ child: const _i24.TransactionsHistoryPageWrapper(),
);
},
CreateAccountRouteWrapper.name: (routeData) {
- return _i43.AutoRoutePage(
+ return _i44.AutoRoutePage(
routeData: routeData,
- child: _i43.WrappedRoute(child: const _i24.CreateAccountPageWrapper()),
+ child: _i44.WrappedRoute(child: const _i25.CreateAccountPageWrapper()),
);
},
CreateAccountFromObjectRoute.name: (routeData) {
- return _i43.AutoRoutePage(
+ return _i44.AutoRoutePage(
routeData: routeData,
- child: const _i25.CreateAccountFromObjectPage(),
+ child: const _i26.CreateAccountFromObjectPage(),
);
},
ImportMnemonicFormRoute.name: (routeData) {
final args = routeData.argsAs(
orElse: () => const ImportMnemonicFormRouteArgs());
- return _i43.AutoRoutePage(
+ return _i44.AutoRoutePage(
routeData: routeData,
- child: _i26.ImportMnemonicFormPage(key: args.key),
+ child: _i27.ImportMnemonicFormPage(key: args.key),
);
},
CreateAccountInfoRoute.name: (routeData) {
- return _i43.AutoRoutePage(
+ return _i44.AutoRoutePage(
routeData: routeData,
- child: const _i27.CreateAccountInfoPage(),
+ child: const _i28.CreateAccountInfoPage(),
);
},
CreateAccountMnemonicBackupRoute.name: (routeData) {
- return _i43.AutoRoutePage(
+ return _i44.AutoRoutePage(
routeData: routeData,
- child: const _i28.CreateAccountMnemonicBackupPage(),
+ child: const _i29.CreateAccountMnemonicBackupPage(),
);
},
CreateAccountMnemonicConfirmRoute.name: (routeData) {
- return _i43.AutoRoutePage(
+ return _i44.AutoRoutePage(
routeData: routeData,
- child: const _i29.CreateAccountMnemonicConfirmPage(),
+ child: const _i30.CreateAccountMnemonicConfirmPage(),
);
},
CreateAccountCredentialsRoute.name: (routeData) {
final args = routeData.argsAs();
- return _i43.AutoRoutePage(
+ return _i44.AutoRoutePage(
routeData: routeData,
- child: _i30.CreateAccountCredentialsPage(
+ child: _i31.CreateAccountCredentialsPage(
appbarText: args.appbarText,
key: args.key,
),
);
},
CreateAccountTypeRoute.name: (routeData) {
- return _i43.AutoRoutePage(
+ return _i44.AutoRoutePage(
routeData: routeData,
- child: const _i31.CreateAccountTypePage(),
+ child: const _i32.CreateAccountTypePage(),
);
},
CreateAccountLoaderRoute.name: (routeData) {
- return _i43.AutoRoutePage(
+ return _i44.AutoRoutePage(
routeData: routeData,
- child: const _i32.CreateAccountLoaderPage(),
+ child: const _i33.CreateAccountLoaderPage(),
);
},
NoStableHashRoute.name: (routeData) {
- return _i43.AutoRoutePage(
+ return _i44.AutoRoutePage(
routeData: routeData,
- child: const _i33.NoStableHashDialog(),
+ child: const _i34.NoStableHashDialog(),
);
},
SettingsRoute.name: (routeData) {
- return _i43.AutoRoutePage(
+ return _i44.AutoRoutePage(
routeData: routeData,
- child: const _i34.SettingsPage(),
+ child: const _i35.SettingsPage(),
);
},
SectionsSubRoute.name: (routeData) {
final args = routeData.argsAs();
- return _i43.AutoRoutePage(
+ return _i44.AutoRoutePage(
routeData: routeData,
- child: _i35.SectionsSubPage(
+ child: _i36.SectionsSubPage(
initialState: args.initialState,
key: args.key,
),
@@ -388,56 +396,56 @@ abstract class $RootRouter extends _i43.RootStackRouter {
},
TransBytesSubRoute.name: (routeData) {
final args = routeData.argsAs();
- return _i43.AutoRoutePage(
+ return _i44.AutoRoutePage(
routeData: routeData,
- child: _i36.TransBytesSubPage(
+ child: _i37.TransBytesSubPage(
initialState: args.initialState,
key: args.key,
),
);
},
GridSizeSubRoute.name: (routeData) {
- return _i43.AutoRoutePage(
+ return _i44.AutoRoutePage(
routeData: routeData,
- child: const _i37.GridSizeSubPage(),
+ child: const _i38.GridSizeSubPage(),
);
},
PixelRatioSubRoute.name: (routeData) {
- return _i43.AutoRoutePage(
+ return _i44.AutoRoutePage(
routeData: routeData,
- child: const _i38.PixelRatioSubPage(),
+ child: const _i39.PixelRatioSubPage(),
);
},
WalletNodeSubRoute.name: (routeData) {
final args = routeData.argsAs();
- return _i43.AutoRoutePage(
+ return _i44.AutoRoutePage(
routeData: routeData,
- child: _i39.WalletNodeSubPage(
+ child: _i40.WalletNodeSubPage(
initialState: args.initialState,
key: args.key,
),
);
},
ChooseAlgorithmSubRoute.name: (routeData) {
- return _i43.AutoRoutePage(
+ return _i44.AutoRoutePage(
routeData: routeData,
- child: const _i40.ChooseAlgorithmSubPage(),
+ child: const _i41.ChooseAlgorithmSubPage(),
);
},
StableHashSubRoute.name: (routeData) {
final args = routeData.argsAs();
- return _i43.AutoRoutePage(
+ return _i44.AutoRoutePage(
routeData: routeData,
- child: _i41.StableHashSubPage(
+ child: _i42.StableHashSubPage(
initialState: args.initialState,
key: args.key,
),
);
},
SettingsWrapperRoute.name: (routeData) {
- return _i43.AutoRoutePage(
+ return _i44.AutoRoutePage(
routeData: routeData,
- child: const _i42.EmptySettingsRoute(),
+ child: const _i43.EmptySettingsRoute(),
);
},
};
@@ -445,11 +453,11 @@ abstract class $RootRouter extends _i43.RootStackRouter {
/// generated route for
/// [_i1.ErrorPage]
-class ErrorRoute extends _i43.PageRouteInfo {
+class ErrorRoute extends _i44.PageRouteInfo {
ErrorRoute({
required Object error,
- _i44.Key? key,
- List<_i43.PageRouteInfo>? children,
+ _i45.Key? key,
+ List<_i44.PageRouteInfo>? children,
}) : super(
ErrorRoute.name,
args: ErrorRouteArgs(
@@ -461,8 +469,8 @@ class ErrorRoute extends _i43.PageRouteInfo {
static const String name = 'ErrorRoute';
- static const _i43.PageInfo page =
- _i43.PageInfo(name);
+ static const _i44.PageInfo page =
+ _i44.PageInfo(name);
}
class ErrorRouteArgs {
@@ -473,7 +481,7 @@ class ErrorRouteArgs {
final Object error;
- final _i44.Key? key;
+ final _i45.Key? key;
@override
String toString() {
@@ -483,11 +491,11 @@ class ErrorRouteArgs {
/// generated route for
/// [_i2.DefaultLoadingDialog]
-class DefaultLoadingRoute extends _i43.PageRouteInfo {
+class DefaultLoadingRoute extends _i44.PageRouteInfo {
DefaultLoadingRoute({
- _i44.Key? key,
+ _i45.Key? key,
String? text,
- List<_i43.PageRouteInfo>? children,
+ List<_i44.PageRouteInfo>? children,
}) : super(
DefaultLoadingRoute.name,
args: DefaultLoadingRouteArgs(
@@ -499,8 +507,8 @@ class DefaultLoadingRoute extends _i43.PageRouteInfo {
static const String name = 'DefaultLoadingRoute';
- static const _i43.PageInfo page =
- _i43.PageInfo(name);
+ static const _i44.PageInfo page =
+ _i44.PageInfo(name);
}
class DefaultLoadingRouteArgs {
@@ -509,7 +517,7 @@ class DefaultLoadingRouteArgs {
this.text,
});
- final _i44.Key? key;
+ final _i45.Key? key;
final String? text;
@@ -521,12 +529,12 @@ class DefaultLoadingRouteArgs {
/// generated route for
/// [_i3.ComparePageWrapper]
-class CompareRouteWrapper extends _i43.PageRouteInfo {
+class CompareRouteWrapper extends _i44.PageRouteInfo {
CompareRouteWrapper({
- required _i45.Snapshot origObj,
- required _i46.HashObject hashObject,
- _i44.Key? key,
- List<_i43.PageRouteInfo>? children,
+ required _i46.Snapshot origObj,
+ required _i47.HashObject hashObject,
+ _i45.Key? key,
+ List<_i44.PageRouteInfo>? children,
}) : super(
CompareRouteWrapper.name,
args: CompareRouteWrapperArgs(
@@ -539,8 +547,8 @@ class CompareRouteWrapper extends _i43.PageRouteInfo {
static const String name = 'CompareRouteWrapper';
- static const _i43.PageInfo page =
- _i43.PageInfo(name);
+ static const _i44.PageInfo page =
+ _i44.PageInfo(name);
}
class CompareRouteWrapperArgs {
@@ -550,11 +558,11 @@ class CompareRouteWrapperArgs {
this.key,
});
- final _i45.Snapshot origObj;
+ final _i46.Snapshot origObj;
- final _i46.HashObject hashObject;
+ final _i47.HashObject hashObject;
- final _i44.Key? key;
+ final _i45.Key? key;
@override
String toString() {
@@ -564,13 +572,13 @@ class CompareRouteWrapperArgs {
/// generated route for
/// [_i4.PreviewPageWrapper]
-class PreviewRouteWrapper extends _i43.PageRouteInfo {
+class PreviewRouteWrapper extends _i44.PageRouteInfo {
PreviewRouteWrapper({
- required _i46.HashObject? hashObject,
- required _i45.Snapshot snapshot,
- _i44.Key? key,
+ required _i47.HashObject? hashObject,
+ required _i46.Snapshot snapshot,
+ _i45.Key? key,
bool createNewAnyway = false,
- List<_i43.PageRouteInfo>? children,
+ List<_i44.PageRouteInfo>? children,
}) : super(
PreviewRouteWrapper.name,
args: PreviewRouteWrapperArgs(
@@ -584,8 +592,8 @@ class PreviewRouteWrapper extends _i43.PageRouteInfo {
static const String name = 'PreviewRouteWrapper';
- static const _i43.PageInfo page =
- _i43.PageInfo(name);
+ static const _i44.PageInfo page =
+ _i44.PageInfo(name);
}
class PreviewRouteWrapperArgs {
@@ -596,11 +604,11 @@ class PreviewRouteWrapperArgs {
this.createNewAnyway = false,
});
- final _i46.HashObject? hashObject;
+ final _i47.HashObject? hashObject;
- final _i45.Snapshot snapshot;
+ final _i46.Snapshot snapshot;
- final _i44.Key? key;
+ final _i45.Key? key;
final bool createNewAnyway;
@@ -612,8 +620,8 @@ class PreviewRouteWrapperArgs {
/// generated route for
/// [_i5.PreviewPage]
-class PreviewRoute extends _i43.PageRouteInfo {
- const PreviewRoute({List<_i43.PageRouteInfo>? children})
+class PreviewRoute extends _i44.PageRouteInfo {
+ const PreviewRoute({List<_i44.PageRouteInfo>? children})
: super(
PreviewRoute.name,
initialChildren: children,
@@ -621,17 +629,17 @@ class PreviewRoute extends _i43.PageRouteInfo {
static const String name = 'PreviewRoute';
- static const _i43.PageInfo page = _i43.PageInfo(name);
+ static const _i44.PageInfo page = _i44.PageInfo(name);
}
/// generated route for
/// [_i6.RenameSnapshotDialog]
-class RenameSnapshotRoute extends _i43.PageRouteInfo {
+class RenameSnapshotRoute extends _i44.PageRouteInfo {
RenameSnapshotRoute({
- required _i45.Snapshot snapshot,
- required _i46.HashObject hashObject,
- _i44.Key? key,
- List<_i43.PageRouteInfo>? children,
+ required _i46.Snapshot snapshot,
+ required _i47.HashObject hashObject,
+ _i45.Key? key,
+ List<_i44.PageRouteInfo>? children,
}) : super(
RenameSnapshotRoute.name,
args: RenameSnapshotRouteArgs(
@@ -644,8 +652,8 @@ class RenameSnapshotRoute extends _i43.PageRouteInfo {
static const String name = 'RenameSnapshotRoute';
- static const _i43.PageInfo page =
- _i43.PageInfo(name);
+ static const _i44.PageInfo page =
+ _i44.PageInfo(name);
}
class RenameSnapshotRouteArgs {
@@ -655,11 +663,11 @@ class RenameSnapshotRouteArgs {
this.key,
});
- final _i45.Snapshot snapshot;
+ final _i46.Snapshot snapshot;
- final _i46.HashObject hashObject;
+ final _i47.HashObject hashObject;
- final _i44.Key? key;
+ final _i45.Key? key;
@override
String toString() {
@@ -669,12 +677,12 @@ class RenameSnapshotRouteArgs {
/// generated route for
/// [_i7.SaveHashDialog]
-class SaveHashRoute extends _i43.PageRouteInfo {
+class SaveHashRoute extends _i44.PageRouteInfo {
SaveHashRoute({
- required _i45.Snapshot snapshot,
- required _i46.HashObject hashObject,
- _i44.Key? key,
- List<_i43.PageRouteInfo>? children,
+ required _i46.Snapshot snapshot,
+ required _i47.HashObject hashObject,
+ _i45.Key? key,
+ List<_i44.PageRouteInfo>? children,
}) : super(
SaveHashRoute.name,
args: SaveHashRouteArgs(
@@ -687,8 +695,8 @@ class SaveHashRoute extends _i43.PageRouteInfo {
static const String name = 'SaveHashRoute';
- static const _i43.PageInfo page =
- _i43.PageInfo(name);
+ static const _i44.PageInfo page =
+ _i44.PageInfo(name);
}
class SaveHashRouteArgs {
@@ -698,11 +706,11 @@ class SaveHashRouteArgs {
this.key,
});
- final _i45.Snapshot snapshot;
+ final _i46.Snapshot snapshot;
- final _i46.HashObject hashObject;
+ final _i47.HashObject hashObject;
- final _i44.Key? key;
+ final _i45.Key? key;
@override
String toString() {
@@ -712,11 +720,11 @@ class SaveHashRouteArgs {
/// generated route for
/// [_i8.SaveTopHashesDialog]
-class SaveTopHashesRoute extends _i43.PageRouteInfo {
+class SaveTopHashesRoute extends _i44.PageRouteInfo {
SaveTopHashesRoute({
- required _i47.PreviewPageCubitState pageCubitState,
- _i44.Key? key,
- List<_i43.PageRouteInfo>? children,
+ required _i48.PreviewPageCubitState pageCubitState,
+ _i45.Key? key,
+ List<_i44.PageRouteInfo>? children,
}) : super(
SaveTopHashesRoute.name,
args: SaveTopHashesRouteArgs(
@@ -728,8 +736,8 @@ class SaveTopHashesRoute extends _i43.PageRouteInfo {
static const String name = 'SaveTopHashesRoute';
- static const _i43.PageInfo page =
- _i43.PageInfo(name);
+ static const _i44.PageInfo page =
+ _i44.PageInfo(name);
}
class SaveTopHashesRouteArgs {
@@ -738,9 +746,9 @@ class SaveTopHashesRouteArgs {
this.key,
});
- final _i47.PreviewPageCubitState pageCubitState;
+ final _i48.PreviewPageCubitState pageCubitState;
- final _i44.Key? key;
+ final _i45.Key? key;
@override
String toString() {
@@ -750,11 +758,11 @@ class SaveTopHashesRouteArgs {
/// generated route for
/// [_i9.SaveObjectDialog]
-class SaveObjectRoute extends _i43.PageRouteInfo {
+class SaveObjectRoute extends _i44.PageRouteInfo {
SaveObjectRoute({
- required _i45.Snapshot snapshot,
- _i44.Key? key,
- List<_i43.PageRouteInfo>? children,
+ required _i46.Snapshot snapshot,
+ _i45.Key? key,
+ List<_i44.PageRouteInfo>? children,
}) : super(
SaveObjectRoute.name,
args: SaveObjectRouteArgs(
@@ -766,8 +774,8 @@ class SaveObjectRoute extends _i43.PageRouteInfo {
static const String name = 'SaveObjectRoute';
- static const _i43.PageInfo page =
- _i43.PageInfo(name);
+ static const _i44.PageInfo page =
+ _i44.PageInfo(name);
}
class SaveObjectRouteArgs {
@@ -776,9 +784,9 @@ class SaveObjectRouteArgs {
this.key,
});
- final _i45.Snapshot snapshot;
+ final _i46.Snapshot snapshot;
- final _i44.Key? key;
+ final _i45.Key? key;
@override
String toString() {
@@ -788,8 +796,8 @@ class SaveObjectRouteArgs {
/// generated route for
/// [_i10.ScanPageWrapper]
-class ScanRouteWrapper extends _i43.PageRouteInfo {
- const ScanRouteWrapper({List<_i43.PageRouteInfo>? children})
+class ScanRouteWrapper extends _i44.PageRouteInfo {
+ const ScanRouteWrapper({List<_i44.PageRouteInfo>? children})
: super(
ScanRouteWrapper.name,
initialChildren: children,
@@ -797,13 +805,13 @@ class ScanRouteWrapper extends _i43.PageRouteInfo {
static const String name = 'ScanRouteWrapper';
- static const _i43.PageInfo page = _i43.PageInfo(name);
+ static const _i44.PageInfo page = _i44.PageInfo(name);
}
/// generated route for
/// [_i11.ScanPage]
-class ScanRoute extends _i43.PageRouteInfo {
- const ScanRoute({List<_i43.PageRouteInfo>? children})
+class ScanRoute extends _i44.PageRouteInfo {
+ const ScanRoute({List<_i44.PageRouteInfo>? children})
: super(
ScanRoute.name,
initialChildren: children,
@@ -811,13 +819,13 @@ class ScanRoute extends _i43.PageRouteInfo {
static const String name = 'ScanRoute';
- static const _i43.PageInfo page = _i43.PageInfo(name);
+ static const _i44.PageInfo page = _i44.PageInfo(name);
}
/// generated route for
/// [_i12.CalcHashLoadingDialog]
-class CalcHashLoadingRoute extends _i43.PageRouteInfo {
- const CalcHashLoadingRoute({List<_i43.PageRouteInfo>? children})
+class CalcHashLoadingRoute extends _i44.PageRouteInfo {
+ const CalcHashLoadingRoute({List<_i44.PageRouteInfo>? children})
: super(
CalcHashLoadingRoute.name,
initialChildren: children,
@@ -825,16 +833,16 @@ class CalcHashLoadingRoute extends _i43.PageRouteInfo {
static const String name = 'CalcHashLoadingRoute';
- static const _i43.PageInfo page = _i43.PageInfo(name);
+ static const _i44.PageInfo page = _i44.PageInfo(name);
}
/// generated route for
/// [_i13.LoginPage]
-class LoginRoute extends _i43.PageRouteInfo {
+class LoginRoute extends _i44.PageRouteInfo {
LoginRoute({
- _i44.Key? key,
+ _i45.Key? key,
void Function(bool)? onLoginResult,
- List<_i43.PageRouteInfo>? children,
+ List<_i44.PageRouteInfo>? children,
}) : super(
LoginRoute.name,
args: LoginRouteArgs(
@@ -846,8 +854,8 @@ class LoginRoute extends _i43.PageRouteInfo