mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-08 03:49:43 +00:00
brightness package change
This commit is contained in:
parent
0dbfc8399f
commit
137ee58ea9
5 changed files with 76 additions and 83 deletions
|
@ -12,6 +12,7 @@ import 'package:cake_wallet/themes/theme_base.dart';
|
||||||
import 'package:device_display_brightness/device_display_brightness.dart';
|
import 'package:device_display_brightness/device_display_brightness.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:qr_flutter/qr_flutter.dart' as qr;
|
import 'package:qr_flutter/qr_flutter.dart' as qr;
|
||||||
|
import 'package:screen_brightness/screen_brightness.dart';
|
||||||
|
|
||||||
class AnonPayReceivePage extends BasePage {
|
class AnonPayReceivePage extends BasePage {
|
||||||
final AnonpayInfoBase invoiceInfo;
|
final AnonpayInfoBase invoiceInfo;
|
||||||
|
@ -44,10 +45,7 @@ class AnonPayReceivePage extends BasePage {
|
||||||
fontSize: 18.0,
|
fontSize: 18.0,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
fontFamily: 'Lato',
|
fontFamily: 'Lato',
|
||||||
color: Theme.of(context)
|
color: Theme.of(context).accentTextTheme!.displayMedium!.backgroundColor!),
|
||||||
.accentTextTheme!
|
|
||||||
.displayMedium!
|
|
||||||
.backgroundColor!),
|
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
invoiceInfo is AnonpayInvoiceInfo
|
invoiceInfo is AnonpayInvoiceInfo
|
||||||
|
@ -78,10 +76,7 @@ class AnonPayReceivePage extends BasePage {
|
||||||
),
|
),
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
Icons.edit,
|
Icons.edit,
|
||||||
color: Theme.of(context)
|
color: Theme.of(context).accentTextTheme!.bodySmall!.color!,
|
||||||
.accentTextTheme!
|
|
||||||
.bodySmall!
|
|
||||||
.color!,
|
|
||||||
size: 22.0,
|
size: 22.0,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -115,19 +110,17 @@ class AnonPayReceivePage extends BasePage {
|
||||||
),
|
),
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
final double brightness = await DeviceDisplayBrightness.getBrightness();
|
final double brightness = await ScreenBrightness().current;
|
||||||
|
|
||||||
// ignore: unawaited_futures
|
// ignore: unawaited_futures
|
||||||
DeviceDisplayBrightness.setBrightness(1.0);
|
await ScreenBrightness().setScreenBrightness(1.0);
|
||||||
await Navigator.pushNamed(
|
await Navigator.pushNamed(context, Routes.fullscreenQR,
|
||||||
context,
|
arguments: QrViewData(
|
||||||
Routes.fullscreenQR,
|
data: invoiceInfo.clearnetUrl,
|
||||||
arguments: QrViewData(data: invoiceInfo.clearnetUrl,
|
version: qr.QrVersions.auto,
|
||||||
version: qr.QrVersions.auto,
|
));
|
||||||
)
|
|
||||||
);
|
|
||||||
// ignore: unawaited_futures
|
// ignore: unawaited_futures
|
||||||
DeviceDisplayBrightness.setBrightness(brightness);
|
await ScreenBrightness().setScreenBrightness(brightness);
|
||||||
},
|
},
|
||||||
child: Hero(
|
child: Hero(
|
||||||
tag: Key(invoiceInfo.clearnetUrl),
|
tag: Key(invoiceInfo.clearnetUrl),
|
||||||
|
@ -139,10 +132,8 @@ class AnonPayReceivePage extends BasePage {
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
border: Border.all(
|
border: Border.all(
|
||||||
width: 3,
|
width: 3,
|
||||||
color: Theme.of(context)
|
color:
|
||||||
.accentTextTheme!
|
Theme.of(context).accentTextTheme!.displayMedium!.backgroundColor!,
|
||||||
.displayMedium!
|
|
||||||
.backgroundColor!,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: QrImage(
|
child: QrImage(
|
||||||
|
|
|
@ -12,6 +12,7 @@ import 'package:flutter_mobx/flutter_mobx.dart';
|
||||||
import 'package:cake_wallet/generated/i18n.dart';
|
import 'package:cake_wallet/generated/i18n.dart';
|
||||||
import 'package:cake_wallet/src/screens/receive/widgets/qr_image.dart';
|
import 'package:cake_wallet/src/screens/receive/widgets/qr_image.dart';
|
||||||
import 'package:cake_wallet/view_model/wallet_address_list/wallet_address_list_view_model.dart';
|
import 'package:cake_wallet/view_model/wallet_address_list/wallet_address_list_view_model.dart';
|
||||||
|
import 'package:screen_brightness/screen_brightness.dart';
|
||||||
|
|
||||||
class QRWidget extends StatelessWidget {
|
class QRWidget extends StatelessWidget {
|
||||||
QRWidget({
|
QRWidget({
|
||||||
|
@ -194,14 +195,14 @@ class QRWidget extends StatelessWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the current brightness:
|
// Get the current brightness:
|
||||||
final brightness = await DeviceDisplayBrightness.getBrightness();
|
final brightness = await ScreenBrightness().current;
|
||||||
|
|
||||||
// ignore: unawaited_futures
|
// ignore: unawaited_futures
|
||||||
DeviceDisplayBrightness.setBrightness(1.0);
|
await ScreenBrightness().setScreenBrightness(1.0);
|
||||||
|
|
||||||
await navigation();
|
await navigation();
|
||||||
|
|
||||||
// ignore: unawaited_futures
|
// ignore: unawaited_futures
|
||||||
DeviceDisplayBrightness.setBrightness(brightness);
|
await ScreenBrightness().setScreenBrightness(brightness);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||||
import 'package:qr_flutter/qr_flutter.dart';
|
import 'package:qr_flutter/qr_flutter.dart';
|
||||||
|
import 'package:screen_brightness/screen_brightness.dart';
|
||||||
|
|
||||||
class WalletKeysPage extends BasePage {
|
class WalletKeysPage extends BasePage {
|
||||||
WalletKeysPage(this.walletKeysViewModel);
|
WalletKeysPage(this.walletKeysViewModel);
|
||||||
|
@ -26,18 +27,18 @@ class WalletKeysPage extends BasePage {
|
||||||
Widget trailing(BuildContext context) => IconButton(
|
Widget trailing(BuildContext context) => IconButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
// Get the current brightness:
|
// Get the current brightness:
|
||||||
final double brightness = await DeviceDisplayBrightness.getBrightness();
|
final double brightness = await ScreenBrightness().current;
|
||||||
final url = await walletKeysViewModel.url;
|
final url = await walletKeysViewModel.url;
|
||||||
|
|
||||||
// ignore: unawaited_futures
|
// ignore: unawaited_futures
|
||||||
DeviceDisplayBrightness.setBrightness(1.0);
|
await ScreenBrightness().setScreenBrightness(1.0);
|
||||||
await Navigator.pushNamed(
|
await Navigator.pushNamed(
|
||||||
context,
|
context,
|
||||||
Routes.fullscreenQR,
|
Routes.fullscreenQR,
|
||||||
arguments: QrViewData(data: url.toString(), version: QrVersions.auto),
|
arguments: QrViewData(data: url.toString(), version: QrVersions.auto),
|
||||||
);
|
);
|
||||||
// ignore: unawaited_futures
|
// ignore: unawaited_futures
|
||||||
DeviceDisplayBrightness.setBrightness(brightness);
|
await ScreenBrightness().setScreenBrightness(brightness);
|
||||||
},
|
},
|
||||||
splashColor: Colors.transparent,
|
splashColor: Colors.transparent,
|
||||||
highlightColor: Colors.transparent,
|
highlightColor: Colors.transparent,
|
||||||
|
@ -48,62 +49,60 @@ class WalletKeysPage extends BasePage {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget body(BuildContext context) {
|
Widget body(BuildContext context) {
|
||||||
return Column(
|
return Column(children: [
|
||||||
children: [
|
Expanded(
|
||||||
Expanded(
|
child: Padding(
|
||||||
child: Padding(
|
padding: const EdgeInsets.symmetric(horizontal: 24.0),
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 24.0),
|
child: Container(
|
||||||
child: Container(
|
width: double.infinity,
|
||||||
width: double.infinity,
|
decoration: BoxDecoration(
|
||||||
decoration: BoxDecoration(
|
borderRadius: BorderRadius.circular(12.0),
|
||||||
borderRadius: BorderRadius.circular(12.0),
|
color: Theme.of(context).accentTextTheme.bodySmall!.color!,
|
||||||
color: Theme.of(context).accentTextTheme.bodySmall!.color!,
|
),
|
||||||
),
|
child: Center(
|
||||||
child: Center(
|
child: Padding(
|
||||||
child: Padding(
|
padding: const EdgeInsets.all(8.0),
|
||||||
padding: const EdgeInsets.all(8.0),
|
child: AutoSizeText(S.of(context).do_not_share_warning_text.toUpperCase(),
|
||||||
child: AutoSizeText(
|
textAlign: TextAlign.center,
|
||||||
S.of(context).do_not_share_warning_text.toUpperCase(),
|
maxLines: 4,
|
||||||
textAlign: TextAlign.center,
|
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w500, color: Colors.red)),
|
||||||
maxLines: 4,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 16,
|
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
color: Colors.red)),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
),
|
||||||
flex: 7,
|
),
|
||||||
|
Expanded(
|
||||||
|
flex: 7,
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: EdgeInsets.only(top: 20.0, bottom: 20.0),
|
padding: EdgeInsets.only(top: 20.0, bottom: 20.0),
|
||||||
child: Observer(
|
child: Observer(
|
||||||
builder: (_) {
|
builder: (_) {
|
||||||
return ListView.separated(
|
return ListView.separated(
|
||||||
separatorBuilder: (context, index) => Container(
|
separatorBuilder: (context, index) => Container(
|
||||||
height: 1,
|
height: 1,
|
||||||
padding: EdgeInsets.only(left: 24),
|
padding: EdgeInsets.only(left: 24),
|
||||||
color: Theme.of(context).accentTextTheme.titleLarge!.backgroundColor!,
|
color: Theme.of(context).accentTextTheme.titleLarge!.backgroundColor!,
|
||||||
child: const SectionDivider(),
|
child: const SectionDivider(),
|
||||||
),
|
),
|
||||||
itemCount: walletKeysViewModel.items.length,
|
itemCount: walletKeysViewModel.items.length,
|
||||||
itemBuilder: (BuildContext context, int index) {
|
itemBuilder: (BuildContext context, int index) {
|
||||||
final item = walletKeysViewModel.items[index];
|
final item = walletKeysViewModel.items[index];
|
||||||
|
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
ClipboardUtil.setSensitiveDataToClipboard(ClipboardData(text: item.value));
|
ClipboardUtil.setSensitiveDataToClipboard(
|
||||||
showBar<void>(context, S.of(context).copied_key_to_clipboard(item.title));
|
ClipboardData(text: item.value));
|
||||||
},
|
showBar<void>(
|
||||||
child: ListRow(
|
context, S.of(context).copied_key_to_clipboard(item.title));
|
||||||
title: item.title + ':',
|
},
|
||||||
value: item.value,
|
child: ListRow(
|
||||||
),
|
title: item.title + ':',
|
||||||
);
|
value: item.value,
|
||||||
});
|
),
|
||||||
},
|
);
|
||||||
)))]);
|
});
|
||||||
|
},
|
||||||
|
)))
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ 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';
|
import 'package:device_display_brightness/device_display_brightness.dart';
|
||||||
|
import 'package:screen_brightness/screen_brightness.dart';
|
||||||
|
|
||||||
part 'ionia_gift_card_details_view_model.g.dart';
|
part 'ionia_gift_card_details_view_model.g.dart';
|
||||||
|
|
||||||
|
@ -48,7 +49,7 @@ abstract class IoniaGiftCardDetailsViewModelBase with Store {
|
||||||
}
|
}
|
||||||
|
|
||||||
void increaseBrightness() async {
|
void increaseBrightness() async {
|
||||||
brightness = await DeviceDisplayBrightness.getBrightness();
|
brightness = await ScreenBrightness().current;
|
||||||
await DeviceDisplayBrightness.setBrightness(1.0);
|
await ScreenBrightness().setScreenBrightness(1.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,8 @@ dependencies:
|
||||||
unorm_dart: ^0.2.0
|
unorm_dart: ^0.2.0
|
||||||
# check unorm_dart for usage and for replace
|
# check unorm_dart for usage and for replace
|
||||||
permission_handler: ^10.0.0
|
permission_handler: ^10.0.0
|
||||||
device_display_brightness: ^0.0.6
|
# device_display_brightness: ^0.0.6
|
||||||
|
screen_brightness: ^0.2.2
|
||||||
workmanager: ^0.5.1
|
workmanager: ^0.5.1
|
||||||
platform_device_id: ^1.0.1
|
platform_device_id: ^1.0.1
|
||||||
wakelock: ^0.6.2
|
wakelock: ^0.6.2
|
||||||
|
|
Loading…
Reference in a new issue