mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 17:57:40 +00:00
syncing pref options show on button press + shows card w current syncing prefs
This commit is contained in:
parent
9508afbd5b
commit
792b91b7c4
1 changed files with 91 additions and 25 deletions
|
@ -3,9 +3,13 @@ import 'package:flutter/src/widgets/framework.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';
|
||||||
import 'package:stackwallet/pages/settings_views/global_settings_view/syncing_preferences_views/syncing_options_view.dart';
|
import 'package:stackwallet/pages/settings_views/global_settings_view/syncing_preferences_views/syncing_options_view.dart';
|
||||||
|
import 'package:stackwallet/providers/global/prefs_provider.dart';
|
||||||
import 'package:stackwallet/utilities/assets.dart';
|
import 'package:stackwallet/utilities/assets.dart';
|
||||||
|
import 'package:stackwallet/utilities/enums/sync_type_enum.dart';
|
||||||
import 'package:stackwallet/utilities/text_styles.dart';
|
import 'package:stackwallet/utilities/text_styles.dart';
|
||||||
|
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
||||||
import 'package:stackwallet/widgets/desktop/primary_button.dart';
|
import 'package:stackwallet/widgets/desktop/primary_button.dart';
|
||||||
|
import 'package:stackwallet/widgets/rounded_container.dart';
|
||||||
import 'package:stackwallet/widgets/rounded_white_container.dart';
|
import 'package:stackwallet/widgets/rounded_white_container.dart';
|
||||||
|
|
||||||
class SyncingPreferencesSettings extends ConsumerStatefulWidget {
|
class SyncingPreferencesSettings extends ConsumerStatefulWidget {
|
||||||
|
@ -20,6 +24,19 @@ class SyncingPreferencesSettings extends ConsumerStatefulWidget {
|
||||||
|
|
||||||
class _SyncingPreferencesSettings
|
class _SyncingPreferencesSettings
|
||||||
extends ConsumerState<SyncingPreferencesSettings> {
|
extends ConsumerState<SyncingPreferencesSettings> {
|
||||||
|
String _currentTypeDescription(SyncingType type) {
|
||||||
|
switch (type) {
|
||||||
|
case SyncingType.currentWalletOnly:
|
||||||
|
return "Sync only currently open wallet";
|
||||||
|
case SyncingType.selectedWalletsAtStartup:
|
||||||
|
return "Sync only selected wallets at startup";
|
||||||
|
case SyncingType.allWalletsOnStartup:
|
||||||
|
return "Sync all wallets at startup";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
late bool changePrefs = false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
debugPrint("BUILD: $runtimeType");
|
debugPrint("BUILD: $runtimeType");
|
||||||
|
@ -33,6 +50,9 @@ class _SyncingPreferencesSettings
|
||||||
radiusMultiplier: 2,
|
radiusMultiplier: 2,
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
@ -42,6 +62,30 @@ class _SyncingPreferencesSettings
|
||||||
height: 48,
|
height: 48,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: RoundedContainer(
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.buttonBackSecondaryDisabled,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Text(
|
||||||
|
_currentTypeDescription(ref.watch(
|
||||||
|
prefsChangeNotifierProvider
|
||||||
|
.select((value) => value.syncType))),
|
||||||
|
style: STextStyles.desktopTextExtraSmall(context)
|
||||||
|
.copyWith(
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.textDark2),
|
||||||
|
textAlign: TextAlign.left,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
Column(
|
Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
children: [
|
children: [
|
||||||
|
@ -67,13 +111,6 @@ class _SyncingPreferencesSettings
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
||||||
///TODO: ONLY SHOW SYNC OPTIONS ON BUTTON PRESS
|
|
||||||
Column(
|
|
||||||
children: const [
|
|
||||||
SyncingOptionsView(),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Column(
|
Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
|
@ -81,15 +118,44 @@ class _SyncingPreferencesSettings
|
||||||
padding: const EdgeInsets.all(
|
padding: const EdgeInsets.all(
|
||||||
10,
|
10,
|
||||||
),
|
),
|
||||||
child: PrimaryButton(
|
child: changePrefs
|
||||||
width: 210,
|
? SizedBox(
|
||||||
|
width: 512,
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
const SyncingOptionsView(),
|
||||||
|
PrimaryButton(
|
||||||
|
width: 200,
|
||||||
|
buttonHeight: ButtonHeight.m,
|
||||||
|
enabled: true,
|
||||||
|
label: "Save",
|
||||||
|
onPressed: () {
|
||||||
|
setState(() {
|
||||||
|
changePrefs = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: Column(
|
||||||
|
children: [
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
PrimaryButton(
|
||||||
|
width: 200,
|
||||||
buttonHeight: ButtonHeight.m,
|
buttonHeight: ButtonHeight.m,
|
||||||
enabled: true,
|
enabled: true,
|
||||||
label: "Change preferences",
|
label: "Change preferences",
|
||||||
onPressed: () {},
|
onPressed: () {
|
||||||
),
|
setState(() {
|
||||||
|
changePrefs = true;
|
||||||
|
});
|
||||||
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
)),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
Loading…
Reference in a new issue