mirror of
https://github.com/Myzel394/quid_faciam_hodie.git
synced 2025-06-18 23:35:25 +02:00
79 lines
2.2 KiB
Dart
79 lines
2.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
|
import 'package:flutter_platform_widgets/flutter_platform_widgets.dart';
|
|
import 'package:quid_faciam_hodie/constants/spacing.dart';
|
|
|
|
import 'welcome_screen/pages/get_started_page.dart';
|
|
import 'welcome_screen/pages/guide_page.dart';
|
|
import 'welcome_screen/pages/initial_page.dart';
|
|
|
|
class WelcomeScreen extends StatefulWidget {
|
|
static const ID = '/welcome';
|
|
|
|
const WelcomeScreen({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
State<WelcomeScreen> createState() => _WelcomeScreenState();
|
|
}
|
|
|
|
class _WelcomeScreenState extends State<WelcomeScreen> {
|
|
final controller = PageController();
|
|
|
|
@override
|
|
void dispose() {
|
|
controller.dispose();
|
|
|
|
super.dispose();
|
|
}
|
|
|
|
void nextPage() {
|
|
controller.animateToPage(
|
|
(controller.page! + 1).toInt(),
|
|
duration: const Duration(milliseconds: 300),
|
|
curve: Curves.ease,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final localizations = AppLocalizations.of(context)!;
|
|
|
|
return PlatformScaffold(
|
|
body: Padding(
|
|
padding: const EdgeInsets.symmetric(vertical: MEDIUM_SPACE),
|
|
child: Center(
|
|
child: PageView.builder(
|
|
itemBuilder: (context, index) {
|
|
switch (index) {
|
|
case 0:
|
|
return InitialPage(
|
|
onNextPage: nextPage,
|
|
);
|
|
case 1:
|
|
return GuidePage(
|
|
onNextPage: nextPage,
|
|
description: localizations
|
|
.welcomeScreenCreateMemoriesGuideDescription,
|
|
picture: 'assets/images/live_photo.svg',
|
|
);
|
|
case 2:
|
|
return GuidePage(
|
|
onNextPage: nextPage,
|
|
description:
|
|
localizations.welcomeScreenViewMemoriesGuideDescription,
|
|
);
|
|
case 3:
|
|
return const GetStartedPage();
|
|
default:
|
|
return const SizedBox();
|
|
}
|
|
},
|
|
controller: controller,
|
|
itemCount: 4,
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|