2022-05-18 19:38:11 +02:00
|
|
|
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';
|
2023-01-28 14:30:54 +01:00
|
|
|
import 'package:opencanteen/util.dart';
|
2022-05-18 19:38:11 +02:00
|
|
|
|
2022-12-14 20:02:32 +01:00
|
|
|
class WelcomePage extends StatefulWidget {
|
|
|
|
const WelcomePage({Key? key, required this.canteen}) : super(key: key);
|
2022-05-18 19:38:11 +02:00
|
|
|
|
|
|
|
final Canteen canteen;
|
|
|
|
|
|
|
|
@override
|
2022-12-14 20:02:32 +01:00
|
|
|
State<WelcomePage> createState() => _WelcomePageState();
|
2022-05-18 19:38:11 +02:00
|
|
|
}
|
|
|
|
|
2022-12-14 20:02:32 +01:00
|
|
|
class _WelcomePageState extends State<WelcomePage> {
|
2022-05-18 19:38:11 +02:00
|
|
|
@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,
|
2022-05-18 19:38:11 +02:00
|
|
|
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,
|
2022-05-18 19:38:11 +02:00
|
|
|
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,
|
2022-05-18 19:38:11 +02:00
|
|
|
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,
|
2022-05-18 19:38:11 +02:00
|
|
|
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,
|
2022-05-18 19:38:11 +02:00
|
|
|
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,
|
2022-05-18 19:38:11 +02:00
|
|
|
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;
|
2022-09-26 17:02:45 +02:00
|
|
|
Navigator.of(context).pushAndRemoveUntil(
|
2023-01-28 14:30:54 +01:00
|
|
|
platformRouter((c) => MealView(canteen: widget.canteen)),
|
2022-09-26 17:02:45 +02:00
|
|
|
(route) => false);
|
2022-05-18 19:38:11 +02:00
|
|
|
},
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|