7/17/2
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import 'package:SEFER/controller/functions/gemeni.dart';
|
||||
import 'package:SEFER/controller/functions/tts.dart';
|
||||
import 'package:SEFER/views/widgets/elevated_btn.dart';
|
||||
import 'package:SEFER/views/widgets/my_circular_indicator_timer.dart';
|
||||
import 'package:SEFER/views/widgets/my_textField.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
@@ -34,7 +35,9 @@ class EgyptCardAI extends StatelessWidget {
|
||||
body: [
|
||||
GetBuilder<AI>(builder: (controller) {
|
||||
return controller.isLoading
|
||||
? const MyCircularProgressIndicator()
|
||||
? MyCircularProgressIndicatorWithTimer(
|
||||
isLoading: controller.isLoading,
|
||||
)
|
||||
: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Column(
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:SEFER/constant/box_name.dart';
|
||||
import 'package:SEFER/constant/style.dart';
|
||||
import 'package:SEFER/controller/functions/face_detect.dart';
|
||||
import 'package:SEFER/main.dart';
|
||||
import 'package:SEFER/views/auth/captin/cards/egypt_card_a_i.dart';
|
||||
import 'package:SEFER/views/widgets/elevated_btn.dart';
|
||||
import 'package:SEFER/views/widgets/mydialoug.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_font_icons/flutter_font_icons.dart';
|
||||
import 'package:get/get.dart';
|
||||
@@ -31,37 +38,28 @@ GetBuilder<HomeCaptainController> leftMainMenuCaptainIcons() {
|
||||
// // String apikey = AK.passwordPayMob;
|
||||
// // String convertedStringN = credentials.c(
|
||||
// // credentials.c(credentials.c(apikey, cs), cC), cn);
|
||||
// // print(convertedStringN);
|
||||
// // String retrievedStringS = credentials.r(
|
||||
// // credentials.r(credentials.r(convertedStringN, cn), cC),
|
||||
// // cs);
|
||||
// // print(retrievedStringS);
|
||||
// // //
|
||||
// // if (retrievedStringS ==
|
||||
// // 'apikey') {
|
||||
// // print('same');
|
||||
// // }
|
||||
|
||||
// // key.forEach((key, apiKey) {
|
||||
// // Get.to(() => SmsSignupEgypt());
|
||||
// // keys.forEach((key, apiKey) {
|
||||
// // String apikey = Env.basicAuthCredentials;
|
||||
// // print('apikey: ${apikey}');
|
||||
// // String retrievedStringS = credentials.r(
|
||||
// // credentials.r(credentials.r(apikey, cn), cC), cs);
|
||||
// // print('retrievedStringS: $retrievedStringS');
|
||||
// // String encryptedApiKey =
|
||||
// // X.c(X.c(X.c(retrievedStringS, cs), cC), cn);
|
||||
// // print('encrypted $encryptedApiKey');
|
||||
|
||||
// // String decryptedApiKey =
|
||||
// // X.r(X.r(X.r(encryptedApiKey, cn), cC), cs);
|
||||
// // print('Decrypted API Key for : $decryptedApiKey');
|
||||
|
||||
// // if (decryptedApiKey == retrievedStringS) {
|
||||
// // print('match ');
|
||||
// // } else {
|
||||
// // print('Keys do not match for ');
|
||||
// // }
|
||||
// // }
|
||||
// // );
|
||||
@@ -189,8 +187,8 @@ GetBuilder<HomeCaptainController> leftMainMenuCaptainIcons() {
|
||||
// border: Border.all(color: AppColor.blueColor),
|
||||
// borderRadius: BorderRadius.circular(15)),
|
||||
// child: IconButton(
|
||||
// onPressed: () {
|
||||
// print(box.read(BoxName.tokenDriver));
|
||||
// onPressed: () async {
|
||||
// Get.to(() => EgyptCardAI());
|
||||
// },
|
||||
// icon: const Icon(
|
||||
// FontAwesome5.grin_tears,
|
||||
|
||||
73
lib/views/widgets/my_circular_indicator_timer.dart
Normal file
73
lib/views/widgets/my_circular_indicator_timer.dart
Normal file
@@ -0,0 +1,73 @@
|
||||
import 'package:SEFER/constant/style.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'dart:async';
|
||||
|
||||
class MyCircularProgressIndicatorWithTimer extends StatelessWidget {
|
||||
final Color backgroundColor;
|
||||
final bool isLoading;
|
||||
|
||||
MyCircularProgressIndicatorWithTimer({
|
||||
Key? key,
|
||||
this.backgroundColor = Colors.transparent,
|
||||
required this.isLoading,
|
||||
}) : super(key: key);
|
||||
|
||||
final StreamController<int> _streamController = StreamController<int>();
|
||||
|
||||
void startTimer() {
|
||||
int _timeLeft = 60;
|
||||
Timer.periodic(const Duration(seconds: 1), (timer) {
|
||||
if (_timeLeft > 0 && isLoading) {
|
||||
_streamController.add(_timeLeft);
|
||||
_timeLeft--;
|
||||
} else {
|
||||
timer.cancel();
|
||||
_streamController.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (isLoading) {
|
||||
startTimer();
|
||||
}
|
||||
|
||||
return Center(
|
||||
child: Container(
|
||||
width: 200,
|
||||
height: 200,
|
||||
decoration: BoxDecoration(
|
||||
color: backgroundColor,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Stack(
|
||||
children: [
|
||||
const Center(child: CircularProgressIndicator()),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Align(
|
||||
alignment: Alignment.center,
|
||||
child: Image.asset(
|
||||
'assets/images/logo.gif',
|
||||
width: 140,
|
||||
height: 140,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
StreamBuilder<int>(
|
||||
stream: _streamController.stream,
|
||||
initialData: 60,
|
||||
builder: (context, snapshot) {
|
||||
return Text('${snapshot.data}', style: AppStyle.title);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user