mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2025-01-23 09:16:54 +00:00
feat: Add Support drawer and basic support cubit.
This commit is contained in:
parent
768d5ff226
commit
8fc229647f
|
@ -14,3 +14,6 @@ max_line_length = 150
|
||||||
|
|
||||||
[*.md]
|
[*.md]
|
||||||
trim_trailing_whitespace = false
|
trim_trailing_whitespace = false
|
||||||
|
|
||||||
|
[*.json]
|
||||||
|
indent_size = 4
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
"test": "en-test",
|
"test": "en-test",
|
||||||
"locale": "en",
|
"locale": "en",
|
||||||
"basis": {
|
"basis": {
|
||||||
|
"app_name": "SelfPrivacy",
|
||||||
"providers": "Providers",
|
"providers": "Providers",
|
||||||
"providers_title": "Your Data Center",
|
"providers_title": "Your Data Center",
|
||||||
"select": "Select",
|
"select": "Select",
|
||||||
|
@ -59,8 +60,11 @@
|
||||||
},
|
},
|
||||||
"application_settings": {
|
"application_settings": {
|
||||||
"title": "Application settings",
|
"title": "Application settings",
|
||||||
|
"system_dark_theme_title": "System default theme",
|
||||||
|
"system_dark_theme_description": "Use light or dark theme depending on system settings",
|
||||||
"dark_theme_title": "Dark theme",
|
"dark_theme_title": "Dark theme",
|
||||||
"dark_theme_description": "Switch your application theme",
|
"dark_theme_description": "Switch your application theme",
|
||||||
|
"dangerous_settings": "Dangerous settings",
|
||||||
"reset_config_title": "Reset application config",
|
"reset_config_title": "Reset application config",
|
||||||
"reset_config_description": "Reset api keys and root user",
|
"reset_config_description": "Reset api keys and root user",
|
||||||
"delete_server_title": "Delete server",
|
"delete_server_title": "Delete server",
|
||||||
|
@ -472,5 +476,19 @@
|
||||||
"root_name": "Cannot be 'root'",
|
"root_name": "Cannot be 'root'",
|
||||||
"length_not_equal": "Length is [], should be {}",
|
"length_not_equal": "Length is [], should be {}",
|
||||||
"length_longer": "Length is [], should be shorter than or equal to {}"
|
"length_longer": "Length is [], should be shorter than or equal to {}"
|
||||||
|
},
|
||||||
|
"support": {
|
||||||
|
"title": "SelfPrivacy Support"
|
||||||
|
},
|
||||||
|
"developer_settings": {
|
||||||
|
"title": "Developer settings",
|
||||||
|
"subtitle": "These settings are for debugging only. Don't change them unless you know what you're doing.",
|
||||||
|
"server_setup": "Server setup",
|
||||||
|
"use_staging_acme": "Use staging ACME server",
|
||||||
|
"use_staging_acme_description": "Rebuild your app to change this value.",
|
||||||
|
"routing": "App routing",
|
||||||
|
"reset_onboarding": "Reset onboarding switch",
|
||||||
|
"reset_onboarding_description": "Reset onboarding switch to show onboarding screen again",
|
||||||
|
"cubit_statuses": "Cubit loading statuses"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ import 'package:selfprivacy/logic/cubit/providers/providers_cubit.dart';
|
||||||
import 'package:selfprivacy/logic/cubit/server_jobs/server_jobs_cubit.dart';
|
import 'package:selfprivacy/logic/cubit/server_jobs/server_jobs_cubit.dart';
|
||||||
import 'package:selfprivacy/logic/cubit/server_volumes/server_volume_cubit.dart';
|
import 'package:selfprivacy/logic/cubit/server_volumes/server_volume_cubit.dart';
|
||||||
import 'package:selfprivacy/logic/cubit/services/services_cubit.dart';
|
import 'package:selfprivacy/logic/cubit/services/services_cubit.dart';
|
||||||
|
import 'package:selfprivacy/logic/cubit/support_system/support_system_cubit.dart';
|
||||||
import 'package:selfprivacy/logic/cubit/users/users_cubit.dart';
|
import 'package:selfprivacy/logic/cubit/users/users_cubit.dart';
|
||||||
import 'package:selfprivacy/logic/cubit/provider_volumes/provider_volume_cubit.dart';
|
import 'package:selfprivacy/logic/cubit/provider_volumes/provider_volume_cubit.dart';
|
||||||
|
|
||||||
|
@ -23,7 +24,9 @@ class BlocAndProviderConfig extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(final BuildContext context) {
|
Widget build(final BuildContext context) {
|
||||||
const isDark = false;
|
const isDark = false;
|
||||||
|
const isAutoDark = true;
|
||||||
final serverInstallationCubit = ServerInstallationCubit()..load();
|
final serverInstallationCubit = ServerInstallationCubit()..load();
|
||||||
|
final supportSystemCubit = SupportSystemCubit();
|
||||||
final usersCubit = UsersCubit(serverInstallationCubit);
|
final usersCubit = UsersCubit(serverInstallationCubit);
|
||||||
final servicesCubit = ServicesCubit(serverInstallationCubit);
|
final servicesCubit = ServicesCubit(serverInstallationCubit);
|
||||||
final backupsCubit = BackupsCubit(serverInstallationCubit);
|
final backupsCubit = BackupsCubit(serverInstallationCubit);
|
||||||
|
@ -41,9 +44,13 @@ class BlocAndProviderConfig extends StatelessWidget {
|
||||||
BlocProvider(
|
BlocProvider(
|
||||||
create: (final _) => AppSettingsCubit(
|
create: (final _) => AppSettingsCubit(
|
||||||
isDarkModeOn: isDark,
|
isDarkModeOn: isDark,
|
||||||
|
isAutoDarkModeOn: isAutoDark,
|
||||||
isOnboardingShowing: true,
|
isOnboardingShowing: true,
|
||||||
)..load(),
|
)..load(),
|
||||||
),
|
),
|
||||||
|
BlocProvider(
|
||||||
|
create: (final _) => supportSystemCubit,
|
||||||
|
),
|
||||||
BlocProvider(
|
BlocProvider(
|
||||||
create: (final _) => serverInstallationCubit,
|
create: (final _) => serverInstallationCubit,
|
||||||
lazy: false,
|
lazy: false,
|
||||||
|
|
19
lib/logic/cubit/support_system/support_system_cubit.dart
Normal file
19
lib/logic/cubit/support_system/support_system_cubit.dart
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:equatable/equatable.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
part 'support_system_state.dart';
|
||||||
|
|
||||||
|
class SupportSystemCubit extends Cubit<SupportSystemState> {
|
||||||
|
SupportSystemCubit() : super(const SupportSystemState('about'));
|
||||||
|
|
||||||
|
void showArticle({
|
||||||
|
required final String article,
|
||||||
|
final BuildContext? context,
|
||||||
|
}) {
|
||||||
|
emit(SupportSystemState(article));
|
||||||
|
if (context != null) {
|
||||||
|
Scaffold.of(context).openEndDrawer();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
12
lib/logic/cubit/support_system/support_system_state.dart
Normal file
12
lib/logic/cubit/support_system/support_system_state.dart
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
part of 'support_system_cubit.dart';
|
||||||
|
|
||||||
|
class SupportSystemState extends Equatable {
|
||||||
|
const SupportSystemState(
|
||||||
|
this.currentArticle,
|
||||||
|
);
|
||||||
|
|
||||||
|
final String currentArticle;
|
||||||
|
|
||||||
|
@override
|
||||||
|
List<Object> get props => [currentArticle];
|
||||||
|
}
|
52
lib/ui/components/support_drawer/support_drawer.dart
Normal file
52
lib/ui/components/support_drawer/support_drawer.dart
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:selfprivacy/logic/cubit/support_system/support_system_cubit.dart';
|
||||||
|
import 'package:selfprivacy/ui/components/brand_md/brand_md.dart';
|
||||||
|
|
||||||
|
class SupportDrawer extends StatelessWidget {
|
||||||
|
const SupportDrawer({
|
||||||
|
super.key,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(final BuildContext context) {
|
||||||
|
final currentArticle =
|
||||||
|
context.watch<SupportSystemCubit>().state.currentArticle;
|
||||||
|
return Drawer(
|
||||||
|
width: 440,
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
const SizedBox(width: 8),
|
||||||
|
const Icon(Icons.help_outline),
|
||||||
|
const SizedBox(width: 16),
|
||||||
|
Text(
|
||||||
|
'support.title'.tr(),
|
||||||
|
style: Theme.of(context).textTheme.titleLarge,
|
||||||
|
),
|
||||||
|
const Spacer(),
|
||||||
|
IconButton(
|
||||||
|
onPressed: () => Scaffold.of(context).closeEndDrawer(),
|
||||||
|
icon: const Icon(Icons.chevron_right_outlined),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: BrandMarkdown(
|
||||||
|
fileName: currentArticle,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -390,14 +390,6 @@ packages:
|
||||||
description: flutter
|
description: flutter
|
||||||
source: sdk
|
source: sdk
|
||||||
version: "0.0.0"
|
version: "0.0.0"
|
||||||
flutter_adaptive_scaffold:
|
|
||||||
dependency: "direct main"
|
|
||||||
description:
|
|
||||||
name: flutter_adaptive_scaffold
|
|
||||||
sha256: d5842a235ec810320c7e6dac282876d93bccf231201be6e684b016cd717c0576
|
|
||||||
url: "https://pub.dev"
|
|
||||||
source: hosted
|
|
||||||
version: "0.1.0"
|
|
||||||
flutter_bloc:
|
flutter_bloc:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
|
|
@ -23,7 +23,6 @@ dependencies:
|
||||||
fl_chart: ^0.50.1
|
fl_chart: ^0.50.1
|
||||||
flutter:
|
flutter:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
flutter_adaptive_scaffold: ^0.1.0
|
|
||||||
flutter_bloc: ^8.1.1
|
flutter_bloc: ^8.1.1
|
||||||
flutter_markdown: ^0.6.13+1
|
flutter_markdown: ^0.6.13+1
|
||||||
flutter_secure_storage: ^7.0.1
|
flutter_secure_storage: ^7.0.1
|
||||||
|
|
35
shell.nix
Normal file
35
shell.nix
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
with (import <nixpkgs> { });
|
||||||
|
|
||||||
|
mkShell {
|
||||||
|
buildInputs = [
|
||||||
|
at-spi2-core.dev
|
||||||
|
clang
|
||||||
|
cmake
|
||||||
|
dart
|
||||||
|
dbus.dev
|
||||||
|
flutter
|
||||||
|
gtk3
|
||||||
|
libdatrie
|
||||||
|
libepoxy.dev
|
||||||
|
libselinux
|
||||||
|
libsepol
|
||||||
|
libthai
|
||||||
|
libxkbcommon
|
||||||
|
libsecret
|
||||||
|
ninja
|
||||||
|
pcre
|
||||||
|
pkg-config
|
||||||
|
util-linux.dev
|
||||||
|
xorg.libXdmcp
|
||||||
|
xorg.libXtst
|
||||||
|
xorg.libX11
|
||||||
|
|
||||||
|
glib
|
||||||
|
jsoncpp
|
||||||
|
libgcrypt
|
||||||
|
libgpg-error
|
||||||
|
];
|
||||||
|
shellHook = ''
|
||||||
|
export LD_LIBRARY_PATH=${libepoxy}/lib
|
||||||
|
'';
|
||||||
|
}
|
Loading…
Reference in a new issue