|
|
|
|
import 'dart:io';
|
|
|
|
|
|
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:test_sa/extensions/context_extension.dart';
|
|
|
|
|
import 'package:test_sa/extensions/text_extensions.dart';
|
|
|
|
|
import 'package:test_sa/new_views/app_style/app_color.dart';
|
|
|
|
|
|
|
|
|
|
class AAlertDialog extends StatelessWidget {
|
|
|
|
|
final String? title;
|
|
|
|
|
final String? content;
|
|
|
|
|
|
|
|
|
|
const AAlertDialog({Key? key, this.title, this.content}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return Platform.isIOS
|
|
|
|
|
? CupertinoAlertDialog(
|
|
|
|
|
title: title != null ? Text(title!) : null,
|
|
|
|
|
content: content != null ? Text(content!) : null,
|
|
|
|
|
actions: <Widget>[
|
|
|
|
|
TextButton(
|
|
|
|
|
// child: Text(_subtitle.confirm),
|
|
|
|
|
child: Text(context.translation.confirm),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.of(context).pop(true);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
TextButton(
|
|
|
|
|
// child: Text(_subtitle.cancel),
|
|
|
|
|
child: Text(context.translation.cancel),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.of(context).pop(false);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
: AlertDialog(
|
|
|
|
|
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
|
|
|
|
title: title != null ? Text(title!) : null,
|
|
|
|
|
content: content != null ? Text(content!) : null,
|
|
|
|
|
// contentTextStyle: AppTextStyles.bodyText.copyWith(color: (context.isDark ? AppColor.neutral30 : AppColor.neutral50)),
|
|
|
|
|
actions: <Widget>[
|
|
|
|
|
TextButton(
|
|
|
|
|
// child: Text(_subtitle.confirm),
|
|
|
|
|
child: Text(context.translation.confirm, style: AppTextStyles.bodyText),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.of(context).pop(true);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
TextButton(
|
|
|
|
|
// child: Text(_subtitle.cancel),
|
|
|
|
|
child: Text(context.translation.cancel, style: AppTextStyles.bodyText),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.of(context).pop(false);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|