-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathon_board_screen.dart
116 lines (111 loc) · 3.54 KB
/
on_board_screen.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
import 'package:flutter/material.dart';
import 'package:flutter_ui_source/onboard/board_model.dart';
import 'package:flutter_ui_source/onboard/dot_indicator_2.dart';
import 'package:flutter_ui_source/onboard/on_board_item.dart';
class OnBoardScreen extends StatefulWidget {
const OnBoardScreen({Key? key}) : super(key: key);
@override
State<OnBoardScreen> createState() => _OnBoardScreenState();
}
class _OnBoardScreenState extends State<OnBoardScreen> {
late PageController _pageController;
int pageIndex = 0;
@override
void initState() {
super.initState();
_pageController = PageController(initialPage: 0);
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
elevation: 0,
actions: [
TextButton(
onPressed: () {},
child: const Text(
'SKIP',
style: TextStyle(
color: Colors.teal,
fontWeight: FontWeight.w900,
fontSize: 18,
),
),
),
const SizedBox(
width: 10,
),
],
),
body: Padding(
padding: const EdgeInsets.only(left: 15, right: 15, bottom: 35),
child: Column(
children: [
Expanded(
child: PageView.builder(
onPageChanged: (index) {
setState(() {
pageIndex = index;
});
},
itemCount: dummyData.length,
controller: _pageController,
itemBuilder: (context, index) {
return OnBoardItem(
image: dummyData[index].image,
title: dummyData[index].title,
description: dummyData[index].description,
);
},
),
),
//pageIndex != dummyData.length - 1 ?
Row(
//mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
...List.generate(
dummyData.length,
(index) => DotIndicator2(
isActive: index == pageIndex,
index: index,
),
),
const Spacer(),
ElevatedButton(
onPressed: () {
_pageController.nextPage(
duration: const Duration(milliseconds: 300),
curve: Curves.slowMiddle,
);
},
style: ElevatedButton.styleFrom(
shape: const CircleBorder(),
backgroundColor: Colors.teal,
padding: const EdgeInsets.all(10)),
child: const Icon(
Icons.arrow_forward,
color: Colors.white,
),
),
],
)
// : ElevatedButton(
// onPressed: () {},
// style: ElevatedButton.styleFrom(
// backgroundColor: Colors.teal,
// padding: const EdgeInsets.symmetric(horizontal: 30)),
// child: const Text(
// 'Start',
// style: TextStyle(
// color: Colors.white,
// fontWeight: FontWeight.bold,
// ),
// ),
// ),
],
),
),
);
}
}