Created
June 5, 2018 15:03
-
-
Save HansMuller/f35aeae7ac44225d8b831f5e4749c0e1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// listview in alert dialog error | |
// https://github.com/flutter/flutter/issues/18108 | |
import 'package:flutter/material.dart'; | |
void main() { | |
runApp( | |
new MaterialApp( | |
theme: new ThemeData( | |
brightness: Brightness.dark, | |
primaryColor: Colors.amber, | |
accentColor: Colors.red), | |
home: new Test(), | |
), | |
); | |
} | |
class Test extends StatelessWidget { | |
final List<String> values = ["1", "2", "3"]; | |
@override | |
Widget build(BuildContext context) { | |
return new Scaffold( | |
appBar: new AppBar( | |
title: new Center( | |
child: const Text('TEST', style: const TextStyle(color: Colors.white)), | |
), | |
), | |
body: new FloatingActionButton( | |
child: new Icon(Icons.cancel), | |
onPressed: () { | |
showDialog( | |
context: context, | |
builder: (BuildContext context) { | |
return new AlertDialog( | |
title: new Text("test"), | |
content: new ListView.builder( | |
itemCount: values.length, | |
itemBuilder: (BuildContext buildContext, int index) => new Text(values[index]), | |
shrinkWrap: true, | |
), | |
); | |
}, | |
); | |
}, | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment