filter in content bytes
This commit is contained in:
@@ -48,7 +48,6 @@ class ApiUrls {
|
|||||||
static String getContentBytesCategoriesApi =
|
static String getContentBytesCategoriesApi =
|
||||||
"${base}getContentByteCategories";
|
"${base}getContentByteCategories";
|
||||||
static String getContentBytesApi = "${base}getContentBytes";
|
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 getPreviousReadApi = "${base}get-previous-reads-of-user";
|
||||||
static String storeReadCountApi = "${base}store-content-byte-read-click";
|
static String storeReadCountApi = "${base}store-content-byte-read-click";
|
||||||
|
|
||||||
|
|||||||
@@ -15,8 +15,12 @@ class ContentBytesController extends GetxController {
|
|||||||
ContentBytesCategoriesModel();
|
ContentBytesCategoriesModel();
|
||||||
ContentBytesModel contentBytesModel = ContentBytesModel();
|
ContentBytesModel contentBytesModel = ContentBytesModel();
|
||||||
|
|
||||||
|
ContentBytesModel moreVideoModel = ContentBytesModel();
|
||||||
|
ContentBytesModel moreAudioModel = ContentBytesModel();
|
||||||
|
ContentBytesModel moreReadsModel = ContentBytesModel();
|
||||||
|
|
||||||
PreviousReadOfUserModel previousReadOfUserModel = PreviousReadOfUserModel();
|
PreviousReadOfUserModel previousReadOfUserModel = PreviousReadOfUserModel();
|
||||||
int filterId = 0;
|
String filterId = "0";
|
||||||
RxBool isApiCalling = true.obs;
|
RxBool isApiCalling = true.obs;
|
||||||
RxBool isAudioSeekBarVisible = false.obs;
|
RxBool isAudioSeekBarVisible = false.obs;
|
||||||
RxInt indexForAudios = 0.obs;
|
RxInt indexForAudios = 0.obs;
|
||||||
|
|||||||
@@ -27,16 +27,17 @@ class _VideosMoreState extends State<AudioMore> {
|
|||||||
ContentBytesController contentBytesController =
|
ContentBytesController contentBytesController =
|
||||||
Get.put(ContentBytesController());
|
Get.put(ContentBytesController());
|
||||||
var data;
|
var data;
|
||||||
RxBool isLoading = false.obs;
|
RxBool isLoading = true.obs;
|
||||||
|
|
||||||
|
RxInt selectedFilterIndex = 100.obs;
|
||||||
TextEditingController searchController = TextEditingController();
|
TextEditingController searchController = TextEditingController();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
ContentBytesApi().getContentBytesData("", "audio", "").then((value) {
|
ContentBytesApi().getContentBytesData("", "audio", "").then((value) {
|
||||||
contentBytesController.contentBytesModel =
|
contentBytesController.moreAudioModel =
|
||||||
ContentBytesModel.fromJson(value.data);
|
ContentBytesModel.fromJson(value.data);
|
||||||
contentBytesController.isApiCalling.value = false;
|
isLoading.value = false;
|
||||||
setState(() {});
|
setState(() {});
|
||||||
});
|
});
|
||||||
super.initState();
|
super.initState();
|
||||||
@@ -47,7 +48,7 @@ class _VideosMoreState extends State<AudioMore> {
|
|||||||
.getContentBytesData(
|
.getContentBytesData(
|
||||||
query, "audio", contentBytesController.filterId.toString())
|
query, "audio", contentBytesController.filterId.toString())
|
||||||
.then((value) {
|
.then((value) {
|
||||||
contentBytesController.contentBytesModel =
|
contentBytesController.moreAudioModel =
|
||||||
ContentBytesModel.fromJson(value.data);
|
ContentBytesModel.fromJson(value.data);
|
||||||
setState(() {});
|
setState(() {});
|
||||||
});
|
});
|
||||||
@@ -81,7 +82,7 @@ class _VideosMoreState extends State<AudioMore> {
|
|||||||
borderRadius: BorderRadius.circular(100),
|
borderRadius: BorderRadius.circular(100),
|
||||||
child: Image.network(
|
child: Image.network(
|
||||||
contentBytesController
|
contentBytesController
|
||||||
.contentBytesModel
|
.moreAudioModel
|
||||||
.data!
|
.data!
|
||||||
.audio![contentBytesController
|
.audio![contentBytesController
|
||||||
.indexForAudios.value]
|
.indexForAudios.value]
|
||||||
@@ -101,7 +102,7 @@ class _VideosMoreState extends State<AudioMore> {
|
|||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
contentBytesController
|
contentBytesController
|
||||||
.contentBytesModel
|
.moreAudioModel
|
||||||
.data!
|
.data!
|
||||||
.audio![contentBytesController
|
.audio![contentBytesController
|
||||||
.indexForAudios.value]
|
.indexForAudios.value]
|
||||||
@@ -117,7 +118,7 @@ class _VideosMoreState extends State<AudioMore> {
|
|||||||
// SizedBox(height: 5),
|
// SizedBox(height: 5),
|
||||||
Text(
|
Text(
|
||||||
contentBytesController
|
contentBytesController
|
||||||
.contentBytesModel
|
.moreAudioModel
|
||||||
.data!
|
.data!
|
||||||
.audio![contentBytesController
|
.audio![contentBytesController
|
||||||
.indexForAudios.value]
|
.indexForAudios.value]
|
||||||
@@ -237,98 +238,111 @@ class _VideosMoreState extends State<AudioMore> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
sizedBoxHeight(20.h),
|
sizedBoxHeight(20.h),
|
||||||
GridView.builder(
|
contentBytesController
|
||||||
shrinkWrap: true,
|
.moreAudioModel.data!.audio!.isEmpty
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
? Center(
|
||||||
gridDelegate:
|
child: Column(
|
||||||
const SliverGridDelegateWithFixedCrossAxisCount(
|
children: [
|
||||||
mainAxisExtent: 172,
|
const Gap(250),
|
||||||
crossAxisCount:
|
text24W500("No Data Found !"),
|
||||||
2, // number of items in each row
|
],
|
||||||
mainAxisSpacing: 8.0, // spacing between rows
|
))
|
||||||
crossAxisSpacing:
|
: GridView.builder(
|
||||||
8.0, // spacing between columns
|
shrinkWrap: true,
|
||||||
),
|
physics:
|
||||||
|
const NeverScrollableScrollPhysics(),
|
||||||
itemCount: contentBytesController
|
gridDelegate:
|
||||||
.contentBytesModel
|
const SliverGridDelegateWithFixedCrossAxisCount(
|
||||||
.data!
|
mainAxisExtent: 172,
|
||||||
.audio!
|
crossAxisCount:
|
||||||
.length, // total number of items
|
2, // number of items in each row
|
||||||
itemBuilder: (context, index) {
|
mainAxisSpacing:
|
||||||
return InkWell(
|
8.0, // spacing between rows
|
||||||
onTap: () {
|
crossAxisSpacing:
|
||||||
if (contentBytesController
|
8.0, // spacing between columns
|
||||||
.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),
|
|
||||||
),
|
),
|
||||||
child: Stack(
|
|
||||||
children: [
|
itemCount: contentBytesController
|
||||||
Image.network(
|
.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
|
contentBytesController
|
||||||
.contentBytesModel
|
.isAudioSeekBarVisible
|
||||||
.data!
|
.value = true;
|
||||||
.audio![index]
|
//https://actions.google.com/sounds/v1/horror/aggressive_zombie_snarls.ogg
|
||||||
.image!,
|
},
|
||||||
),
|
child: Container(
|
||||||
Positioned(
|
decoration: BoxDecoration(
|
||||||
bottom: 5,
|
gradient: LinearGradient(
|
||||||
left: 5,
|
begin: Alignment.topLeft,
|
||||||
child: Row(
|
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: [
|
children: [
|
||||||
CircleAvatar(
|
Image.network(
|
||||||
radius: 18.sp,
|
contentBytesController
|
||||||
child: const Icon(
|
.moreAudioModel
|
||||||
Icons.headphones),
|
.data!
|
||||||
|
.audio![index]
|
||||||
|
.image!,
|
||||||
),
|
),
|
||||||
SizedBox(
|
Positioned(
|
||||||
width: 5.w,
|
bottom: 5,
|
||||||
),
|
left: 5,
|
||||||
SizedBox(
|
child: Row(
|
||||||
width: 125.w,
|
children: [
|
||||||
child: text14W500(
|
CircleAvatar(
|
||||||
contentBytesController
|
radius: 18.sp,
|
||||||
.contentBytesModel
|
child: const Icon(
|
||||||
.data!
|
Icons.headphones),
|
||||||
.audio![index]
|
),
|
||||||
.title!),
|
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 [
|
return [
|
||||||
PopupMenuItem(
|
PopupMenuItem(
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
SizedBox(
|
Center(
|
||||||
height: (Get.height *
|
child: SizedBox(
|
||||||
contentBytesController
|
height: (Get.height *
|
||||||
.contentBytesCategoriesModel.data!.length) /
|
contentBytesController
|
||||||
17,
|
.contentBytesCategoriesModel.data!.length) /
|
||||||
width: 150,
|
12,
|
||||||
child: ListView.builder(
|
width: 180,
|
||||||
padding: EdgeInsets.zero,
|
child: ListView.builder(
|
||||||
shrinkWrap: true,
|
padding: EdgeInsets.zero,
|
||||||
itemCount: contentBytesController
|
shrinkWrap: true,
|
||||||
.contentBytesCategoriesModel.data!.length,
|
itemCount: contentBytesController
|
||||||
itemBuilder: (ctx, index) {
|
.contentBytesCategoriesModel.data!.length +
|
||||||
return InkWell(
|
1,
|
||||||
onTap: () {
|
itemBuilder: (ctx, index) {
|
||||||
// contentBytesController.isApiCalling.value = true;
|
return index == 0
|
||||||
Get.back();
|
? selectedFilterIndex.value == 100
|
||||||
contentBytesController.filterId =
|
? SizedBox()
|
||||||
contentBytesController
|
: Row(
|
||||||
.contentBytesCategoriesModel
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
.data![index]
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
.id!;
|
children: [
|
||||||
log(contentBytesController.filterId.toString());
|
GestureDetector(
|
||||||
handleSearch(searchController.text,
|
onTap: (() {
|
||||||
contentBytesController.filterId.toString());
|
Get.back();
|
||||||
},
|
selectedFilterIndex.value = 100;
|
||||||
child: itemFilter(index));
|
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(
|
return Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
const Gap(8),
|
const Gap(8),
|
||||||
text18W400(
|
Row(
|
||||||
contentBytesController
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
.contentBytesCategoriesModel.data![index].categoryName!,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
texAl: TextAlign.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 ==
|
index ==
|
||||||
contentBytesController
|
contentBytesController
|
||||||
|
|||||||
@@ -961,7 +961,8 @@ class _VideosState extends State<Videos> {
|
|||||||
contentBytesController
|
contentBytesController
|
||||||
.contentBytesCategoriesModel
|
.contentBytesCategoriesModel
|
||||||
.data![index]
|
.data![index]
|
||||||
.id!;
|
.id!
|
||||||
|
.toString();
|
||||||
|
|
||||||
log(contentBytesController.filterId.toString());
|
log(contentBytesController.filterId.toString());
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -29,15 +29,16 @@ class _VideosMoreState extends State<ReadMore> {
|
|||||||
ContentBytesController contentBytesController =
|
ContentBytesController contentBytesController =
|
||||||
Get.put(ContentBytesController());
|
Get.put(ContentBytesController());
|
||||||
var data;
|
var data;
|
||||||
RxBool isLoading = false.obs;
|
RxBool isLoading = true.obs;
|
||||||
|
RxInt selectedFilterIndex = 100.obs;
|
||||||
TextEditingController searchController = TextEditingController();
|
TextEditingController searchController = TextEditingController();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
ContentBytesApi().getContentBytesData("", "reads", "").then((value) {
|
ContentBytesApi().getContentBytesData("", "reads", "").then((value) {
|
||||||
contentBytesController.contentBytesModel =
|
contentBytesController.moreReadsModel =
|
||||||
ContentBytesModel.fromJson(value.data);
|
ContentBytesModel.fromJson(value.data);
|
||||||
contentBytesController.isApiCalling.value = false;
|
isLoading.value = false;
|
||||||
setState(() {});
|
setState(() {});
|
||||||
});
|
});
|
||||||
super.initState();
|
super.initState();
|
||||||
@@ -48,7 +49,7 @@ class _VideosMoreState extends State<ReadMore> {
|
|||||||
.getContentBytesData(
|
.getContentBytesData(
|
||||||
query, "reads", contentBytesController.filterId.toString())
|
query, "reads", contentBytesController.filterId.toString())
|
||||||
.then((value) {
|
.then((value) {
|
||||||
contentBytesController.contentBytesModel =
|
contentBytesController.moreReadsModel =
|
||||||
ContentBytesModel.fromJson(value.data);
|
ContentBytesModel.fromJson(value.data);
|
||||||
setState(() {});
|
setState(() {});
|
||||||
});
|
});
|
||||||
@@ -108,7 +109,7 @@ class _VideosMoreState extends State<ReadMore> {
|
|||||||
|
|
||||||
sizedBoxHeight(20.h),
|
sizedBoxHeight(20.h),
|
||||||
contentBytesController
|
contentBytesController
|
||||||
.contentBytesModel.data!.read!.isEmpty
|
.moreReadsModel.data!.read!.isEmpty
|
||||||
? Center(
|
? Center(
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
@@ -118,7 +119,7 @@ class _VideosMoreState extends State<ReadMore> {
|
|||||||
))
|
))
|
||||||
: ListView.builder(
|
: ListView.builder(
|
||||||
itemCount: contentBytesController
|
itemCount: contentBytesController
|
||||||
.contentBytesModel.data!.read!.length,
|
.moreReadsModel.data!.read!.length,
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
physics: NeverScrollableScrollPhysics(),
|
physics: NeverScrollableScrollPhysics(),
|
||||||
itemBuilder: (ctx, index) {
|
itemBuilder: (ctx, index) {
|
||||||
@@ -128,12 +129,12 @@ class _VideosMoreState extends State<ReadMore> {
|
|||||||
onTap: () {
|
onTap: () {
|
||||||
Get.to(ReadPDF(
|
Get.to(ReadPDF(
|
||||||
title: contentBytesController
|
title: contentBytesController
|
||||||
.contentBytesModel
|
.moreReadsModel
|
||||||
.data!
|
.data!
|
||||||
.read![index]
|
.read![index]
|
||||||
.title,
|
.title,
|
||||||
pdfUrfl: contentBytesController
|
pdfUrfl: contentBytesController
|
||||||
.contentBytesModel
|
.moreReadsModel
|
||||||
.data!
|
.data!
|
||||||
.read![index]
|
.read![index]
|
||||||
.file,
|
.file,
|
||||||
@@ -163,7 +164,7 @@ class _VideosMoreState extends State<ReadMore> {
|
|||||||
width: 235.w,
|
width: 235.w,
|
||||||
child: text20W400(
|
child: text20W400(
|
||||||
contentBytesController
|
contentBytesController
|
||||||
.contentBytesModel
|
.moreReadsModel
|
||||||
.data!
|
.data!
|
||||||
.read![index]
|
.read![index]
|
||||||
.title!),
|
.title!),
|
||||||
@@ -174,7 +175,7 @@ class _VideosMoreState extends State<ReadMore> {
|
|||||||
height: 50,
|
height: 50,
|
||||||
child: text16W400(
|
child: text16W400(
|
||||||
contentBytesController
|
contentBytesController
|
||||||
.contentBytesModel
|
.moreReadsModel
|
||||||
.data!
|
.data!
|
||||||
.read![index]
|
.read![index]
|
||||||
.description!),
|
.description!),
|
||||||
@@ -183,7 +184,7 @@ class _VideosMoreState extends State<ReadMore> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
Image.network(
|
Image.network(
|
||||||
"${contentBytesController.contentBytesModel.data!.read![index].image}",
|
"${contentBytesController.moreReadsModel.data!.read![index].image}",
|
||||||
height: 110,
|
height: 110,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -217,37 +218,62 @@ class _VideosMoreState extends State<ReadMore> {
|
|||||||
return [
|
return [
|
||||||
PopupMenuItem(
|
PopupMenuItem(
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
SizedBox(
|
Center(
|
||||||
height: (Get.height *
|
child: SizedBox(
|
||||||
contentBytesController
|
height: (Get.height *
|
||||||
.contentBytesCategoriesModel.data!.length) /
|
contentBytesController
|
||||||
17,
|
.contentBytesCategoriesModel.data!.length) /
|
||||||
width: 150,
|
12,
|
||||||
child: ListView.builder(
|
width: 180,
|
||||||
padding: EdgeInsets.zero,
|
child: ListView.builder(
|
||||||
shrinkWrap: true,
|
padding: EdgeInsets.zero,
|
||||||
itemCount: contentBytesController
|
shrinkWrap: true,
|
||||||
.contentBytesCategoriesModel.data!.length,
|
itemCount: contentBytesController
|
||||||
itemBuilder: (ctx, index) {
|
.contentBytesCategoriesModel.data!.length +
|
||||||
return InkWell(
|
1,
|
||||||
onTap: () {
|
itemBuilder: (ctx, index) {
|
||||||
// contentBytesController.isApiCalling.value = true;
|
return index == 0
|
||||||
Get.back();
|
? selectedFilterIndex.value == 100
|
||||||
contentBytesController.filterId =
|
? SizedBox()
|
||||||
contentBytesController
|
: Row(
|
||||||
.contentBytesCategoriesModel
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
.data![index]
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
.id!;
|
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(
|
||||||
handleSearch(searchController.text,
|
searchController.text,
|
||||||
contentBytesController.filterId.toString());
|
contentBytesController.filterId
|
||||||
},
|
.toString());
|
||||||
child: itemFilter(index));
|
},
|
||||||
}),
|
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(
|
return Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
const Gap(8),
|
const Gap(8),
|
||||||
text18W400(
|
Row(
|
||||||
contentBytesController
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
.contentBytesCategoriesModel.data![index].categoryName!,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
texAl: TextAlign.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 ==
|
index ==
|
||||||
contentBytesController
|
contentBytesController
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import 'dart:developer';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:flutter_svg/flutter_svg.dart';
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
@@ -27,16 +26,17 @@ class _VideosMoreState extends State<VideosMore> {
|
|||||||
ContentBytesController contentBytesController =
|
ContentBytesController contentBytesController =
|
||||||
Get.put(ContentBytesController());
|
Get.put(ContentBytesController());
|
||||||
var data;
|
var data;
|
||||||
RxBool isLoading = false.obs;
|
RxBool isLoading = true.obs;
|
||||||
|
RxInt selectedFilterIndex = 100.obs;
|
||||||
|
|
||||||
TextEditingController searchController = TextEditingController();
|
TextEditingController searchController = TextEditingController();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
ContentBytesApi().getContentBytesData("", "video", "").then((value) {
|
ContentBytesApi().getContentBytesData("", "video", "").then((value) {
|
||||||
contentBytesController.contentBytesModel =
|
contentBytesController.moreVideoModel =
|
||||||
ContentBytesModel.fromJson(value.data);
|
ContentBytesModel.fromJson(value.data);
|
||||||
contentBytesController.isApiCalling.value = false;
|
isLoading.value = false;
|
||||||
setState(() {});
|
setState(() {});
|
||||||
});
|
});
|
||||||
super.initState();
|
super.initState();
|
||||||
@@ -47,7 +47,7 @@ class _VideosMoreState extends State<VideosMore> {
|
|||||||
.getContentBytesData(
|
.getContentBytesData(
|
||||||
query, "video", contentBytesController.filterId.toString())
|
query, "video", contentBytesController.filterId.toString())
|
||||||
.then((value) {
|
.then((value) {
|
||||||
contentBytesController.contentBytesModel =
|
contentBytesController.moreVideoModel =
|
||||||
ContentBytesModel.fromJson(value.data);
|
ContentBytesModel.fromJson(value.data);
|
||||||
setState(() {});
|
setState(() {});
|
||||||
});
|
});
|
||||||
@@ -72,98 +72,103 @@ class _VideosMoreState extends State<VideosMore> {
|
|||||||
color: Color(0xFF9A0000),
|
color: Color(0xFF9A0000),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: Stack(
|
: SingleChildScrollView(
|
||||||
children: [
|
child: Stack(
|
||||||
Padding(
|
children: [
|
||||||
padding: const EdgeInsets.symmetric(
|
Padding(
|
||||||
horizontal: 16, vertical: 8),
|
padding: const EdgeInsets.symmetric(
|
||||||
child: Column(
|
horizontal: 16, vertical: 8),
|
||||||
children: [
|
child: Column(
|
||||||
Row(
|
children: [
|
||||||
children: [
|
Row(
|
||||||
SizedBox(
|
children: [
|
||||||
width: 295.w,
|
SizedBox(
|
||||||
child: CustomTextFormField(
|
width: 295.w,
|
||||||
textEditingController: searchController,
|
child: CustomTextFormField(
|
||||||
onInput: (value) {
|
textEditingController: searchController,
|
||||||
// Call method to handle search
|
onInput: (value) {
|
||||||
handleSearch(value, "");
|
// Call method to handle search
|
||||||
},
|
handleSearch(value, "");
|
||||||
hintText: "Search videos",
|
},
|
||||||
|
hintText: "Search videos",
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
SizedBox(
|
||||||
SizedBox(
|
width: 12.w,
|
||||||
width: 12.w,
|
),
|
||||||
),
|
filter(),
|
||||||
filter(),
|
],
|
||||||
],
|
),
|
||||||
),
|
SizedBox(
|
||||||
SizedBox(
|
height: 10.h,
|
||||||
height: 10.h,
|
),
|
||||||
),
|
// Display search results or regular list
|
||||||
// Display search results or regular list
|
contentBytesController
|
||||||
contentBytesController
|
.moreVideoModel.data!.video!.isEmpty
|
||||||
.contentBytesModel.data!.video!.isEmpty
|
? Center(
|
||||||
? Center(
|
child: Column(
|
||||||
child: Column(
|
children: [
|
||||||
children: [
|
const Gap(250),
|
||||||
Gap(250),
|
text24W500("No Data Found !"),
|
||||||
text24W500("No Data Found !"),
|
],
|
||||||
],
|
))
|
||||||
))
|
: Container(
|
||||||
: ListView.separated(
|
height: 0.75.sh,
|
||||||
padding: EdgeInsets.zero,
|
child: ListView.separated(
|
||||||
shrinkWrap: true,
|
padding: EdgeInsets.zero,
|
||||||
itemCount: contentBytesController
|
shrinkWrap: true,
|
||||||
.contentBytesModel.data!.video!.length,
|
itemCount: contentBytesController
|
||||||
itemBuilder: (ctx, index) {
|
.moreVideoModel.data!.video!.length,
|
||||||
return Container(
|
itemBuilder: (ctx, index) {
|
||||||
margin: const EdgeInsets.only(
|
return Container(
|
||||||
bottom: 20,
|
margin: const EdgeInsets.only(
|
||||||
),
|
bottom: 20,
|
||||||
child: videoCard(
|
),
|
||||||
contentBytesController
|
child: videoCard(
|
||||||
.contentBytesModel
|
contentBytesController
|
||||||
.data!
|
.moreVideoModel
|
||||||
.video![index]
|
.data!
|
||||||
.link ??
|
.video![index]
|
||||||
"",
|
.link ??
|
||||||
contentBytesController
|
"",
|
||||||
.contentBytesModel
|
contentBytesController
|
||||||
.data!
|
.moreVideoModel
|
||||||
.video![index]
|
.data!
|
||||||
.title ??
|
.video![index]
|
||||||
"",
|
.title ??
|
||||||
contentBytesController
|
"",
|
||||||
.contentBytesModel
|
contentBytesController
|
||||||
.data!
|
.moreVideoModel
|
||||||
.video![index]
|
.data!
|
||||||
.description ??
|
.video![index]
|
||||||
"",
|
.description ??
|
||||||
contentBytesController
|
"",
|
||||||
.contentBytesModel
|
contentBytesController
|
||||||
.data!
|
.moreVideoModel
|
||||||
.video![index]
|
.data!
|
||||||
.image ??
|
.video![index]
|
||||||
"",
|
.image ??
|
||||||
contentBytesController
|
"",
|
||||||
.contentBytesModel
|
contentBytesController
|
||||||
.data!
|
.moreVideoModel
|
||||||
.video![index]
|
.data!
|
||||||
.createdAt ??
|
.video![index]
|
||||||
""),
|
.createdAt ??
|
||||||
);
|
""),
|
||||||
},
|
);
|
||||||
separatorBuilder: (ctx, inndex) {
|
},
|
||||||
return SizedBox(
|
separatorBuilder: (ctx, inndex) {
|
||||||
height: 10,
|
return const SizedBox(
|
||||||
);
|
height: 10,
|
||||||
},
|
);
|
||||||
)
|
},
|
||||||
],
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -190,30 +195,53 @@ class _VideosMoreState extends State<VideosMore> {
|
|||||||
height: (Get.height *
|
height: (Get.height *
|
||||||
contentBytesController
|
contentBytesController
|
||||||
.contentBytesCategoriesModel.data!.length) /
|
.contentBytesCategoriesModel.data!.length) /
|
||||||
17,
|
12,
|
||||||
width: 160,
|
width: 180,
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
itemCount: contentBytesController
|
itemCount: contentBytesController
|
||||||
.contentBytesCategoriesModel.data!.length,
|
.contentBytesCategoriesModel.data!.length +
|
||||||
|
1,
|
||||||
itemBuilder: (ctx, index) {
|
itemBuilder: (ctx, index) {
|
||||||
return InkWell(
|
return index == 0
|
||||||
onTap: () {
|
? selectedFilterIndex.value == 100
|
||||||
// contentBytesController.isApiCalling.value = true;
|
? SizedBox()
|
||||||
Get.back();
|
: Row(
|
||||||
contentBytesController.filterId =
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
contentBytesController
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
.contentBytesCategoriesModel
|
children: [
|
||||||
.data![index]
|
GestureDetector(
|
||||||
.id!;
|
onTap: (() {
|
||||||
log(
|
Get.back();
|
||||||
contentBytesController.filterId.toString(),
|
selectedFilterIndex.value = 100;
|
||||||
);
|
contentBytesController.filterId =
|
||||||
handleSearch(searchController.text,
|
"";
|
||||||
contentBytesController.filterId.toString());
|
handleSearch("", "");
|
||||||
},
|
}),
|
||||||
child: itemFilter(index));
|
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(
|
return Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
const Gap(8),
|
const Gap(8),
|
||||||
text18W400(
|
Row(
|
||||||
contentBytesController
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
.contentBytesCategoriesModel.data![index].categoryName!,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
texAl: TextAlign.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 ==
|
index ==
|
||||||
contentBytesController
|
contentBytesController
|
||||||
@@ -251,7 +301,7 @@ class _VideosMoreState extends State<VideosMore> {
|
|||||||
|
|
||||||
Widget searchResultsWidget() {
|
Widget searchResultsWidget() {
|
||||||
// Display search results here
|
// Display search results here
|
||||||
return SizedBox();
|
return const SizedBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget videoCard(String video, String title, String description, String image,
|
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