product recommendations api integration, content bytes

This commit is contained in:
jayesh
2024-05-07 19:27:23 +05:30
parent f0da450dc2
commit 2b564aa57f
16 changed files with 1281 additions and 574 deletions

View File

@@ -94,6 +94,7 @@ class _CustomTextFormFieldState extends State<CustomTextFormField> {
obscureText: obscureText,
controller: widget.textEditingController,
decoration: InputDecoration(
hintStyle: TextStyle(color: Colors.white),
hintText: widget.hintText,
prefixIconColor: widget.prefixIconColor,
// ignore: prefer_null_aware_operators

View File

@@ -49,6 +49,8 @@ class ApiUrls {
"${base}getContentByteCategories";
static String getContentBytesApi = "${base}getContentBytes";
static String morevideoApi = "${base}get-content-bytes-of-videos";
static String getPreviousReadApi = "${base}get-previous-reads-of-user";
static String storeReadCountApi = "${base}store-content-byte-read-click";
//Profile
static String Getprofile = "${base}getuserDetails";

View File

@@ -4,6 +4,7 @@ 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:timeago/timeago.dart' as timeago;
import '../model/ContactUsModel/ticket_details_model.dart';
import 'package:intl/intl.dart';
@@ -35,4 +36,15 @@ class ContactUsController extends GetxController {
return DateFormat("dd MMM yyyy, hh:mm a").format(dateTime.toLocal());
}
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)));
}
}

View File

@@ -1,9 +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/model/ContentBytesModel/content_bytes_categories_model.dart';
import 'package:traderscircuit/model/ContentBytesModel/content_bytes_model.dart';
import '../model/ContentBytesModel/previous_read_user_model.dart';
import '../view/Sidemenu/ContentByte/ContentBytes.dart';
class ContentBytesController extends GetxController {
@@ -11,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(
@@ -27,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
@@ -52,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}');
@@ -62,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) {
@@ -72,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,
@@ -86,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,
@@ -95,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,
@@ -118,8 +123,8 @@ class ContentBytesController extends GetxController {
init(nextIndex);
play(nextIndex);
} else {
_audioPlayer.seek(Duration.zero);
_audioPlayer.pause();
audioPlayer.seek(Duration.zero);
audioPlayer.pause();
}
}
@@ -138,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() {

View File

@@ -29,8 +29,16 @@ class Data {
List<Video>? video;
List<Audio>? audio;
List<Read>? read;
List<NewReleaseAudio>? newReleaseAudio;
List<MostReads>? mostReads;
Data({this.video, this.audio, this.read});
Data({
this.video,
this.audio,
this.read,
this.newReleaseAudio,
this.mostReads,
});
Data.fromJson(Map<String, dynamic> json) {
if (json['video'] != null) {
@@ -51,6 +59,18 @@ class Data {
read!.add(Read.fromJson(v));
});
}
if (json['new_release_audio'] != null) {
newReleaseAudio = <NewReleaseAudio>[];
json['new_release_audio'].forEach((v) {
newReleaseAudio!.add(NewReleaseAudio.fromJson(v));
});
}
if (json['most_reads'] != null) {
mostReads = <MostReads>[];
json['most_reads'].forEach((v) {
mostReads!.add(MostReads.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
@@ -64,6 +84,144 @@ class Data {
if (read != null) {
data['read'] = read!.map((v) => v.toJson()).toList();
}
if (newReleaseAudio != null) {
data['new_release_audio'] =
newReleaseAudio!.map((v) => v.toJson()).toList();
}
if (mostReads != null) {
data['most_reads'] = mostReads!.map((v) => v.toJson()).toList();
}
return data;
}
}
class MostReads {
int? id;
int? contentByteReadXid;
int? clickCount;
int? isActive;
String? createdAt;
ContentByteData? contentByteData;
MostReads(
{this.id,
this.contentByteReadXid,
this.clickCount,
this.isActive,
this.createdAt,
this.contentByteData});
MostReads.fromJson(Map<String, dynamic> json) {
id = json['id'];
contentByteReadXid = json['content_byte_read_xid'];
clickCount = json['click_count'];
isActive = json['is_active'];
createdAt = json['created_at'];
contentByteData = json['content_byte_data'] != null
? ContentByteData.fromJson(json['content_byte_data'])
: null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['id'] = id;
data['content_byte_read_xid'] = contentByteReadXid;
data['click_count'] = clickCount;
data['is_active'] = isActive;
data['created_at'] = createdAt;
if (contentByteData != null) {
data['content_byte_data'] = contentByteData!.toJson();
}
return data;
}
}
class ContentByteData {
int? id;
String? title;
String? file;
int? categoryId;
String? image;
String? isActive;
String? createdAt;
ContentByteData(
{this.id,
this.title,
this.file,
this.categoryId,
this.image,
this.isActive,
this.createdAt});
ContentByteData.fromJson(Map<String, dynamic> json) {
id = json['id'];
title = json['title'];
file = json['file'];
categoryId = json['category_id'];
image = json['image'];
isActive = json['is_active'];
createdAt = json['created_at'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['id'] = id;
data['title'] = title;
data['file'] = file;
data['category_id'] = categoryId;
data['image'] = image;
data['is_active'] = isActive;
data['created_at'] = createdAt;
return data;
}
}
class NewReleaseAudio {
int? id;
String? title;
String? file;
int? categoryId;
String? image;
String? isActive;
String? createdAt;
String? formattedCreatedAt;
String? fullCreatedAt;
NewReleaseAudio(
{this.id,
this.title,
this.file,
this.categoryId,
this.image,
this.isActive,
this.createdAt,
this.formattedCreatedAt,
this.fullCreatedAt});
NewReleaseAudio.fromJson(Map<String, dynamic> json) {
id = json['id'];
title = json['title'];
file = json['file'];
categoryId = json['category_id'];
image = json['image'];
isActive = json['is_active'];
createdAt = json['created_at'];
formattedCreatedAt = json['formatted_created_at'];
fullCreatedAt = json['full_created_at'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['id'] = id;
data['title'] = title;
data['file'] = file;
data['category_id'] = categoryId;
data['image'] = image;
data['is_active'] = isActive;
data['created_at'] = createdAt;
data['formatted_created_at'] = formattedCreatedAt;
data['full_created_at'] = fullCreatedAt;
return data;
}
}
@@ -77,6 +235,8 @@ class Video {
String? file;
int? categoryId;
String? image;
String? createdAt;
String? link;
String? isActive;
Video({
@@ -86,6 +246,8 @@ class Video {
this.description,
this.tags,
this.file,
this.createdAt,
this.link,
this.categoryId,
this.image,
this.isActive,
@@ -95,7 +257,9 @@ class Video {
id = json['id'];
contentType = json['content_type'];
title = json['title'];
link = json["link"];
description = json['description'];
createdAt = json['created_at'];
tags = json['tags'];
file = json['file'];
categoryId = json['category_id'];
@@ -126,6 +290,7 @@ class Audio {
String? description;
String? tags;
String? file;
String? link;
int? categoryId;
String? image;
String? isActive;
@@ -138,6 +303,7 @@ class Audio {
this.tags,
this.file,
this.categoryId,
this.link,
this.image,
this.isActive,
});
@@ -148,6 +314,7 @@ class Audio {
title = json['title'];
description = json['description'];
tags = json['tags'];
link = json['link'];
file = json['file'];
categoryId = json['category_id'];
image = json['image'];

View File

@@ -0,0 +1,110 @@
class PreviousReadOfUserModel {
String? status;
int? statusCode;
String? message;
List<Data>? data;
PreviousReadOfUserModel(
{this.status, this.statusCode, this.message, this.data});
PreviousReadOfUserModel.fromJson(Map<String, dynamic> json) {
status = json['status'];
statusCode = json['status_code'];
message = json['message'];
if (json['data'] != null) {
data = <Data>[];
json['data'].forEach((v) {
data!.add(Data.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['status'] = status;
data['status_code'] = statusCode;
data['message'] = message;
if (this.data != null) {
data['data'] = this.data!.map((v) => v.toJson()).toList();
}
return data;
}
}
class Data {
int? id;
int? contentByteReadXid;
int? iamPrincipalXid;
String? readAt;
ContentByteData? contentByteData;
Data(
{this.id,
this.contentByteReadXid,
this.iamPrincipalXid,
this.readAt,
this.contentByteData});
Data.fromJson(Map<String, dynamic> json) {
id = json['id'];
contentByteReadXid = json['content_byte_read_xid'];
iamPrincipalXid = json['iam_principal_xid'];
readAt = json['read_at'];
contentByteData = json['content_byte_data'] != null
? ContentByteData.fromJson(json['content_byte_data'])
: null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['id'] = id;
data['content_byte_read_xid'] = contentByteReadXid;
data['iam_principal_xid'] = iamPrincipalXid;
data['read_at'] = readAt;
if (contentByteData != null) {
data['content_byte_data'] = contentByteData!.toJson();
}
return data;
}
}
class ContentByteData {
int? id;
String? title;
String? file;
int? categoryId;
String? image;
String? isActive;
String? createdAt;
ContentByteData(
{this.id,
this.title,
this.file,
this.categoryId,
this.image,
this.isActive,
this.createdAt});
ContentByteData.fromJson(Map<String, dynamic> json) {
id = json['id'];
title = json['title'];
file = json['file'];
categoryId = json['category_id'];
image = json['image'];
isActive = json['is_active'];
createdAt = json['created_at'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['id'] = id;
data['title'] = title;
data['file'] = file;
data['category_id'] = categoryId;
data['image'] = image;
data['is_active'] = isActive;
data['created_at'] = createdAt;
return data;
}
}

View File

@@ -75,7 +75,9 @@ class ActiveCalls {
int? isSendRecommendationNow;
Null? scheduleDateTime;
String? createdAt;
ProductData? productData;
int? optionTypeXid;
ProductTypeData? productTypeData;
ActionData? optionTypeData;
ActionData? actionData;
ActiveCalls(
@@ -94,7 +96,9 @@ class ActiveCalls {
this.isSendRecommendationNow,
this.scheduleDateTime,
this.createdAt,
this.productData,
this.optionTypeXid,
this.productTypeData,
this.optionTypeData,
this.actionData});
ActiveCalls.fromJson(Map<String, dynamic> json) {
@@ -112,9 +116,13 @@ class ActiveCalls {
stopLoss = json['stop_loss'];
isSendRecommendationNow = json['is_send_recommendation_now'];
scheduleDateTime = json['schedule_date_time'];
optionTypeXid = json['option_type_xid'];
createdAt = json['created_at'];
productData = json['product_data'] != null
? ProductData.fromJson(json['product_data'])
productTypeData = json['product_type_data'] != null
? ProductTypeData.fromJson(json['product_type_data'])
: null;
optionTypeData = json['option_type_data'] != null
? ActionData.fromJson(json['option_type_data'])
: null;
actionData = json['action_data'] != null
? ActionData.fromJson(json['action_data'])
@@ -138,8 +146,11 @@ class ActiveCalls {
data['is_send_recommendation_now'] = isSendRecommendationNow;
data['schedule_date_time'] = scheduleDateTime;
data['created_at'] = createdAt;
if (productData != null) {
data['product_data'] = productData!.toJson();
if (productTypeData != null) {
data['product_type_data'] = productTypeData!.toJson();
}
if (optionTypeData != null) {
data['option_type_data'] = optionTypeData!.toJson();
}
if (actionData != null) {
data['action_data'] = actionData!.toJson();
@@ -148,15 +159,15 @@ class ActiveCalls {
}
}
class ProductData {
class ProductTypeData {
int? id;
String? productName;
int? isActive;
String? isActive;
String? createdAt;
ProductData({this.id, this.productName, this.isActive, this.createdAt});
ProductTypeData({this.id, this.productName, this.isActive, this.createdAt});
ProductData.fromJson(Map<String, dynamic> json) {
ProductTypeData.fromJson(Map<String, dynamic> json) {
id = json['id'];
productName = json['product_name'];
isActive = json['is_active'];

View File

@@ -11,6 +11,7 @@ import 'package:traderscircuit/Utils/Common/commonBotton.dart';
import 'package:traderscircuit/Utils/Common/comonGlassmorphicContainer.dart';
import 'package:traderscircuit/Utils/Common/sized_box.dart';
import 'package:traderscircuit/Utils/text.dart';
import 'package:traderscircuit/controller/contact_us_controller.dart';
import 'package:traderscircuit/controller/products_controller.dart';
import 'package:traderscircuit/model/ProductsModel/call_recommendations_model.dart';
import 'package:traderscircuit/view/MainScreen/MainScreen.dart';
@@ -296,7 +297,8 @@ class _ShortTradeState extends State<ShortTrade> {
.data!.activeCalls![index].actionData!.name!,
text: callRecommendationsModel
.data!.activeCalls![index].stockName!,
optiontype: "test",
optiontype: callRecommendationsModel.data!
.activeCalls![index].optionTypeData!.name!,
price:
"${callRecommendationsModel.data!.activeCalls![index].buyPrice}",
date: callRecommendationsModel
@@ -304,9 +306,7 @@ class _ShortTradeState extends State<ShortTrade> {
premium:
"${callRecommendationsModel.data!.activeCalls![index].stopLoss}",
price1:
"${callRecommendationsModel.data!.activeCalls![index].stopLoss}",
price2:
"${callRecommendationsModel.data!.activeCalls![index].stopLoss}",
"${callRecommendationsModel.data!.activeCalls![index].targetPrice}",
stoploss:
"${callRecommendationsModel.data!.activeCalls![index].stopLoss}",
),
@@ -407,7 +407,8 @@ class _ShortTradeState extends State<ShortTrade> {
.data!.exitedCalls![index].actionData!.name!,
text: callRecommendationsModel
.data!.exitedCalls![index].stockName!,
optiontype: "test",
optiontype: callRecommendationsModel.data!
.exitedCalls![index].optionTypeData!.name!,
price:
"${callRecommendationsModel.data!.exitedCalls![index].buyPrice}",
date: callRecommendationsModel
@@ -415,9 +416,7 @@ class _ShortTradeState extends State<ShortTrade> {
premium:
"${callRecommendationsModel.data!.exitedCalls![index].stopLoss}",
price1:
"${callRecommendationsModel.data!.exitedCalls![index].stopLoss}",
price2:
"${callRecommendationsModel.data!.exitedCalls![index].stopLoss}",
"${callRecommendationsModel.data!.exitedCalls![index].targetPrice}",
stoploss:
"${callRecommendationsModel.data!.exitedCalls![index].stopLoss}",
),
@@ -432,11 +431,11 @@ class _ShortTradeState extends State<ShortTrade> {
required String date,
required String premium,
required String price1,
required String price2,
required String stoploss,
required String action,
required String image,
}) {
ContactUsController contactUsController = Get.put(ContactUsController());
return commonGlassContainer(
width: double.infinity,
height: 400.h,
@@ -486,7 +485,9 @@ class _ShortTradeState extends State<ShortTrade> {
height: 25.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4.r),
color: const Color(0xFFFFAD31),
color: action == "Buy"
? const Color(0xFF00FF19)
: const Color(0xFFFFAD31),
),
child: Center(child: text14W600_1B1B1B(action)),
)
@@ -533,7 +534,10 @@ class _ShortTradeState extends State<ShortTrade> {
children: [
text14W400_979797('Expiry Date'),
sizedBoxHeight(5.h),
SizedBox(width: 150.w, child: text15W600(date))
SizedBox(
width: 150.w,
child: text15W600(contactUsController
.formatedDateTimeMethod(date)))
],
),
sizedBoxWidth(30.w),
@@ -553,7 +557,7 @@ class _ShortTradeState extends State<ShortTrade> {
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
text14W400_979797('Target Price 01'),
text14W400_979797('Target Price'),
sizedBoxHeight(5.h),
SizedBox(width: 150.w, child: text15W600(price1))
],
@@ -562,22 +566,13 @@ class _ShortTradeState extends State<ShortTrade> {
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
text14W400_979797('Target Price 01'),
text14W400_979797('Stop Loss'),
sizedBoxHeight(5.h),
text15W600(price2)
text15W600(stoploss)
],
)
],
),
sizedBoxHeight(15.h),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
text14W400_979797('Stop Loss'),
sizedBoxHeight(5.h),
text15W600(stoploss)
],
)
],
),
)

View File

@@ -1,21 +1,21 @@
import 'dart:developer';
import 'package:audio_video_progress_bar/audio_video_progress_bar.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_svg/svg.dart';
import 'package:gap/gap.dart';
import 'package:get/get.dart';
import 'package:traderscircuit/Utils/Common/CommonAppbar.dart';
import 'package:traderscircuit/Utils/Common/CustomTextFormField.dart';
import 'package:traderscircuit/Utils/Common/comonGlassmorphicContainer.dart';
import 'package:traderscircuit/Utils/Common/sized_box.dart';
import 'package:traderscircuit/Utils/text.dart';
import 'package:traderscircuit/controller/content_bytes_controller.dart';
import 'package:traderscircuit/model/ContentBytesModel/content_bytes_model.dart';
import 'package:traderscircuit/resources/routes/route_name.dart';
import 'package:traderscircuit/view/Sidemenu/ContentByte/PlayerWidget.dart';
import 'package:traderscircuit/view/onBoarding/splashScreen1.dart';
import 'package:traderscircuit/view_model/ContentBytesApi/content_bytes_api.dart';
import '../../../Utils/Common/comonGlassmorphicContainer.dart';
import 'ContentBytes.dart';
class AudioMore extends StatefulWidget {
const AudioMore({super.key});
@@ -29,7 +29,7 @@ class _VideosMoreState extends State<AudioMore> {
var data;
RxBool isLoading = false.obs;
TextEditingController searchControllera = TextEditingController();
TextEditingController searchController = TextEditingController();
@override
void initState() {
@@ -55,146 +55,286 @@ class _VideosMoreState extends State<AudioMore> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: const CommonAppbar(
titleTxt: "Audio",
),
backgroundColor: Colors.black,
extendBody: true,
body: Obx(
() => Stack(
children: [
const CommonBlurLeft(),
const CommonBlurRight(),
isLoading.value
? const Center(
child: CircularProgressIndicator(
color: Color(0xFF9A0000),
),
)
: Stack(
return PopScope(
canPop: true,
onPopInvoked: (didPop) {
if (contentBytesController.isAudioInitialize) {
contentBytesController.isAudioSeekBarVisible.value = false;
contentBytesController.pause();
contentBytesController.stop();
}
},
child: Scaffold(
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
floatingActionButton: Obx(
() => contentBytesController.isAudioSeekBarVisible.value
? commonGlassContainer(
borderradius: 8,
width: Get.size.width,
height: 100,
customWidget: Row(
children: [
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 16, vertical: 16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
text16W400_DADADA('The Beauty and Power of Audios'),
sizedBoxHeight(8.w),
Row(
children: [
SizedBox(
width: 295.w,
child: TextField(
controller: searchControllera,
onChanged: (value) {
// Call method to handle search
handleSearch(value, "");
},
decoration: InputDecoration(
prefixIcon: Icon(Icons.search),
hintText: 'Search videos',
border: OutlineInputBorder(),
),
),
),
SizedBox(
width: 12.w,
),
filter(),
],
),
sizedBoxHeight(20.h),
GridView.builder(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
gridDelegate:
const SliverGridDelegateWithFixedCrossAxisCount(
mainAxisExtent: 172,
crossAxisCount:
2, // number of items in each row
mainAxisSpacing: 8.0, // spacing between rows
crossAxisSpacing:
8.0, // spacing between columns
),
itemCount: contentBytesController
Expanded(
flex: 1,
child: Align(
child: ClipRRect(
borderRadius: BorderRadius.circular(100),
child: Image.network(
contentBytesController
.contentBytesModel
.data!
.audio!
.length, // total number of items
itemBuilder: (context, index) {
return InkWell(
onTap: () {
contentBytesController.init(0);
contentBytesController
.isAudioSeekBarVisible.value = true;
//https://actions.google.com/sounds/v1/horror/aggressive_zombie_snarls.ogg
},
child: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Colors.white.withOpacity(0.1),
const Color(0xFFFFFFFF)
.withOpacity(0.05),
],
stops: [
0.1,
1,
],
),
borderRadius: BorderRadius.circular(8),
),
child: Stack(
children: [
Image.network(
contentBytesController
.contentBytesModel
.data!
.audio![index]
.image!,
),
Positioned(
bottom: 5,
left: 5,
child: Row(
children: [
CircleAvatar(
radius: 18.sp,
child: const Icon(
Icons.headphones),
),
SizedBox(
width: 5.w,
),
SizedBox(
width: 125.w,
child: text14W500(
contentBytesController
.contentBytesModel
.data!
.audio![index]
.title!),
),
],
),
),
],
),
.audio![contentBytesController
.indexForAudios.value]
.image!,
width: 57,
height: 57,
fit: BoxFit.cover,
),
),
),
),
Expanded(
flex: 3,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
contentBytesController
.contentBytesModel
.data!
.audio![contentBytesController
.indexForAudios.value]
.title!,
style: const TextStyle(
fontSize: 14,
color: Colors.white,
fontFamily: 'hiragino',
fontWeight: FontWeight.w600,
height: 1.5,
),
),
// SizedBox(height: 5),
Text(
contentBytesController
.contentBytesModel
.data!
.audio![contentBytesController
.indexForAudios.value]
.description!,
style: const TextStyle(
fontSize: 14,
color: Colors.white,
fontFamily: 'hiragino',
fontWeight: FontWeight.w600,
height: 1.5,
),
),
ValueListenableBuilder<ProgressBarState>(
valueListenable:
contentBytesController.progressNotifier,
builder: (context, value, _) {
return ProgressBar(
progress: value.current,
buffered: value.buffered,
total: value.total,
onSeek: contentBytesController.seek,
barHeight: 4,
thumbRadius: 6,
thumbGlowRadius: 15,
timeLabelTextStyle: const TextStyle(
color: Colors.white,
),
thumbColor: Colors.white,
baseBarColor: Colors.white.withOpacity(0.3),
progressBarColor: Colors.white,
bufferedBarColor:
Colors.white.withOpacity(0.3),
);
},
),
],
),
),
Expanded(
flex: 1,
child: ValueListenableBuilder<ButtonState>(
valueListenable:
contentBytesController.buttonNotifier,
builder: (context, value, _) {
switch (value) {
case ButtonState.paused:
return IconButton(
icon: const Icon(
Icons.play_arrow_rounded,
color: Colors.white,
),
iconSize: 50.0,
onPressed: () => contentBytesController.play(
contentBytesController
.indexForAudios.value),
);
case ButtonState.playing:
return IconButton(
icon: const Icon(Icons.pause,
color: Colors.white),
iconSize: 50.0,
onPressed: contentBytesController.pause,
);
}
},
),
),
],
),
],
)
: Container(),
),
appBar: const CommonAppbar(
titleTxt: "Audio",
),
backgroundColor: Colors.black,
extendBody: true,
body: Obx(
() => Stack(
children: [
const CommonBlurLeft(),
const CommonBlurRight(),
isLoading.value
? const Center(
child: CircularProgressIndicator(
color: Color(0xFF9A0000),
),
)
: Stack(
children: [
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 16, vertical: 16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
text16W400_DADADA(
'The Beauty and Power of Audios'),
sizedBoxHeight(8.w),
Row(
children: [
SizedBox(
width: 295.w,
child: CustomTextFormField(
textEditingController: searchController,
onInput: (value) {
// Call method to handle search
handleSearch(value, "");
},
hintText: "Search Audio",
),
),
SizedBox(
width: 12.w,
),
filter(),
],
),
sizedBoxHeight(20.h),
GridView.builder(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
gridDelegate:
const SliverGridDelegateWithFixedCrossAxisCount(
mainAxisExtent: 172,
crossAxisCount:
2, // number of items in each row
mainAxisSpacing: 8.0, // spacing between rows
crossAxisSpacing:
8.0, // spacing between columns
),
itemCount: contentBytesController
.contentBytesModel
.data!
.audio!
.length, // total number of items
itemBuilder: (context, index) {
return InkWell(
onTap: () {
if (contentBytesController
.isAudioInitialize) {
contentBytesController
.isAudioSeekBarVisible
.value = false;
contentBytesController.pause();
contentBytesController.stop();
}
contentBytesController.init(index);
contentBytesController
.isAudioSeekBarVisible.value = true;
//https://actions.google.com/sounds/v1/horror/aggressive_zombie_snarls.ogg
},
child: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Colors.white.withOpacity(0.1),
const Color(0xFFFFFFFF)
.withOpacity(0.05),
],
stops: const [
0.1,
1,
],
),
borderRadius: BorderRadius.circular(8),
),
child: Stack(
children: [
Image.network(
contentBytesController
.contentBytesModel
.data!
.audio![index]
.image!,
),
Positioned(
bottom: 5,
left: 5,
child: Row(
children: [
CircleAvatar(
radius: 18.sp,
child: const Icon(
Icons.headphones),
),
SizedBox(
width: 5.w,
),
SizedBox(
width: 125.w,
child: text14W500(
contentBytesController
.contentBytesModel
.data!
.audio![index]
.title!),
),
],
),
),
],
),
),
);
},
),
],
),
),
],
),
],
),
),
),
);
@@ -237,7 +377,7 @@ class _VideosMoreState extends State<AudioMore> {
.data![index]
.id!;
log(contentBytesController.filterId.toString());
handleSearch(searchControllera.text,
handleSearch(searchController.text,
contentBytesController.filterId.toString());
},
child: itemFilter(index));

View File

@@ -6,13 +6,14 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:gap/gap.dart';
import 'package:get/get.dart';
import 'package:traderscircuit/Utils/Common/CommonAppbar.dart';
import 'package:traderscircuit/Utils/Common/comonGlassmorphicContainer.dart';
import 'package:traderscircuit/Utils/Common/sized_box.dart';
import 'package:traderscircuit/Utils/text.dart';
import 'package:traderscircuit/controller/contact_us_controller.dart';
import 'package:traderscircuit/controller/content_bytes_controller.dart';
import 'package:traderscircuit/model/ContentBytesModel/content_bytes_categories_model.dart';
import 'package:traderscircuit/model/ContentBytesModel/content_bytes_model.dart';
import 'package:traderscircuit/model/ContentBytesModel/previous_read_user_model.dart';
import 'package:traderscircuit/resources/routes/route_name.dart';
import 'package:traderscircuit/view/Sidemenu/ContentByte/PlayerWidget.dart';
import 'package:traderscircuit/view/Sidemenu/ContentByte/read_pdf.dart';
@@ -67,23 +68,36 @@ class _ContentBytesState extends State<ContentBytes> {
ContentBytesApi().getContentBytesData("", "", "").then((value) {
contentBytesController.contentBytesModel =
ContentBytesModel.fromJson(value.data);
contentBytesController.isApiCalling.value = false;
setState(() {});
ContentBytesApi().getPreviousReadData().then((value) {
contentBytesController.previousReadOfUserModel =
PreviousReadOfUserModel.fromJson(value.data);
contentBytesController.isApiCalling.value = false;
setState(() {});
});
});
super.initState();
}
@override
void dispose() {
contentBytesController.stop();
if (contentBytesController.isAudioInitialize) {
contentBytesController.isAudioSeekBarVisible.value = false;
contentBytesController.pause();
contentBytesController.stop();
}
super.dispose();
}
@override
Widget build(BuildContext context) {
return WillPopScope(
onWillPop: () async {
return true;
return PopScope(
canPop: true,
onPopInvoked: (didPop) {
if (contentBytesController.isAudioInitialize) {
contentBytesController.isAudioSeekBarVisible.value = false;
contentBytesController.pause();
contentBytesController.stop();
}
},
child: Scaffold(
key: _scaffoldKey1,
@@ -164,7 +178,7 @@ class _ContentBytesState extends State<ContentBytes> {
barHeight: 4,
thumbRadius: 6,
thumbGlowRadius: 15,
timeLabelTextStyle: TextStyle(
timeLabelTextStyle: const TextStyle(
color: Colors.white,
),
thumbColor: Colors.white,
@@ -214,7 +228,67 @@ class _ContentBytesState extends State<ContentBytes> {
),
backgroundColor: Colors.black,
extendBody: true,
appBar: const CommonAppbar(titleTxt: "Content Bytes"),
appBar: PreferredSize(
preferredSize: const Size.fromHeight(130),
child: AppBar(
scrolledUnderElevation: 0.0,
backgroundColor: Colors.black,
elevation: 0,
leadingWidth: 56.w,
leading: Padding(
padding: EdgeInsets.only(left: 16.w, top: 20.h),
child: GestureDetector(
onTap: () {
if (contentBytesController.isAudioInitialize) {
contentBytesController.isAudioSeekBarVisible.value = false;
contentBytesController.pause();
contentBytesController.stop();
}
Get.back();
},
child: Padding(
padding: EdgeInsets.only(left: 8.w),
child: Icon(
Icons.arrow_back_ios,
color: Colors.white,
size: 25.r,
),
),
),
),
flexibleSpace: FlexibleSpaceBar(
centerTitle: false,
titlePadding: const EdgeInsets.all(0),
title: Padding(
padding: EdgeInsets.only(left: 16.w, right: 16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.end,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"Content Bytes",
style: TextStyle(
color: Colors.white,
fontSize: 24.sp,
fontWeight: FontWeight.w500,
fontFamily: 'hiragino'),
maxLines: 2,
softWrap: true,
),
],
),
// newTextfield(
// FontWeight.w400, 0)
],
),
),
),
),
),
body: Stack(
children: [
const CommonBlurLeft(),
@@ -243,7 +317,7 @@ class _ContentBytesState extends State<ContentBytes> {
child: TabBarView(
children: [
Videos(images: reels),
Audios(),
const Audios(),
Reads(mostread: mostread),
],
),
@@ -297,10 +371,10 @@ class _ReadsState extends State<Reads> {
height: 35.h,
width: 105.w,
decoration: BoxDecoration(
color: Color(0xFF3A3A3A).withOpacity(0.6),
color: const Color(0xFF3A3A3A).withOpacity(0.6),
borderRadius: BorderRadius.circular(5.r),
border: Border.all(
color: Color(0xFF3A3A3A),
color: const Color(0xFF3A3A3A),
)),
child: Center(
child: text16W500('View More'),
@@ -316,18 +390,23 @@ class _ReadsState extends State<Reads> {
itemCount:
contentBytesController.contentBytesModel.data!.read!.length,
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (ctx, index) {
return Column(
children: [
InkWell(
onTap: () {
Get.to(ReadPDF(
title: contentBytesController
.contentBytesModel.data!.read![index].title,
pdfUrfl: contentBytesController
.contentBytesModel.data!.read![index].file,
));
ContentBytesApi()
.updateReadCounts(contentBytesController
.contentBytesModel.data!.read![index].id!)
.then((value) {
Get.to(ReadPDF(
title: contentBytesController
.contentBytesModel.data!.read![index].title,
pdfUrfl: contentBytesController
.contentBytesModel.data!.read![index].file,
));
});
},
child: commonGlassContainer(
borderradius: 8,
@@ -352,22 +431,17 @@ class _ReadsState extends State<Reads> {
sizedBoxHeight(10.h),
SizedBox(
width: 230.w,
height: 50,
child: text16W400(
'"${contentBytesController.contentBytesModel.data!.read![index].description}"'),
),
const Spacer()
],
),
Column(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Image.network(
"${contentBytesController.contentBytesModel.data!.read![index].image}",
height: 110,
),
],
)
Image.network(
"${contentBytesController.contentBytesModel.data!.read![index].image}",
height: 110,
),
],
),
),
@@ -376,117 +450,173 @@ class _ReadsState extends State<Reads> {
],
);
}),
// sizedBoxHeight(30.h),
// text22W500("Most Read"),
// sizedBoxHeight(25.h),
// Container(
// height: 220.h,
// child: ListView.separated(
// separatorBuilder: (context, index) {
// return SizedBox(
// width: 10.w,
// );
// },
// scrollDirection: Axis.horizontal,
// itemCount: 3,
// itemBuilder: (context, index) {
// return Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Container(
// height: 216.h,
// width: 150.w,
// decoration: BoxDecoration(
// gradient: LinearGradient(
// begin: Alignment.topLeft,
// end: Alignment.bottomRight,
// colors: [
// Colors.white.withOpacity(0.1),
// const Color(0xFFFFFFFF).withOpacity(0.05),
// ],
// stops: [
// 0.1,
// 1,
// ],
// ),
// borderRadius: BorderRadius.circular(8),
// ),
// child: Image.asset(mostread[index]),
// ),
// ],
// );
// },
// ),
// ),
// sizedBoxHeight(30.h),
// text22W500("Previous Read"),
// sizedBoxHeight(20.h),
// Container(
// height: 90.h,
// child: ListView.separated(
// separatorBuilder: (context, index) {
// return SizedBox(
// width: 10.w,
// );
// },
// scrollDirection: Axis.horizontal,
// itemCount: 2,
// itemBuilder: (context, index) {
// return Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Container(
// height: 85.h,
// width: 230.w,
// decoration: BoxDecoration(
// gradient: LinearGradient(
// begin: Alignment.topLeft,
// end: Alignment.bottomRight,
// colors: [
// Colors.white.withOpacity(0.1),
// const Color(0xFFFFFFFF).withOpacity(0.05),
// ],
// stops: [
// 0.1,
// 1,
// ],
// ),
// borderRadius: BorderRadius.circular(8),
// ),
// child: Row(
// // mainAxisAlignment:
// // MainAxisAlignment.start,
// children: [
// const SizedBox(
// width: 10,
// ),
// Image.asset(mostread[index]),
// SizedBox(
// width: 15.w,
// ),
// Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// mainAxisAlignment: MainAxisAlignment.spaceEvenly,
// children: [
// SizedBox(
// width: 135.w,
// child: text12W500("Stock Market Essentials"),
// ),
// SizedBox(
// width: 130.w,
// child: text10W300(
// "A Comprehensive Guide to Understanding the Market"),
// )
// ],
// )
// ],
// ),
// ),
// ],
// );
// },
// ),
// ),
contentBytesController.contentBytesModel.data!.mostReads!.isEmpty
? const SizedBox()
: sizedBoxHeight(30.h),
contentBytesController.contentBytesModel.data!.mostReads!.isEmpty
? const SizedBox()
: text22W500("Most Read"),
contentBytesController.contentBytesModel.data!.mostReads!.isEmpty
? const SizedBox()
: sizedBoxHeight(25.h),
contentBytesController.contentBytesModel.data!.mostReads!.isEmpty
? const SizedBox()
: SizedBox(
height: 220.h,
child: ListView.separated(
separatorBuilder: (context, index) {
return SizedBox(
width: 10.w,
);
},
scrollDirection: Axis.horizontal,
itemCount: contentBytesController
.contentBytesModel.data!.mostReads!.length,
itemBuilder: (context, index) {
return InkWell(
onTap: () {
ContentBytesApi()
.updateReadCounts(contentBytesController
.contentBytesModel
.data!
.mostReads![index]
.id!)
.then((value) {
Get.to(ReadPDF(
title: contentBytesController
.contentBytesModel
.data!
.mostReads![index]
.contentByteData!
.title,
pdfUrfl: contentBytesController
.contentBytesModel
.data!
.mostReads![index]
.contentByteData!
.file,
));
});
},
child: Container(
height: 216.h,
width: 150.w,
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Colors.white.withOpacity(0.1),
const Color(0xFFFFFFFF).withOpacity(0.05),
],
stops: [
0.1,
1,
],
),
borderRadius: BorderRadius.circular(8),
),
child: Image.network(
contentBytesController.contentBytesModel.data!
.mostReads![index].contentByteData!.image!,
fit: BoxFit.cover,
),
),
);
},
),
),
contentBytesController.previousReadOfUserModel.data!.isEmpty
? const SizedBox()
: sizedBoxHeight(30.h),
contentBytesController.previousReadOfUserModel.data!.isEmpty
? const SizedBox()
: text22W500("Previous Read"),
contentBytesController.previousReadOfUserModel.data!.isEmpty
? const SizedBox()
: sizedBoxHeight(20.h),
contentBytesController.previousReadOfUserModel.data!.isEmpty
? const SizedBox()
: SizedBox(
height: 100.h,
child: ListView.separated(
separatorBuilder: (context, index) {
return SizedBox(
width: 10.w,
);
},
scrollDirection: Axis.horizontal,
itemCount: contentBytesController
.previousReadOfUserModel.data!.length,
itemBuilder: (context, index) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
height: 100.h,
width: 261.w,
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Colors.white.withOpacity(0.1),
const Color(0xFFFFFFFF).withOpacity(0.05),
],
stops: [
0.1,
1,
],
),
borderRadius: BorderRadius.circular(8),
),
child: Row(
// mainAxisAlignment:
// MainAxisAlignment.start,
children: [
const SizedBox(
width: 10,
),
Image.network(contentBytesController
.previousReadOfUserModel
.data![index]
.contentByteData!
.image!),
SizedBox(
width: 15.w,
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
children: [
SizedBox(
width: 135.w,
child: text12W500(contentBytesController
.previousReadOfUserModel
.data![index]
.contentByteData!
.title!),
),
SizedBox(
width: 130.w,
child: text10W300(
" contentBytesControlle",
),
)
],
)
],
),
),
],
);
},
),
),
SizedBox(
height: 50,
)
],
),
);
@@ -545,10 +675,10 @@ class _AudiosState extends State<Audios> {
height: 35.h,
width: 105.w,
decoration: BoxDecoration(
color: Color(0xFF3A3A3A).withOpacity(0.6),
color: const Color(0xFF3A3A3A).withOpacity(0.6),
borderRadius: BorderRadius.circular(5.r),
border: Border.all(
color: Color(0xFF3A3A3A),
color: const Color(0xFF3A3A3A),
)),
child: Center(
child: text16W500('View More'),
@@ -575,9 +705,14 @@ class _AudiosState extends State<Audios> {
itemBuilder: (context, index) {
return InkWell(
onTap: () {
contentBytesController.init(0);
if (contentBytesController.isAudioInitialize) {
contentBytesController.isAudioSeekBarVisible.value = false;
contentBytesController.pause();
contentBytesController.stop();
}
contentBytesController.init(index);
contentBytesController.isAudioSeekBarVisible.value = true;
//https://actions.google.com/sounds/v1/horror/aggressive_zombie_snarls.ogg
contentBytesController.indexForAudios.value = index;
},
child: Container(
decoration: BoxDecoration(
@@ -630,86 +765,85 @@ class _AudiosState extends State<Audios> {
);
},
),
// SizedBox(
// height: 20.h,
// ),
// text22W600("New Release"),
// SizedBox(
// height: 25.h,
// ),
// Container(
// height: 250.h,
// child: ListView.separated(
// separatorBuilder: (context, index) {
// return const SizedBox(
// width: 10,
// );
// },
// scrollDirection: Axis.horizontal,
// itemCount:
// contentBytesController.contentBytesModel.data!.audio!.length,
// itemBuilder: (context, index) {
// return Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Container(
// height: 183.h,
// width: 148.w,
// decoration: BoxDecoration(
// gradient: LinearGradient(
// begin: Alignment.topLeft,
// end: Alignment.bottomRight,
// colors: [
// Colors.white.withOpacity(0.1),
// const Color(0xFFFFFFFF).withOpacity(0.05),
// ],
// stops: [
// 0.1,
// 1,
// ],
// ),
// borderRadius: BorderRadius.circular(8),
// ),
// child: Stack(
// children: [
// Image.network(
// contentBytesController
// .contentBytesModel.data!.audio![index].image!,
// ),
// const Positioned(
// right: 5,
// top: 5,
// child: CircleAvatar(
// radius: 15,
// child: Icon(
// Icons.headphones,
// size: 20,
// ),
// ),
// ),
// ],
// ),
// ),
// const SizedBox(
// height: 10,
// ),
// Row(
// mainAxisAlignment: MainAxisAlignment.start,
// children: [
// SizedBox(
// width: 148.w,
// child: text14W500Overflow(
// contentBytesController
// .contentBytesModel.data!.audio![index].title!,
// ),
// ),
// ],
// )
// ],
// );
// },
// ),
// )
SizedBox(
height: 20.h,
),
text22W600("New Release"),
SizedBox(
height: 25.h,
),
SizedBox(
height: 250.h,
child: ListView.separated(
separatorBuilder: (context, index) {
return const SizedBox(
width: 10,
);
},
scrollDirection: Axis.horizontal,
itemCount: contentBytesController
.contentBytesModel.data!.newReleaseAudio!.length,
itemBuilder: (context, index) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: 148.w,
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Colors.white.withOpacity(0.1),
const Color(0xFFFFFFFF).withOpacity(0.05),
],
stops: [
0.1,
1,
],
),
borderRadius: BorderRadius.circular(8),
),
child: Stack(
children: [
Image.network(
contentBytesController.contentBytesModel.data!
.newReleaseAudio![index].image!,
),
const Positioned(
right: 5,
top: 5,
child: CircleAvatar(
radius: 15,
child: Icon(
Icons.headphones,
size: 20,
),
),
),
],
),
),
const SizedBox(
height: 10,
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
SizedBox(
width: 148.w,
child: text14W500Overflow(
contentBytesController.contentBytesModel.data!
.newReleaseAudio![index].title!,
),
),
],
)
],
);
},
),
)
],
),
);
@@ -835,16 +969,17 @@ class _VideosState extends State<Videos> {
}
Widget videoCard(Video video) {
ContactUsController contactUsController = Get.put(ContactUsController());
return InkWell(
onTap: () {
Get.to(() => const PlayerWidget(), arguments: {
"video_url": video.file,
"video_url": video.link,
});
},
child: commonGlassContainer(
borderradius: 8,
width: double.infinity,
height: 320.h,
height: 340.h,
customWidget: Padding(
padding: EdgeInsets.symmetric(vertical: 10.h, horizontal: 10.w),
child: Column(
@@ -879,10 +1014,13 @@ class _VideosState extends State<Videos> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
text18W500(video.title!),
text16W400(video.description!),
// sizedBoxHeight(10.h),
//text12W400_979797('20k views . 2 days ago'),
text12W400_979797('2 days ago'),
SizedBox(
width: 0.81.sw,
height: 50,
child: text16W400(video.description!,
textOver: TextOverflow.ellipsis)),
text12W400_979797(contactUsController
.timeAgoConverter(video.createdAt!)),
],
)
],
@@ -929,10 +1067,10 @@ class _VideosState extends State<Videos> {
height: 35.h,
width: 105.w,
decoration: BoxDecoration(
color: Color(0xFF3A3A3A).withOpacity(0.6),
color: const Color(0xFF3A3A3A).withOpacity(0.6),
borderRadius: BorderRadius.circular(5.r),
border: Border.all(
color: Color(0xFF3A3A3A),
color: const Color(0xFF3A3A3A),
)),
child: Center(
child: text16W500('View More'),
@@ -1052,8 +1190,24 @@ class _VideosState extends State<Videos> {
}
}
class ContentTabBar extends StatelessWidget {
class ContentTabBar extends StatefulWidget {
@override
State<ContentTabBar> createState() => _ContentTabBarState();
}
class _ContentTabBarState extends State<ContentTabBar>
with SingleTickerProviderStateMixin {
// Set the desired height
TabController? tabController;
@override
void initState() {
tabController = TabController(length: 3, vsync: this);
tabController!.addListener(() {
print("${tabController!.index}");
});
super.initState();
}
@override
Widget build(BuildContext context) {

View File

@@ -30,7 +30,7 @@ class _VideosMoreState extends State<ReadMore> {
Get.put(ContentBytesController());
var data;
RxBool isLoading = false.obs;
TextEditingController searchControllerr = TextEditingController();
TextEditingController searchController = TextEditingController();
@override
void initState() {
@@ -87,17 +87,13 @@ class _VideosMoreState extends State<ReadMore> {
children: [
SizedBox(
width: 295.w,
child: TextField(
controller: searchControllerr,
onChanged: (value) {
child: CustomTextFormField(
textEditingController: searchController,
onInput: (value) {
// Call method to handle search
handleSearch(value, "");
},
decoration: InputDecoration(
prefixIcon: Icon(Icons.search),
hintText: 'Search videos',
border: OutlineInputBorder(),
),
hintText: "Search Books",
),
),
SizedBox(
@@ -111,81 +107,93 @@ class _VideosMoreState extends State<ReadMore> {
// ),
sizedBoxHeight(20.h),
ListView.builder(
itemCount: contentBytesController
.contentBytesModel.data!.read!.length,
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemBuilder: (ctx, index) {
return Column(
contentBytesController
.contentBytesModel.data!.read!.isEmpty
? Center(
child: Column(
children: [
InkWell(
onTap: () {
Get.to(ReadPDF(
title: contentBytesController
.contentBytesModel
.data!
.read![index]
.title,
pdfUrfl: contentBytesController
.contentBytesModel
.data!
.read![index]
.file,
));
},
child: commonGlassContainer(
borderradius: 8,
width: double.infinity,
height: 150.h,
customWidget: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
crossAxisAlignment:
CrossAxisAlignment.end,
children: [
const SizedBox(
width: 10,
),
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
const Spacer(),
SizedBox(
width: 235.w,
child: text20W400(
'"${contentBytesController.contentBytesModel.data!.read![index].title}"'),
),
sizedBoxHeight(10.h),
SizedBox(
width: 230.w,
child: text16W400(
'"${contentBytesController.contentBytesModel.data!.read![index].description}"'),
),
const Spacer()
],
),
Column(
Gap(250),
text24W500("No Data Found !"),
],
))
: ListView.builder(
itemCount: contentBytesController
.contentBytesModel.data!.read!.length,
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemBuilder: (ctx, index) {
return Column(
children: [
InkWell(
onTap: () {
Get.to(ReadPDF(
title: contentBytesController
.contentBytesModel
.data!
.read![index]
.title,
pdfUrfl: contentBytesController
.contentBytesModel
.data!
.read![index]
.file,
));
},
child: commonGlassContainer(
borderradius: 8,
width: double.infinity,
height: 150.h,
customWidget: Row(
mainAxisAlignment:
MainAxisAlignment.end,
MainAxisAlignment
.spaceBetween,
crossAxisAlignment:
CrossAxisAlignment.end,
children: [
const SizedBox(
width: 10,
),
Column(
crossAxisAlignment:
CrossAxisAlignment
.start,
children: [
const Spacer(),
SizedBox(
width: 235.w,
child: text20W400(
contentBytesController
.contentBytesModel
.data!
.read![index]
.title!),
),
sizedBoxHeight(10.h),
SizedBox(
width: 230.w,
height: 50,
child: text16W400(
contentBytesController
.contentBytesModel
.data!
.read![index]
.description!),
),
const Spacer()
],
),
Image.network(
"${contentBytesController.contentBytesModel.data!.read![index].image}",
height: 110,
),
],
)
],
),
),
),
),
),
sizedBoxHeight(20.h),
],
);
}),
sizedBoxHeight(20.h),
],
);
}),
],
),
),
@@ -235,7 +243,7 @@ class _VideosMoreState extends State<ReadMore> {
.id!;
log(contentBytesController.filterId.toString());
handleSearch(searchControllerr.text,
handleSearch(searchController.text,
contentBytesController.filterId.toString());
},
child: itemFilter(index));

View File

@@ -5,9 +5,11 @@ import 'package:flutter_svg/flutter_svg.dart';
import 'package:gap/gap.dart';
import 'package:get/get.dart';
import 'package:traderscircuit/Utils/Common/CommonAppBar.dart';
import 'package:traderscircuit/Utils/Common/CustomTextFormField.dart';
import 'package:traderscircuit/Utils/Common/comonGlassmorphicContainer.dart';
import 'package:traderscircuit/Utils/Common/sized_box.dart';
import 'package:traderscircuit/Utils/text.dart';
import 'package:traderscircuit/controller/contact_us_controller.dart';
import 'package:traderscircuit/controller/content_bytes_controller.dart';
import 'package:traderscircuit/model/ContentBytesModel/content_bytes_model.dart';
import 'package:traderscircuit/view/Sidemenu/ContentByte/PlayerWidget.dart';
@@ -81,17 +83,13 @@ class _VideosMoreState extends State<VideosMore> {
children: [
SizedBox(
width: 295.w,
child: TextField(
controller: searchController,
onChanged: (value) {
child: CustomTextFormField(
textEditingController: searchController,
onInput: (value) {
// Call method to handle search
handleSearch(value, "");
},
decoration: InputDecoration(
prefixIcon: Icon(Icons.search),
hintText: 'Search videos',
border: OutlineInputBorder(),
),
hintText: "Search videos",
),
),
SizedBox(
@@ -104,43 +102,64 @@ class _VideosMoreState extends State<VideosMore> {
height: 10.h,
),
// Display search results or regular list
SizedBox(
height: 620.h,
child: ListView.separated(
padding: EdgeInsets.zero,
shrinkWrap: true,
itemCount: contentBytesController
.contentBytesModel.data!.video!.length,
itemBuilder: (ctx, index) {
return Container(
margin: const EdgeInsets.only(
bottom: 20,
),
child: videoCard(
contentBytesController.contentBytesModel
.data!.video![index].file ??
"",
contentBytesController.contentBytesModel
.data!.video![index].title ??
"",
contentBytesController
.contentBytesModel
.data!
.video![index]
.description ??
"",
contentBytesController.contentBytesModel
.data!.video![index].image ??
""),
);
},
separatorBuilder: (ctx, inndex) {
return SizedBox(
height: 10,
);
},
),
)
contentBytesController
.contentBytesModel.data!.video!.isEmpty
? Center(
child: Column(
children: [
Gap(250),
text24W500("No Data Found !"),
],
))
: ListView.separated(
padding: EdgeInsets.zero,
shrinkWrap: true,
itemCount: contentBytesController
.contentBytesModel.data!.video!.length,
itemBuilder: (ctx, index) {
return Container(
margin: const EdgeInsets.only(
bottom: 20,
),
child: videoCard(
contentBytesController
.contentBytesModel
.data!
.video![index]
.link ??
"",
contentBytesController
.contentBytesModel
.data!
.video![index]
.title ??
"",
contentBytesController
.contentBytesModel
.data!
.video![index]
.description ??
"",
contentBytesController
.contentBytesModel
.data!
.video![index]
.image ??
"",
contentBytesController
.contentBytesModel
.data!
.video![index]
.createdAt ??
""),
);
},
separatorBuilder: (ctx, inndex) {
return SizedBox(
height: 10,
);
},
)
],
),
),
@@ -235,8 +254,9 @@ class _VideosMoreState extends State<VideosMore> {
return SizedBox();
}
Widget videoCard(
String video, String title, String description, String image) {
Widget videoCard(String video, String title, String description, String image,
String createdAt) {
ContactUsController contactUsController = Get.put(ContactUsController());
return InkWell(
onTap: () {
Get.to(() => const PlayerWidget(), arguments: {
@@ -246,7 +266,7 @@ class _VideosMoreState extends State<VideosMore> {
child: commonGlassContainer(
borderradius: 8,
width: double.infinity,
height: 320.h,
height: 340.h,
customWidget: Padding(
padding: EdgeInsets.symmetric(vertical: 10.h, horizontal: 10.w),
child: Column(
@@ -271,12 +291,23 @@ class _VideosMoreState extends State<VideosMore> {
sizedBoxHeight(20.h),
Row(
children: [
// CircleAvatar(
// radius: 23.r,
// backgroundImage: const AssetImage(
// 'assets/images/png/Ellipse 1494.png'),
// ),
sizedBoxWidth(10.w),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
text18W500(title),
text16W400(description),
text12W400_979797('2 days ago'),
SizedBox(
width: 0.81.sw,
height: 50,
child: text16W400(description,
textOver: TextOverflow.ellipsis)),
text12W400_979797(
contactUsController.timeAgoConverter(createdAt)),
],
)
],

View File

@@ -17,7 +17,7 @@ class ReadPDF extends StatelessWidget {
title: Text(title!),
),
body: SfPdfViewer.network(
'https://cdn.syncfusion.com/content/PDFViewer/flutter-succinctly.pdf',
pdfUrfl!,
),
);
}

View File

@@ -47,4 +47,42 @@ class ContentBytesApi {
}
return response;
}
Future<ResponseData<dynamic>> getPreviousReadData() async {
final response = await NetworkApiServices()
.getApi(ApiUrls.getPreviousReadApi, isAuth: true);
log(response.data.toString());
if (response.status == ResponseStatus.SUCCESS) {
Map<String, dynamic> responseData =
Map<String, dynamic>.from(response.data);
if (responseData['status'] == "success") {
return response;
} else {
return ResponseData<dynamic>(
responseData['message'], ResponseStatus.FAILED);
}
}
return response;
}
Future<ResponseData<dynamic>> updateReadCounts(int xid) async {
final response = await NetworkApiServices().postApi(
{
'content_byte_read_xid': xid,
},
ApiUrls.storeReadCountApi,
);
log(response.data.toString());
if (response.status == ResponseStatus.SUCCESS) {
Map<String, dynamic> responseData =
Map<String, dynamic>.from(response.data);
if (responseData['status'] == "success") {
return response;
} else {
return ResponseData<dynamic>(
responseData['message'], ResponseStatus.FAILED);
}
}
return response;
}
}

View File

@@ -117,10 +117,10 @@ packages:
dependency: transitive
description:
name: collection
sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687
sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
url: "https://pub.dev"
source: hosted
version: "1.17.2"
version: "1.18.0"
connectivity_plus:
dependency: "direct main"
description:
@@ -616,6 +616,30 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.4.9"
leak_tracker:
dependency: transitive
description:
name: leak_tracker
sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa"
url: "https://pub.dev"
source: hosted
version: "10.0.0"
leak_tracker_flutter_testing:
dependency: transitive
description:
name: leak_tracker_flutter_testing
sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0
url: "https://pub.dev"
source: hosted
version: "2.0.1"
leak_tracker_testing:
dependency: transitive
description:
name: leak_tracker_testing
sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47
url: "https://pub.dev"
source: hosted
version: "2.0.1"
lints:
dependency: transitive
description:
@@ -684,26 +708,26 @@ packages:
dependency: transitive
description:
name: matcher
sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e"
sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb
url: "https://pub.dev"
source: hosted
version: "0.12.16"
version: "0.12.16+1"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41"
sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a"
url: "https://pub.dev"
source: hosted
version: "0.5.0"
version: "0.8.0"
meta:
dependency: transitive
description:
name: meta
sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3"
sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04
url: "https://pub.dev"
source: hosted
version: "1.9.1"
version: "1.11.0"
mime:
dependency: transitive
description:
@@ -748,10 +772,10 @@ packages:
dependency: transitive
description:
name: path
sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917"
sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
url: "https://pub.dev"
source: hosted
version: "1.8.3"
version: "1.9.0"
path_drawing:
dependency: transitive
description:
@@ -985,18 +1009,18 @@ packages:
dependency: transitive
description:
name: stack_trace
sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5
sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
url: "https://pub.dev"
source: hosted
version: "1.11.0"
version: "1.11.1"
stream_channel:
dependency: transitive
description:
name: stream_channel
sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8"
sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
url: "https://pub.dev"
source: hosted
version: "2.1.1"
version: "2.1.2"
string_scanner:
dependency: transitive
description:
@@ -1081,10 +1105,18 @@ packages:
dependency: transitive
description:
name: test_api
sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8"
sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b"
url: "https://pub.dev"
source: hosted
version: "0.6.0"
version: "0.6.1"
timeago:
dependency: "direct main"
description:
name: timeago
sha256: d3204eb4c788214883380253da7f23485320a58c11d145babc82ad16bf4e7764
url: "https://pub.dev"
source: hosted
version: "3.6.1"
typed_data:
dependency: transitive
description:
@@ -1246,6 +1278,14 @@ packages:
url: "https://github.com/kishan06/videoPlayerKB.git"
source: git
version: "0.0.2"
vm_service:
dependency: transitive
description:
name: vm_service
sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957
url: "https://pub.dev"
source: hosted
version: "13.0.0"
wakelock:
dependency: transitive
description:
@@ -1286,14 +1326,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.2.1"
web:
dependency: transitive
description:
name: web
sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10
url: "https://pub.dev"
source: hosted
version: "0.1.4-beta"
win32:
dependency: transitive
description:
@@ -1319,5 +1351,5 @@ packages:
source: hosted
version: "6.3.0"
sdks:
dart: ">=3.1.0 <4.0.0"
dart: ">=3.2.0-0 <4.0.0"
flutter: ">=3.13.0"

View File

@@ -50,6 +50,7 @@ dependencies:
flutter_html: ^3.0.0-beta.2
flutter_bloc: ^8.1.5
equatable: ^2.0.5
timeago: ^3.6.1
dev_dependencies:
flutter_test: