Skip to content

Commit

Permalink
Merge pull request #299 from archethic-foundation/298-add-bridge-link…
Browse files Browse the repository at this point in the history
…-in-bottom-menu-mobile-format

feat: ✨ Add bridge access in bottom menu
  • Loading branch information
redDwarf03 authored Oct 18, 2024
2 parents 47b450d + 335c238 commit 47873e2
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 10 deletions.
43 changes: 35 additions & 8 deletions lib/ui/views/main_screen/layouts/bottom_navigation_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import 'package:aedex/ui/views/util/icon_size.dart';
import 'package:archethic_dapp_framework_flutter/archethic_dapp_framework_flutter.dart'
as aedappfm;
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/localizations.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:go_router/go_router.dart';
import 'package:url_launcher/url_launcher.dart';

class BottomNavigationBarMainScreen extends ConsumerStatefulWidget {
const BottomNavigationBarMainScreen({
Expand All @@ -35,15 +35,13 @@ class _BottomNavigationBarMainScreenState
return const SizedBox();
}

widget.listNavigationLabelIcon.removeWhere(
(element) => element.$1 == AppLocalizations.of(context)!.menu_bridge,
);
return ClipRRect(
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10),
child: BottomNavigationBar(
elevation: 0,
backgroundColor: Colors.transparent,
elevation: 1,
type: BottomNavigationBarType.fixed,
backgroundColor: Colors.black.withOpacity(0.3),
selectedFontSize: 10,
unselectedFontSize: 10,
selectedLabelStyle: const TextStyle(
Expand Down Expand Up @@ -81,6 +79,12 @@ class _BottomNavigationBarMainScreenState
selected = true;
}
break;
case aedappfm.Iconsax.recovery_convert:
if (tabSelected == NavigationIndex.bridge) {
widthContainer = 40;
selected = true;
}
break;
default:
}

Expand Down Expand Up @@ -121,8 +125,7 @@ class _BottomNavigationBarMainScreenState
),
);
}).toList(),
currentIndex:
widget.navDrawerIndex.index > 3 ? 0 : widget.navDrawerIndex.index,
currentIndex: widget.navDrawerIndex.index,
onTap: (int selectedIndex) async {
switch (selectedIndex) {
case 0:
Expand Down Expand Up @@ -156,6 +159,30 @@ class _BottomNavigationBarMainScreenState
context.go(FarmLockSheet.routerPage2);
break;

case 3:
setState(() {
ref
.read(
navigationIndexMainScreenProvider.notifier,
)
.state = NavigationIndex.bridge;
});
await launchUrl(
Uri.parse(
(Uri.base
.toString()
.toLowerCase()
.contains('dex.archethic') ||
Uri.base
.toString()
.toLowerCase()
.contains('swap.archethic'))
? 'https://bridge.archethic.net'
: 'https://bridge.testnet.archethic.net',
),
webOnlyWindowName: '_self',
);

default:
break;
}
Expand Down
4 changes: 4 additions & 0 deletions lib/ui/views/main_screen/layouts/main_screen_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ class MainScreenListState extends ConsumerState<MainScreenList> {
aedappfm.Iconsax.wallet_money
),
(AppLocalizations.of(context)!.menu_earn, aedappfm.Iconsax.wallet_add),
(
AppLocalizations.of(context)!.menu_bridge,
aedappfm.Iconsax.recovery_convert
),
];
}

Expand Down
4 changes: 4 additions & 0 deletions lib/ui/views/main_screen/layouts/main_screen_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ class MainScreenSheetState extends ConsumerState<MainScreenSheet> {
aedappfm.Iconsax.wallet_money
),
(AppLocalizations.of(context)!.menu_earn, aedappfm.Iconsax.wallet_add),
(
AppLocalizations.of(context)!.menu_bridge,
aedappfm.Iconsax.recovery_convert
),
];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ class PoolDetailsInfoButtons extends ConsumerWidget {
);
},
isConnected: ref.watch(
sessionNotifierProvider.select((session) => session.isConnected)),
sessionNotifierProvider.select((session) => session.isConnected),
),
displayWalletConnectOnPressed: () async {
final session = ref.read(sessionNotifierProvider);
if (session.error.isNotEmpty) {
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: aedex
description: Enable direct peer-to-peer trading of digital assets on the Archethic blockchain, eliminating the need for centralized intermediaries.
publish_to: "none"

version: 2.1.1+89
version: 2.1.2+90

environment:
sdk: ">=3.3.0 <4.0.0"
Expand Down

0 comments on commit 47873e2

Please sign in to comment.