Flutter: ListView in a SimpleDialog

后端 未结 9 1630
深忆病人
深忆病人 2020-12-24 01:04

I want to show a SimpleDialog with ListView.builder in my Flutter app with this code:

showDialog(
  context: context,
  builder: (BuildContext context) {
           


        
9条回答
  •  一生所求
    2020-12-24 01:58

    you can create a separate method method for SimpleDialogOptions code below:

    final SimpleDialog dialog = new SimpleDialog(
          title: const Text('Select assignment'),
          children: [
            new SimpleDialogOption(
              onPressed: () { Navigator.pop(context); },
              child: const Text('Text one'),
            ),
            new SimpleDialogOption(
              onPressed: () {},
              child: const Text('Text two'),
            ),
          ],
        );
        return dialog;
    

提交回复
热议问题