Merge branch 'main' into product
This commit is contained in:
@@ -3,9 +3,10 @@ import 'dart:io';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:traderscircuit/model/ContactUsModel/contact_us_cat_model.dart';
|
||||
import 'package:traderscircuit/model/ContactUsModel/contact_us_model.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
import 'package:timeago/timeago.dart' as timeago;
|
||||
import '../model/ContactUsModel/ticket_details_model.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
class ContactUsController extends GetxController {
|
||||
RxBool isLoading = true.obs;
|
||||
@@ -29,11 +30,23 @@ class ContactUsController extends GetxController {
|
||||
|
||||
RxString selectedValue = "".obs;
|
||||
|
||||
//formated date
|
||||
String formatedDateTimeMethod(String originalDateTimeString) {
|
||||
DateTime dateTime = DateTime.parse(originalDateTimeString);
|
||||
|
||||
return DateFormat("dd MMM yyyy, hh:mm a").format(dateTime.toLocal());
|
||||
}
|
||||
|
||||
// RxList<dynamic> contactUsDetailsChatContent = [].obs;
|
||||
|
||||
String timeAgoConverter(String originalDateTimeString) {
|
||||
DateTime dateTime = DateTime.parse(originalDateTimeString);
|
||||
|
||||
// Get the difference in days
|
||||
DateTime now = DateTime.now();
|
||||
int differenceInDays = now.difference(dateTime).inDays;
|
||||
|
||||
// Convert to "2 days ago" format
|
||||
return timeago.format(now.subtract(Duration(days: differenceInDays)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:just_audio/just_audio.dart';
|
||||
import 'package:traderscircuit/Utils/base_manager.dart';
|
||||
import 'package:traderscircuit/model/ContentBytesModel/content_bytes_categories_model.dart';
|
||||
import 'package:traderscircuit/model/ContentBytesModel/content_bytes_model.dart';
|
||||
import 'package:traderscircuit/view_model/ContentBytesApi/content_bytes_api.dart';
|
||||
|
||||
import '../model/ContentBytesModel/previous_read_user_model.dart';
|
||||
import '../view/Sidemenu/ContentByte/ContentBytes.dart';
|
||||
|
||||
class ContentBytesController extends GetxController {
|
||||
@@ -13,12 +14,15 @@ class ContentBytesController extends GetxController {
|
||||
ContentBytesCategoriesModel contentBytesCategoriesModel =
|
||||
ContentBytesCategoriesModel();
|
||||
ContentBytesModel contentBytesModel = ContentBytesModel();
|
||||
|
||||
PreviousReadOfUserModel previousReadOfUserModel = PreviousReadOfUserModel();
|
||||
int filterId = 0;
|
||||
RxBool isApiCalling = true.obs;
|
||||
RxBool isAudioSeekBarVisible = false.obs;
|
||||
RxInt indexForAudios = 0.obs;
|
||||
RxBool titlePlaying = false.obs;
|
||||
RxList<bool>? titlePlayingList = <bool>[].obs;
|
||||
bool isAudioInitialize = false;
|
||||
|
||||
final progressNotifier = ValueNotifier<ProgressBarState>(
|
||||
ProgressBarState(
|
||||
@@ -29,22 +33,21 @@ class ContentBytesController extends GetxController {
|
||||
);
|
||||
final buttonNotifier = ValueNotifier<ButtonState>(ButtonState.paused);
|
||||
|
||||
late AudioPlayer _audioPlayer;
|
||||
late AudioPlayer audioPlayer;
|
||||
@override
|
||||
void dispose() {
|
||||
_audioPlayer.stop();
|
||||
audioPlayer.stop();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void getAudio() => _audioPlayer;
|
||||
|
||||
void init(index) async {
|
||||
_audioPlayer = AudioPlayer();
|
||||
audioPlayer = AudioPlayer();
|
||||
isAudioInitialize = true;
|
||||
indexForAudios.value = index;
|
||||
try {
|
||||
await _audioPlayer.setUrl(
|
||||
//contentBytesModel.data!.audio![index].file ??
|
||||
'https://ghantalele.com/uploads/files/data-78/38825/Besharam%20Rang_192(Ghantalele.com).mp3');
|
||||
// await _audioPlayer.setAsset(url);
|
||||
log(index.toString());
|
||||
await audioPlayer.setUrl(contentBytesModel.data!.audio![index].link!);
|
||||
// await audioPlayer.setAsset(url);
|
||||
} on PlayerException catch (e) {
|
||||
print("Error code: ${e.code}");
|
||||
// iOS/macOS: maps to NSError.localizedDescription
|
||||
@@ -54,7 +57,7 @@ class ContentBytesController extends GetxController {
|
||||
print("Error message: ${e.message}");
|
||||
}
|
||||
//Catching errors during playback (e.g. lost network connection)
|
||||
_audioPlayer.playbackEventStream.listen((event) {},
|
||||
audioPlayer.playbackEventStream.listen((event) {},
|
||||
onError: (Object e, StackTrace st) {
|
||||
if (e is PlayerException) {
|
||||
print('Error code: ${e.code}');
|
||||
@@ -64,7 +67,7 @@ class ContentBytesController extends GetxController {
|
||||
}
|
||||
});
|
||||
|
||||
_audioPlayer.playerStateStream.listen((playerState) {
|
||||
audioPlayer.playerStateStream.listen((playerState) {
|
||||
final isPlaying = playerState.playing;
|
||||
final processingState = playerState.processingState;
|
||||
if (!isPlaying) {
|
||||
@@ -74,12 +77,12 @@ class ContentBytesController extends GetxController {
|
||||
} else {
|
||||
_playNextTrack();
|
||||
|
||||
// _audioPlayer.seek(Duration.zero);
|
||||
// _audioPlayer.pause();
|
||||
// audioPlayer.seek(Duration.zero);
|
||||
// audioPlayer.pause();
|
||||
}
|
||||
});
|
||||
|
||||
_audioPlayer.positionStream.listen((position) {
|
||||
audioPlayer.positionStream.listen((position) {
|
||||
final oldState = progressNotifier.value;
|
||||
progressNotifier.value = ProgressBarState(
|
||||
current: position,
|
||||
@@ -88,7 +91,7 @@ class ContentBytesController extends GetxController {
|
||||
);
|
||||
});
|
||||
|
||||
_audioPlayer.bufferedPositionStream.listen((bufferedPosition) {
|
||||
audioPlayer.bufferedPositionStream.listen((bufferedPosition) {
|
||||
final oldState = progressNotifier.value;
|
||||
progressNotifier.value = ProgressBarState(
|
||||
current: oldState.current,
|
||||
@@ -97,7 +100,7 @@ class ContentBytesController extends GetxController {
|
||||
);
|
||||
});
|
||||
|
||||
_audioPlayer.durationStream.listen((totalDuration) {
|
||||
audioPlayer.durationStream.listen((totalDuration) {
|
||||
final oldState = progressNotifier.value;
|
||||
progressNotifier.value = ProgressBarState(
|
||||
current: oldState.current,
|
||||
@@ -120,8 +123,8 @@ class ContentBytesController extends GetxController {
|
||||
init(nextIndex);
|
||||
play(nextIndex);
|
||||
} else {
|
||||
_audioPlayer.seek(Duration.zero);
|
||||
_audioPlayer.pause();
|
||||
audioPlayer.seek(Duration.zero);
|
||||
audioPlayer.pause();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,26 +143,26 @@ class ContentBytesController extends GetxController {
|
||||
}
|
||||
|
||||
void play(index) {
|
||||
_audioPlayer.play();
|
||||
audioPlayer.play();
|
||||
isAudioSeekBarVisible.value = false;
|
||||
isAudioSeekBarVisible.value = true;
|
||||
indexForAudios.value = index;
|
||||
}
|
||||
|
||||
void pause() {
|
||||
_audioPlayer.pause();
|
||||
audioPlayer.pause();
|
||||
}
|
||||
|
||||
void seek(Duration position) {
|
||||
_audioPlayer.seek(position);
|
||||
audioPlayer.seek(position);
|
||||
}
|
||||
|
||||
void stop() {
|
||||
_audioPlayer.stop();
|
||||
audioPlayer.stop();
|
||||
}
|
||||
|
||||
bool isPlaying() {
|
||||
return _audioPlayer.playing;
|
||||
return audioPlayer.playing;
|
||||
}
|
||||
|
||||
addTitles() {
|
||||
|
||||
@@ -1,9 +1,17 @@
|
||||
import 'package:get/get.dart';
|
||||
import 'package:traderscircuit/model/ProductsModel/call_recommendations_model.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
class ProductsController extends GetxController {
|
||||
RxBool isLoaded = true.obs;
|
||||
CallRecommendationsModel swingTradeModel = CallRecommendationsModel();
|
||||
CallRecommendationsModel multibaggerModel = CallRecommendationsModel();
|
||||
CallRecommendationsModel optionModel = CallRecommendationsModel();
|
||||
|
||||
final selectedIndex = 0.obs;
|
||||
String dateConverterMethod(String dateV) {
|
||||
DateTime dateTime = DateTime.parse(dateV);
|
||||
DateTime newDateTime = DateTime(dateTime.year, 3, 25);
|
||||
return DateFormat("dd MMMM yyyy").format(newDateTime);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user