Hello guys today, Im going to tell you
"How to make your dialog's width be full of your device screen!"
How?
1. find the file 'dialog.dart' from
\flutter\packages\flutter\lib\src\cupertino
(this is the location where you installed your flutter)
2. change the line
padding: MediaQuery.of(context).viewInsets + const EdgeInsets.symmetric(horizontal: 40.0, vertical: 24.0),
to
padding: MediaQuery.of(context).viewInsets + const EdgeInsets.symmetric(horizontal: 0.0, vertical: 24.0),
And ctrl + s
Its done!
Enjoy your wide dialog
byebye
Wait!!!
it is not done.
You don't have to change the dialog.dart file in the flutter directory.
It causes some problems when updating it's version or something.
so follow it
1. copy all texts in the dialog.dart
2. make a new dart file named 'customDialog.dart' in your project's lib
and paste 1.'s texts at customDialog.dart
3. change the line
padding: MediaQuery.of(context).viewInsets + const EdgeInsets.symmetric(horizontal: 40.0, vertical: 24.0),
to
padding: MediaQuery.of(context).viewInsets + const EdgeInsets.symmetric(horizontal: 0.0, vertical: 24.0),
4. add this to your main.dart
import 'package:nininaenae/custom_dialog.dart' as customDialog;
5. use 'return customDialog.AlertDialog();'
when you need a full width dialog
it's end
so please use it. it's very good
byebye
'안드로이드 > Flutter' 카테고리의 다른 글
Flutter - how to use custom Icons (0) | 2020.05.14 |
---|---|
플러터 비동기 post방식 사용법 (0) | 2020.05.12 |
Taps, drags, and other gestures (0) | 2020.05.07 |
How to make a right size of Widgets in Flutter (0) | 2020.05.06 |
pub.dev에서 라이브러리를 가져오는방법 (0) | 2020.04.28 |