Skip to content

Commit

Permalink
add refresh for Desktop
Browse files Browse the repository at this point in the history
  • Loading branch information
amazingCoding committed Apr 23, 2023
1 parent 725fc32 commit 60b26af
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
14 changes: 13 additions & 1 deletion lib/page/wallet/main_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ class WalletHomePage extends StatefulWidget {
class _WalletHomePageState extends State<WalletHomePage> {
List<Widget> _bottomNavPages = [];
int _currentIndex = 0;
final GlobalKey<WalletPageState> walletPageStateKey = GlobalKey();
@override
void initState() {
super.initState();
_bottomNavPages = [
const WalletPage(),
WalletPage(key: walletPageStateKey),
const ContactsMainPage(),
const WalletSettingPage(),
];
Expand All @@ -34,6 +35,17 @@ class _WalletHomePageState extends State<WalletHomePage> {
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(
Expand Down
5 changes: 2 additions & 3 deletions lib/page/wallet/wallet_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@ import 'package:flutter_gen/gen_l10n/app_localizations.dart';

class WalletPage extends StatefulWidget {
const WalletPage({super.key});

@override
State<WalletPage> createState() => _WalletPageState();
State<WalletPage> createState() => WalletPageState();
}

class _WalletPageState extends State<WalletPage> {
class WalletPageState extends State<WalletPage> {
final _refreshIndicatorKey = GlobalKey<RefreshIndicatorState>();
String _crurrentAddress = "";
int _network = 0;
Expand Down

0 comments on commit 60b26af

Please sign in to comment.