97 lines
2.5 KiB
Dart
97 lines
2.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
class LogoutDialog extends StatelessWidget {
|
|
final VoidCallback onLogout;
|
|
|
|
const LogoutDialog({super.key, required this.onLogout});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Dialog(
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)),
|
|
backgroundColor: Colors.white,
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 32),
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
const Text(
|
|
'Yakin ingin keluar dari akun?',
|
|
textAlign: TextAlign.center,
|
|
style: TextStyle(
|
|
fontSize: 17,
|
|
fontWeight: FontWeight.bold,
|
|
color: Colors.black87,
|
|
height: 1.4,
|
|
),
|
|
),
|
|
const SizedBox(height: 28),
|
|
Row(
|
|
children: [
|
|
Expanded(
|
|
child: _DialogButton(
|
|
label: 'Batal',
|
|
color: Colors.grey.shade300,
|
|
textColor: Colors.black87,
|
|
onTap: () => Navigator.of(context).pop(),
|
|
),
|
|
),
|
|
const SizedBox(width: 12),
|
|
Expanded(
|
|
child: _DialogButton(
|
|
label: 'Logout',
|
|
color: const Color(0xFF5B9BD5),
|
|
textColor: Colors.white,
|
|
onTap: () {
|
|
Navigator.of(context).pop();
|
|
onLogout();
|
|
},
|
|
),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class _DialogButton extends StatelessWidget {
|
|
final String label;
|
|
final Color color;
|
|
final Color textColor;
|
|
final VoidCallback? onTap;
|
|
|
|
const _DialogButton({
|
|
required this.label,
|
|
required this.color,
|
|
required this.textColor,
|
|
this.onTap,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return GestureDetector(
|
|
onTap: onTap,
|
|
child: Container(
|
|
padding: const EdgeInsets.symmetric(vertical: 14),
|
|
decoration: BoxDecoration(
|
|
color: color,
|
|
borderRadius: BorderRadius.circular(14),
|
|
),
|
|
child: Center(
|
|
child: Text(
|
|
label,
|
|
style: TextStyle(
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.w600,
|
|
color: textColor,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|