selfprivacy.org.app/lib/ui/pages/server_details/text_details.dart
aliaksei tratseuski dd81053f42 refactor(UI): Rewrite onboarding page
rewrote OnboardingPage:
* decomposed into separate widgets
* now content stays centered on wide screens (set so width won't expand further than 480px)
* pageController is now properly disposed
* added some more code changes to
    * main (error widget builder)
    * brand_header (centerTitle instead of empty actions list)
    * console_page (listener callback fix, used gaps instead of SizedBox'es, added keys to list items)
    * service_page (just cleaner build method)
	* removed some dead code

Co-authored-by: Aliaksei Tratseuski <aliaksei.tratseuski@gmail.com>
Reviewed-on: https://git.selfprivacy.org/SelfPrivacy/selfprivacy.org.app/pulls/444
Co-authored-by: aliaksei tratseuski <misterfourtytwo@noreply.git.selfprivacy.org>
Co-committed-by: aliaksei tratseuski <misterfourtytwo@noreply.git.selfprivacy.org>
2024-02-08 13:59:52 +02:00

59 lines
1.7 KiB
Dart

part of 'server_details_screen.dart';
class _TextDetails extends StatelessWidget {
@override
Widget build(final BuildContext context) {
final details = context.watch<ServerDetailsCubit>().state;
if (details is ServerDetailsLoading || details is ServerDetailsInitial) {
return _TempMessage(message: 'basis.loading'.tr());
} else if (details is ServerDetailsNotReady) {
return _TempMessage(message: 'basis.no_data'.tr());
} else if (details is Loaded) {
return FilledCard(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.all(16.0),
child: Text(
'server.general_information'.tr(),
style: Theme.of(context).textTheme.titleMedium?.copyWith(
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
),
),
...details.metadata.map(
(final metadata) => ListTileOnSurfaceVariant(
leadingIcon: metadata.type.icon,
title: metadata.trId.tr(),
subtitle: metadata.value,
),
),
],
),
);
} else {
throw Exception('wrong state');
}
}
}
class _TempMessage extends StatelessWidget {
const _TempMessage({
required this.message,
});
final String message;
@override
Widget build(final BuildContext context) => SizedBox(
height: MediaQuery.of(context).size.height - 100,
child: Center(
child: Text(
message,
style: Theme.of(context).textTheme.bodyMedium,
),
),
);
}