Flutter AlertDialogのボタンを中央に寄せるサンプル
環境
Windows11 pro 64bit
Flutter 3.3.7
構文
AlertDialogのボタンを中央に寄せるには、「actions」を使わず、
「Rowウェジェット」を使います。
使用例
return AlertDialog(
title: Text('Test'),
content: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text('選択'),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
mainAxisSize: MainAxisSize.min,
children: [
TextButton(
onPressed: () {},
child: Text('Cancel'),
),
TextButton(
onPressed: () {},
child: Text('OK'),
),
],
)
],
),
);