mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-10 20:54:33 +00:00
ask to load themes if in incognito mode
This commit is contained in:
parent
6990d60b9b
commit
b16e96fc6d
1 changed files with 69 additions and 20 deletions
|
@ -1,14 +1,17 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:stackwallet/pages/settings_views/global_settings_view/appearance_settings/sub_widgets/stack_theme_card.dart';
|
||||
import 'package:stackwallet/providers/global/prefs_provider.dart';
|
||||
import 'package:stackwallet/themes/stack_colors.dart';
|
||||
import 'package:stackwallet/themes/theme_service.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
import 'package:stackwallet/utilities/util.dart';
|
||||
import 'package:stackwallet/widgets/conditional_parent.dart';
|
||||
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
||||
import 'package:stackwallet/widgets/desktop/primary_button.dart';
|
||||
import 'package:stackwallet/widgets/desktop/secondary_button.dart';
|
||||
import 'package:stackwallet/widgets/loading_indicator.dart';
|
||||
import 'package:stackwallet/widgets/rounded_white_container.dart';
|
||||
|
||||
class ManageThemesView extends ConsumerStatefulWidget {
|
||||
const ManageThemesView({Key? key}) : super(key: key);
|
||||
|
@ -20,6 +23,16 @@ class ManageThemesView extends ConsumerStatefulWidget {
|
|||
}
|
||||
|
||||
class _ManageThemesViewState extends ConsumerState<ManageThemesView> {
|
||||
late bool _showThemes;
|
||||
|
||||
Future<List<StackThemeMetaData>> future = Future(() => []);
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_showThemes = ref.read(prefsChangeNotifierProvider).externalCalls;
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ConditionalParent(
|
||||
|
@ -37,7 +50,8 @@ class _ManageThemesViewState extends ConsumerState<ManageThemesView> {
|
|||
style: STextStyles.navBarTitle(context),
|
||||
),
|
||||
),
|
||||
body: Column(
|
||||
body: _showThemes
|
||||
? Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
|
@ -59,13 +73,48 @@ class _ManageThemesViewState extends ConsumerState<ManageThemesView> {
|
|||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Column(
|
||||
children: [
|
||||
RoundedWhiteContainer(
|
||||
child: Text(
|
||||
"You are using Incognito Mode. Please press the"
|
||||
" button below to load available themes from our server"
|
||||
" or upload a theme file manually from your device.",
|
||||
style: STextStyles.smallMed12(context),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
PrimaryButton(
|
||||
label: "Load themes",
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
_showThemes = true;
|
||||
future = ref.watch(pThemeService).fetchThemes();
|
||||
});
|
||||
},
|
||||
),
|
||||
const SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
SecondaryButton(
|
||||
label: "Install theme file",
|
||||
onPressed: () {},
|
||||
),
|
||||
const Spacer(),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
FutureBuilder(
|
||||
future: ref.watch(pThemeService).fetchThemes(),
|
||||
future: future,
|
||||
builder: (
|
||||
context,
|
||||
AsyncSnapshot<List<StackThemeMetaData>> snapshot,
|
||||
|
|
Loading…
Reference in a new issue