product recommendations api integration, content bytes

This commit is contained in:
jayesh
2024-05-08 17:15:26 +05:30
parent a2796be19c
commit 8d526c7b65
15 changed files with 435 additions and 132 deletions

View File

@@ -131,12 +131,12 @@ Widget text12W500_B4B4B4(String text) {
);
}
Widget text14W600_1B1B1B(String text) {
Widget text14W600_1B1B1B(String text, {Color? clr}) {
return Text(
text,
style: TextStyle(
fontSize: 14.sp,
color: Color(0Xff1B1B1B),
color: clr ?? const Color(0Xff1B1B1B),
fontWeight: FontWeight.w600,
fontFamily: 'hiragino'),
);

View File

@@ -1,8 +1,13 @@
import 'dart:developer';
import 'dart:io';
import 'package:device_info_plus/device_info_plus.dart';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:get/get.dart' as getx;
import 'package:permission_handler/permission_handler.dart';
class Utils {
static Future<MultipartFile> networkImageToMultipartFile(
@@ -61,4 +66,112 @@ class Utils {
barrierDismissible: false,
);
}
static Future<void> getStoragePermission() async {
DeviceInfoPlugin plugin = DeviceInfoPlugin();
AndroidDeviceInfo android = await plugin.androidInfo;
if (android.version.sdkInt < 33) {
if (await Permission.storage.request().isGranted) {
// setState(() {
// permissionGranted = true;
// });
} else if (await Permission.storage.request().isPermanentlyDenied) {
await openAppSettings();
await showToast("Permission denied.");
}
// else if (await Permission.audio.request().isDenied) {
// // setState(() {
// // permissionGranted = false;
// // });
// }
} else {
if (await Permission.photos.request().isGranted) {
// await utils.showToast("Permission granted.");
// setState(() {
// permissionGranted = true;
// });
} else if (await Permission.photos.request().isPermanentlyDenied) {
await openAppSettings();
await showToast("Permission denied.");
} else if (await Permission.photos.request().isDenied) {
await openAppSettings();
await showToast("Permission denied.");
// setState(() {
// permissionGranted = false;
// });
}
}
}
static Future openFile({
required String url,
String? fileName,
}) async {
var status;
// Permission.manageExternalStorage.request();
final deviceInfo = await DeviceInfoPlugin().androidInfo;
if (deviceInfo.version.sdkInt > 32) {
status = await Permission.photos.request().isGranted;
await Permission.manageExternalStorage.request();
} else {
status = await Permission.storage.request().isGranted;
await Permission.manageExternalStorage.request();
}
if (status) {
await downloadFile(url, fileName!);
// if (file == null) {
// log("Error 3333333333333");
// } else {
// await OpenFile.open(file.path).then((value) {
// print("RUNNING THIS");
// if (value.type == ResultType.noAppToOpen) {
// ScaffoldMessenger.of(context).showSnackBar(Helper.displaySnackBar(
// "type",
// "error",
// "You do not have any application to open this file"));
// //Navigator.pop(context);
// } else {
// log(value.message);
// }
// });
// // if (message.toString() != "done") {
// // displaySnackBar("login", "error", message.message.toString());
// // }
// }
} else {
openAppSettings();
}
}
static Future<File?> downloadFile(String url, String name) async {
final appStorage = Directory("/storage/emulated/0/Download");
final file = File('${appStorage.path}/$name');
try {
showToast("Downloading...");
final response = await Dio().get(
url,
options: Options(
// headers: requestHeaders,
responseType: ResponseType.bytes,
followRedirects: false,
// receiveTimeout: 0,
),
);
final raf = file.openSync(mode: FileMode.write);
raf.writeFromSync(response.data);
await raf.close();
showToast("Download Completed !");
return file;
} catch (e) {
log(e.toString());
showToast("Download Error! Please try again");
return null;
}
}
}

View File

@@ -40,13 +40,14 @@ class ContentBytesController extends GetxController {
super.dispose();
}
void init(index) async {
void init(index, type) async {
audioPlayer = AudioPlayer();
isAudioInitialize = true;
indexForAudios.value = index;
try {
log(index.toString());
await audioPlayer.setUrl(contentBytesModel.data!.audio![index].link!);
await audioPlayer.setUrl(type == "new"
? contentBytesModel.data!.newReleaseAudio![index].link!
: contentBytesModel.data!.audio![index].link!);
// await audioPlayer.setAsset(url);
} on PlayerException catch (e) {
print("Error code: ${e.code}");
@@ -75,7 +76,7 @@ class ContentBytesController extends GetxController {
} else if (processingState != ProcessingState.completed) {
buttonNotifier.value = ButtonState.playing;
} else {
_playNextTrack();
// _playNextTrack(type);
// audioPlayer.seek(Duration.zero);
// audioPlayer.pause();
@@ -110,7 +111,7 @@ class ContentBytesController extends GetxController {
});
}
void _playNextTrack() {
void _playNextTrack(type) {
// Determine the index of the next track (you need to implement this logic)
int nextIndex = getNextTrackIndex();
@@ -120,7 +121,7 @@ class ContentBytesController extends GetxController {
if (isPlaying()) {
stop();
}
init(nextIndex);
init(nextIndex, type);
play(nextIndex);
} else {
audioPlayer.seek(Duration.zero);
@@ -184,41 +185,4 @@ 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

@@ -1,4 +1,6 @@
import 'package:device_info_plus/device_info_plus.dart';
import 'package:get/get.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:traderscircuit/model/ProductsModel/call_recommendations_model.dart';
import 'package:intl/intl.dart';
@@ -14,4 +16,15 @@ class ProductsController extends GetxController {
DateTime newDateTime = DateTime(dateTime.year, 3, 25);
return DateFormat("dd MMMM yyyy").format(newDateTime);
}
static Future<bool> requestP() async {
bool permissionStatus;
final deviceInfo = await DeviceInfoPlugin().androidInfo;
if (deviceInfo.version.sdkInt > 32) {
permissionStatus = await Permission.photos.request().isGranted;
} else {
permissionStatus = await Permission.storage.request().isGranted;
}
return permissionStatus;
}
}

View File

@@ -8,6 +8,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:traderscircuit/Utils/utils.dart';
import 'package:traderscircuit/firebase_options.dart';
import 'package:scgateway_flutter_plugin/scgateway_flutter_plugin.dart';
import 'package:traderscircuit/resources/routes/route_name.dart';
@@ -45,8 +46,7 @@ Future<void> main() async {
);
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
]).then((value) => runApp(MultiBlocProvider(
providers: [
]).then((value) => runApp(MultiBlocProvider(providers: [
BlocProvider<CounterBloc>(
create: (context) => CounterBloc(),
),
@@ -54,7 +54,7 @@ Future<void> main() async {
create: (context) => SendOtpBloc(),
),
// Add more BlocProviders for other Blocs here if needed
],child: const MyApp())));
], child: const MyApp())));
}
class MyApp extends StatefulWidget {
@@ -72,6 +72,7 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
@override
void initState() {
super.initState();
Utils.getStoragePermission();
WidgetsBinding.instance.addObserver(this);
connectivity = Connectivity();

View File

@@ -182,6 +182,7 @@ class NewReleaseAudio {
String? title;
String? file;
int? categoryId;
String? link;
String? image;
String? isActive;
String? createdAt;
@@ -195,6 +196,7 @@ class NewReleaseAudio {
this.categoryId,
this.image,
this.isActive,
this.link,
this.createdAt,
this.formattedCreatedAt,
this.fullCreatedAt});
@@ -205,6 +207,7 @@ class NewReleaseAudio {
file = json['file'];
categoryId = json['category_id'];
image = json['image'];
link = json['link'];
isActive = json['is_active'];
createdAt = json['created_at'];
formattedCreatedAt = json['formatted_created_at'];
@@ -218,6 +221,7 @@ class NewReleaseAudio {
data['file'] = file;
data['category_id'] = categoryId;
data['image'] = image;
data['link'] = link;
data['is_active'] = isActive;
data['created_at'] = createdAt;
data['formatted_created_at'] = formattedCreatedAt;

View File

@@ -75,6 +75,7 @@ class ContentByteData {
int? categoryId;
String? image;
String? isActive;
String? description;
String? createdAt;
ContentByteData(
@@ -82,6 +83,7 @@ class ContentByteData {
this.title,
this.file,
this.categoryId,
this.description,
this.image,
this.isActive,
this.createdAt});
@@ -89,6 +91,7 @@ class ContentByteData {
ContentByteData.fromJson(Map<String, dynamic> json) {
id = json['id'];
title = json['title'];
description = json["description"];
file = json['file'];
categoryId = json['category_id'];
image = json['image'];
@@ -105,6 +108,7 @@ class ContentByteData {
data['image'] = image;
data['is_active'] = isActive;
data['created_at'] = createdAt;
data['description'] = description;
return data;
}
}

View File

@@ -77,6 +77,7 @@ class ActiveCalls {
String? createdAt;
int? optionTypeXid;
ProductTypeData? productTypeData;
String? docs;
ActionData? optionTypeData;
ActionData? actionData;
@@ -90,6 +91,7 @@ class ActiveCalls {
this.qty,
this.duration,
this.currentPrice,
this.docs,
this.buyPrice,
this.targetPrice,
this.stopLoss,
@@ -111,6 +113,7 @@ class ActiveCalls {
qty = json['qty'];
duration = json['duration'];
currentPrice = json['current_price'];
docs = json['docs'];
buyPrice = json['buy_price'];
targetPrice = json['target_price'];
stopLoss = json['stop_loss'];
@@ -142,6 +145,7 @@ class ActiveCalls {
data['current_price'] = currentPrice;
data['buy_price'] = buyPrice;
data['target_price'] = targetPrice;
data['docs'] = docs;
data['stop_loss'] = stopLoss;
data['is_send_recommendation_now'] = isSendRecommendationNow;
data['schedule_date_time'] = scheduleDateTime;

View File

@@ -1,6 +1,7 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:gap/gap.dart';
import 'package:get/get.dart';
@@ -11,6 +12,7 @@ import 'package:traderscircuit/Utils/Common/commonBotton.dart';
import 'package:traderscircuit/Utils/Common/comonGlassmorphicContainer.dart';
import 'package:traderscircuit/Utils/Common/sized_box.dart';
import 'package:traderscircuit/Utils/text.dart';
import 'package:traderscircuit/Utils/utils.dart';
import 'package:traderscircuit/controller/contact_us_controller.dart';
import 'package:traderscircuit/controller/products_controller.dart';
import 'package:traderscircuit/model/ProductsModel/call_recommendations_model.dart';
@@ -27,7 +29,7 @@ class ShortTrade extends StatefulWidget {
}
class _ShortTradeState extends State<ShortTrade> {
GlobalKey<ScaffoldState> _scaffoldKey1 = GlobalKey<ScaffoldState>();
final GlobalKey<ScaffoldState> _scaffoldKey1 = GlobalKey<ScaffoldState>();
List<String> containerTexts = ["Swing Trade", "Multibagger", "Options"];
ProductsController productsController = Get.put(ProductsController());
@@ -256,6 +258,7 @@ class _ShortTradeState extends State<ShortTrade> {
padding: EdgeInsets.only(top: 20.h, bottom: 5.h),
child: productsController.selectedIndex.value == 0
? cardSwingWidget(
pdfLink: "",
image: callRecommendationsModel
.data!.activeCalls![index].stockImage!,
text: callRecommendationsModel
@@ -289,8 +292,10 @@ class _ShortTradeState extends State<ShortTrade> {
duration: callRecommendationsModel
.data!.activeCalls![index].duration!,
pdfname: "Download Pdf",
pdfLink: "",
)
: cardOptionWidget(
pdfLink: "",
image: callRecommendationsModel
.data!.activeCalls![index].stockImage!,
action: callRecommendationsModel
@@ -366,6 +371,8 @@ class _ShortTradeState extends State<ShortTrade> {
padding: EdgeInsets.only(top: 20.h, bottom: 5.h),
child: productsController.selectedIndex.value == 0
? cardSwingWidget(
pdfLink: callRecommendationsModel
.data!.exitedCalls![index].docs!,
image: callRecommendationsModel
.data!.exitedCalls![index].stockImage!,
text: callRecommendationsModel
@@ -399,8 +406,12 @@ class _ShortTradeState extends State<ShortTrade> {
duration: callRecommendationsModel
.data!.exitedCalls![index].duration!,
pdfname: "Download Pdf",
pdfLink: callRecommendationsModel
.data!.exitedCalls![index].docs!,
)
: cardOptionWidget(
pdfLink: callRecommendationsModel
.data!.exitedCalls![index].docs!,
image: callRecommendationsModel
.data!.exitedCalls![index].stockImage!,
action: callRecommendationsModel
@@ -433,12 +444,13 @@ class _ShortTradeState extends State<ShortTrade> {
required String price1,
required String stoploss,
required String action,
required String pdfLink,
required String image,
}) {
ContactUsController contactUsController = Get.put(ContactUsController());
return commonGlassContainer(
width: double.infinity,
height: 400.h,
height: action != "Exit" ? 330.h : 380.h,
borderradius: 8,
customWidget: Column(
children: [
@@ -487,9 +499,15 @@ class _ShortTradeState extends State<ShortTrade> {
borderRadius: BorderRadius.circular(4.r),
color: action == "Buy"
? const Color(0xFF00FF19)
: const Color(0xFFFFAD31),
: action == "Exit"
? const Color(0Xff6C0000)
: const Color(0xFFFFAD31),
),
child: Center(child: text14W600_1B1B1B(action)),
child: Center(
child: text14W600_1B1B1B(action,
clr: action == "Exit"
? Colors.white
: const Color(0Xff1B1B1B))),
)
],
),
@@ -536,8 +554,8 @@ class _ShortTradeState extends State<ShortTrade> {
sizedBoxHeight(5.h),
SizedBox(
width: 150.w,
child: text15W600(contactUsController
.formatedDateTimeMethod(date)))
child: text15W600(
productsController.dateConverterMethod(date)))
],
),
sizedBoxWidth(30.w),
@@ -573,6 +591,32 @@ class _ShortTradeState extends State<ShortTrade> {
)
],
),
sizedBoxHeight(15.h),
action != "Exit"
? const SizedBox()
: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
text14W400_979797('Report'),
sizedBoxHeight(5.h),
GestureDetector(
onTap: () {
Utils.openFile(
url: pdfLink, fileName: "${text}_report.pdf");
},
child: Row(
children: [
Image.asset(
'assets/images/png/pdf.png',
height: 20.h,
width: 20.w,
),
text15W600("Download Pdf"),
],
),
)
],
)
],
),
)
@@ -590,6 +634,7 @@ class _ShortTradeState extends State<ShortTrade> {
required String duration,
required String pdfname,
required String action,
required String pdfLink,
required String image,
}) {
return commonGlassContainer(
@@ -643,9 +688,15 @@ class _ShortTradeState extends State<ShortTrade> {
borderRadius: BorderRadius.circular(4.r),
color: action == "Buy"
? const Color(0xFF00FF19)
: const Color(0xFFFFAD31),
: action == "Exit"
? const Color(0Xff6C0000)
: const Color(0xFFFFAD31),
),
child: Center(child: text14W600_1B1B1B(action)),
child: Center(
child: text14W600_1B1B1B(action,
clr: action == "Exit"
? Colors.white
: const Color(0Xff1B1B1B))),
)
],
),
@@ -717,23 +768,32 @@ class _ShortTradeState extends State<ShortTrade> {
],
),
sizedBoxWidth(30.w),
// Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// text14W400_979797('Report'),
// sizedBoxHeight(5.h),
// Row(
// children: [
// Image.asset(
// 'assets/images/png/pdf.png',
// height: 20.h,
// width: 20.w,
// ),
// text15W600(pdfname),
// ],
// )
// ],
// )
action != "Exit"
? const SizedBox()
: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
text14W400_979797('Report'),
sizedBoxHeight(5.h),
GestureDetector(
onTap: () {
Utils.openFile(
url: pdfLink,
fileName: "${text}_report.pdf");
},
child: Row(
children: [
Image.asset(
'assets/images/png/pdf.png',
height: 20.h,
width: 20.w,
),
text15W600(pdfname),
],
),
)
],
)
],
),
],
@@ -751,11 +811,12 @@ class _ShortTradeState extends State<ShortTrade> {
required String targetamount,
required String stoploss,
required String time,
required String pdfLink,
required String action,
}) {
return commonGlassContainer(
width: double.infinity,
height: 260.h,
height: action != "Exit" ? 250.h : 300.h,
borderradius: 8,
customWidget: Column(
children: [
@@ -800,9 +861,17 @@ class _ShortTradeState extends State<ShortTrade> {
borderRadius: BorderRadius.circular(4.r),
color: action == "Buy"
? const Color(0xFF00FF19)
: const Color(0xFFFFAD31),
: action == "Exit"
? const Color(0Xff6C0000)
: const Color(0xFFFFAD31),
),
child: Center(child: text14W600_1B1B1B(action)),
child: Center(
child: text14W600_1B1B1B(
action,
clr: action == "Exit"
? Colors.white
: const Color(0Xff1B1B1B),
)),
)
],
),
@@ -859,6 +928,32 @@ class _ShortTradeState extends State<ShortTrade> {
)
],
),
sizedBoxHeight(15.h),
action != "Exit"
? const SizedBox()
: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
text14W400_979797('Report'),
sizedBoxHeight(5.h),
GestureDetector(
onTap: () {
Utils.openFile(
url: pdfLink, fileName: "${text}_report.pdf");
},
child: Row(
children: [
Image.asset(
'assets/images/png/pdf.png',
height: 20.h,
width: 20.w,
),
text15W600("Download Pdf"),
],
),
)
],
)
],
),
)

View File

@@ -266,7 +266,8 @@ class _VideosMoreState extends State<AudioMore> {
contentBytesController.pause();
contentBytesController.stop();
}
contentBytesController.init(index);
contentBytesController.init(
index, "regular");
contentBytesController
.isAudioSeekBarVisible.value = true;
//https://actions.google.com/sounds/v1/horror/aggressive_zombie_snarls.ogg

View File

@@ -1,6 +1,7 @@
import 'dart:developer';
import 'package:audio_video_progress_bar/audio_video_progress_bar.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_svg/flutter_svg.dart';
@@ -115,8 +116,8 @@ class _ContentBytesState extends State<ContentBytes> {
child: Align(
child: ClipRRect(
borderRadius: BorderRadius.circular(100),
child: Image.network(
contentBytesController
child: CachedNetworkImage(
imageUrl: contentBytesController
.contentBytesModel
.data!
.audio![contentBytesController
@@ -315,6 +316,7 @@ class _ContentBytesState extends State<ContentBytes> {
SizedBox(
height: 600.h,
child: TabBarView(
physics: const NeverScrollableScrollPhysics(),
children: [
Videos(images: reels),
const Audios(),
@@ -438,8 +440,9 @@ class _ReadsState extends State<Reads> {
const Spacer()
],
),
Image.network(
"${contentBytesController.contentBytesModel.data!.read![index].image}",
CachedNetworkImage(
imageUrl:
"${contentBytesController.contentBytesModel.data!.read![index].image}",
height: 110,
),
],
@@ -509,16 +512,20 @@ class _ReadsState extends State<Reads> {
Colors.white.withOpacity(0.1),
const Color(0xFFFFFFFF).withOpacity(0.05),
],
stops: [
stops: const [
0.1,
1,
],
),
borderRadius: BorderRadius.circular(8),
),
child: Image.network(
contentBytesController.contentBytesModel.data!
.mostReads![index].contentByteData!.image!,
child: CachedNetworkImage(
imageUrl: contentBytesController
.contentBytesModel
.data!
.mostReads![index]
.contentByteData!
.image!,
fit: BoxFit.cover,
),
),
@@ -563,7 +570,7 @@ class _ReadsState extends State<Reads> {
Colors.white.withOpacity(0.1),
const Color(0xFFFFFFFF).withOpacity(0.05),
],
stops: [
stops: const [
0.1,
1,
],
@@ -577,11 +584,12 @@ class _ReadsState extends State<Reads> {
const SizedBox(
width: 10,
),
Image.network(contentBytesController
.previousReadOfUserModel
.data![index]
.contentByteData!
.image!),
CachedNetworkImage(
imageUrl: contentBytesController
.previousReadOfUserModel
.data![index]
.contentByteData!
.image!),
SizedBox(
width: 15.w,
),
@@ -600,8 +608,13 @@ class _ReadsState extends State<Reads> {
),
SizedBox(
width: 130.w,
height: 40,
child: text10W300(
" contentBytesControlle",
contentBytesController
.previousReadOfUserModel
.data![index]
.contentByteData!
.description!,
),
)
],
@@ -710,7 +723,7 @@ class _AudiosState extends State<Audios> {
contentBytesController.pause();
contentBytesController.stop();
}
contentBytesController.init(index);
contentBytesController.init(index, "regular");
contentBytesController.isAudioSeekBarVisible.value = true;
contentBytesController.indexForAudios.value = index;
},
@@ -723,7 +736,7 @@ class _AudiosState extends State<Audios> {
Colors.white.withOpacity(0.1),
const Color(0xFFFFFFFF).withOpacity(0.05),
],
stops: [
stops: const [
0.1,
1,
],
@@ -732,8 +745,8 @@ class _AudiosState extends State<Audios> {
),
child: Stack(
children: [
Image.network(
contentBytesController
CachedNetworkImage(
imageUrl: contentBytesController
.contentBytesModel.data!.audio![index].image!,
),
Positioned(
@@ -787,41 +800,63 @@ class _AudiosState extends State<Audios> {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: 148.w,
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Colors.white.withOpacity(0.1),
const Color(0xFFFFFFFF).withOpacity(0.05),
],
stops: [
0.1,
1,
],
),
borderRadius: BorderRadius.circular(8),
),
child: Stack(
children: [
Image.network(
contentBytesController.contentBytesModel.data!
.newReleaseAudio![index].image!,
InkWell(
onTap: () {
if (contentBytesController.isAudioInitialize) {
contentBytesController.isAudioSeekBarVisible.value =
false;
contentBytesController.pause();
contentBytesController.stop();
}
contentBytesController.init(index, "new");
contentBytesController.isAudioSeekBarVisible.value =
true;
contentBytesController.indexForAudios.value = index;
},
child: Container(
width: 148.w,
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Colors.white.withOpacity(0.1),
const Color(0xFFFFFFFF).withOpacity(0.05),
],
stops: const [
0.1,
1,
],
),
const Positioned(
right: 5,
top: 5,
child: CircleAvatar(
radius: 15,
child: Icon(
Icons.headphones,
size: 20,
borderRadius: BorderRadius.circular(8),
),
child: Stack(
children: [
ClipRRect(
borderRadius: BorderRadius.circular(8),
child: CachedNetworkImage(
imageUrl: contentBytesController
.contentBytesModel
.data!
.newReleaseAudio![index]
.image!,
height: 180,
fit: BoxFit.contain,
),
),
),
],
const Positioned(
right: 5,
top: 5,
child: CircleAvatar(
radius: 15,
child: Icon(
Icons.headphones,
size: 20,
),
),
),
],
),
),
),
const SizedBox(
@@ -1209,9 +1244,21 @@ class _ContentTabBarState extends State<ContentTabBar>
super.initState();
}
ContentBytesController contentBytesController =
Get.put(ContentBytesController());
@override
Widget build(BuildContext context) {
return TabBar(
onTap: (index) {
if (index == 0 || index == 2) {
if (contentBytesController.isAudioInitialize) {
contentBytesController.isAudioSeekBarVisible.value = false;
contentBytesController.pause();
contentBytesController.stop();
}
}
},
tabAlignment: TabAlignment.fill,
isScrollable: false,
dividerColor: Colors.transparent,