mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 01:37:54 +00:00
fix showing wallet button when no other options exist on mobile home screen
This commit is contained in:
parent
0a822e8e22
commit
314c68fcea
2 changed files with 21 additions and 9 deletions
|
@ -17,6 +17,7 @@ import 'package:flutter_svg/svg.dart';
|
|||
|
||||
import '../../app_config.dart';
|
||||
import '../../providers/global/notifications_provider.dart';
|
||||
import '../../providers/global/prefs_provider.dart';
|
||||
import '../../providers/ui/home_view_index_provider.dart';
|
||||
import '../../providers/ui/unread_notifications_provider.dart';
|
||||
import '../../services/event_bus/events/global/tor_connection_status_changed_event.dart';
|
||||
|
@ -172,6 +173,20 @@ class _HomeViewState extends ConsumerState<HomeView> {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
debugPrint("BUILD: $runtimeType");
|
||||
|
||||
// dirty hack
|
||||
ref.listen(
|
||||
prefsChangeNotifierProvider.select((value) => value.enableExchange),
|
||||
(prev, next) {
|
||||
if (next == false &&
|
||||
mounted &&
|
||||
ref.read(homeViewPageIndexStateProvider) != 0) {
|
||||
WidgetsBinding.instance.addPostFrameCallback(
|
||||
(_) => ref.read(homeViewPageIndexStateProvider.state).state = 0,
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
return WillPopScope(
|
||||
onWillPop: _onWillPop,
|
||||
child: Background(
|
||||
|
@ -345,7 +360,8 @@ class _HomeViewState extends ConsumerState<HomeView> {
|
|||
),
|
||||
body: Column(
|
||||
children: [
|
||||
if (_children.length > 1)
|
||||
if (_children.length > 1 &&
|
||||
ref.watch(prefsChangeNotifierProvider).enableExchange)
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context)
|
||||
|
|
|
@ -44,10 +44,6 @@ class _HomeViewButtonBarState extends ConsumerState<HomeViewButtonBar> {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final prefs = ref.watch(prefsChangeNotifierProvider);
|
||||
|
||||
final showExchange = prefs.enableExchange;
|
||||
|
||||
final selectedIndex = ref.watch(homeViewPageIndexStateProvider.state).state;
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
|
@ -90,11 +86,11 @@ class _HomeViewButtonBarState extends ConsumerState<HomeViewButtonBar> {
|
|||
),
|
||||
),
|
||||
),
|
||||
if (AppConfig.hasFeature(AppFeature.swap) && showExchange)
|
||||
if (AppConfig.hasFeature(AppFeature.swap))
|
||||
const SizedBox(
|
||||
width: 8,
|
||||
),
|
||||
if (AppConfig.hasFeature(AppFeature.swap) && showExchange)
|
||||
if (AppConfig.hasFeature(AppFeature.swap))
|
||||
Expanded(
|
||||
child: TextButton(
|
||||
style: selectedIndex == 1
|
||||
|
@ -141,11 +137,11 @@ class _HomeViewButtonBarState extends ConsumerState<HomeViewButtonBar> {
|
|||
),
|
||||
),
|
||||
),
|
||||
if (AppConfig.hasFeature(AppFeature.buy) && showExchange)
|
||||
if (AppConfig.hasFeature(AppFeature.buy))
|
||||
const SizedBox(
|
||||
width: 8,
|
||||
),
|
||||
if (AppConfig.hasFeature(AppFeature.buy) && showExchange)
|
||||
if (AppConfig.hasFeature(AppFeature.buy))
|
||||
Expanded(
|
||||
child: TextButton(
|
||||
style: selectedIndex == 2
|
||||
|
|
Loading…
Reference in a new issue