-
Notifications
You must be signed in to change notification settings - Fork 2
/
example.dart
40 lines (36 loc) · 936 Bytes
/
example.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
import 'package:flutter/material.dart';
import 'package:snapping_page_scroll/snapping_page_scroll.dart';
void main() => runApp(App());
class App extends StatelessWidget {
Widget customCard(String text) {
return Padding(
padding: const EdgeInsets.fromLTRB(20, 100, 20, 100),
child: Card(
child: Text(text),
),
);
}
final controller = PageController(
viewportFraction: 0.75,
);
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
backgroundColor: Colors.amber,
appBar: AppBar(),
body: SnappingPageScroll(
controller: controller,
children: <Widget>[
customCard('Card 1'),
customCard('Card 2'),
customCard('Card 3'),
customCard('Card 4'),
customCard('Card 5'),
customCard('Card 6'),
],
),
),
);
}
}