2022-05-09 06:54:36 +00:00
|
|
|
import 'package:flutter/material.dart';
|
2022-05-31 13:48:18 +00:00
|
|
|
import 'package:openclosenew/colors.dart';
|
2022-05-09 06:54:36 +00:00
|
|
|
import 'package:openclosenew/home_screen.dart';
|
|
|
|
|
2022-06-01 16:36:23 +00:00
|
|
|
import 'FontFamily.dart';
|
|
|
|
|
2022-05-09 06:54:36 +00:00
|
|
|
class PageViewModel {
|
|
|
|
String title;
|
|
|
|
String body;
|
|
|
|
String image;
|
|
|
|
|
|
|
|
PageViewModel({required this.title, required this.body, required this.image});
|
|
|
|
}
|
|
|
|
|
|
|
|
class IntroScreen extends StatefulWidget {
|
|
|
|
@override
|
|
|
|
State<IntroScreen> createState() => _IntroScreenState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _IntroScreenState extends State<IntroScreen> {
|
|
|
|
int pageIndex = 0;
|
|
|
|
PageController pageController = PageController();
|
|
|
|
|
|
|
|
final List<PageViewModel> pages = [
|
|
|
|
PageViewModel(
|
|
|
|
title: '',
|
|
|
|
body: 'Best Hotels and Restaurants around you...',
|
|
|
|
image: 'assets/images/onboarding_image_1.png',
|
|
|
|
),
|
|
|
|
PageViewModel(
|
|
|
|
title: '',
|
|
|
|
body: 'Best Medicals, Clinics and Hospitals around you...',
|
|
|
|
image: 'assets/images/onboarding_image_2.png',
|
|
|
|
),
|
|
|
|
PageViewModel(
|
|
|
|
title: '',
|
|
|
|
body: 'Best Grocery and all Other Shops around you...',
|
|
|
|
image: "assets/images/onboarding_image_3.png",
|
|
|
|
)
|
|
|
|
];
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Scaffold(
|
|
|
|
body: Column(
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: PageView.builder(
|
|
|
|
itemCount: pages.length,
|
|
|
|
controller: pageController,
|
|
|
|
physics: BouncingScrollPhysics(),
|
|
|
|
onPageChanged: (val) {
|
|
|
|
setState(() {
|
|
|
|
pageIndex = val;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
itemBuilder: (context, pos) {
|
|
|
|
PageViewModel item = pages[pos];
|
|
|
|
return Center(
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Image.asset(item.image),
|
|
|
|
SizedBox(
|
|
|
|
height: 16,
|
|
|
|
),
|
|
|
|
Text(item.body)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Padding(
|
|
|
|
padding: const EdgeInsets.only(bottom: 16, left: 70, right: 16),
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
Spacer(),
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
for (int i = 0; i < pages.length; i++)
|
|
|
|
Container(
|
|
|
|
height: 8,
|
|
|
|
width: (pageIndex == i) ? 20 : 8,
|
|
|
|
margin: EdgeInsets.only(right: 8),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: (pageIndex == i)
|
2022-05-31 13:48:18 +00:00
|
|
|
? primaryColor
|
2022-05-09 06:54:36 +00:00
|
|
|
: Colors.green.shade100,
|
|
|
|
borderRadius: BorderRadius.circular(8)),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
Spacer(),
|
|
|
|
(pageIndex == 2)
|
|
|
|
? FloatingActionButton(
|
|
|
|
onPressed: () {
|
|
|
|
Navigator.push(context,
|
|
|
|
MaterialPageRoute(builder: (_) => Register()));
|
|
|
|
},
|
|
|
|
elevation: 0,
|
2022-05-31 13:48:18 +00:00
|
|
|
backgroundColor: primaryColor,
|
2022-05-09 06:54:36 +00:00
|
|
|
child: Icon(
|
|
|
|
Icons.arrow_forward_rounded,
|
2022-05-31 13:48:18 +00:00
|
|
|
color: White,
|
2022-05-09 06:54:36 +00:00
|
|
|
),
|
|
|
|
)
|
|
|
|
: TextButton(
|
|
|
|
onPressed: () {
|
|
|
|
pageController.jumpToPage(2);
|
|
|
|
},
|
|
|
|
child: Text(
|
|
|
|
"Skip",
|
2022-06-01 16:36:23 +00:00
|
|
|
style: TextStyle(
|
|
|
|
color: Gray,
|
|
|
|
fontSize: 18,
|
|
|
|
fontFamily: Font,
|
|
|
|
),
|
2022-05-09 06:54:36 +00:00
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
2022-06-01 16:36:23 +00:00
|
|
|
),
|
2022-05-09 06:54:36 +00:00
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|