selfprivacy.org.app/lib/ui/pages/onboarding/views/onboarding_view.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

54 lines
1.5 KiB
Dart

import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:selfprivacy/ui/components/buttons/buttons.dart';
// base widget for onboarding view
class OnboardingView extends StatelessWidget {
const OnboardingView({
required this.onProceed,
required this.children,
this.buttonTitle = 'basis.next',
super.key,
});
/// Proceed button title
final String buttonTitle;
/// Proceed button callback
final VoidCallback onProceed;
/// Current view content
final List<Widget> children;
@override
Widget build(final BuildContext context) => Scaffold(
body: Align(
child: ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 480),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Expanded(
child: ListView(
primary: true,
shrinkWrap: true,
padding: const EdgeInsets.all(15) +
const EdgeInsets.only(top: 15),
children: children,
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 15) +
const EdgeInsets.only(bottom: 30),
child: SPBrandButton.text(
title: buttonTitle.tr(),
onPressed: onProceed,
),
),
],
),
),
),
);
}