2024-04-25 21:54:40 +00:00
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/widgets.dart';
|
|
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
2024-05-23 00:37:06 +00:00
|
|
|
import 'pages/add_wallet_views/frost_ms/new/steps/frost_create_step_1a.dart';
|
|
|
|
import 'pages/add_wallet_views/frost_ms/new/steps/frost_create_step_1b.dart';
|
|
|
|
import 'pages/add_wallet_views/frost_ms/new/steps/frost_create_step_2.dart';
|
|
|
|
import 'pages/add_wallet_views/frost_ms/new/steps/frost_create_step_3.dart';
|
|
|
|
import 'pages/add_wallet_views/frost_ms/new/steps/frost_create_step_4.dart';
|
|
|
|
import 'pages/add_wallet_views/frost_ms/new/steps/frost_create_step_5.dart';
|
|
|
|
import 'pages/add_wallet_views/frost_ms/reshare/frost_reshare_step_1a.dart';
|
|
|
|
import 'pages/add_wallet_views/frost_ms/reshare/frost_reshare_step_1b.dart';
|
|
|
|
import 'pages/add_wallet_views/frost_ms/reshare/frost_reshare_step_1c.dart';
|
|
|
|
import 'pages/add_wallet_views/frost_ms/reshare/frost_reshare_step_2abd.dart';
|
|
|
|
import 'pages/add_wallet_views/frost_ms/reshare/frost_reshare_step_2c.dart';
|
|
|
|
import 'pages/add_wallet_views/frost_ms/reshare/frost_reshare_step_3abd.dart';
|
|
|
|
import 'pages/add_wallet_views/frost_ms/reshare/frost_reshare_step_3c.dart';
|
|
|
|
import 'pages/add_wallet_views/frost_ms/reshare/frost_reshare_step_4.dart';
|
|
|
|
import 'pages/add_wallet_views/frost_ms/reshare/frost_reshare_step_5.dart';
|
|
|
|
import 'pages/send_view/frost_ms/send_steps/frost_send_step_1a.dart';
|
|
|
|
import 'pages/send_view/frost_ms/send_steps/frost_send_step_1b.dart';
|
|
|
|
import 'pages/send_view/frost_ms/send_steps/frost_send_step_2.dart';
|
|
|
|
import 'pages/send_view/frost_ms/send_steps/frost_send_step_3.dart';
|
|
|
|
import 'pages/send_view/frost_ms/send_steps/frost_send_step_4.dart';
|
|
|
|
import 'route_generator.dart';
|
|
|
|
import 'wallets/crypto_currency/intermediate/frost_currency.dart';
|
2024-04-25 21:54:40 +00:00
|
|
|
|
|
|
|
typedef FrostStepRoute = ({String routeName, String title});
|
|
|
|
|
2024-05-01 20:50:12 +00:00
|
|
|
enum FrostInterruptionDialogType {
|
|
|
|
walletCreation,
|
|
|
|
resharing,
|
|
|
|
transactionCreation;
|
|
|
|
}
|
|
|
|
|
2024-04-25 21:54:40 +00:00
|
|
|
final pFrostCreateCurrentStep = StateProvider.autoDispose((ref) => 1);
|
2024-05-02 16:50:28 +00:00
|
|
|
final pFrostScaffoldCanPopDesktop = StateProvider.autoDispose((_) => false);
|
2024-04-30 21:30:41 +00:00
|
|
|
final pFrostScaffoldArgs = StateProvider<
|
|
|
|
({
|
|
|
|
({String walletName, FrostCurrency frostCurrency}) info,
|
|
|
|
String? walletId,
|
|
|
|
List<FrostStepRoute> stepRoutes,
|
2024-05-01 20:50:12 +00:00
|
|
|
FrostInterruptionDialogType frostInterruptionDialogType,
|
2024-05-03 22:38:12 +00:00
|
|
|
NavigatorState parentNav,
|
2024-05-13 14:55:27 +00:00
|
|
|
String callerRouteName,
|
2024-04-30 21:30:41 +00:00
|
|
|
})?>((ref) => null);
|
2024-04-25 21:54:40 +00:00
|
|
|
|
|
|
|
abstract class FrostRouteGenerator {
|
|
|
|
static const bool useMaterialPageRoute = true;
|
|
|
|
|
|
|
|
static const List<FrostStepRoute> createNewConfigStepRoutes = [
|
2024-04-29 22:14:59 +00:00
|
|
|
(routeName: FrostCreateStep1a.routeName, title: FrostCreateStep1a.title),
|
2024-04-25 21:54:40 +00:00
|
|
|
(routeName: FrostCreateStep2.routeName, title: FrostCreateStep2.title),
|
|
|
|
(routeName: FrostCreateStep3.routeName, title: FrostCreateStep3.title),
|
|
|
|
(routeName: FrostCreateStep4.routeName, title: FrostCreateStep4.title),
|
2024-04-29 22:14:59 +00:00
|
|
|
(routeName: FrostCreateStep5.routeName, title: FrostCreateStep5.title),
|
2024-04-25 21:54:40 +00:00
|
|
|
];
|
|
|
|
|
2024-04-29 23:30:46 +00:00
|
|
|
static const List<FrostStepRoute> importNewConfigStepRoutes = [
|
|
|
|
(routeName: FrostCreateStep1b.routeName, title: FrostCreateStep1b.title),
|
|
|
|
(routeName: FrostCreateStep2.routeName, title: FrostCreateStep2.title),
|
|
|
|
(routeName: FrostCreateStep3.routeName, title: FrostCreateStep3.title),
|
|
|
|
(routeName: FrostCreateStep4.routeName, title: FrostCreateStep4.title),
|
|
|
|
(routeName: FrostCreateStep5.routeName, title: FrostCreateStep5.title),
|
|
|
|
];
|
|
|
|
|
2024-04-30 21:30:41 +00:00
|
|
|
static const List<FrostStepRoute> initiateReshareStepRoutes = [
|
|
|
|
(routeName: FrostReshareStep1a.routeName, title: FrostReshareStep1a.title),
|
|
|
|
(
|
|
|
|
routeName: FrostReshareStep2abd.routeName,
|
|
|
|
title: FrostReshareStep2abd.title
|
|
|
|
),
|
|
|
|
(
|
|
|
|
routeName: FrostReshareStep3abd.routeName,
|
|
|
|
title: FrostReshareStep3abd.title
|
|
|
|
),
|
|
|
|
(routeName: FrostReshareStep4.routeName, title: FrostReshareStep4.title),
|
|
|
|
(routeName: FrostReshareStep5.routeName, title: FrostReshareStep5.title),
|
|
|
|
];
|
|
|
|
|
|
|
|
static const List<FrostStepRoute> importReshareStepRoutes = [
|
|
|
|
(routeName: FrostReshareStep1b.routeName, title: FrostReshareStep1b.title),
|
|
|
|
(
|
|
|
|
routeName: FrostReshareStep2abd.routeName,
|
|
|
|
title: FrostReshareStep2abd.title
|
|
|
|
),
|
|
|
|
(
|
|
|
|
routeName: FrostReshareStep3abd.routeName,
|
|
|
|
title: FrostReshareStep3abd.title
|
|
|
|
),
|
|
|
|
(routeName: FrostReshareStep4.routeName, title: FrostReshareStep4.title),
|
|
|
|
(routeName: FrostReshareStep5.routeName, title: FrostReshareStep5.title),
|
|
|
|
];
|
|
|
|
|
|
|
|
static const List<FrostStepRoute> joinReshareStepRoutes = [
|
|
|
|
(routeName: FrostReshareStep1c.routeName, title: FrostReshareStep1c.title),
|
|
|
|
(routeName: FrostReshareStep2c.routeName, title: FrostReshareStep2c.title),
|
|
|
|
(routeName: FrostReshareStep3c.routeName, title: FrostReshareStep3c.title),
|
|
|
|
(routeName: FrostReshareStep4.routeName, title: FrostReshareStep4.title),
|
|
|
|
(routeName: FrostReshareStep5.routeName, title: FrostReshareStep5.title),
|
|
|
|
];
|
|
|
|
|
2024-05-01 20:30:33 +00:00
|
|
|
static const List<FrostStepRoute> sendFrostTxStepRoutes = [
|
|
|
|
(routeName: FrostSendStep1a.routeName, title: FrostSendStep1a.title),
|
|
|
|
(routeName: FrostSendStep2.routeName, title: FrostSendStep2.title),
|
|
|
|
(routeName: FrostSendStep3.routeName, title: FrostSendStep3.title),
|
|
|
|
(routeName: FrostSendStep4.routeName, title: FrostSendStep4.title),
|
|
|
|
];
|
|
|
|
|
|
|
|
static const List<FrostStepRoute> signFrostTxStepRoutes = [
|
|
|
|
(routeName: FrostSendStep1b.routeName, title: FrostSendStep1b.title),
|
|
|
|
(routeName: FrostSendStep2.routeName, title: FrostSendStep2.title),
|
|
|
|
(routeName: FrostSendStep3.routeName, title: FrostSendStep3.title),
|
|
|
|
(routeName: FrostSendStep4.routeName, title: FrostSendStep4.title),
|
|
|
|
];
|
|
|
|
|
2024-04-25 21:54:40 +00:00
|
|
|
static Route<dynamic> generateRoute(RouteSettings settings) {
|
|
|
|
final args = settings.arguments;
|
|
|
|
|
|
|
|
switch (settings.name) {
|
2024-04-29 22:14:59 +00:00
|
|
|
case FrostCreateStep1a.routeName:
|
2024-04-25 21:54:40 +00:00
|
|
|
return RouteGenerator.getRoute(
|
|
|
|
shouldUseMaterialRoute: useMaterialPageRoute,
|
2024-04-29 22:14:59 +00:00
|
|
|
builder: (_) => const FrostCreateStep1a(),
|
2024-04-25 21:54:40 +00:00
|
|
|
settings: settings,
|
|
|
|
);
|
|
|
|
|
2024-04-29 23:30:46 +00:00
|
|
|
case FrostCreateStep1b.routeName:
|
|
|
|
return RouteGenerator.getRoute(
|
|
|
|
shouldUseMaterialRoute: useMaterialPageRoute,
|
|
|
|
builder: (_) => const FrostCreateStep1b(),
|
|
|
|
settings: settings,
|
|
|
|
);
|
|
|
|
|
2024-04-25 21:54:40 +00:00
|
|
|
case FrostCreateStep2.routeName:
|
|
|
|
return RouteGenerator.getRoute(
|
|
|
|
shouldUseMaterialRoute: useMaterialPageRoute,
|
|
|
|
builder: (_) => const FrostCreateStep2(),
|
|
|
|
settings: settings,
|
|
|
|
);
|
|
|
|
|
|
|
|
case FrostCreateStep3.routeName:
|
|
|
|
return RouteGenerator.getRoute(
|
|
|
|
shouldUseMaterialRoute: useMaterialPageRoute,
|
|
|
|
builder: (_) => const FrostCreateStep3(),
|
|
|
|
settings: settings,
|
|
|
|
);
|
|
|
|
|
|
|
|
case FrostCreateStep4.routeName:
|
|
|
|
return RouteGenerator.getRoute(
|
|
|
|
shouldUseMaterialRoute: useMaterialPageRoute,
|
|
|
|
builder: (_) => const FrostCreateStep4(),
|
|
|
|
settings: settings,
|
|
|
|
);
|
|
|
|
|
2024-04-29 22:14:59 +00:00
|
|
|
case FrostCreateStep5.routeName:
|
|
|
|
return RouteGenerator.getRoute(
|
|
|
|
shouldUseMaterialRoute: useMaterialPageRoute,
|
|
|
|
builder: (_) => const FrostCreateStep5(),
|
|
|
|
settings: settings,
|
|
|
|
);
|
|
|
|
|
2024-04-30 21:30:41 +00:00
|
|
|
case FrostReshareStep1a.routeName:
|
|
|
|
return RouteGenerator.getRoute(
|
|
|
|
shouldUseMaterialRoute: useMaterialPageRoute,
|
|
|
|
builder: (_) => const FrostReshareStep1a(),
|
|
|
|
settings: settings,
|
|
|
|
);
|
|
|
|
|
|
|
|
case FrostReshareStep1b.routeName:
|
|
|
|
return RouteGenerator.getRoute(
|
|
|
|
shouldUseMaterialRoute: useMaterialPageRoute,
|
|
|
|
builder: (_) => const FrostReshareStep1b(),
|
|
|
|
settings: settings,
|
|
|
|
);
|
|
|
|
|
|
|
|
case FrostReshareStep1c.routeName:
|
|
|
|
return RouteGenerator.getRoute(
|
|
|
|
shouldUseMaterialRoute: useMaterialPageRoute,
|
|
|
|
builder: (_) => const FrostReshareStep1c(),
|
|
|
|
settings: settings,
|
|
|
|
);
|
|
|
|
|
|
|
|
case FrostReshareStep2abd.routeName:
|
|
|
|
return RouteGenerator.getRoute(
|
|
|
|
shouldUseMaterialRoute: useMaterialPageRoute,
|
|
|
|
builder: (_) => const FrostReshareStep2abd(),
|
|
|
|
settings: settings,
|
|
|
|
);
|
|
|
|
|
|
|
|
case FrostReshareStep2c.routeName:
|
|
|
|
return RouteGenerator.getRoute(
|
|
|
|
shouldUseMaterialRoute: useMaterialPageRoute,
|
|
|
|
builder: (_) => const FrostReshareStep2c(),
|
|
|
|
settings: settings,
|
|
|
|
);
|
|
|
|
|
|
|
|
case FrostReshareStep3abd.routeName:
|
|
|
|
return RouteGenerator.getRoute(
|
|
|
|
shouldUseMaterialRoute: useMaterialPageRoute,
|
2024-04-30 22:01:34 +00:00
|
|
|
builder: (_) => const FrostReshareStep3abd(),
|
2024-04-30 21:30:41 +00:00
|
|
|
settings: settings,
|
|
|
|
);
|
|
|
|
|
|
|
|
case FrostReshareStep3c.routeName:
|
|
|
|
return RouteGenerator.getRoute(
|
|
|
|
shouldUseMaterialRoute: useMaterialPageRoute,
|
2024-04-30 22:01:34 +00:00
|
|
|
builder: (_) => const FrostReshareStep3c(),
|
2024-04-30 21:30:41 +00:00
|
|
|
settings: settings,
|
|
|
|
);
|
|
|
|
|
|
|
|
case FrostReshareStep4.routeName:
|
|
|
|
return RouteGenerator.getRoute(
|
|
|
|
shouldUseMaterialRoute: useMaterialPageRoute,
|
|
|
|
builder: (_) => const FrostReshareStep4(),
|
|
|
|
settings: settings,
|
|
|
|
);
|
|
|
|
|
|
|
|
case FrostReshareStep5.routeName:
|
|
|
|
return RouteGenerator.getRoute(
|
|
|
|
shouldUseMaterialRoute: useMaterialPageRoute,
|
|
|
|
builder: (_) => const FrostReshareStep5(),
|
|
|
|
settings: settings,
|
|
|
|
);
|
|
|
|
|
2024-05-01 20:30:33 +00:00
|
|
|
case FrostSendStep1a.routeName:
|
|
|
|
return RouteGenerator.getRoute(
|
|
|
|
shouldUseMaterialRoute: useMaterialPageRoute,
|
|
|
|
builder: (_) => const FrostSendStep1a(),
|
|
|
|
settings: settings,
|
|
|
|
);
|
|
|
|
|
|
|
|
case FrostSendStep1b.routeName:
|
|
|
|
return RouteGenerator.getRoute(
|
|
|
|
shouldUseMaterialRoute: useMaterialPageRoute,
|
|
|
|
builder: (_) => const FrostSendStep1b(),
|
|
|
|
settings: settings,
|
|
|
|
);
|
|
|
|
|
|
|
|
case FrostSendStep2.routeName:
|
|
|
|
return RouteGenerator.getRoute(
|
|
|
|
shouldUseMaterialRoute: useMaterialPageRoute,
|
|
|
|
builder: (_) => const FrostSendStep2(),
|
|
|
|
settings: settings,
|
|
|
|
);
|
|
|
|
|
|
|
|
case FrostSendStep3.routeName:
|
|
|
|
return RouteGenerator.getRoute(
|
|
|
|
shouldUseMaterialRoute: useMaterialPageRoute,
|
|
|
|
builder: (_) => const FrostSendStep3(),
|
|
|
|
settings: settings,
|
|
|
|
);
|
|
|
|
|
|
|
|
case FrostSendStep4.routeName:
|
|
|
|
return RouteGenerator.getRoute(
|
|
|
|
shouldUseMaterialRoute: useMaterialPageRoute,
|
|
|
|
builder: (_) => const FrostSendStep4(),
|
|
|
|
settings: settings,
|
|
|
|
);
|
|
|
|
|
2024-04-25 21:54:40 +00:00
|
|
|
default:
|
|
|
|
return _routeError("");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static Route<dynamic> _routeError(String message) {
|
|
|
|
return RouteGenerator.getRoute(
|
|
|
|
shouldUseMaterialRoute: useMaterialPageRoute,
|
|
|
|
builder: (_) => Placeholder(
|
|
|
|
child: Center(
|
|
|
|
child: Text(message),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|