본문 바로가기

study/flutter

플러터(flutter) GestureDetector 이벤트 및 Navigator

  Widget Information(BuildContext context) {
    return Container(
      width: MediaQuery.of(context).size.width,
      padding: const EdgeInsets.only(top: 10),
      // 제스터 이벤트 
      child: GestureDetector(  
        behavior: HitTestBehavior.opaque,
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: [
            Container(
              padding: const EdgeInsets.only(left: 30),
              child: Text(
                '내 정보 확인 / 변경',
                style: TextStyle(fontSize: 20),
              ),
            ),
            Container(
              alignment: Alignment.centerRight,
            ),
            Container(
              padding: const EdgeInsets.only(right: 30),
              child: Row(
                mainAxisAlignment: MainAxisAlignment.end,
                children: [
                  Container(
                    child: Icon(
                      Icons.arrow_forward_ios,
                      size: 15,
                      color: Colors.grey,
                    ),
                  ),
                ],
              ),
            ),
          ],
        ),
        // GestureDetector를 이용한 onTap
        onTap: () => {
          HapticFeedback.mediumImpact(),
          //Navigator.pushReplacement(context, CupertinoPageRoute(builder: (context)=>AppSetting())),
          Navigator.of(context).push(CupertinoPageRoute(
            builder: (context) => Information1(),
          )),
        },
      ),
    );
  }