flutter 嗨,我如何添加一个按钮,让我进入主页

rseugnpd  于 2023-01-06  发布在  Flutter
关注(0)|答案(1)|浏览(112)

class _BottomPart扩展无状态控件{ const _BottomPart({Key?key}):超级(键:键);
@override小部件构建(BuildContext上下文){ return对齐(对齐方式:对齐方式.底部居中,子项:填充(填充:const EdgeInsets.对称(水平:40.0),儿童:色谱柱(

mainAxisSize: MainAxisSize.min,
      children: [
        const Text(
          'Find The Best Coffee for You',
          style: TextStyle(
              fontSize: 27.0,
              fontWeight: FontWeight.bold,
              color: Colors.white),
        ),
        const SizedBox(height: 30.0),
        Text(
          'Lorem ipsum dolor sit amet, adipiscing elit. '
              'Nullam pulvinar dolor sed enim eleifend efficitur.',
          style: TextStyle(
            fontSize: 15.0,
            color: Colors.white.withOpacity(0.8),
            height: 1.5,
          ),
        ),
        const SizedBox(height: 50.0),
        Align(
          alignment: Alignment.centerRight,
          child: Container(

            height: 85.0,
            width: 85.0,
            decoration: BoxDecoration(
              shape: BoxShape.circle,
              border: Border.all(color: Colors.white, width: 2.0),
            ),
            child: const Icon(
              Icons.chevron_right,
              size: 50.0,
              color: Colors.white,
            ),
          ),
        ),
        const SizedBox(height: 50.0),

      ],
    ),
  ),
);

} }

nfs0ujit

nfs0ujit1#

最简单的方法是(假设您的家是一条命名路径,名称为/):

Navigator.popUntil(context, ModalRoute.withName('/'));

相关问题