daily pastebin goal
17%
SHARE
TWEET

Untitled

a guest Aug 10th, 2018 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import 'package:flutter/material.dart';
  2.  
  3. void main() => runApp(MaterialApp(home: new MyApp()));
  4.  
  5. class MyApp extends StatefulWidget {
  6.   @override
  7.   _MyAppState createState() => _MyAppState();
  8. }
  9.  
  10. class _MyAppState extends State<MyApp> {
  11.   var mylist = List.generate(500, (i) => "Flutter $i");
  12.  
  13.   var _controller = ScrollController();
  14.   var _controller2 = ScrollController();
  15.   @override
  16.   Widget build(BuildContext context) {
  17.     return Scaffold(
  18.       appBar: AppBar(),
  19.       floatingActionButton: FloatingActionButton(
  20.         onPressed: () {
  21.           _controller.animateTo(0.0,
  22.               curve: Curves.easeInOut, duration: Duration(seconds: 1));
  23.           _controller2.animateTo(_controller.position.maxScrollExtent,
  24.               curve: Curves.easeInOut, duration: Duration(seconds: 1));
  25.         },
  26.       ),
  27.       body: Row(
  28.         children: <Widget>[
  29.           Expanded(
  30.             child: ListView(
  31.               controller: _controller,
  32.               children: mylist.map((item) {
  33.                 return ListTile(
  34.                   leading: FlutterLogo(),
  35.                   title: Text(item),
  36.                 );
  37.               }).toList(),
  38.             ),
  39.           ),
  40.           Expanded(
  41.             child: ListView(
  42.               controller: _controller2,
  43.               children: mylist.map((item) {
  44.                 return ListTile(
  45.                   leading: FlutterLogo(
  46.                     colors: Colors.red,
  47.                   ),
  48.                   title: Text(item),
  49.                 );
  50.               }).toList(),
  51.             ),
  52.           ),
  53.         ],
  54.       ),
  55.     );
  56.   }
  57. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top