【问题标题】:creating a selection menu with flutter使用颤振创建选择菜单
【发布时间】:2021-12-09 21:05:18
【问题描述】:

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

【问题讨论】:

  • 我的问题不是很好,你可以检查ExpansionTileDropDownMenuItem

标签: flutter dart mobile


【解决方案1】:

您可以使用 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

【讨论】:

  • 非常感谢 :)
【解决方案2】:

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

flutter 框架捆绑了一个材料和一个 Cupertino 操作表 -

【讨论】:

    猜你喜欢
    • 2021-09-17
    • 2021-06-01
    • 2021-11-19
    • 2019-05-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多