Last active
March 1, 2024 10:41
-
-
Save kimgeuntae/19069ba0f790a33e1200361e0ea40a85 to your computer and use it in GitHub Desktop.
Flutter 화면 하단에서 올라오는 다이얼로그 BottomSheet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 화면 하단에서 올라오는 다이얼로그 | |
// 画面下から上がってくるダイアログ | |
// Dialog Rising from the Bottom of the Screen | |
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
home: Scaffold( | |
body: Center( | |
child: Text('MyApp'), | |
), | |
floatingActionButton: _RenderFloatingActionButton(), | |
), | |
); | |
} | |
} | |
class _RenderFloatingActionButton extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return FloatingActionButton( | |
onPressed: () { | |
showModalBottomSheet( | |
context: context, | |
builder: (context) => _BottomSheet(), | |
); | |
}, | |
child: Icon(Icons.add), | |
); | |
} | |
} | |
class _BottomSheet extends StatelessWidget { | |
const _BottomSheet({Key? key}) : super(key: key); | |
@override | |
Widget build(BuildContext context) { | |
return Container( | |
height: 300.0, | |
color: Colors.amber, | |
child: Center( | |
child: Text('BottomSheet Content1'), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment