Skip to content

Instantly share code, notes, and snippets.

@kimgeuntae
Last active March 1, 2024 10:41
Show Gist options
  • Save kimgeuntae/19069ba0f790a33e1200361e0ea40a85 to your computer and use it in GitHub Desktop.
Save kimgeuntae/19069ba0f790a33e1200361e0ea40a85 to your computer and use it in GitHub Desktop.
Flutter 화면 하단에서 올라오는 다이얼로그 BottomSheet
// 화면 하단에서 올라오는 다이얼로그
// 画面下から上がってくるダイアログ
// 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