-
Notifications
You must be signed in to change notification settings - Fork 105
/
Copy pathpageview_builder.dart
63 lines (58 loc) · 1.67 KB
/
pageview_builder.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
import 'package:flutter/material.dart';
class MyPageViewBuilder extends StatefulWidget {
const MyPageViewBuilder({Key? key}) : super(key: key);
@override
State<MyPageViewBuilder> createState() => _MyPageViewBuilderState();
}
class _MyPageViewBuilderState extends State<MyPageViewBuilder> {
final List<Color> _colors = [
Colors.orange,
Colors.purple,
Colors.redAccent,
Colors.teal,
Colors.blue,
Colors.black,
];
int currentPage = 0;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Page View Builder')),
body: PageView.builder(
itemCount: _colors.length,
scrollDirection: Axis.vertical,
itemBuilder: (context, index) {
return Container(
color: _colors[index],
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text(
'Page no',
style: TextStyle(
fontSize: 30,
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 30),
CircleAvatar(
radius: 50,
backgroundColor: Colors.white,
child: Text(
'${index + 1}',
style: TextStyle(
fontSize: 30,
color: _colors[index],
fontWeight: FontWeight.bold,
),
),
)
],
),
);
},
),
);
}
}