This repository has been archived on 2024-07-21. You can view files and clone it, but cannot push or open issues or pull requests.
opencanteen/lib/okna/welcome.dart

79 lines
2.7 KiB
Dart
Raw Permalink Normal View History

import 'package:canteenlib/canteenlib.dart';
import 'package:flutter/material.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:introduction_screen/introduction_screen.dart';
2023-01-28 15:41:17 +01:00
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
2022-12-14 20:02:32 +01:00
import 'package:opencanteen/okna/jidelnicek.dart';
import 'package:opencanteen/util.dart';
2022-12-14 20:02:32 +01:00
class WelcomePage extends StatefulWidget {
const WelcomePage({Key? key, required this.canteen}) : super(key: key);
final Canteen canteen;
@override
2022-12-14 20:02:32 +01:00
State<WelcomePage> createState() => _WelcomePageState();
}
2022-12-14 20:02:32 +01:00
class _WelcomePageState extends State<WelcomePage> {
@override
Widget build(BuildContext context) {
var listPagesViewModel = [
PageViewModel(
2023-01-28 15:41:17 +01:00
title: AppLocalizations.of(context)!.welcome,
body: AppLocalizations.of(context)!.appDesc,
image: const Center(
child: Icon(Icons.waving_hand_outlined, size: 175),
),
),
PageViewModel(
2023-01-28 15:41:17 +01:00
title: AppLocalizations.of(context)!.aboutOrder,
body: AppLocalizations.of(context)!.howOrder,
image: Center(
child: Image.asset('assets/objednavam.png',
width: MediaQuery.of(context).size.width * 0.85),
),
),
PageViewModel(
2023-01-28 15:41:17 +01:00
title: AppLocalizations.of(context)!.aboutToExch,
body: AppLocalizations.of(context)!.howToExch,
image: Center(
child: Image.asset('assets/doburzy.png',
width: MediaQuery.of(context).size.width * 0.85),
),
),
PageViewModel(
2023-01-28 15:41:17 +01:00
title: AppLocalizations.of(context)!.aboutFromExch,
body: AppLocalizations.of(context)!.howFromExch,
image: Center(
child: Image.asset('assets/burza.png',
width: MediaQuery.of(context).size.width * 0.85),
),
),
PageViewModel(
2023-01-28 15:41:17 +01:00
title: AppLocalizations.of(context)!.warning,
body: AppLocalizations.of(context)!.notOfficial,
image: const Center(
child: Icon(Icons.warning_amber_outlined, size: 175),
),
),
];
return Scaffold(
body: IntroductionScreen(
pages: listPagesViewModel,
2023-01-28 15:41:17 +01:00
next: Text(AppLocalizations.of(context)!.next),
done: Text(AppLocalizations.of(context)!.ok,
style: const TextStyle(fontWeight: FontWeight.w600)),
onDone: () async {
const storage = FlutterSecureStorage();
await storage.write(key: "oc_souhlas", value: "ano");
2022-09-06 20:02:17 +02:00
if (!mounted) return;
Navigator.of(context).pushAndRemoveUntil(
platformRouter((c) => MealView(canteen: widget.canteen)),
(route) => false);
},
),
);
}
}