mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-11-11 08:44:02 +01:00
CW-331-Add-option-to-disable-market-place-in-display-settings (#872)
* CW-331-Add-option-to-disable-market-place-in-display-settings [skip ci] * CW-331-Add-option-to-disable-market-place-in-display-settings [skip ci]
This commit is contained in:
@@ -109,14 +109,29 @@ class _DashboardPageView extends BasePage {
|
||||
|
||||
final DashboardViewModel dashboardViewModel;
|
||||
final WalletAddressListViewModel addressListViewModel;
|
||||
final controller = PageController(initialPage: 1);
|
||||
|
||||
var pages = <Widget>[];
|
||||
int get initialPage => dashboardViewModel.shouldShowMarketPlaceInDashboard ? 1 : 0;
|
||||
ObservableList<Widget> pages = ObservableList<Widget>();
|
||||
bool _isEffectsInstalled = false;
|
||||
StreamSubscription<bool>? _onInactiveSub;
|
||||
|
||||
@override
|
||||
Widget body(BuildContext context) {
|
||||
final controller = PageController(initialPage: initialPage);
|
||||
|
||||
reaction((_) => dashboardViewModel.shouldShowMarketPlaceInDashboard, (bool value) {
|
||||
if (!dashboardViewModel.shouldShowMarketPlaceInDashboard) {
|
||||
controller.jumpToPage(0);
|
||||
}
|
||||
pages.clear();
|
||||
_isEffectsInstalled = false;
|
||||
_setEffects(context);
|
||||
|
||||
if (value) {
|
||||
controller.jumpToPage(1);
|
||||
} else {
|
||||
controller.jumpToPage(0);
|
||||
}
|
||||
});
|
||||
_setEffects(context);
|
||||
|
||||
return SafeArea(
|
||||
@@ -125,23 +140,28 @@ class _DashboardPageView extends BasePage {
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: PageView.builder(
|
||||
controller: controller,
|
||||
itemCount: pages.length,
|
||||
itemBuilder: (context, index) => pages[index])),
|
||||
child: Observer(builder: (context) {
|
||||
return PageView.builder(
|
||||
controller: controller,
|
||||
itemCount: pages.length,
|
||||
itemBuilder: (context, index) => pages[index]);
|
||||
})),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(bottom: 24, top: 10),
|
||||
child: SmoothPageIndicator(
|
||||
controller: controller,
|
||||
count: pages.length,
|
||||
effect: ColorTransitionEffect(
|
||||
spacing: 6.0,
|
||||
radius: 6.0,
|
||||
dotWidth: 6.0,
|
||||
dotHeight: 6.0,
|
||||
dotColor: Theme.of(context).indicatorColor,
|
||||
activeDotColor:
|
||||
Theme.of(context).accentTextTheme!.headline4!.backgroundColor!),
|
||||
child: Observer(builder: (context) {
|
||||
return SmoothPageIndicator(
|
||||
controller: controller,
|
||||
count: pages.length,
|
||||
effect: ColorTransitionEffect(
|
||||
spacing: 6.0,
|
||||
radius: 6.0,
|
||||
dotWidth: 6.0,
|
||||
dotHeight: 6.0,
|
||||
dotColor: Theme.of(context).indicatorColor,
|
||||
activeDotColor:
|
||||
Theme.of(context).accentTextTheme!.headline4!.backgroundColor!),
|
||||
);
|
||||
}
|
||||
)),
|
||||
Observer(builder: (_) {
|
||||
return ClipRect(
|
||||
@@ -201,7 +221,9 @@ class _DashboardPageView extends BasePage {
|
||||
if (_isEffectsInstalled) {
|
||||
return;
|
||||
}
|
||||
pages.add(MarketPlacePage(dashboardViewModel: dashboardViewModel));
|
||||
if (dashboardViewModel.shouldShowMarketPlaceInDashboard) {
|
||||
pages.add(MarketPlacePage(dashboardViewModel: dashboardViewModel));
|
||||
}
|
||||
pages.add(balancePage);
|
||||
pages.add(TransactionsPage(dashboardViewModel: dashboardViewModel));
|
||||
_isEffectsInstalled = true;
|
||||
|
||||
@@ -34,6 +34,13 @@ class DisplaySettingsPage extends BasePage {
|
||||
onValueChange: (_, bool value) {
|
||||
_displaySettingsViewModel.setShouldDisplayBalance(value);
|
||||
}),
|
||||
SettingsSwitcherCell(
|
||||
title: S.current.show_market_place,
|
||||
value: _displaySettingsViewModel.shouldShowMarketPlaceInDashboard,
|
||||
onValueChange: (_, bool value) {
|
||||
_displaySettingsViewModel.setShouldShowMarketPlaceInDashbaord(value);
|
||||
},
|
||||
),
|
||||
//if (!isHaven) it does not work correctly
|
||||
if(!_displaySettingsViewModel.disabledFiatApiMode)
|
||||
SettingsPickerCell<FiatCurrency>(
|
||||
|
||||
Reference in New Issue
Block a user