小编Ser*_*jik的帖子

Flutter-onPressed功能

我需要在下面的图标上插入onpressed()函数(导航器推至其他页面):

Column buildButtonColumn(IconData icon, String label) {
    Color color = Theme.of(context).primaryColor;
      return Column(
      mainAxisSize: MainAxisSize.min,
       mainAxisAlignment: MainAxisAlignment.center,
       children: [
      Icon(icon, color: color),
      Container(
        margin: const EdgeInsets.only(top: 8.0),
        child: Text(
          label,
          style: TextStyle(
            fontSize: 12.0,
            fontWeight: FontWeight.w400,
            color: color,
             ),
           ),
         ),
       ],
     );
   }

   Widget buttonSection = Container(
    child: Row(
      mainAxisAlignment: MainAxisAlignment.spaceEvenly,
      children: [
        buildButtonColumn(Icons.call, 'CALL'),
        buildButtonColumn(Icons.near_me, 'ROUTE'),
        buildButtonColumn(Icons.share, 'SHARE'),
      ],
    ),
  );
Run Code Online (Sandbox Code Playgroud)

flutter

3
推荐指数
1
解决办法
6924
查看次数

标签 统计

flutter ×1