45 lines
1.2 KiB
Dart
45 lines
1.2 KiB
Dart
import 'dart:ui';
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
|
|
import '../../constant/colors.dart';
|
|
import '../../constant/style.dart';
|
|
import '../../controller/functions/tts.dart';
|
|
import 'elevated_btn.dart';
|
|
|
|
class MyDialog extends GetxController {
|
|
void getDialog(String title, String? midTitle, VoidCallback onPressed) {
|
|
final textToSpeechController = Get.put(TextToSpeechController());
|
|
Get.defaultDialog(
|
|
title: title,
|
|
titleStyle: AppStyle.title,
|
|
barrierDismissible: false,
|
|
middleTextStyle: AppStyle.title,
|
|
content: Column(
|
|
children: [
|
|
IconButton(
|
|
onPressed: () async {
|
|
await textToSpeechController.speakText(title ?? midTitle!);
|
|
},
|
|
icon: const Icon(Icons.headphones)),
|
|
Text(
|
|
midTitle!,
|
|
style: AppStyle.title,
|
|
)
|
|
],
|
|
),
|
|
confirm: MyElevatedButton(
|
|
title: 'Ok'.tr,
|
|
onPressed: onPressed,
|
|
kolor: AppColor.greenColor,
|
|
),
|
|
cancel: MyElevatedButton(
|
|
title: 'Cancel',
|
|
kolor: AppColor.redColor,
|
|
onPressed: () {
|
|
Get.back();
|
|
}));
|
|
}
|
|
}
|