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_svg/svg.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/enums/sync_type_enum.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/rounded_container.dart';
|
||||
import 'package:stackwallet/widgets/rounded_white_container.dart';
|
||||
|
||||
class SyncingPreferencesSettings extends ConsumerStatefulWidget {
|
||||
|
@ -20,6 +24,19 @@ class SyncingPreferencesSettings extends ConsumerStatefulWidget {
|
|||
|
||||
class _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
|
||||
Widget build(BuildContext context) {
|
||||
debugPrint("BUILD: $runtimeType");
|
||||
|
@ -34,13 +51,40 @@ class _SyncingPreferencesSettings
|
|||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: SvgPicture.asset(
|
||||
Assets.svg.circleArrowRotate,
|
||||
width: 48,
|
||||
height: 48,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: SvgPicture.asset(
|
||||
Assets.svg.circleArrowRotate,
|
||||
width: 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(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
|
@ -67,28 +111,50 @@ class _SyncingPreferencesSettings
|
|||
),
|
||||
],
|
||||
),
|
||||
|
||||
///TODO: ONLY SHOW SYNC OPTIONS ON BUTTON PRESS
|
||||
Column(
|
||||
children: const [
|
||||
SyncingOptionsView(),
|
||||
],
|
||||
),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(
|
||||
10,
|
||||
),
|
||||
child: PrimaryButton(
|
||||
width: 210,
|
||||
buttonHeight: ButtonHeight.m,
|
||||
enabled: true,
|
||||
label: "Change preferences",
|
||||
onPressed: () {},
|
||||
),
|
||||
),
|
||||
padding: const EdgeInsets.all(
|
||||
10,
|
||||
),
|
||||
child: changePrefs
|
||||
? 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,
|
||||
enabled: true,
|
||||
label: "Change preferences",
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
changePrefs = true;
|
||||
});
|
||||
},
|
||||
),
|
||||
],
|
||||
)),
|
||||
],
|
||||
),
|
||||
],
|
||||
|
|
Loading…
Reference in a new issue