showSettingDialog static method
Implementation
static Future showSettingDialog({String text = ""}) {
assert(_context != null, 'Please call initContext() method first.');
return showDialog(
context: _context!,
builder: (context) => Dialog(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
const SizedBox(height: 20),
Text(
_title ?? '授權失敗',
style: const TextStyle(
color: Colors.black,
fontSize: 18,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 12),
Text(
_description?.call(text) ?? '請前往設置中心開啟$text權限',
style: const TextStyle(
color: Colors.black87,
fontSize: 16,
),
textAlign: TextAlign.center,
),
const SizedBox(height: 20),
Container(height: 0.5, width: 300, color: Colors.black12),
SizedBox(
width: 300,
height: 50,
child: Row(children: [
Expanded(
child: TextButton(
onPressed: () => Navigator.of(_context!).pop(),
style: ButtonStyle(
overlayColor:
MaterialStateProperty.all(Colors.transparent),
),
child: Text(
_cancelText ?? '取消',
style: const TextStyle(
color: Colors.black54,
fontSize: 16,
),
),
),
),
Container(height: 50, width: 0.5, color: Colors.black12),
Expanded(
child: TextButton(
onPressed: () {
Navigator.of(_context!).pop();
openAppSettings();
},
style: ButtonStyle(
overlayColor:
MaterialStateProperty.all(Colors.transparent),
),
child: Text(
_confirmText ?? '前往',
style: const TextStyle(
color: Colors.blue,
fontSize: 16,
),
),
),
),
]),
),
],
),
),
);
}