2022-11-01 08:27:11 +01:00
|
|
|
// SPDX-FileCopyrightText: 2022 Iconica
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
|
2022-10-07 15:31:07 +02:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_introduction/flutter_introduction.dart';
|
2022-10-07 15:59:02 +02:00
|
|
|
import 'package:flutter_introduction_shared_preferences/flutter_introduction_shared_preferences.dart';
|
2022-10-07 15:31:07 +02:00
|
|
|
|
|
|
|
void main() {
|
|
|
|
runApp(const MyApp());
|
|
|
|
}
|
|
|
|
|
|
|
|
class MyApp extends StatelessWidget {
|
|
|
|
const MyApp({super.key});
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return MaterialApp(
|
|
|
|
title: 'Flutter Demo',
|
|
|
|
theme: ThemeData(
|
|
|
|
primarySwatch: Colors.blue,
|
|
|
|
),
|
|
|
|
home: const MyHomePage(),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class MyHomePage extends StatefulWidget {
|
|
|
|
const MyHomePage({super.key});
|
|
|
|
|
|
|
|
@override
|
|
|
|
State<MyHomePage> createState() => _MyHomePageState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _MyHomePageState extends State<MyHomePage> {
|
2022-10-07 15:59:02 +02:00
|
|
|
IntroductionService service =
|
|
|
|
IntroductionService(SharedPreferencesIntroductionDataProvider());
|
2022-10-07 15:31:07 +02:00
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Scaffold(
|
|
|
|
body: Introduction(
|
|
|
|
options: IntroductionOptions(
|
|
|
|
pages: [
|
|
|
|
IntroductionPage(
|
|
|
|
title: const Text('First page'),
|
|
|
|
text: const Text('Wow a page'),
|
|
|
|
graphic: const FlutterLogo(),
|
|
|
|
),
|
|
|
|
IntroductionPage(
|
|
|
|
title: const Text('Second page'),
|
|
|
|
text: const Text('Another page'),
|
|
|
|
graphic: const FlutterLogo(),
|
|
|
|
),
|
|
|
|
IntroductionPage(
|
|
|
|
title: const Text('Third page'),
|
|
|
|
text: const Text('The final page of this app'),
|
|
|
|
graphic: const FlutterLogo(),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
introductionTranslations: const IntroductionTranslations(
|
|
|
|
skipButton: 'Skip it!',
|
|
|
|
nextButton: 'Previous',
|
|
|
|
previousButton: 'Next',
|
|
|
|
finishButton: 'To the app!',
|
|
|
|
),
|
|
|
|
tapEnabled: true,
|
|
|
|
displayMode: IntroductionDisplayMode.multiPageHorizontal,
|
|
|
|
buttonMode: IntroductionScreenButtonMode.text,
|
|
|
|
indicatorMode: IndicatorMode.dash,
|
|
|
|
skippable: true,
|
|
|
|
buttonBuilder: (context, onPressed, child) =>
|
|
|
|
ElevatedButton(onPressed: onPressed, child: child),
|
|
|
|
),
|
|
|
|
service: service,
|
|
|
|
navigateTo: () {
|
|
|
|
Navigator.of(context).push(
|
|
|
|
MaterialPageRoute(
|
|
|
|
builder: (context) {
|
|
|
|
return const Home();
|
|
|
|
},
|
|
|
|
),
|
|
|
|
);
|
|
|
|
},
|
2022-10-07 15:59:02 +02:00
|
|
|
child: const Home(),
|
2022-10-07 15:31:07 +02:00
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class Home extends StatelessWidget {
|
|
|
|
const Home({
|
|
|
|
super.key,
|
|
|
|
});
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Container();
|
|
|
|
}
|
|
|
|
}
|