import 'package:flutter/material.dart';
import 'package:intro_slider/intro_slider.dart';
import 'package:intro_slider/slide_object.dart';
import 'package:intro_slider/scrollbar_behavior_enum.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.green,
),
home: IntroScreen(),
);
}
}
class IntroScreen extends StatefulWidget {
@override
_IntroScreenState createState() => _IntroScreenState();
}
class _IntroScreenState extends State<IntroScreen> {
// creating List of Slide objects
// to store data of all intro slides
List<Slide> slides = [];
@override
void initState() {
super.initState();
// initializing slides at
// the runtime of app
slides.add(
new Slide(
title: "GeeksForGeeks ",
maxLineTitle: 2,
styleTitle: TextStyle(
color: Colors.green,
fontSize: 30.0,
fontWeight: FontWeight.bold,
),
description:
"GeeksForGeeks present you the intro_slider
tutorial making your learning phase Easier.",
styleDescription: TextStyle(
color: Colors.green,
fontSize: 20.0,
),
marginDescription:
EdgeInsets.only(left: 20.0,
right: 20.0,
top: 20.0,
bottom: 70.0),
backgroundColor: Colors.yellow,
directionColorBegin: Alignment.topLeft,
directionColorEnd: Alignment.bottomRight,
onCenterItemPress: () {},
),
);
slides.add(
new Slide(
title: "Second Slide",
styleTitle: TextStyle(
color: Colors.white,
fontSize: 30.0,
fontWeight: FontWeight.bold,
),
description: "Do video call anywhere anytime with this app.",
styleDescription: TextStyle(
color: Colors.white,
fontSize: 20.0,
),
backgroundImage: "assets/image1.png",
directionColorBegin: Alignment.topRight,
directionColorEnd: Alignment.bottomLeft,
),
);
slides.add(
new Slide(
title: "Third Slide",
styleTitle: TextStyle(
color: Colors.white,
fontSize: 30.0,
fontWeight: FontWeight.bold,
),
description: "Now track the location with this app easily.",
styleDescription: TextStyle(
color: Colors.white,
fontSize: 20.0,
),
backgroundImage: "assets/image2.png",
directionColorBegin: Alignment.topCenter,
directionColorEnd: Alignment.bottomCenter,
maxLineTextDescription: 3,
),
);
}
@override
Widget build(BuildContext context) {
return new IntroSlider(
// List slides
slides: this.slides,
// Skip button
renderSkipBtn: TextButton(
onPressed: () {},
child: Text(
"Skip",
style: TextStyle(fontSize: 20),
)),
// Next button
renderNextBtn: Icon(
Icons.navigate_next,
color: Colors.green,
size: 40.0,
),
// Done button
renderDoneBtn: TextButton(
onPressed: () {},
child: Text("Done",
style: TextStyle(fontSize: 20))),
// Dot indicator
colorDot: Colors.green,
colorActiveDot: Colors.green,
sizeDot: 13.0,
// Show or hide status bar
hideStatusBar: true,
backgroundColorAllSlides: Colors.black,
// Scrollbar
verticalScrollbarBehavior: scrollbarBehavior.SHOW_ALWAYS,
);
}
}