mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-10 04:34:34 +00:00
standardize isDesktop check
This commit is contained in:
parent
6af788a25e
commit
b0c179666c
12 changed files with 26 additions and 33 deletions
|
@ -57,6 +57,7 @@ import 'package:stackwallet/utilities/enums/backup_frequency_type.dart';
|
||||||
import 'package:stackwallet/utilities/logger.dart';
|
import 'package:stackwallet/utilities/logger.dart';
|
||||||
import 'package:stackwallet/utilities/prefs.dart';
|
import 'package:stackwallet/utilities/prefs.dart';
|
||||||
import 'package:stackwallet/utilities/text_styles.dart';
|
import 'package:stackwallet/utilities/text_styles.dart';
|
||||||
|
import 'package:stackwallet/utilities/util.dart';
|
||||||
import 'package:window_size/window_size.dart';
|
import 'package:window_size/window_size.dart';
|
||||||
|
|
||||||
final openedFromSWBFileStringStateProvider =
|
final openedFromSWBFileStringStateProvider =
|
||||||
|
@ -68,7 +69,7 @@ final openedFromSWBFileStringStateProvider =
|
||||||
void main() async {
|
void main() async {
|
||||||
WidgetsBinding widgetsBinding = WidgetsFlutterBinding.ensureInitialized();
|
WidgetsBinding widgetsBinding = WidgetsFlutterBinding.ensureInitialized();
|
||||||
|
|
||||||
if (Platform.isLinux || Platform.isWindows || Platform.isMacOS) {
|
if (Util.isDesktop) {
|
||||||
setWindowTitle('Stack Wallet');
|
setWindowTitle('Stack Wallet');
|
||||||
setWindowMinSize(const Size(1200, 900));
|
setWindowMinSize(const Size(1200, 900));
|
||||||
setWindowMaxSize(Size.infinite);
|
setWindowMaxSize(Size.infinite);
|
||||||
|
@ -605,7 +606,7 @@ class _MaterialAppWithThemeState extends ConsumerState<MaterialAppWithTheme>
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO proper desktop auth view
|
// TODO proper desktop auth view
|
||||||
if (Platform.isMacOS || Platform.isWindows || Platform.isLinux) {
|
if (Util.isDesktop) {
|
||||||
Future<void>.delayed(Duration.zero).then((value) =>
|
Future<void>.delayed(Duration.zero).then((value) =>
|
||||||
Navigator.of(context).pushNamedAndRemoveUntil(
|
Navigator.of(context).pushNamedAndRemoveUntil(
|
||||||
DesktopHomeView.routeName, (route) => false));
|
DesktopHomeView.routeName, (route) => false));
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
import 'dart:io';
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:flutter_svg/svg.dart';
|
import 'package:flutter_svg/svg.dart';
|
||||||
|
@ -9,6 +7,7 @@ import 'package:stackwallet/utilities/cfcolors.dart';
|
||||||
import 'package:stackwallet/utilities/constants.dart';
|
import 'package:stackwallet/utilities/constants.dart';
|
||||||
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||||
import 'package:stackwallet/utilities/text_styles.dart';
|
import 'package:stackwallet/utilities/text_styles.dart';
|
||||||
|
import 'package:stackwallet/utilities/util.dart';
|
||||||
|
|
||||||
class CoinSelectItem extends ConsumerWidget {
|
class CoinSelectItem extends ConsumerWidget {
|
||||||
const CoinSelectItem({
|
const CoinSelectItem({
|
||||||
|
@ -23,8 +22,7 @@ class CoinSelectItem extends ConsumerWidget {
|
||||||
debugPrint("BUILD: CoinSelectItem for ${coin.name}");
|
debugPrint("BUILD: CoinSelectItem for ${coin.name}");
|
||||||
final selectedCoin = ref.watch(addWalletSelectedCoinStateProvider);
|
final selectedCoin = ref.watch(addWalletSelectedCoinStateProvider);
|
||||||
|
|
||||||
final isDesktop =
|
final isDesktop = Util.isDesktop;
|
||||||
Platform.isLinux || Platform.isMacOS || Platform.isWindows;
|
|
||||||
|
|
||||||
return Container(
|
return Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:io';
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
@ -17,6 +16,7 @@ import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||||
import 'package:stackwallet/utilities/enums/flush_bar_type.dart';
|
import 'package:stackwallet/utilities/enums/flush_bar_type.dart';
|
||||||
import 'package:stackwallet/utilities/name_generator.dart';
|
import 'package:stackwallet/utilities/name_generator.dart';
|
||||||
import 'package:stackwallet/utilities/text_styles.dart';
|
import 'package:stackwallet/utilities/text_styles.dart';
|
||||||
|
import 'package:stackwallet/utilities/util.dart';
|
||||||
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
||||||
import 'package:stackwallet/widgets/desktop/desktop_app_bar.dart';
|
import 'package:stackwallet/widgets/desktop/desktop_app_bar.dart';
|
||||||
import 'package:stackwallet/widgets/desktop/desktop_scaffold.dart';
|
import 'package:stackwallet/widgets/desktop/desktop_scaffold.dart';
|
||||||
|
@ -67,7 +67,7 @@ class _NameYourWalletViewState extends ConsumerState<NameYourWalletView> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
isDesktop = Platform.isLinux || Platform.isWindows || Platform.isMacOS;
|
isDesktop = Util.isDesktop;
|
||||||
|
|
||||||
ref.read(walletsServiceChangeNotifierProvider).walletNames.then(
|
ref.read(walletsServiceChangeNotifierProvider).walletNames.then(
|
||||||
(value) => namesToExclude.addAll(
|
(value) => namesToExclude.addAll(
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:io';
|
|
||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
@ -20,6 +19,7 @@ import 'package:stackwallet/utilities/clipboard_interface.dart';
|
||||||
import 'package:stackwallet/utilities/constants.dart';
|
import 'package:stackwallet/utilities/constants.dart';
|
||||||
import 'package:stackwallet/utilities/enums/flush_bar_type.dart';
|
import 'package:stackwallet/utilities/enums/flush_bar_type.dart';
|
||||||
import 'package:stackwallet/utilities/text_styles.dart';
|
import 'package:stackwallet/utilities/text_styles.dart';
|
||||||
|
import 'package:stackwallet/utilities/util.dart';
|
||||||
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
||||||
import 'package:stackwallet/widgets/desktop/desktop_app_bar.dart';
|
import 'package:stackwallet/widgets/desktop/desktop_app_bar.dart';
|
||||||
import 'package:stackwallet/widgets/desktop/desktop_scaffold.dart';
|
import 'package:stackwallet/widgets/desktop/desktop_scaffold.dart';
|
||||||
|
@ -59,7 +59,7 @@ class _NewWalletRecoveryPhraseViewState
|
||||||
_manager = widget.manager;
|
_manager = widget.manager;
|
||||||
_mnemonic = widget.mnemonic;
|
_mnemonic = widget.mnemonic;
|
||||||
_clipboardInterface = widget.clipboardInterface;
|
_clipboardInterface = widget.clipboardInterface;
|
||||||
isDesktop = Platform.isMacOS || Platform.isWindows || Platform.isLinux;
|
isDesktop = Util.isDesktop;
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:io';
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
@ -15,6 +14,7 @@ import 'package:stackwallet/utilities/default_nodes.dart';
|
||||||
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||||
import 'package:stackwallet/utilities/logger.dart';
|
import 'package:stackwallet/utilities/logger.dart';
|
||||||
import 'package:stackwallet/utilities/text_styles.dart';
|
import 'package:stackwallet/utilities/text_styles.dart';
|
||||||
|
import 'package:stackwallet/utilities/util.dart';
|
||||||
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
||||||
import 'package:stackwallet/widgets/desktop/desktop_app_bar.dart';
|
import 'package:stackwallet/widgets/desktop/desktop_app_bar.dart';
|
||||||
import 'package:stackwallet/widgets/desktop/desktop_scaffold.dart';
|
import 'package:stackwallet/widgets/desktop/desktop_scaffold.dart';
|
||||||
|
@ -49,7 +49,7 @@ class _NewWalletRecoveryPhraseWarningViewState
|
||||||
void initState() {
|
void initState() {
|
||||||
coin = widget.coin;
|
coin = widget.coin;
|
||||||
walletName = widget.walletName;
|
walletName = widget.walletName;
|
||||||
isDesktop = Platform.isMacOS || Platform.isWindows || Platform.isLinux;
|
isDesktop = Util.isDesktop;
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
import 'dart:io';
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:flutter_rounded_date_picker/flutter_rounded_date_picker.dart';
|
import 'package:flutter_rounded_date_picker/flutter_rounded_date_picker.dart';
|
||||||
|
@ -14,6 +12,7 @@ import 'package:stackwallet/utilities/constants.dart';
|
||||||
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||||
import 'package:stackwallet/utilities/format.dart';
|
import 'package:stackwallet/utilities/format.dart';
|
||||||
import 'package:stackwallet/utilities/text_styles.dart';
|
import 'package:stackwallet/utilities/text_styles.dart';
|
||||||
|
import 'package:stackwallet/utilities/util.dart';
|
||||||
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
||||||
import 'package:stackwallet/widgets/desktop/desktop_app_bar.dart';
|
import 'package:stackwallet/widgets/desktop/desktop_app_bar.dart';
|
||||||
import 'package:stackwallet/widgets/desktop/desktop_scaffold.dart';
|
import 'package:stackwallet/widgets/desktop/desktop_scaffold.dart';
|
||||||
|
@ -51,7 +50,7 @@ class _RestoreOptionsViewState extends ConsumerState<RestoreOptionsView> {
|
||||||
void initState() {
|
void initState() {
|
||||||
walletName = widget.walletName;
|
walletName = widget.walletName;
|
||||||
coin = widget.coin;
|
coin = widget.coin;
|
||||||
isDesktop = Platform.isMacOS || Platform.isWindows || Platform.isLinux;
|
isDesktop = Util.isDesktop;
|
||||||
|
|
||||||
_dateController = TextEditingController();
|
_dateController = TextEditingController();
|
||||||
textFieldFocusNode = FocusNode();
|
textFieldFocusNode = FocusNode();
|
||||||
|
|
|
@ -34,6 +34,7 @@ import 'package:stackwallet/utilities/enums/flush_bar_type.dart';
|
||||||
import 'package:stackwallet/utilities/enums/form_input_status_enum.dart';
|
import 'package:stackwallet/utilities/enums/form_input_status_enum.dart';
|
||||||
import 'package:stackwallet/utilities/logger.dart';
|
import 'package:stackwallet/utilities/logger.dart';
|
||||||
import 'package:stackwallet/utilities/text_styles.dart';
|
import 'package:stackwallet/utilities/text_styles.dart';
|
||||||
|
import 'package:stackwallet/utilities/util.dart';
|
||||||
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
||||||
import 'package:stackwallet/widgets/icon_widgets/clipboard_icon.dart';
|
import 'package:stackwallet/widgets/icon_widgets/clipboard_icon.dart';
|
||||||
import 'package:stackwallet/widgets/icon_widgets/qrcode_icon.dart';
|
import 'package:stackwallet/widgets/icon_widgets/qrcode_icon.dart';
|
||||||
|
@ -117,7 +118,7 @@ class _RestoreWalletViewState extends ConsumerState<RestoreWalletView> {
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
_seedWordCount = widget.seedWordsLength;
|
_seedWordCount = widget.seedWordsLength;
|
||||||
isDesktop = Platform.isMacOS || Platform.isWindows || Platform.isLinux;
|
isDesktop = Util.isDesktop;
|
||||||
|
|
||||||
textSelectionControls = Platform.isIOS
|
textSelectionControls = Platform.isIOS
|
||||||
? CustomCupertinoTextSelectionControls(onPaste: onControlsPaste)
|
? CustomCupertinoTextSelectionControls(onPaste: onControlsPaste)
|
||||||
|
@ -199,7 +200,7 @@ class _RestoreWalletViewState extends ConsumerState<RestoreWalletView> {
|
||||||
context: context,
|
context: context,
|
||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
if (!Platform.isLinux) Wakelock.enable();
|
if (!Platform.isLinux) await Wakelock.enable();
|
||||||
final walletsService = ref.read(walletsServiceChangeNotifierProvider);
|
final walletsService = ref.read(walletsServiceChangeNotifierProvider);
|
||||||
|
|
||||||
final walletId = await walletsService.addNewWallet(
|
final walletId = await walletsService.addNewWallet(
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:io';
|
|
||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
@ -17,6 +16,7 @@ import 'package:stackwallet/utilities/cfcolors.dart';
|
||||||
import 'package:stackwallet/utilities/constants.dart';
|
import 'package:stackwallet/utilities/constants.dart';
|
||||||
import 'package:stackwallet/utilities/enums/flush_bar_type.dart';
|
import 'package:stackwallet/utilities/enums/flush_bar_type.dart';
|
||||||
import 'package:stackwallet/utilities/text_styles.dart';
|
import 'package:stackwallet/utilities/text_styles.dart';
|
||||||
|
import 'package:stackwallet/utilities/util.dart';
|
||||||
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
||||||
import 'package:stackwallet/widgets/desktop/desktop_app_bar.dart';
|
import 'package:stackwallet/widgets/desktop/desktop_app_bar.dart';
|
||||||
import 'package:stackwallet/widgets/desktop/desktop_scaffold.dart';
|
import 'package:stackwallet/widgets/desktop/desktop_scaffold.dart';
|
||||||
|
@ -51,7 +51,7 @@ class _VerifyRecoveryPhraseViewState
|
||||||
void initState() {
|
void initState() {
|
||||||
_manager = widget.manager;
|
_manager = widget.manager;
|
||||||
_mnemonic = widget.mnemonic;
|
_mnemonic = widget.mnemonic;
|
||||||
isDesktop = Platform.isLinux || Platform.isWindows || Platform.isMacOS;
|
isDesktop = Util.isDesktop;
|
||||||
// WidgetsBinding.instance?.addObserver(this);
|
// WidgetsBinding.instance?.addObserver(this);
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
import 'dart:io';
|
|
||||||
|
|
||||||
import 'package:flutter/gestures.dart';
|
import 'package:flutter/gestures.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_svg/svg.dart';
|
import 'package:flutter_svg/svg.dart';
|
||||||
|
@ -8,6 +6,7 @@ import 'package:stackwallet/pages_desktop_specific/create_password/create_passwo
|
||||||
import 'package:stackwallet/utilities/assets.dart';
|
import 'package:stackwallet/utilities/assets.dart';
|
||||||
import 'package:stackwallet/utilities/cfcolors.dart';
|
import 'package:stackwallet/utilities/cfcolors.dart';
|
||||||
import 'package:stackwallet/utilities/text_styles.dart';
|
import 'package:stackwallet/utilities/text_styles.dart';
|
||||||
|
import 'package:stackwallet/utilities/util.dart';
|
||||||
import 'package:url_launcher/url_launcher.dart';
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
|
||||||
class IntroView extends StatefulWidget {
|
class IntroView extends StatefulWidget {
|
||||||
|
@ -22,7 +21,7 @@ class _IntroViewState extends State<IntroView> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
isDesktop = Platform.isMacOS || Platform.isWindows || Platform.isLinux;
|
isDesktop = Util.isDesktop;
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
import 'dart:io';
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_svg/svg.dart';
|
import 'package:flutter_svg/svg.dart';
|
||||||
import 'package:stackwallet/pages/add_wallet_views/add_wallet_view/add_wallet_view.dart';
|
import 'package:stackwallet/pages/add_wallet_views/add_wallet_view/add_wallet_view.dart';
|
||||||
import 'package:stackwallet/utilities/assets.dart';
|
import 'package:stackwallet/utilities/assets.dart';
|
||||||
import 'package:stackwallet/utilities/cfcolors.dart';
|
import 'package:stackwallet/utilities/cfcolors.dart';
|
||||||
import 'package:stackwallet/utilities/text_styles.dart';
|
import 'package:stackwallet/utilities/text_styles.dart';
|
||||||
|
import 'package:stackwallet/utilities/util.dart';
|
||||||
|
|
||||||
class EmptyWallets extends StatelessWidget {
|
class EmptyWallets extends StatelessWidget {
|
||||||
const EmptyWallets({Key? key}) : super(key: key);
|
const EmptyWallets({Key? key}) : super(key: key);
|
||||||
|
@ -14,8 +13,7 @@ class EmptyWallets extends StatelessWidget {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
debugPrint("BUILD: $runtimeType");
|
debugPrint("BUILD: $runtimeType");
|
||||||
|
|
||||||
final isDesktop =
|
final isDesktop = Util.isDesktop;
|
||||||
Platform.isMacOS || Platform.isWindows || Platform.isLinux;
|
|
||||||
|
|
||||||
return SafeArea(
|
return SafeArea(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
import 'dart:io';
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_svg/svg.dart';
|
import 'package:flutter_svg/svg.dart';
|
||||||
import 'package:stackwallet/utilities/assets.dart';
|
import 'package:stackwallet/utilities/assets.dart';
|
||||||
import 'package:stackwallet/utilities/cfcolors.dart';
|
import 'package:stackwallet/utilities/cfcolors.dart';
|
||||||
|
import 'package:stackwallet/utilities/util.dart';
|
||||||
|
|
||||||
class AppBarIconButton extends StatelessWidget {
|
class AppBarIconButton extends StatelessWidget {
|
||||||
const AppBarIconButton({
|
const AppBarIconButton({
|
||||||
|
@ -54,8 +53,7 @@ class AppBarBackButton extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final isDesktop =
|
final isDesktop = Util.isDesktop;
|
||||||
Platform.isMacOS || Platform.isWindows || Platform.isLinux;
|
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: isDesktop
|
padding: isDesktop
|
||||||
? const EdgeInsets.symmetric(
|
? const EdgeInsets.symmetric(
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
import 'dart:io';
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:stackwallet/utilities/cfcolors.dart';
|
import 'package:stackwallet/utilities/cfcolors.dart';
|
||||||
import 'package:stackwallet/utilities/text_styles.dart';
|
import 'package:stackwallet/utilities/text_styles.dart';
|
||||||
|
import 'package:stackwallet/utilities/util.dart';
|
||||||
|
|
||||||
InputDecoration standardInputDecoration(
|
InputDecoration standardInputDecoration(
|
||||||
String? labelText, FocusNode textFieldFocusNode) {
|
String? labelText, FocusNode textFieldFocusNode) {
|
||||||
final isDesktop = Platform.isWindows || Platform.isMacOS || Platform.isLinux;
|
final isDesktop = Util.isDesktop;
|
||||||
|
|
||||||
return InputDecoration(
|
return InputDecoration(
|
||||||
labelText: labelText,
|
labelText: labelText,
|
||||||
|
|
Loading…
Reference in a new issue