Skip to content

Commit

Permalink
tabs/home: add ethereum rpc tab
Browse files Browse the repository at this point in the history
  • Loading branch information
octobocto committed Nov 9, 2023
1 parent a11c0ec commit f3ebeb7
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 3 deletions.
31 changes: 31 additions & 0 deletions lib/pages/tabs/ethereum/ethereum_rpc_tab_page.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:get_it/get_it.dart';
import 'package:sail_ui/sail_ui.dart';
import 'package:sidesail/console.dart';
import 'package:sidesail/routing/router.dart';

@RoutePage()
class EthereumRPCTabPage extends StatelessWidget {
AppRouter get router => GetIt.I.get<AppRouter>();

const EthereumRPCTabPage({super.key});

@override
Widget build(BuildContext context) {
return const SailPage(
scrollable: true,
title: 'Ethereum RPC',
subtitle:
'Here you can call eth rpcs directly to the eth-sidechain. Try typing in "eth_blockNumber" in the input below.',
body: Padding(
padding: EdgeInsets.only(bottom: SailStyleValues.padding30),
child: Column(
children: [
RPCWidget(),
],
),
),
);
}
}
9 changes: 6 additions & 3 deletions lib/pages/tabs/home_page.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:auto_route/auto_route.dart' as auto_router;
import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:get_it/get_it.dart';
import 'package:logger/logger.dart';
Expand All @@ -13,7 +14,7 @@ import 'package:sidesail/rpc/rpc_sidechain.dart';
import 'package:sidesail/widgets/containers/chain_overview_card.dart';
import 'package:stacked/stacked.dart';

@auto_router.RoutePage()
@RoutePage()
class HomePage extends StatelessWidget {
SidechainRPC get _sideRPC => GetIt.I.get<SidechainRPC>();

Expand All @@ -34,7 +35,7 @@ class HomePage extends StatelessWidget {
body: SideNav(
child: children[tabsRouter.activeIndex],
// assume settings tab is final tab!
navigateToSettings: () => tabsRouter.setActiveIndex(routes.length - 1),
navigateToSettings: () => tabsRouter.setActiveIndex(routes.length - 2),
),
);
},
Expand All @@ -59,11 +60,13 @@ class HomePage extends StatelessWidget {
const WithdrawalBundleTabRoute(),
const BlindMergedMiningTabRoute(),
];
break;

case SidechainType.ethereum:
chainRoutes = [
const DashboardTabRoute(),
const EthereumRPCTabRoute(),
];
break;
}

return [
Expand Down
4 changes: 4 additions & 0 deletions lib/routing/router.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:auto_route/auto_route.dart';
import 'package:flutter/widgets.dart';
import 'package:sidesail/pages/tabs/dashboard_tab_page.dart';
import 'package:sidesail/pages/tabs/ethereum/ethereum_rpc_tab_page.dart';
import 'package:sidesail/pages/tabs/home_page.dart';
import 'package:sidesail/pages/tabs/settings/node_settings_tab.dart';
import 'package:sidesail/pages/tabs/settings/theme_settings_tab.dart';
Expand Down Expand Up @@ -50,6 +51,9 @@ class AppRouter extends _$AppRouter {
AutoRoute(
page: BlindMergedMiningTabRoute.page,
),
AutoRoute(
page: EthereumRPCTabRoute.page,
),
AutoRoute(
page: NodeSettingsTabRoute.page,
),
Expand Down
20 changes: 20 additions & 0 deletions lib/routing/router.gr.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f3ebeb7

Please sign in to comment.