Merge pull request #54 from WDI-Ideas/jayeshjain25
filter in content bytes
This commit is contained in:
@@ -48,7 +48,6 @@ class ApiUrls {
|
||||
static String getContentBytesCategoriesApi =
|
||||
"${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";
|
||||
|
||||
|
||||
@@ -15,8 +15,12 @@ class ContentBytesController extends GetxController {
|
||||
ContentBytesCategoriesModel();
|
||||
ContentBytesModel contentBytesModel = ContentBytesModel();
|
||||
|
||||
ContentBytesModel moreVideoModel = ContentBytesModel();
|
||||
ContentBytesModel moreAudioModel = ContentBytesModel();
|
||||
ContentBytesModel moreReadsModel = ContentBytesModel();
|
||||
|
||||
PreviousReadOfUserModel previousReadOfUserModel = PreviousReadOfUserModel();
|
||||
int filterId = 0;
|
||||
String filterId = "0";
|
||||
RxBool isApiCalling = true.obs;
|
||||
RxBool isAudioSeekBarVisible = false.obs;
|
||||
RxInt indexForAudios = 0.obs;
|
||||
|
||||
@@ -27,16 +27,17 @@ class _VideosMoreState extends State<AudioMore> {
|
||||
ContentBytesController contentBytesController =
|
||||
Get.put(ContentBytesController());
|
||||
var data;
|
||||
RxBool isLoading = false.obs;
|
||||
RxBool isLoading = true.obs;
|
||||
|
||||
RxInt selectedFilterIndex = 100.obs;
|
||||
TextEditingController searchController = TextEditingController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
ContentBytesApi().getContentBytesData("", "audio", "").then((value) {
|
||||
contentBytesController.contentBytesModel =
|
||||
contentBytesController.moreAudioModel =
|
||||
ContentBytesModel.fromJson(value.data);
|
||||
contentBytesController.isApiCalling.value = false;
|
||||
isLoading.value = false;
|
||||
setState(() {});
|
||||
});
|
||||
super.initState();
|
||||
@@ -47,7 +48,7 @@ class _VideosMoreState extends State<AudioMore> {
|
||||
.getContentBytesData(
|
||||
query, "audio", contentBytesController.filterId.toString())
|
||||
.then((value) {
|
||||
contentBytesController.contentBytesModel =
|
||||
contentBytesController.moreAudioModel =
|
||||
ContentBytesModel.fromJson(value.data);
|
||||
setState(() {});
|
||||
});
|
||||
@@ -81,7 +82,7 @@ class _VideosMoreState extends State<AudioMore> {
|
||||
borderRadius: BorderRadius.circular(100),
|
||||
child: Image.network(
|
||||
contentBytesController
|
||||
.contentBytesModel
|
||||
.moreAudioModel
|
||||
.data!
|
||||
.audio![contentBytesController
|
||||
.indexForAudios.value]
|
||||
@@ -101,7 +102,7 @@ class _VideosMoreState extends State<AudioMore> {
|
||||
children: [
|
||||
Text(
|
||||
contentBytesController
|
||||
.contentBytesModel
|
||||
.moreAudioModel
|
||||
.data!
|
||||
.audio![contentBytesController
|
||||
.indexForAudios.value]
|
||||
@@ -117,7 +118,7 @@ class _VideosMoreState extends State<AudioMore> {
|
||||
// SizedBox(height: 5),
|
||||
Text(
|
||||
contentBytesController
|
||||
.contentBytesModel
|
||||
.moreAudioModel
|
||||
.data!
|
||||
.audio![contentBytesController
|
||||
.indexForAudios.value]
|
||||
@@ -237,98 +238,111 @@ class _VideosMoreState extends State<AudioMore> {
|
||||
],
|
||||
),
|
||||
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, "regular");
|
||||
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),
|
||||
contentBytesController
|
||||
.moreAudioModel.data!.audio!.isEmpty
|
||||
? Center(
|
||||
child: Column(
|
||||
children: [
|
||||
const Gap(250),
|
||||
text24W500("No Data Found !"),
|
||||
],
|
||||
))
|
||||
: 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
|
||||
),
|
||||
child: Stack(
|
||||
children: [
|
||||
Image.network(
|
||||
|
||||
itemCount: contentBytesController
|
||||
.moreAudioModel
|
||||
.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, "regular");
|
||||
contentBytesController
|
||||
.contentBytesModel
|
||||
.data!
|
||||
.audio![index]
|
||||
.image!,
|
||||
),
|
||||
Positioned(
|
||||
bottom: 5,
|
||||
left: 5,
|
||||
child: Row(
|
||||
.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: [
|
||||
CircleAvatar(
|
||||
radius: 18.sp,
|
||||
child: const Icon(
|
||||
Icons.headphones),
|
||||
Image.network(
|
||||
contentBytesController
|
||||
.moreAudioModel
|
||||
.data!
|
||||
.audio![index]
|
||||
.image!,
|
||||
),
|
||||
SizedBox(
|
||||
width: 5.w,
|
||||
),
|
||||
SizedBox(
|
||||
width: 125.w,
|
||||
child: text14W500(
|
||||
contentBytesController
|
||||
.contentBytesModel
|
||||
.data!
|
||||
.audio![index]
|
||||
.title!),
|
||||
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
|
||||
.moreAudioModel
|
||||
.data!
|
||||
.audio![index]
|
||||
.title!),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -353,36 +367,62 @@ class _VideosMoreState extends State<AudioMore> {
|
||||
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));
|
||||
}),
|
||||
Center(
|
||||
child: SizedBox(
|
||||
height: (Get.height *
|
||||
contentBytesController
|
||||
.contentBytesCategoriesModel.data!.length) /
|
||||
12,
|
||||
width: 180,
|
||||
child: ListView.builder(
|
||||
padding: EdgeInsets.zero,
|
||||
shrinkWrap: true,
|
||||
itemCount: contentBytesController
|
||||
.contentBytesCategoriesModel.data!.length +
|
||||
1,
|
||||
itemBuilder: (ctx, index) {
|
||||
return index == 0
|
||||
? selectedFilterIndex.value == 100
|
||||
? SizedBox()
|
||||
: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: (() {
|
||||
Get.back();
|
||||
selectedFilterIndex.value = 100;
|
||||
contentBytesController.filterId =
|
||||
"";
|
||||
handleSearch("", "");
|
||||
}),
|
||||
child: text16W600("Reset",
|
||||
clr: const Color(0xFF9A0000)))
|
||||
],
|
||||
)
|
||||
: InkWell(
|
||||
onTap: () {
|
||||
// contentBytesController.isApiCalling.value = true;
|
||||
Get.back();
|
||||
selectedFilterIndex.value = index - 1;
|
||||
contentBytesController.filterId =
|
||||
contentBytesController
|
||||
.contentBytesCategoriesModel
|
||||
.data![index - 1]
|
||||
.id!
|
||||
.toString();
|
||||
|
||||
handleSearch(
|
||||
searchController.text,
|
||||
contentBytesController.filterId
|
||||
.toString());
|
||||
},
|
||||
child: itemFilter(
|
||||
index - 1, selectedFilterIndex.value));
|
||||
}),
|
||||
),
|
||||
),
|
||||
],
|
||||
))
|
||||
@@ -391,16 +431,38 @@ class _VideosMoreState extends State<AudioMore> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget itemFilter(int index) {
|
||||
Widget itemFilter(int index, int selectedIndex) {
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
const Gap(8),
|
||||
text18W400(
|
||||
contentBytesController
|
||||
.contentBytesCategoriesModel.data![index].categoryName!,
|
||||
texAl: TextAlign.center,
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
selectedIndex == index
|
||||
? const CircleAvatar(
|
||||
radius: 12,
|
||||
backgroundColor: Colors.white,
|
||||
child: Center(
|
||||
child: Icon(
|
||||
Icons.check,
|
||||
color: Colors.green,
|
||||
),
|
||||
),
|
||||
)
|
||||
: const SizedBox(),
|
||||
selectedIndex == index ? const Gap(5) : const SizedBox(),
|
||||
SizedBox(
|
||||
width: 150,
|
||||
child: text18W400(
|
||||
contentBytesController
|
||||
.contentBytesCategoriesModel.data![index].categoryName!,
|
||||
texAl: TextAlign.center,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
index ==
|
||||
contentBytesController
|
||||
|
||||
@@ -961,7 +961,8 @@ class _VideosState extends State<Videos> {
|
||||
contentBytesController
|
||||
.contentBytesCategoriesModel
|
||||
.data![index]
|
||||
.id!;
|
||||
.id!
|
||||
.toString();
|
||||
|
||||
log(contentBytesController.filterId.toString());
|
||||
},
|
||||
|
||||
@@ -29,15 +29,16 @@ class _VideosMoreState extends State<ReadMore> {
|
||||
ContentBytesController contentBytesController =
|
||||
Get.put(ContentBytesController());
|
||||
var data;
|
||||
RxBool isLoading = false.obs;
|
||||
RxBool isLoading = true.obs;
|
||||
RxInt selectedFilterIndex = 100.obs;
|
||||
TextEditingController searchController = TextEditingController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
ContentBytesApi().getContentBytesData("", "reads", "").then((value) {
|
||||
contentBytesController.contentBytesModel =
|
||||
contentBytesController.moreReadsModel =
|
||||
ContentBytesModel.fromJson(value.data);
|
||||
contentBytesController.isApiCalling.value = false;
|
||||
isLoading.value = false;
|
||||
setState(() {});
|
||||
});
|
||||
super.initState();
|
||||
@@ -48,7 +49,7 @@ class _VideosMoreState extends State<ReadMore> {
|
||||
.getContentBytesData(
|
||||
query, "reads", contentBytesController.filterId.toString())
|
||||
.then((value) {
|
||||
contentBytesController.contentBytesModel =
|
||||
contentBytesController.moreReadsModel =
|
||||
ContentBytesModel.fromJson(value.data);
|
||||
setState(() {});
|
||||
});
|
||||
@@ -108,7 +109,7 @@ class _VideosMoreState extends State<ReadMore> {
|
||||
|
||||
sizedBoxHeight(20.h),
|
||||
contentBytesController
|
||||
.contentBytesModel.data!.read!.isEmpty
|
||||
.moreReadsModel.data!.read!.isEmpty
|
||||
? Center(
|
||||
child: Column(
|
||||
children: [
|
||||
@@ -118,7 +119,7 @@ class _VideosMoreState extends State<ReadMore> {
|
||||
))
|
||||
: ListView.builder(
|
||||
itemCount: contentBytesController
|
||||
.contentBytesModel.data!.read!.length,
|
||||
.moreReadsModel.data!.read!.length,
|
||||
shrinkWrap: true,
|
||||
physics: NeverScrollableScrollPhysics(),
|
||||
itemBuilder: (ctx, index) {
|
||||
@@ -128,12 +129,12 @@ class _VideosMoreState extends State<ReadMore> {
|
||||
onTap: () {
|
||||
Get.to(ReadPDF(
|
||||
title: contentBytesController
|
||||
.contentBytesModel
|
||||
.moreReadsModel
|
||||
.data!
|
||||
.read![index]
|
||||
.title,
|
||||
pdfUrfl: contentBytesController
|
||||
.contentBytesModel
|
||||
.moreReadsModel
|
||||
.data!
|
||||
.read![index]
|
||||
.file,
|
||||
@@ -163,7 +164,7 @@ class _VideosMoreState extends State<ReadMore> {
|
||||
width: 235.w,
|
||||
child: text20W400(
|
||||
contentBytesController
|
||||
.contentBytesModel
|
||||
.moreReadsModel
|
||||
.data!
|
||||
.read![index]
|
||||
.title!),
|
||||
@@ -174,7 +175,7 @@ class _VideosMoreState extends State<ReadMore> {
|
||||
height: 50,
|
||||
child: text16W400(
|
||||
contentBytesController
|
||||
.contentBytesModel
|
||||
.moreReadsModel
|
||||
.data!
|
||||
.read![index]
|
||||
.description!),
|
||||
@@ -183,7 +184,7 @@ class _VideosMoreState extends State<ReadMore> {
|
||||
],
|
||||
),
|
||||
Image.network(
|
||||
"${contentBytesController.contentBytesModel.data!.read![index].image}",
|
||||
"${contentBytesController.moreReadsModel.data!.read![index].image}",
|
||||
height: 110,
|
||||
),
|
||||
],
|
||||
@@ -217,37 +218,62 @@ class _VideosMoreState extends State<ReadMore> {
|
||||
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!;
|
||||
Center(
|
||||
child: SizedBox(
|
||||
height: (Get.height *
|
||||
contentBytesController
|
||||
.contentBytesCategoriesModel.data!.length) /
|
||||
12,
|
||||
width: 180,
|
||||
child: ListView.builder(
|
||||
padding: EdgeInsets.zero,
|
||||
shrinkWrap: true,
|
||||
itemCount: contentBytesController
|
||||
.contentBytesCategoriesModel.data!.length +
|
||||
1,
|
||||
itemBuilder: (ctx, index) {
|
||||
return index == 0
|
||||
? selectedFilterIndex.value == 100
|
||||
? SizedBox()
|
||||
: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: (() {
|
||||
Get.back();
|
||||
selectedFilterIndex.value = 100;
|
||||
contentBytesController.filterId =
|
||||
"";
|
||||
handleSearch("", "");
|
||||
}),
|
||||
child: text16W600("Reset",
|
||||
clr: const Color(0xFF9A0000)))
|
||||
],
|
||||
)
|
||||
: InkWell(
|
||||
onTap: () {
|
||||
// contentBytesController.isApiCalling.value = true;
|
||||
Get.back();
|
||||
selectedFilterIndex.value = index - 1;
|
||||
contentBytesController.filterId =
|
||||
contentBytesController
|
||||
.contentBytesCategoriesModel
|
||||
.data![index - 1]
|
||||
.id!
|
||||
.toString();
|
||||
|
||||
log(contentBytesController.filterId.toString());
|
||||
handleSearch(searchController.text,
|
||||
contentBytesController.filterId.toString());
|
||||
},
|
||||
child: itemFilter(index));
|
||||
}),
|
||||
handleSearch(
|
||||
searchController.text,
|
||||
contentBytesController.filterId
|
||||
.toString());
|
||||
},
|
||||
child: itemFilter(
|
||||
index - 1, selectedFilterIndex.value));
|
||||
}),
|
||||
),
|
||||
),
|
||||
],
|
||||
))
|
||||
@@ -256,16 +282,38 @@ class _VideosMoreState extends State<ReadMore> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget itemFilter(int index) {
|
||||
Widget itemFilter(int index, int selectedIndex) {
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
const Gap(8),
|
||||
text18W400(
|
||||
contentBytesController
|
||||
.contentBytesCategoriesModel.data![index].categoryName!,
|
||||
texAl: TextAlign.center,
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
selectedIndex == index
|
||||
? const CircleAvatar(
|
||||
radius: 12,
|
||||
backgroundColor: Colors.white,
|
||||
child: Center(
|
||||
child: Icon(
|
||||
Icons.check,
|
||||
color: Colors.green,
|
||||
),
|
||||
),
|
||||
)
|
||||
: const SizedBox(),
|
||||
selectedIndex == index ? const Gap(5) : const SizedBox(),
|
||||
SizedBox(
|
||||
width: 150,
|
||||
child: text18W400(
|
||||
contentBytesController
|
||||
.contentBytesCategoriesModel.data![index].categoryName!,
|
||||
texAl: TextAlign.center,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
index ==
|
||||
contentBytesController
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import 'dart:developer';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
@@ -27,16 +26,17 @@ class _VideosMoreState extends State<VideosMore> {
|
||||
ContentBytesController contentBytesController =
|
||||
Get.put(ContentBytesController());
|
||||
var data;
|
||||
RxBool isLoading = false.obs;
|
||||
RxBool isLoading = true.obs;
|
||||
RxInt selectedFilterIndex = 100.obs;
|
||||
|
||||
TextEditingController searchController = TextEditingController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
ContentBytesApi().getContentBytesData("", "video", "").then((value) {
|
||||
contentBytesController.contentBytesModel =
|
||||
contentBytesController.moreVideoModel =
|
||||
ContentBytesModel.fromJson(value.data);
|
||||
contentBytesController.isApiCalling.value = false;
|
||||
isLoading.value = false;
|
||||
setState(() {});
|
||||
});
|
||||
super.initState();
|
||||
@@ -47,7 +47,7 @@ class _VideosMoreState extends State<VideosMore> {
|
||||
.getContentBytesData(
|
||||
query, "video", contentBytesController.filterId.toString())
|
||||
.then((value) {
|
||||
contentBytesController.contentBytesModel =
|
||||
contentBytesController.moreVideoModel =
|
||||
ContentBytesModel.fromJson(value.data);
|
||||
setState(() {});
|
||||
});
|
||||
@@ -72,98 +72,103 @@ class _VideosMoreState extends State<VideosMore> {
|
||||
color: Color(0xFF9A0000),
|
||||
),
|
||||
)
|
||||
: Stack(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16, vertical: 8),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 295.w,
|
||||
child: CustomTextFormField(
|
||||
textEditingController: searchController,
|
||||
onInput: (value) {
|
||||
// Call method to handle search
|
||||
handleSearch(value, "");
|
||||
},
|
||||
hintText: "Search videos",
|
||||
: SingleChildScrollView(
|
||||
child: Stack(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16, vertical: 8),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 295.w,
|
||||
child: CustomTextFormField(
|
||||
textEditingController: searchController,
|
||||
onInput: (value) {
|
||||
// Call method to handle search
|
||||
handleSearch(value, "");
|
||||
},
|
||||
hintText: "Search videos",
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 12.w,
|
||||
),
|
||||
filter(),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 10.h,
|
||||
),
|
||||
// Display search results or regular list
|
||||
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,
|
||||
);
|
||||
},
|
||||
)
|
||||
],
|
||||
SizedBox(
|
||||
width: 12.w,
|
||||
),
|
||||
filter(),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: 10.h,
|
||||
),
|
||||
// Display search results or regular list
|
||||
contentBytesController
|
||||
.moreVideoModel.data!.video!.isEmpty
|
||||
? Center(
|
||||
child: Column(
|
||||
children: [
|
||||
const Gap(250),
|
||||
text24W500("No Data Found !"),
|
||||
],
|
||||
))
|
||||
: Container(
|
||||
height: 0.75.sh,
|
||||
child: ListView.separated(
|
||||
padding: EdgeInsets.zero,
|
||||
shrinkWrap: true,
|
||||
itemCount: contentBytesController
|
||||
.moreVideoModel.data!.video!.length,
|
||||
itemBuilder: (ctx, index) {
|
||||
return Container(
|
||||
margin: const EdgeInsets.only(
|
||||
bottom: 20,
|
||||
),
|
||||
child: videoCard(
|
||||
contentBytesController
|
||||
.moreVideoModel
|
||||
.data!
|
||||
.video![index]
|
||||
.link ??
|
||||
"",
|
||||
contentBytesController
|
||||
.moreVideoModel
|
||||
.data!
|
||||
.video![index]
|
||||
.title ??
|
||||
"",
|
||||
contentBytesController
|
||||
.moreVideoModel
|
||||
.data!
|
||||
.video![index]
|
||||
.description ??
|
||||
"",
|
||||
contentBytesController
|
||||
.moreVideoModel
|
||||
.data!
|
||||
.video![index]
|
||||
.image ??
|
||||
"",
|
||||
contentBytesController
|
||||
.moreVideoModel
|
||||
.data!
|
||||
.video![index]
|
||||
.createdAt ??
|
||||
""),
|
||||
);
|
||||
},
|
||||
separatorBuilder: (ctx, inndex) {
|
||||
return const SizedBox(
|
||||
height: 10,
|
||||
);
|
||||
},
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -190,30 +195,53 @@ class _VideosMoreState extends State<VideosMore> {
|
||||
height: (Get.height *
|
||||
contentBytesController
|
||||
.contentBytesCategoriesModel.data!.length) /
|
||||
17,
|
||||
width: 160,
|
||||
12,
|
||||
width: 180,
|
||||
child: ListView.builder(
|
||||
padding: EdgeInsets.zero,
|
||||
shrinkWrap: true,
|
||||
itemCount: contentBytesController
|
||||
.contentBytesCategoriesModel.data!.length,
|
||||
.contentBytesCategoriesModel.data!.length +
|
||||
1,
|
||||
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));
|
||||
return index == 0
|
||||
? selectedFilterIndex.value == 100
|
||||
? SizedBox()
|
||||
: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: (() {
|
||||
Get.back();
|
||||
selectedFilterIndex.value = 100;
|
||||
contentBytesController.filterId =
|
||||
"";
|
||||
handleSearch("", "");
|
||||
}),
|
||||
child: text16W600("Reset",
|
||||
clr: const Color(0xFF9A0000)))
|
||||
],
|
||||
)
|
||||
: InkWell(
|
||||
onTap: () {
|
||||
// contentBytesController.isApiCalling.value = true;
|
||||
Get.back();
|
||||
selectedFilterIndex.value = index - 1;
|
||||
contentBytesController.filterId =
|
||||
contentBytesController
|
||||
.contentBytesCategoriesModel
|
||||
.data![index - 1]
|
||||
.id!
|
||||
.toString();
|
||||
|
||||
handleSearch(
|
||||
searchController.text,
|
||||
contentBytesController.filterId
|
||||
.toString());
|
||||
},
|
||||
child: itemFilter(
|
||||
index - 1, selectedFilterIndex.value));
|
||||
}),
|
||||
),
|
||||
),
|
||||
@@ -224,16 +252,38 @@ class _VideosMoreState extends State<VideosMore> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget itemFilter(int index) {
|
||||
Widget itemFilter(int index, int selectedIndex) {
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
const Gap(8),
|
||||
text18W400(
|
||||
contentBytesController
|
||||
.contentBytesCategoriesModel.data![index].categoryName!,
|
||||
texAl: TextAlign.center,
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
selectedIndex == index
|
||||
? const CircleAvatar(
|
||||
radius: 12,
|
||||
backgroundColor: Colors.white,
|
||||
child: Center(
|
||||
child: Icon(
|
||||
Icons.check,
|
||||
color: Colors.green,
|
||||
),
|
||||
),
|
||||
)
|
||||
: const SizedBox(),
|
||||
selectedIndex == index ? const Gap(5) : const SizedBox(),
|
||||
SizedBox(
|
||||
width: 150,
|
||||
child: text18W400(
|
||||
contentBytesController
|
||||
.contentBytesCategoriesModel.data![index].categoryName!,
|
||||
texAl: TextAlign.center,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
index ==
|
||||
contentBytesController
|
||||
@@ -251,7 +301,7 @@ class _VideosMoreState extends State<VideosMore> {
|
||||
|
||||
Widget searchResultsWidget() {
|
||||
// Display search results here
|
||||
return SizedBox();
|
||||
return const SizedBox();
|
||||
}
|
||||
|
||||
Widget videoCard(String video, String title, String description, String image,
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user