@@ -2,45 +2,41 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flutter code sample for [RawScrollbar].
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
void main() => runApp(const MyApp());
|
||||
/// Flutter code sample for [RawScrollbar].
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({super.key});
|
||||
void main() => runApp(const RawScrollbarExampleApp());
|
||||
|
||||
static const String _title = 'Flutter Code Sample';
|
||||
class RawScrollbarExampleApp extends StatelessWidget {
|
||||
const RawScrollbarExampleApp({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
title: _title,
|
||||
home: Scaffold(
|
||||
appBar: AppBar(title: const Text(_title)),
|
||||
appBar: AppBar(title: const Text('RawScrollbar Sample')),
|
||||
body: const Center(
|
||||
child: MyStatefulWidget(),
|
||||
child: RawScrollbarExample(),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class MyStatefulWidget extends StatefulWidget {
|
||||
const MyStatefulWidget({super.key});
|
||||
class RawScrollbarExample extends StatefulWidget {
|
||||
const RawScrollbarExample({super.key});
|
||||
|
||||
@override
|
||||
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
|
||||
State<RawScrollbarExample> createState() => _RawScrollbarExampleState();
|
||||
}
|
||||
|
||||
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
|
||||
class _RawScrollbarExampleState extends State<RawScrollbarExample> {
|
||||
final ScrollController _firstController = ScrollController();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return LayoutBuilder(
|
||||
builder: (BuildContext context, BoxConstraints constraints) {
|
||||
return LayoutBuilder(builder: (BuildContext context, BoxConstraints constraints) {
|
||||
return Row(
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
@@ -78,9 +74,7 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return Container(
|
||||
height: 50,
|
||||
color: index.isEven
|
||||
? Colors.amberAccent
|
||||
: Colors.blueAccent,
|
||||
color: index.isEven ? Colors.amberAccent : Colors.blueAccent,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text('Scrollable 2 : Index $index'),
|
||||
|
||||
@@ -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 [RawScrollbar].
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
void main() => runApp(const MyApp());
|
||||
/// Flutter code sample for [RawScrollbar].
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({super.key});
|
||||
void main() => runApp(const RawScrollbarExampleApp());
|
||||
|
||||
static const String _title = 'Flutter Code Sample';
|
||||
class RawScrollbarExampleApp extends StatelessWidget {
|
||||
const RawScrollbarExampleApp({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('RawScrollbar Sample')),
|
||||
body: const RawScrollbarExample(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class MyStatelessWidget extends StatelessWidget {
|
||||
const MyStatelessWidget({super.key});
|
||||
class RawScrollbarExample extends StatelessWidget {
|
||||
const RawScrollbarExample({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return RawScrollbar(
|
||||
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 [RawScrollbar].
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
void main() => runApp(const MyApp());
|
||||
/// Flutter code sample for [RawScrollbar].
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({super.key});
|
||||
void main() => runApp(const RawScrollbarExampleApp());
|
||||
|
||||
static const String _title = 'Flutter Code Sample';
|
||||
class RawScrollbarExampleApp extends StatelessWidget {
|
||||
const RawScrollbarExampleApp({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('RawScrollbar Sample')),
|
||||
body: const RawScrollbarExample(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class MyStatefulWidget extends StatefulWidget {
|
||||
const MyStatefulWidget({super.key});
|
||||
class RawScrollbarExample extends StatefulWidget {
|
||||
const RawScrollbarExample({super.key});
|
||||
|
||||
@override
|
||||
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
|
||||
State<RawScrollbarExample> createState() => _RawScrollbarExampleState();
|
||||
}
|
||||
|
||||
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
|
||||
class _RawScrollbarExampleState extends State<RawScrollbarExample> {
|
||||
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'),
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
// 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';
|
||||
|
||||
/// Flutter code sample for [Scrollbar].
|
||||
|
||||
void main() => runApp(const ScrollbarApp());
|
||||
|
||||
class ScrollbarApp extends StatelessWidget {
|
||||
@@ -17,27 +17,26 @@ class ScrollbarApp extends StatelessWidget {
|
||||
home: Scaffold(
|
||||
appBar: AppBar(title: const Text('Scrollbar Sample')),
|
||||
body: const Center(
|
||||
child: MyStatefulWidget(),
|
||||
child: DesktopExample(),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class MyStatefulWidget extends StatefulWidget {
|
||||
const MyStatefulWidget({super.key});
|
||||
class DesktopExample extends StatefulWidget {
|
||||
const DesktopExample({super.key});
|
||||
|
||||
@override
|
||||
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
|
||||
State<DesktopExample> createState() => _DesktopExampleState();
|
||||
}
|
||||
|
||||
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
|
||||
class _DesktopExampleState extends State<DesktopExample> {
|
||||
final ScrollController controller = ScrollController();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return LayoutBuilder(
|
||||
builder: (BuildContext context, BoxConstraints constraints) {
|
||||
return LayoutBuilder(builder: (BuildContext context, BoxConstraints constraints) {
|
||||
return Row(
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
@@ -73,8 +72,7 @@ class _MyStatefulWidgetState extends State<MyStatefulWidget> {
|
||||
thickness: 20.0,
|
||||
thumbVisibility: true,
|
||||
child: ScrollConfiguration(
|
||||
behavior: ScrollConfiguration.of(context)
|
||||
.copyWith(scrollbars: false),
|
||||
behavior: ScrollConfiguration.of(context).copyWith(scrollbars: false),
|
||||
child: ListView.builder(
|
||||
primary: true,
|
||||
itemCount: 100,
|
||||
|
||||
@@ -2,35 +2,31 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flutter code sample for [RawScrollbar.shape].
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
void main() => runApp(const MyApp());
|
||||
/// Flutter code sample for [RawScrollbar.shape].
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({super.key});
|
||||
void main() => runApp(const ShapeExampleApp());
|
||||
|
||||
static const String _title = 'Flutter Code Sample';
|
||||
class ShapeExampleApp extends StatelessWidget {
|
||||
const ShapeExampleApp({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const MaterialApp(
|
||||
title: _title,
|
||||
home: MyStatelessWidget(),
|
||||
home: ShapeExample(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class MyStatelessWidget extends StatelessWidget {
|
||||
const MyStatelessWidget({super.key});
|
||||
class ShapeExample extends StatelessWidget {
|
||||
const ShapeExample({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: RawScrollbar(
|
||||
shape: const StadiumBorder(
|
||||
side: BorderSide(color: Colors.brown, width: 3.0)),
|
||||
shape: const StadiumBorder(side: BorderSide(color: Colors.brown, width: 3.0)),
|
||||
thickness: 15.0,
|
||||
thumbColor: Colors.blue,
|
||||
thumbVisibility: true,
|
||||
@@ -41,8 +37,7 @@ class MyStatelessWidget extends StatelessWidget {
|
||||
// PrimaryScrollController requires ScrollView.primary be set.
|
||||
primary: true,
|
||||
physics: const BouncingScrollPhysics(),
|
||||
children: List<Text>.generate(
|
||||
100, (int index) => Text((index * index).toString())),
|
||||
children: List<Text>.generate(100, (int index) => Text((index * index).toString())),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user