用 flutter 创建一个选择菜单

creating a selection menu with flutter

我想知道如何制作如图所示的选择菜单(按下时,所选菜单项的文本会重新绘制成另一个) image is here

据我所知,我相信您需要使用操作 sheets。

Flutter 框架捆绑了一个 material 和一个 Cupertino 动作 sheet -

您可以使用 Column 来布局该类型的视图,每个子项都有一个选择器。

class MyWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
 return Column(
   children: [
     GestureDetector(
       onTap: (){
         //Take an action like navegate to another route with pressed info
         /*Navigator.push(
               context,
               MaterialPageRoute(builder: (_) => const NextRoute(text : 'girl\boy friend')),);*/
       },
       child: Text(
         'girl/boy friend',
       ),
     ),
     Divider(),
      Text(
       'Just friend',
     ),
     Divider(),
      Text(
       'Mother/father',
     ),
   ],
 );
}
}

Result of that code