[ Flutter ] Row를 클릭하여 아래에서 올라오는 팝업을 만들자!

내가 가끔 쓰는 앱 중 "마이루틴" 이라는 앱이 있습니다.

 

그 앱에서 설정을 건드리는 부분 중 클릭 했더니 아래에서 위로 올라와서 설정을 변경하는게 마음에 들어서 알아보며 정리한 글 입니다.

 

일단 Row를 클릭하면 이벤트를 발생시키기 위해 

"InkWell" 이라는 위젯을 사용했습니다

 

https://api.flutter.dev/flutter/material/InkWell-class.html

 

InkWell class - material library - Dart API

A rectangular area of a Material that responds to touch. For a variant of this widget that does not clip splashes, see InkResponse. The following diagram shows how an InkWell looks when tapped, when using default values. The InkWell widget must have a Mate

api.flutter.dev

 

위 사이트에서 예제를 다음과 같이 inkWell로 onTab 되는 이벤트만 있지만 이걸 응용해서

이렇게 Row를 child로 집어넣고 클릭하면 위 onTap 이벤트가 발생 시킬 수 있습니다.

 

https://api.flutter.dev/flutter/material/showModalBottomSheet.html

 

showModalBottomSheet function - material library - Dart API

Future showModalBottomSheet ({ required BuildContext context, required WidgetBuilder builder, Color? backgroundColor, String? barrierLabel, double? elevation, ShapeBorder? shape, Clip? clipBehavior, BoxConstraints? constraints, Color? barrierColor, bool is

api.flutter.dev

 

클릭하면 요로케 귀여운 놈이 튀어나옴!

하다보니.. 

요로코롬 되어있구만유