feat(initializing): Add description and back button to server type step

pull/140/head
NaiJi ✨ 2022-11-20 14:48:08 +04:00
parent b53bb6d4dd
commit b2a5d57a1d
4 changed files with 31 additions and 3 deletions

View File

@ -273,6 +273,8 @@
"place_where_data": "A place where your data and SelfPrivacy services will reside:",
"how": "How to obtain API token",
"provider_bad_key_error": "Provider API key is invalid",
"choose_location_type": "Choose your server location and type:",
"back_to_locations": "Go back to available locations!",
"no_locations_found": "No available locations found. Make sure your account is accessible.",
"no_server_types_found": "No available server types found. Make sure your account is accessible and try to change your server location.",
"cloudflare_bad_key_error": "Cloudflare API key is invalid",

View File

@ -271,7 +271,9 @@
"connect_to_server": "Подключите сервер",
"place_where_data": "Здесь будут жить ваши данные и SelfPrivacy-сервисы:",
"how": "Как получить API Token",
"provider_bad_key_error": "API ключ провайдера неверен",
"provider_bad_key_error": "Provider API key is invalid",
"choose_location_type": "Выберите локацию и тип вашего сервера:",
"back_to_locations": "Назад к доступным локациям!",
"no_locations_found": "Не найдено локаций. Убедитесь, что ваш аккаунт доступен.",
"no_server_types_found": "Не удалось получить список серверов. Убедитесь, что ваш аккаунт доступен и попытайтесь сменить локацию сервера.",
"cloudflare_bad_key_error": "Cloudflare API ключ неверен",

View File

@ -82,6 +82,11 @@ class InitializingPage extends StatelessWidget {
activeIndex: cubit.state.porgressBar,
),
),
if (cubit.state.porgressBar ==
ServerSetupProgress.serverProviderFilled.index)
BrandText.h2(
'initializing.choose_location_type'.tr(),
),
_addCard(
AnimatedSwitcher(
duration: const Duration(milliseconds: 300),

View File

@ -4,6 +4,7 @@ import 'package:selfprivacy/config/brand_theme.dart';
import 'package:selfprivacy/logic/cubit/app_config_dependent/authentication_dependend_cubit.dart';
import 'package:selfprivacy/logic/models/server_provider_location.dart';
import 'package:selfprivacy/logic/models/server_type.dart';
import 'package:selfprivacy/ui/components/brand_button/brand_button.dart';
class ServerTypePicker extends StatefulWidget {
const ServerTypePicker({
@ -21,7 +22,7 @@ class _ServerTypePickerState extends State<ServerTypePicker> {
ServerProviderLocation? serverProviderLocation;
ServerType? serverType;
void setServerProviderLocation(final ServerProviderLocation location) {
void setServerProviderLocation(final ServerProviderLocation? location) {
setState(() {
serverProviderLocation = location;
});
@ -39,6 +40,9 @@ class _ServerTypePickerState extends State<ServerTypePicker> {
return SelectTypePage(
location: serverProviderLocation!,
serverInstallationCubit: widget.serverInstallationCubit,
backToLocationPickingCallback: () {
setServerProviderLocation(null);
},
);
}
}
@ -102,6 +106,7 @@ class SelectLocationPage extends StatelessWidget {
class SelectTypePage extends StatelessWidget {
const SelectTypePage({
required this.backToLocationPickingCallback,
required this.location,
required this.serverInstallationCubit,
super.key,
@ -109,6 +114,7 @@ class SelectTypePage extends StatelessWidget {
final ServerProviderLocation location;
final ServerInstallationCubit serverInstallationCubit;
final Function backToLocationPickingCallback;
@override
Widget build(final BuildContext context) => FutureBuilder(
@ -119,7 +125,20 @@ class SelectTypePage extends StatelessWidget {
) {
if (snapshot.hasData) {
if ((snapshot.data as List<ServerType>).isEmpty) {
return Text('initializing.no_server_types_found'.tr());
return Column(
children: [
Text(
'initializing.no_server_types_found'.tr(),
),
const SizedBox(height: 10),
BrandButton.rised(
onPressed: () {
backToLocationPickingCallback();
},
text: 'initializing.back_to_locations'.tr(),
),
],
);
}
return ListView(
padding: paddingH15V0,