cupertino_scrollbar.0.dart 1.36 KB
Newer Older
1 2 3 4 5 6
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:flutter/cupertino.dart';

7 8
/// Flutter code sample for [CupertinoScrollbar].

9
void main() => runApp(const ScrollbarApp());
10

11
class ScrollbarApp extends StatelessWidget {
12
  const ScrollbarApp({super.key});
13 14 15

  @override
  Widget build(BuildContext context) {
16 17 18
    return const CupertinoApp(
      theme: CupertinoThemeData(brightness: Brightness.light),
      home: ScrollbarExample(),
19 20 21 22
    );
  }
}

23
class ScrollbarExample extends StatelessWidget {
24
  const ScrollbarExample({super.key});
25 26 27

  @override
  Widget build(BuildContext context) {
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
    return CupertinoPageScaffold(
      navigationBar: const CupertinoNavigationBar(
        middle: Text('CupertinoScrollbar Sample'),
      ),
      child: CupertinoScrollbar(
        thickness: 6.0,
        thicknessWhileDragging: 10.0,
        radius: const Radius.circular(34.0),
        radiusWhileDragging: Radius.zero,
        child: ListView.builder(
          itemCount: 120,
          itemBuilder: (BuildContext context, int index) {
            return Center(
              child: Padding(
                padding: const EdgeInsets.all(8.0),
                child: Text('Item $index'),
              ),
            );
          },
        ),
48 49 50 51
      ),
    );
  }
}