mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-22 18:54:47 +00:00
Merge branch 'main' of https://github.com/cake-tech/cake_wallet into cw_linux_direct_input_password
This commit is contained in:
commit
f3e8767203
6 changed files with 92 additions and 80 deletions
|
@ -132,6 +132,9 @@ class NodeForm extends StatelessWidget {
|
||||||
Observer(
|
Observer(
|
||||||
builder: (_) => StandardCheckbox(
|
builder: (_) => StandardCheckbox(
|
||||||
value: nodeViewModel.useSSL,
|
value: nodeViewModel.useSSL,
|
||||||
|
gradientBackground: true,
|
||||||
|
borderColor: Theme.of(context).dividerColor,
|
||||||
|
iconColor: Colors.white,
|
||||||
onChanged: (value) => nodeViewModel.useSSL = value,
|
onChanged: (value) => nodeViewModel.useSSL = value,
|
||||||
caption: S.of(context).use_ssl,
|
caption: S.of(context).use_ssl,
|
||||||
),
|
),
|
||||||
|
@ -148,6 +151,9 @@ class NodeForm extends StatelessWidget {
|
||||||
Observer(
|
Observer(
|
||||||
builder: (_) => StandardCheckbox(
|
builder: (_) => StandardCheckbox(
|
||||||
value: nodeViewModel.trusted,
|
value: nodeViewModel.trusted,
|
||||||
|
gradientBackground: true,
|
||||||
|
borderColor: Theme.of(context).dividerColor,
|
||||||
|
iconColor: Colors.white,
|
||||||
onChanged: (value) => nodeViewModel.trusted = value,
|
onChanged: (value) => nodeViewModel.trusted = value,
|
||||||
caption: S.of(context).trusted,
|
caption: S.of(context).trusted,
|
||||||
),
|
),
|
||||||
|
@ -166,6 +172,9 @@ class NodeForm extends StatelessWidget {
|
||||||
children: [
|
children: [
|
||||||
StandardCheckbox(
|
StandardCheckbox(
|
||||||
value: nodeViewModel.useSocksProxy,
|
value: nodeViewModel.useSocksProxy,
|
||||||
|
gradientBackground: true,
|
||||||
|
borderColor: Theme.of(context).dividerColor,
|
||||||
|
iconColor: Colors.white,
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
if (!value) {
|
if (!value) {
|
||||||
_socksAddressController.text = '';
|
_socksAddressController.text = '';
|
||||||
|
|
|
@ -10,7 +10,7 @@ import 'package:cake_wallet/src/screens/receive/widgets/anonpay_status_section.d
|
||||||
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/src/screens/receive/widgets/copy_link_item.dart';
|
import 'package:cake_wallet/src/screens/receive/widgets/copy_link_item.dart';
|
||||||
import 'package:cake_wallet/themes/extensions/qr_code_theme.dart';
|
import 'package:cake_wallet/themes/extensions/qr_code_theme.dart';
|
||||||
import 'package:device_display_brightness/device_display_brightness.dart';
|
import 'package:cake_wallet/utils/brightness_util.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:cake_wallet/themes/extensions/dashboard_page_theme.dart';
|
import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart';
|
||||||
|
@ -82,8 +82,7 @@ class AnonPayReceivePage extends BasePage {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget Function(BuildContext, Widget) get rootWrapper =>
|
Widget Function(BuildContext, Widget) get rootWrapper =>
|
||||||
(BuildContext context, Widget scaffold) =>
|
(BuildContext context, Widget scaffold) => GradientBackground(scaffold: scaffold);
|
||||||
GradientBackground(scaffold: scaffold);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget body(BuildContext context) {
|
Widget body(BuildContext context) {
|
||||||
|
@ -101,19 +100,13 @@ class AnonPayReceivePage extends BasePage {
|
||||||
),
|
),
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
final double brightness = await DeviceDisplayBrightness.getBrightness();
|
BrightnessUtil.changeBrightnessForFunction(() async {
|
||||||
|
await Navigator.pushNamed(context, Routes.fullscreenQR,
|
||||||
// ignore: unawaited_futures
|
arguments: QrViewData(
|
||||||
DeviceDisplayBrightness.setBrightness(1.0);
|
data: invoiceInfo.clearnetUrl,
|
||||||
await Navigator.pushNamed(
|
version: qr.QrVersions.auto,
|
||||||
context,
|
));
|
||||||
Routes.fullscreenQR,
|
});
|
||||||
arguments: QrViewData(data: invoiceInfo.clearnetUrl,
|
|
||||||
version: qr.QrVersions.auto,
|
|
||||||
)
|
|
||||||
);
|
|
||||||
// ignore: unawaited_futures
|
|
||||||
DeviceDisplayBrightness.setBrightness(brightness);
|
|
||||||
},
|
},
|
||||||
child: Hero(
|
child: Hero(
|
||||||
tag: Key(invoiceInfo.clearnetUrl),
|
tag: Key(invoiceInfo.clearnetUrl),
|
||||||
|
|
|
@ -3,10 +3,9 @@ import 'package:cake_wallet/themes/extensions/qr_code_theme.dart';
|
||||||
import 'package:cake_wallet/routes.dart';
|
import 'package:cake_wallet/routes.dart';
|
||||||
import 'package:cake_wallet/src/screens/exchange/widgets/currency_picker.dart';
|
import 'package:cake_wallet/src/screens/exchange/widgets/currency_picker.dart';
|
||||||
import 'package:cake_wallet/src/screens/receive/widgets/currency_input_field.dart';
|
import 'package:cake_wallet/src/screens/receive/widgets/currency_input_field.dart';
|
||||||
import 'package:cake_wallet/utils/device_info.dart';
|
import 'package:cake_wallet/utils/brightness_util.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: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_mobx/flutter_mobx.dart';
|
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||||
|
@ -64,7 +63,7 @@ class QRWidget extends StatelessWidget {
|
||||||
flex: 5,
|
flex: 5,
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
changeBrightnessForRoute(
|
BrightnessUtil.changeBrightnessForFunction(
|
||||||
() async {
|
() async {
|
||||||
await Navigator.pushNamed(context, Routes.fullscreenQR,
|
await Navigator.pushNamed(context, Routes.fullscreenQR,
|
||||||
arguments: QrViewData(
|
arguments: QrViewData(
|
||||||
|
@ -178,23 +177,4 @@ class QRWidget extends StatelessWidget {
|
||||||
// update amount if currency changed
|
// update amount if currency changed
|
||||||
addressListViewModel.changeAmount(amountController.text);
|
addressListViewModel.changeAmount(amountController.text);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> changeBrightnessForRoute(Future<void> Function() navigation) async {
|
|
||||||
// if not mobile, just navigate
|
|
||||||
if (!DeviceInfo.instance.isMobile) {
|
|
||||||
navigation();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the current brightness:
|
|
||||||
final brightness = await DeviceDisplayBrightness.getBrightness();
|
|
||||||
|
|
||||||
// ignore: unawaited_futures
|
|
||||||
DeviceDisplayBrightness.setBrightness(1.0);
|
|
||||||
|
|
||||||
await navigation();
|
|
||||||
|
|
||||||
// ignore: unawaited_futures
|
|
||||||
DeviceDisplayBrightness.setBrightness(brightness);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,10 +5,10 @@ import 'package:cake_wallet/src/widgets/list_row.dart';
|
||||||
import 'package:cake_wallet/src/widgets/section_divider.dart';
|
import 'package:cake_wallet/src/widgets/section_divider.dart';
|
||||||
import 'package:cake_wallet/generated/i18n.dart';
|
import 'package:cake_wallet/generated/i18n.dart';
|
||||||
import 'package:cake_wallet/routes.dart';
|
import 'package:cake_wallet/routes.dart';
|
||||||
|
import 'package:cake_wallet/utils/brightness_util.dart';
|
||||||
import 'package:cake_wallet/utils/clipboard_util.dart';
|
import 'package:cake_wallet/utils/clipboard_util.dart';
|
||||||
import 'package:cake_wallet/utils/show_bar.dart';
|
import 'package:cake_wallet/utils/show_bar.dart';
|
||||||
import 'package:cake_wallet/view_model/wallet_keys_view_model.dart';
|
import 'package:cake_wallet/view_model/wallet_keys_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_mobx/flutter_mobx.dart';
|
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||||
|
@ -26,19 +26,15 @@ class WalletKeysPage extends BasePage {
|
||||||
@override
|
@override
|
||||||
Widget trailing(BuildContext context) => IconButton(
|
Widget trailing(BuildContext context) => IconButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
// Get the current brightness:
|
|
||||||
final double brightness = await DeviceDisplayBrightness.getBrightness();
|
|
||||||
final url = await walletKeysViewModel.url;
|
final url = await walletKeysViewModel.url;
|
||||||
|
|
||||||
// ignore: unawaited_futures
|
BrightnessUtil.changeBrightnessForFunction(() async {
|
||||||
DeviceDisplayBrightness.setBrightness(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
|
|
||||||
DeviceDisplayBrightness.setBrightness(brightness);
|
|
||||||
},
|
},
|
||||||
splashColor: Colors.transparent,
|
splashColor: Colors.transparent,
|
||||||
highlightColor: Colors.transparent,
|
highlightColor: Colors.transparent,
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import 'package:cake_wallet/src/widgets/standard_checkbox.dart';
|
||||||
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
|
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
|
||||||
import 'package:cake_wallet/palette.dart';
|
import 'package:cake_wallet/palette.dart';
|
||||||
import 'package:cake_wallet/utils/responsive_layout_util.dart';
|
import 'package:cake_wallet/utils/responsive_layout_util.dart';
|
||||||
|
@ -101,7 +102,7 @@ class CheckBoxPickerState extends State<CheckBoxPicker> {
|
||||||
height: 1,
|
height: 1,
|
||||||
)
|
)
|
||||||
: const SizedBox(),
|
: const SizedBox(),
|
||||||
itemCount: items == null || items.isEmpty ? 0 : items.length,
|
itemCount: items.isEmpty ? 0 : items.length,
|
||||||
itemBuilder: (context, index) => buildItem(index),
|
itemBuilder: (context, index) => buildItem(index),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -112,41 +113,51 @@ class CheckBoxPickerState extends State<CheckBoxPicker> {
|
||||||
|
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.of(context).pop();
|
if (item.isDisabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool newValue = !item.value;
|
||||||
|
item.value = newValue;
|
||||||
|
widget.onChanged(index, newValue);
|
||||||
|
setState(() {});
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
height: 55,
|
height: 55,
|
||||||
color: Theme.of(context).dialogTheme.backgroundColor,
|
color: Theme.of(context).dialogTheme.backgroundColor,
|
||||||
padding: EdgeInsets.only(left: 24, right: 24),
|
padding: EdgeInsets.only(left: 24, right: 24),
|
||||||
child: CheckboxListTile(
|
child: Row(
|
||||||
value: item.value,
|
children: [
|
||||||
activeColor: item.value
|
StandardCheckbox(
|
||||||
? Palette.blueCraiola
|
value: item.value,
|
||||||
: Theme.of(context).extension<FilterTheme>()!.checkboxBackgroundColor,
|
gradientBackground: true,
|
||||||
checkColor: Colors.white,
|
borderColor: Theme.of(context).dividerColor,
|
||||||
title: widget.displayItem?.call(item) ??
|
iconColor: Colors.white,
|
||||||
Text(
|
onChanged: (bool? value) {
|
||||||
item.title,
|
if (value == null || item.isDisabled) {
|
||||||
style: TextStyle(
|
return;
|
||||||
fontSize: 14,
|
}
|
||||||
fontFamily: 'Lato',
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
color: item.isDisabled
|
|
||||||
? Colors.grey.withOpacity(0.5)
|
|
||||||
: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
|
|
||||||
decoration: TextDecoration.none,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onChanged: (bool? value) {
|
|
||||||
if (value == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
item.value = value;
|
item.value = value;
|
||||||
widget.onChanged(index, value);
|
widget.onChanged(index, value);
|
||||||
setState(() {});
|
setState(() {});
|
||||||
},
|
},
|
||||||
controlAffinity: ListTileControlAffinity.leading,
|
),
|
||||||
|
SizedBox(width: 16),
|
||||||
|
widget.displayItem?.call(item) ??
|
||||||
|
Text(
|
||||||
|
item.title,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14,
|
||||||
|
fontFamily: 'Lato',
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
color: item.isDisabled
|
||||||
|
? Colors.grey.withOpacity(0.5)
|
||||||
|
: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
|
||||||
|
decoration: TextDecoration.none,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
23
lib/utils/brightness_util.dart
Normal file
23
lib/utils/brightness_util.dart
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
import 'package:cake_wallet/utils/device_info.dart';
|
||||||
|
import 'package:device_display_brightness/device_display_brightness.dart';
|
||||||
|
|
||||||
|
class BrightnessUtil {
|
||||||
|
static Future<void> changeBrightnessForFunction(Future<void> Function() func) async {
|
||||||
|
// if not mobile, just navigate
|
||||||
|
if (!DeviceInfo.instance.isMobile) {
|
||||||
|
func();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the current brightness:
|
||||||
|
final brightness = await DeviceDisplayBrightness.getBrightness();
|
||||||
|
|
||||||
|
// ignore: unawaited_futures
|
||||||
|
DeviceDisplayBrightness.setBrightness(1.0);
|
||||||
|
|
||||||
|
await func();
|
||||||
|
|
||||||
|
// ignore: unawaited_futures
|
||||||
|
DeviceDisplayBrightness.setBrightness(brightness);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue