Skip to content

Instantly share code, notes, and snippets.

@MariaMelnik
Created March 25, 2019 15:12
Show Gist options
  • Save MariaMelnik/ff1bef77ec5b719b0412761b6eb5ac1e to your computer and use it in GitHub Desktop.
Save MariaMelnik/ff1bef77ec5b719b0412761b6eb5ac1e to your computer and use it in GitHub Desktop.
Flutter: test app for FlutterDriver scrollIntoView issue
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
List<String> titles = List.generate(50, (i) => "tile $i");
List<Widget> widgets = titles.map((String tile) => Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Expanded(
child: Container(
child: Text(
tile,
style: Theme.of(context).textTheme.title,
textAlign: TextAlign.center,
)
),
)
],)
).toList();
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: ListView(
children: widgets,
),
),
// This trailing comma makes auto-formatting nicer for build methods.
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment