mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-23 12:09:43 +00:00
increase brightness for gift card detail page (#478)
* increase brightness for gift card detail page * move logic to view model * fix format
This commit is contained in:
parent
31a57fc4d3
commit
4a5747c630
2 changed files with 15 additions and 1 deletions
|
@ -13,6 +13,7 @@ import 'package:cake_wallet/typography.dart';
|
||||||
import 'package:cake_wallet/utils/show_bar.dart';
|
import 'package:cake_wallet/utils/show_bar.dart';
|
||||||
import 'package:cake_wallet/utils/show_pop_up.dart';
|
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||||
import 'package:cake_wallet/view_model/ionia/ionia_gift_card_details_view_model.dart';
|
import 'package:cake_wallet/view_model/ionia/ionia_gift_card_details_view_model.dart';
|
||||||
|
import 'package:device_display_brightness/device_display_brightness.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter/src/widgets/framework.dart';
|
import 'package:flutter/src/widgets/framework.dart';
|
||||||
|
@ -25,6 +26,8 @@ class IoniaGiftCardDetailPage extends BasePage {
|
||||||
|
|
||||||
final IoniaGiftCardDetailsViewModel viewModel;
|
final IoniaGiftCardDetailsViewModel viewModel;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget leading(BuildContext context) {
|
Widget leading(BuildContext context) {
|
||||||
if (ModalRoute.of(context).isFirst) {
|
if (ModalRoute.of(context).isFirst) {
|
||||||
|
@ -47,7 +50,10 @@ class IoniaGiftCardDetailPage extends BasePage {
|
||||||
highlightColor: Colors.transparent,
|
highlightColor: Colors.transparent,
|
||||||
splashColor: Colors.transparent,
|
splashColor: Colors.transparent,
|
||||||
padding: EdgeInsets.all(0),
|
padding: EdgeInsets.all(0),
|
||||||
onPressed: () => onClose(context),
|
onPressed: () {
|
||||||
|
onClose(context);
|
||||||
|
DeviceDisplayBrightness.setBrightness(viewModel.brightness);
|
||||||
|
},
|
||||||
child: _backButton),
|
child: _backButton),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -64,6 +70,7 @@ class IoniaGiftCardDetailPage extends BasePage {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget body(BuildContext context) {
|
Widget body(BuildContext context) {
|
||||||
|
viewModel.increaseBrightness();
|
||||||
reaction((_) => viewModel.redeemState, (ExecutionState state) {
|
reaction((_) => viewModel.redeemState, (ExecutionState state) {
|
||||||
if (state is FailureState) {
|
if (state is FailureState) {
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
|
|
@ -2,6 +2,7 @@ import 'package:cake_wallet/core/execution_state.dart';
|
||||||
import 'package:cake_wallet/ionia/ionia_service.dart';
|
import 'package:cake_wallet/ionia/ionia_service.dart';
|
||||||
import 'package:cake_wallet/ionia/ionia_gift_card.dart';
|
import 'package:cake_wallet/ionia/ionia_gift_card.dart';
|
||||||
import 'package:mobx/mobx.dart';
|
import 'package:mobx/mobx.dart';
|
||||||
|
import 'package:device_display_brightness/device_display_brightness.dart';
|
||||||
|
|
||||||
part 'ionia_gift_card_details_view_model.g.dart';
|
part 'ionia_gift_card_details_view_model.g.dart';
|
||||||
|
|
||||||
|
@ -14,6 +15,7 @@ abstract class IoniaGiftCardDetailsViewModelBase with Store {
|
||||||
}
|
}
|
||||||
|
|
||||||
final IoniaService ioniaService;
|
final IoniaService ioniaService;
|
||||||
|
double brightness;
|
||||||
|
|
||||||
@observable
|
@observable
|
||||||
IoniaGiftCard giftCard;
|
IoniaGiftCard giftCard;
|
||||||
|
@ -32,4 +34,9 @@ abstract class IoniaGiftCardDetailsViewModelBase with Store {
|
||||||
redeemState = FailureState(e.toString());
|
redeemState = FailureState(e.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void increaseBrightness() async {
|
||||||
|
brightness = await DeviceDisplayBrightness.getBrightness();
|
||||||
|
await DeviceDisplayBrightness.setBrightness(1.0);
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue