diff --git a/lib/page/wallet/main_page.dart b/lib/page/wallet/main_page.dart index 94cb04b..20ae4b8 100644 --- a/lib/page/wallet/main_page.dart +++ b/lib/page/wallet/main_page.dart @@ -16,11 +16,12 @@ class WalletHomePage extends StatefulWidget { class _WalletHomePageState extends State { List _bottomNavPages = []; int _currentIndex = 0; + final GlobalKey walletPageStateKey = GlobalKey(); @override void initState() { super.initState(); _bottomNavPages = [ - const WalletPage(), + WalletPage(key: walletPageStateKey), const ContactsMainPage(), const WalletSettingPage(), ]; @@ -34,6 +35,17 @@ class _WalletHomePageState extends State { appBar: null, body: IndexedStack(index: _currentIndex, children: _bottomNavPages), backgroundColor: DarkColors.bgColor, + floatingActionButton: _currentIndex == 0 && Helper.isDesktop + ? FloatingActionButton( + onPressed: () { + if (walletPageStateKey.currentState?.loading != true) { + walletPageStateKey.currentState?.fetchFristPage(); + } + }, + backgroundColor: DarkColors.mainColor, + child: const Icon(Icons.refresh), + ) + : null, bottomNavigationBar: BottomAppBar( color: DarkColors.bgColor, child: Row( diff --git a/lib/page/wallet/wallet_page.dart b/lib/page/wallet/wallet_page.dart index e3ffae6..38dfbdf 100644 --- a/lib/page/wallet/wallet_page.dart +++ b/lib/page/wallet/wallet_page.dart @@ -13,12 +13,11 @@ import 'package:flutter_gen/gen_l10n/app_localizations.dart'; class WalletPage extends StatefulWidget { const WalletPage({super.key}); - @override - State createState() => _WalletPageState(); + State createState() => WalletPageState(); } -class _WalletPageState extends State { +class WalletPageState extends State { final _refreshIndicatorKey = GlobalKey(); String _crurrentAddress = ""; int _network = 0;