-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmain.dart
74 lines (66 loc) · 1.98 KB
/
main.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
// Flutter imports:
import 'package:flutter/material.dart';
// Package imports:
import 'package:flutter_scroll_shadow/flutter_scroll_shadow.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) => MaterialApp(
title: 'ScrollShadow Example',
theme: ThemeData(primarySwatch: Colors.blue),
home: const MyHomePage(),
);
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key});
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) => Scaffold(
appBar: AppBar(
title: const Text(
' Vertical | Horizontal',
),
centerTitle: true,
),
body: Row(
children: [
// Vertically-scrolling child
Expanded(
child: ScrollShadow(
color: Colors.grey,
child: ListView(
scrollDirection: Axis.vertical,
children: List.generate(
15,
(index) => ListTile(title: Text('Element $index')),
),
),
),
),
// Horizontally-scrolling child
Expanded(
child: ScrollShadow(
color: Colors.grey,
child: ListView(
scrollDirection: Axis.horizontal,
children: List.generate(
5,
(index) => SizedBox(
width: 100,
child: RotatedBox(
quarterTurns: 1,
child: Text('Element $index'),
),
),
),
),
),
),
],
),
);
}