【Flutter】showDialog 模板

此 AlertDialog 已考慮大字體溢出的情況。

showDialog(
  context: context,
  builder: (context) {
    return AlertDialog(
      title: const FittedBox(
        fit: BoxFit.scaleDown,
        alignment: Alignment.centerLeft,
        child: Text('title'),
      ),
      content: const SingleChildScrollView(
        child: Column(
          mainAxisSize: MainAxisSize.min,
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Text('content'),
          ],
        ),
      ),
      actions: [
        TextButton(
          onPressed: () {
            Navigator.of(context).pop();
          },
          child: const Text('close'),
        )
      ],
    );
  },
);
發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *