Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import 'package:flutter/material.dart';
- void main() => runApp(MaterialApp(home: new MyApp()));
- class MyApp extends StatefulWidget {
- @override
- _MyAppState createState() => _MyAppState();
- }
- class _MyAppState extends State<MyApp> {
- var mylist = List.generate(500, (i) => "Flutter $i");
- var _controller = ScrollController();
- var _controller2 = ScrollController();
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- appBar: AppBar(),
- floatingActionButton: FloatingActionButton(
- onPressed: () {
- _controller.animateTo(0.0,
- curve: Curves.easeInOut, duration: Duration(seconds: 1));
- _controller2.animateTo(_controller.position.maxScrollExtent,
- curve: Curves.easeInOut, duration: Duration(seconds: 1));
- },
- ),
- body: Row(
- children: <Widget>[
- Expanded(
- child: ListView(
- controller: _controller,
- children: mylist.map((item) {
- return ListTile(
- leading: FlutterLogo(),
- title: Text(item),
- );
- }).toList(),
- ),
- ),
- Expanded(
- child: ListView(
- controller: _controller2,
- children: mylist.map((item) {
- return ListTile(
- leading: FlutterLogo(
- colors: Colors.red,
- ),
- title: Text(item),
- );
- }).toList(),
- ),
- ),
- ],
- ),
- );
- }
- }
Add Comment
Please, Sign In to add comment