@@ -2,39 +2,35 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flutter code sample for [Scrollbar].
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
void main() => runApp(const MyApp());
|
||||
/// Flutter code sample for [Scrollbar].
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({super.key});
|
||||
void main() => runApp(const ScrollbarExampleApp());
|
||||
|
||||
static const String _title = 'Flutter Code Sample';
|
||||
class ScrollbarExampleApp extends StatelessWidget {
|
||||
const ScrollbarExampleApp({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
title: _title,
|
||||
home: Scaffold(
|
||||
appBar: AppBar(title: const Text(_title)),
|
||||
body: const MyStatelessWidget(),
|
||||
appBar: AppBar(title: const Text('Scrollbar Sample')),
|
||||
body: const ScrollbarExample(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class MyStatelessWidget extends StatelessWidget {
|
||||
const MyStatelessWidget({super.key});
|
||||
class ScrollbarExample extends StatelessWidget {
|
||||
const ScrollbarExample({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scrollbar(
|
||||
child: GridView.builder(
|
||||
itemCount: 120,
|
||||
gridDelegate:
|
||||
const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3),
|
||||
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3),
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return Center(
|
||||
child: Text('item $index'),
|
||||
|
||||
@@ -2,37 +2,34 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flutter code sample for [Scrollbar].
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
void main() => runApp(const MyApp());
|
||||
/// Flutter code sample for [Scrollbar].
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({super.key});
|
||||
void main() => runApp(const ScrollbarExampleApp());
|
||||
|
||||
static const String _title = 'Flutter Code Sample';
|
||||
class ScrollbarExampleApp extends StatelessWidget {
|
||||
const ScrollbarExampleApp({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
title: _title,
|
||||
home: Scaffold(
|
||||
appBar: AppBar(title: const Text(_title)),
|
||||
body: const MyStatefulWidget(),
|
||||
appBar: AppBar(title: const Text('Scrollbar Sample')),
|
||||
body: const ScrollbarExample(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class MyStatefulWidget extends StatefulWidget {
|
||||
const MyStatefulWidget({super.key});
|
||||
class ScrollbarExample extends StatefulWidget {
|
||||
const ScrollbarExample({super.key});
|
||||
|
||||
@override
|
||||
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
|
||||
State<ScrollbarExample> createState() => _ScrollbarExampleState();
|
||||
}
|
||||
|
||||
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
|
||||
class _ScrollbarExampleState extends State<ScrollbarExample> {
|
||||
final ScrollController _controllerOne = ScrollController();
|
||||
|
||||
@override
|
||||
@@ -43,8 +40,7 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
|
||||
child: GridView.builder(
|
||||
controller: _controllerOne,
|
||||
itemCount: 120,
|
||||
gridDelegate:
|
||||
const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3),
|
||||
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3),
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return Center(
|
||||
child: Text('item $index'),
|
||||
|
||||
Reference in New Issue
Block a user