Merge pull request #33 from WDI-Ideas/temp

video view more
This commit is contained in:
Raj
2024-04-25 13:26:00 +05:30
committed by GitHub
13 changed files with 1059 additions and 95 deletions

View File

@@ -48,6 +48,7 @@ class ApiUrls {
static String getContentBytesCategoriesApi =
"${base}getContentByteCategories";
static String getContentBytesApi = "${base}getContentBytes";
static String morevideoApi = "${base}get-content-bytes-of-videos";
//Profile
static String Getprofile = "${base}getuserDetails";

View File

@@ -1,12 +1,15 @@
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 '../view/Sidemenu/ContentByte/ContentBytes.dart';
class ContentBytesController extends GetxController {
RxBool isLoading = true.obs;
ContentBytesCategoriesModel contentBytesCategoriesModel =
ContentBytesCategoriesModel();
ContentBytesModel contentBytesModel = ContentBytesModel();
@@ -178,4 +181,41 @@ class ContentBytesController extends GetxController {
titlePlayingList![index] = true;
}
}
// RxList<Video> searchResults = <Video>[].obs;
// Future<void> getContentBytesDataVideo(String query) async {
// // Set isLoading to true if needed
// isLoading.value = true;
// try {
// // Make API call to fetch search results based on the query
// final response = await ContentBytesApi().getContentBytesData({
// // Pass query parameters if needed
// 'search_data': query,
// 'content_type': "video",
// 'category_id': "",
// });
// // Check if the API call was successful
// if (response.status == ResponseStatus.SUCCESS) {
// // Parse the response data into a list of videos
// final List<dynamic> responseData = response.data['data']['video'];
// searchResults.value =
// responseData.map((data) => Video.fromJson(data)).toList();
// // Notify listeners about the changes to the searchResults list
// update();
// } else {
// // Handle API call failure
// // You may show an error message or handle it as needed
// }
// } catch (e) {
// // Handle exceptions
// // You may show an error message or handle it as needed
// } finally {
// // Set isLoading to false after the API call completes
// isLoading.value = false;
// }
// }
}

View File

@@ -14,16 +14,16 @@ class ContentBytesCategoriesModel {
if (json['data'] != null) {
data = <Data>[];
json['data'].forEach((v) {
data!.add(Data.fromJson(v));
data!.add(new Data.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['status'] = status;
data['status_code'] = statusCode;
data['message'] = message;
final Map<String, dynamic> data = new Map<String, dynamic>();
data['status'] = this.status;
data['status_code'] = this.statusCode;
data['message'] = this.message;
if (this.data != null) {
data['data'] = this.data!.map((v) => v.toJson()).toList();
}
@@ -33,51 +33,25 @@ class ContentBytesCategoriesModel {
class Data {
int? id;
String? contentType;
String? title;
String? description;
String? tags;
String? file;
int? categoryId;
String? image;
String? categoryName;
String? categoryDescription;
String? isActive;
Data({
this.id,
this.contentType,
this.title,
this.description,
this.tags,
this.file,
this.categoryId,
this.image,
this.isActive,
});
Data({this.id, this.categoryName, this.categoryDescription, this.isActive});
Data.fromJson(Map<String, dynamic> json) {
id = json['id'];
contentType = json['content_type'];
title = json['title'];
description = json['description'];
tags = json['tags'];
file = json['file'];
categoryId = json['category_id'];
image = json['image'];
categoryName = json['category_name'];
categoryDescription = json['category_description'];
isActive = json['is_active'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['id'] = id;
data['content_type'] = contentType;
data['title'] = title;
data['description'] = description;
data['tags'] = tags;
data['file'] = file;
data['category_id'] = categoryId;
data['image'] = image;
data['is_active'] = isActive;
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['category_name'] = this.categoryName;
data['category_description'] = this.categoryDescription;
data['is_active'] = this.isActive;
return data;
}
}

View File

@@ -0,0 +1,84 @@
class VideoMoreModel {
String? status;
int? statusCode;
String? message;
List<Data>? data;
VideoMoreModel({this.status, this.statusCode, this.message, this.data});
VideoMoreModel.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(new Data.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['status'] = this.status;
data['status_code'] = this.statusCode;
data['message'] = this.message;
if (this.data != null) {
data['data'] = this.data!.map((v) => v.toJson()).toList();
}
return data;
}
}
class Data {
int? id;
String? contentType;
String? title;
String? description;
String? tags;
String? file;
int? categoryId;
String? image;
String? isActive;
String? createdAt;
Data(
{this.id,
this.contentType,
this.title,
this.description,
this.tags,
this.file,
this.categoryId,
this.image,
this.isActive,
this.createdAt});
Data.fromJson(Map<String, dynamic> json) {
id = json['id'];
contentType = json['content_type'];
title = json['title'];
description = json['description'];
tags = json['tags'];
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 = new Map<String, dynamic>();
data['id'] = this.id;
data['content_type'] = this.contentType;
data['title'] = this.title;
data['description'] = this.description;
data['tags'] = this.tags;
data['file'] = this.file;
data['category_id'] = this.categoryId;
data['image'] = this.image;
data['is_active'] = this.isActive;
data['created_at'] = this.createdAt;
return data;
}
}

View File

@@ -4,6 +4,8 @@ import 'package:traderscircuit/resources/routes/route_name.dart';
import 'package:traderscircuit/view/MainScreen/ExploreUnseen.dart';
import 'package:traderscircuit/view/Sidemenu/AboutUs.dart';
import 'package:traderscircuit/view/Sidemenu/ContentByte/ContentBytes.dart';
import 'package:traderscircuit/view/Sidemenu/ContentByte/AudioMore.dart';
import 'package:traderscircuit/view/Sidemenu/ContentByte/ReadMore.dart';
import 'package:traderscircuit/view/Sidemenu/ContentByte/VideosMore.dart';
import 'package:traderscircuit/view/Sidemenu/FaqScreen.dart';
import 'package:traderscircuit/view/Sidemenu/PrivacyPolicy.dart';
@@ -166,6 +168,14 @@ class AppRoutes {
name: RouteName.videosmore,
page: () => const VideosMore(),
),
GetPage(
name: RouteName.audiomore,
page: () => const AudioMore(),
),
GetPage(
name: RouteName.bookmore,
page: () => const ReadMore(),
),
//contact us
GetPage(

View File

@@ -0,0 +1,278 @@
import 'dart:developer';
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';
class AudioMore extends StatefulWidget {
const AudioMore({super.key});
@override
State<AudioMore> createState() => _VideosMoreState();
}
class _VideosMoreState extends State<AudioMore> {
ContentBytesController contentBytesController =
Get.put(ContentBytesController());
var data;
RxBool isLoading = false.obs;
TextEditingController searchControllera = TextEditingController();
@override
void initState() {
ContentBytesApi().getContentBytesData("", "audio", "").then((value) {
contentBytesController.contentBytesModel =
ContentBytesModel.fromJson(value.data);
contentBytesController.isApiCalling.value = false;
setState(() {});
});
super.initState();
}
void handleSearch(String query, String category) async {
await ContentBytesApi()
.getContentBytesData(
query, "audio", contentBytesController.filterId.toString())
.then((value) {
contentBytesController.contentBytesModel =
ContentBytesModel.fromJson(value.data);
setState(() {});
});
}
@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(
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
.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!),
),
],
),
),
],
),
),
);
},
),
],
),
),
],
),
],
),
),
);
}
Widget filter() {
return PopupMenuButton(
icon: Image.asset(
"assets/images/png/filter.png",
height: 30.h,
width: 30.w,
),
color: const Color(0xFF191919),
itemBuilder: (context) {
return [
PopupMenuItem(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(
height: (Get.height *
contentBytesController
.contentBytesCategoriesModel.data!.length) /
17,
width: 150,
child: ListView.builder(
padding: EdgeInsets.zero,
shrinkWrap: true,
itemCount: contentBytesController
.contentBytesCategoriesModel.data!.length,
itemBuilder: (ctx, index) {
return InkWell(
onTap: () {
// contentBytesController.isApiCalling.value = true;
Get.back();
contentBytesController.filterId =
contentBytesController
.contentBytesCategoriesModel
.data![index]
.id!;
log(contentBytesController.filterId.toString());
handleSearch(searchControllera.text,
contentBytesController.filterId.toString());
},
child: itemFilter(index));
}),
),
],
))
];
},
);
}
Widget itemFilter(int index) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const Gap(8),
text18W400(
contentBytesController
.contentBytesCategoriesModel.data![index].categoryName!,
texAl: TextAlign.center,
),
index ==
contentBytesController
.contentBytesCategoriesModel.data!.length -
1
? const SizedBox()
: const Divider(
color: Color(0xFF2C2C2C),
thickness: 0.6,
endIndent: 0,
),
],
);
}
}

View File

@@ -7,7 +7,6 @@ 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/commonBotton.dart';
import 'package:traderscircuit/Utils/Common/comonGlassmorphicContainer.dart';
import 'package:traderscircuit/Utils/Common/sized_box.dart';
import 'package:traderscircuit/Utils/text.dart';
@@ -65,10 +64,11 @@ class _ContentBytesState extends State<ContentBytes> {
contentBytesController.contentBytesCategoriesModel =
ContentBytesCategoriesModel.fromJson(value.data);
});
ContentBytesApi().getContentBytesData("").then((value) {
ContentBytesApi().getContentBytesData("", "", "").then((value) {
contentBytesController.contentBytesModel =
ContentBytesModel.fromJson(value.data);
contentBytesController.isApiCalling.value = false;
setState(() {});
});
super.initState();
}
@@ -285,28 +285,32 @@ class _ReadsState extends State<Reads> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Row(
// children: [
// const SizedBox(
// width: 300,
// child: CustomTextFormField(
// leadingIcon: Icon(Icons.search),
// ),
// ),
// SizedBox(
// width: 15.w,
// ),
// Image.asset(
// "assets/images/png/filter.png",
// height: 30.h,
// width: 30.w,
// ),
// ],
// ),
// SizedBox(
// height: 10.h,
// ),
text22W600('Harnessing the Power of Ebooks'),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
text22W600('Content Bytes'),
GestureDetector(
onTap: () {
Get.toNamed(RouteName.bookmore);
},
child: Container(
height: 35.h,
width: 105.w,
decoration: BoxDecoration(
color: Color(0xFF3A3A3A).withOpacity(0.6),
borderRadius: BorderRadius.circular(5.r),
border: Border.all(
color: Color(0xFF3A3A3A),
)),
child: Center(
child: text16W500('View More'),
),
),
),
],
),
sizedBoxHeight(8.w),
text16W400_DADADA('Harnessing the Power of Ebooks'),
sizedBoxHeight(20.h),
ListView.builder(
itemCount:
@@ -529,7 +533,30 @@ class _AudiosState extends State<Audios> {
// SizedBox(
// height: 10.h,
// ),
text22W600('Content Bytes'),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
text22W600('Content Bytes'),
GestureDetector(
onTap: () {
Get.toNamed(RouteName.audiomore);
},
child: Container(
height: 35.h,
width: 105.w,
decoration: BoxDecoration(
color: Color(0xFF3A3A3A).withOpacity(0.6),
borderRadius: BorderRadius.circular(5.r),
border: Border.all(
color: Color(0xFF3A3A3A),
)),
child: Center(
child: text16W500('View More'),
),
),
),
],
),
sizedBoxHeight(8.w),
text16W400_DADADA('The Beauty and Power of Audios'),
sizedBoxHeight(20.h),
@@ -713,7 +740,7 @@ class _VideosState extends State<Videos> {
const Gap(8),
text18W400(
contentBytesController
.contentBytesCategoriesModel.data![index].title!,
.contentBytesCategoriesModel.data![index].categoryName!,
texAl: TextAlign.center,
),
index ==
@@ -765,7 +792,7 @@ class _VideosState extends State<Videos> {
contentBytesController
.contentBytesCategoriesModel
.data![index]
.categoryId!;
.id!;
log(contentBytesController.filterId.toString());
},
@@ -914,7 +941,6 @@ class _VideosState extends State<Videos> {
),
],
),
sizedBoxHeight(8.w),
text16W400_DADADA('The Beauty and Power of Video'),
sizedBoxHeight(20.h),

View File

@@ -0,0 +1,299 @@
import 'dart:developer';
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/Sidemenu/ContentByte/read_pdf.dart';
import 'package:traderscircuit/view/onBoarding/splashScreen1.dart';
class ReadMore extends StatefulWidget {
const ReadMore({super.key});
@override
State<ReadMore> createState() => _VideosMoreState();
}
class _VideosMoreState extends State<ReadMore> {
ContentBytesController contentBytesController =
Get.put(ContentBytesController());
var data;
RxBool isLoading = false.obs;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: const CommonAppbar(
titleTxt: "Read",
),
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: 290.w,
child: CustomTextFormField(
leadingIcon: Icon(Icons.search),
),
),
SizedBox(
width: 10.w,
),
filter(),
],
),
// SizedBox(
// height: 10.h,
// ),
sizedBoxHeight(20.h),
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.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(
mainAxisAlignment:
MainAxisAlignment.end,
crossAxisAlignment:
CrossAxisAlignment.end,
children: [
Image.network(
"${contentBytesController.contentBytesModel.data!.read![index].image}",
height: 110,
),
],
)
],
),
),
),
sizedBoxHeight(20.h),
],
);
}),
],
),
),
],
),
],
),
),
);
}
Widget filter() {
return PopupMenuButton(
icon: Image.asset(
"assets/images/png/filter.png",
height: 30.h,
width: 30.w,
),
color: const Color(0xFF191919),
itemBuilder: (context) {
return [
PopupMenuItem(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(
height: (Get.height *
contentBytesController
.contentBytesCategoriesModel.data!.length) /
17,
width: 150,
child: ListView.builder(
padding: EdgeInsets.zero,
shrinkWrap: true,
itemCount: contentBytesController
.contentBytesCategoriesModel.data!.length,
itemBuilder: (ctx, index) {
return InkWell(
onTap: () {
// contentBytesController.isApiCalling.value = true;
Get.back();
contentBytesController.filterId =
contentBytesController
.contentBytesCategoriesModel
.data![index]
.id!;
log(contentBytesController.filterId.toString());
},
child: itemFilter(index));
}),
),
],
))
];
},
);
}
Widget itemFilter(int index) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const Gap(8),
text18W400(
contentBytesController
.contentBytesCategoriesModel.data![index].categoryName!,
texAl: TextAlign.center,
),
index ==
contentBytesController
.contentBytesCategoriesModel.data!.length -
1
? const SizedBox()
: const Divider(
color: Color(0xFF2C2C2C),
thickness: 0.6,
endIndent: 0,
),
],
);
}
}
Widget videoCard(Video video) {
return InkWell(
onTap: () {
Get.to(() => const PlayerWidget(), arguments: {
"video_url": video.file,
});
},
child: commonGlassContainer(
borderradius: 8,
width: double.infinity,
height: 320.h,
customWidget: Padding(
padding: EdgeInsets.symmetric(vertical: 10.h, horizontal: 10.w),
child: Column(
children: [
Container(
height: 200.h,
width: double.infinity,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.r),
image: DecorationImage(
image: NetworkImage(
video.image!,
))),
child: Center(
child: SvgPicture.asset(
'assets/images/svg/gridicons_play.svg',
height: 56.h,
width: 56.w,
),
),
),
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(video.title!),
text16W400(video.description!),
// sizedBoxHeight(10.h),
//text12W400_979797('20k views . 2 days ago'),
text12W400_979797('2 days ago'),
],
)
],
)
],
),
)),
);
}

View File

@@ -1,32 +1,55 @@
import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:flutter_html/flutter_html.dart';
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/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/model/TermsConditionModel/terms_condition_model.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';
import 'package:traderscircuit/view/onBoarding/splashScreen1.dart';
import 'package:traderscircuit/view_model/TermsAndConditionApi/terms_condition_api.dart';
import 'package:traderscircuit/view_model/ContentBytesApi/content_bytes_api.dart';
class VideosMore extends StatefulWidget {
const VideosMore({super.key});
const VideosMore({Key? key}) : super(key: key);
@override
State<VideosMore> createState() => _VideosMoreState();
}
class _VideosMoreState extends State<VideosMore> {
ContentBytesController contentBytesController =
Get.put(ContentBytesController());
var data;
RxBool isLoading = false.obs;
// TermsAndConditionModel termsAndConditionModel = TermsAndConditionModel();
// @override
// void initState() {
// TermsAndConditionApi().getTermsAndConditionData().then((value) {
// termsAndConditionModel = TermsAndConditionModel.fromJson(value.data);
// isLoading.value = false;
// });
// super.initState();
// }
TextEditingController searchController = TextEditingController();
@override
void initState() {
ContentBytesApi().getContentBytesData("", "video", "").then((value) {
contentBytesController.contentBytesModel =
ContentBytesModel.fromJson(value.data);
contentBytesController.isApiCalling.value = false;
setState(() {});
});
super.initState();
}
void handleSearch(String query, String category) async {
await ContentBytesApi()
.getContentBytesData(
query, "video", contentBytesController.filterId.toString())
.then((value) {
contentBytesController.contentBytesModel =
ContentBytesModel.fromJson(value.data);
setState(() {});
});
}
@override
Widget build(BuildContext context) {
@@ -51,20 +74,73 @@ class _VideosMoreState extends State<VideosMore> {
children: [
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 16, vertical: 16),
child: ListView(
physics: const BouncingScrollPhysics(),
horizontal: 16, vertical: 8),
child: Column(
children: [
// CommonDropdownBtn(hint: "hint", items: ["hi", "hii"]),
SizedBox(
height: 10.h,
),
text16W400(
"",
Row(
children: [
SizedBox(
width: 295.w,
child: TextField(
controller: searchController,
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(),
],
),
SizedBox(
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,
);
},
),
)
],
),
),
@@ -75,4 +151,138 @@ class _VideosMoreState extends State<VideosMore> {
),
);
}
Widget filter() {
return PopupMenuButton(
icon: Image.asset(
"assets/images/png/filter.png",
height: 30.h,
width: 30.w,
),
color: const Color(0xFF191919),
itemBuilder: (context) {
return [
PopupMenuItem(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(
height: (Get.height *
contentBytesController
.contentBytesCategoriesModel.data!.length) /
17,
width: 150,
child: ListView.builder(
padding: EdgeInsets.zero,
shrinkWrap: true,
itemCount: contentBytesController
.contentBytesCategoriesModel.data!.length,
itemBuilder: (ctx, index) {
return InkWell(
onTap: () {
// contentBytesController.isApiCalling.value = true;
Get.back();
contentBytesController.filterId =
contentBytesController
.contentBytesCategoriesModel
.data![index]
.id!;
log(
contentBytesController.filterId.toString(),
);
handleSearch(searchController.text,
contentBytesController.filterId.toString());
},
child: itemFilter(index));
}),
),
],
))
];
},
);
}
Widget itemFilter(int index) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const Gap(8),
text18W400(
contentBytesController
.contentBytesCategoriesModel.data![index].categoryName!,
texAl: TextAlign.center,
),
index ==
contentBytesController
.contentBytesCategoriesModel.data!.length -
1
? const SizedBox()
: const Divider(
color: Color(0xFF2C2C2C),
thickness: 0.6,
endIndent: 0,
),
],
);
}
Widget searchResultsWidget() {
// Display search results here
return SizedBox();
}
Widget videoCard(
String video, String title, String description, String image) {
return InkWell(
onTap: () {
Get.to(() => const PlayerWidget(), arguments: {
"video_url": video,
});
},
child: commonGlassContainer(
borderradius: 8,
width: double.infinity,
height: 320.h,
customWidget: Padding(
padding: EdgeInsets.symmetric(vertical: 10.h, horizontal: 10.w),
child: Column(
children: [
Container(
height: 200.h,
width: double.infinity,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.r),
image: DecorationImage(
image: NetworkImage(
image,
))),
child: Center(
child: SvgPicture.asset(
'assets/images/svg/gridicons_play.svg',
height: 56.h,
width: 56.w,
),
),
),
sizedBoxHeight(20.h),
Row(
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
text18W500(title),
text16W400(description),
text12W400_979797('2 days ago'),
],
)
],
)
],
),
)),
);
}
}

View File

@@ -18,6 +18,13 @@ class SideMenu extends StatefulWidget {
}
class _SideMenuState extends State<SideMenu> {
@override
void initState() {
// TODO: implement initState
GetProfile().GetProfileAPI();
super.initState();
}
List sideBarData = [
{
"imagePath": "assets/images/svg/sidemenu/Faq.svg",

View File

@@ -185,7 +185,7 @@ class CreateTicketBottomSheet {
children: [
SvgPicture.asset(
"assets/images/svg/attachment_pin.svg"),
const Gap(6),
const Gap(5),
text12W400(
"Add Attachment (Max 3 files of 2MB each / Optional)"),
],

View File

@@ -24,9 +24,14 @@ class ContentBytesApi {
return response;
}
Future<ResponseData<dynamic>> getContentBytesData(dynamic data) async {
Future<ResponseData<dynamic>> getContentBytesData(
String query, String type, String category) async {
final response = await NetworkApiServices().postApi(
data,
{
'search_data': query,
'content_type': type,
'category_id': category,
},
ApiUrls.getContentBytesApi,
);
log(response.data.toString());

View File

@@ -0,0 +1,30 @@
import 'dart:developer';
import 'package:traderscircuit/Utils/api_urls.dart';
import 'package:traderscircuit/Utils/base_manager.dart';
import 'package:traderscircuit/data/network/network_api_services.dart';
import 'package:traderscircuit/model/ContentBytesModel/more_video_model.dart';
VideoMoreModel? MoreVideoObj;
class MoreVideoAPI {
Future<ResponseData<dynamic>> getMoreVideo(dynamic data) async {
final response = await NetworkApiServices().postApi(
data,
ApiUrls.morevideoApi,
);
log(response.data.toString());
if (response.status == ResponseStatus.SUCCESS) {
Map<String, dynamic> responseData =
Map<String, dynamic>.from(response.data);
if (responseData['status'] == "success") {
MoreVideoObj = VideoMoreModel.fromJson(responseData);
return response;
} else {
return ResponseData<dynamic>(
responseData['message'], ResponseStatus.FAILED);
}
}
return response;
}
}