通过这个简单的代码,我可以像下面的截图一样在屏幕底部显示对话框:
20.0显示对话框controller.reverse()上解雇对话框import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@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> {
void …Run Code Online (Sandbox Code Playgroud) 我显示里面有列表的对话框。
showDialog(
context: context,
builder: (context) {
return AlertDialog(
title: Text(select_conference),
content: ListView.separated(
itemCount: selected.length,
separatorBuilder: (context, index) => CommonDivider(),
itemBuilder: (context, index) => ListTile(...),
),
);
});
Run Code Online (Sandbox Code Playgroud)
但是无论有多少元素 - 对话框都会填充所有可用高度。有没有办法在不计算列表元素高度的情况下解决这个问题?