faq like dislike, content bytes

This commit is contained in:
jayesh
2024-04-11 18:53:14 +05:30
parent 486ed2ae96
commit cc08510485
13 changed files with 841 additions and 304 deletions

View File

@@ -244,9 +244,9 @@ Widget ActiveCallsTab() {
children: [
InkWell(
onTap: () {
Get.to(
() => PlayerWidget(),
);
Get.to(() => PlayerWidget(), arguments: {
"video_url": "",
});
},
child: Container(
height: 200.h,

View File

@@ -194,9 +194,9 @@ class _ShortTradeState extends State<ShortTrade> {
children: [
InkWell(
onTap: () {
Get.to(
() => PlayerWidget(),
);
Get.to(() => PlayerWidget(), arguments: {
"video_url": "",
});
},
child: Container(
height: 200.h,

View File

@@ -1,5 +1,6 @@
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';
@@ -19,6 +20,19 @@ import 'package:traderscircuit/view/Sidemenu/ContentByte/Reels.dart';
import 'package:traderscircuit/view/onBoarding/splashScreen1.dart';
import 'package:traderscircuit/view_model/ContentBytesApi/content_bytes_api.dart';
class ProgressBarState {
ProgressBarState({
required this.current,
required this.buffered,
required this.total,
});
final Duration current;
final Duration buffered;
final Duration total;
}
enum ButtonState { paused, playing }
class ContentBytes extends StatefulWidget {
const ContentBytes({super.key});
@@ -37,27 +51,12 @@ class _ContentBytesState extends State<ContentBytes> {
"assets/images/png/sidemenu/reels4.png",
];
List<String> audionewimage = [
"assets/images/png/sidemenu/audionew1.png",
"assets/images/png/sidemenu/audionew2.png",
"assets/images/png/sidemenu/audionew1.png",
];
List<String> mostread = [
"assets/images/png/sidemenu/Read1.png",
"assets/images/png/sidemenu/Read2.png",
"assets/images/png/sidemenu/Read1.png",
];
List<String> audio = [
"assets/images/png/sidemenu/audio1.png",
"assets/images/png/sidemenu/audio2.png",
"assets/images/png/sidemenu/audio3.png",
"assets/images/png/sidemenu/audio4.png",
"assets/images/png/sidemenu/audio1.png",
"assets/images/png/sidemenu/audio2.png",
];
List<String> audioname = [
"Week of 21st March 2024",
"Week of 21st March 2024",
@@ -93,6 +92,122 @@ class _ContentBytesState extends State<ContentBytes> {
Widget build(BuildContext context) {
return Scaffold(
key: _scaffoldKey1,
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
floatingActionButton: Obx(() => contentBytesController
.isAudioSeekBarVisible.value
? Container(
width: Get.size.width,
height: 100,
decoration: const BoxDecoration(
color: Colors.red,
),
child: Row(
children: [
Expanded(
flex: 1,
child: Align(
child: ClipRRect(
borderRadius: BorderRadius.circular(100),
child: Image.network(
contentBytesController
.contentBytesModel
.data!
.audio![
contentBytesController.indexForAudios.value]
.image!,
width: 57,
height: 57,
fit: BoxFit.cover,
),
),
),
),
Expanded(
flex: 3,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
contentBytesController
.contentBytesModel
.data!
.audio![
contentBytesController.indexForAudios.value]
.title!,
style: const TextStyle(
fontSize: 14,
color: Colors.black,
fontFamily: 'SFPRO',
fontWeight: FontWeight.w600,
height: 1.5,
),
),
// SizedBox(height: 5),
Text(
contentBytesController
.contentBytesModel
.data!
.audio![
contentBytesController.indexForAudios.value]
.description!,
style: const TextStyle(
fontSize: 14,
color: Colors.black,
fontFamily: 'SFPRO',
fontWeight: FontWeight.w600,
height: 1.5,
),
),
ValueListenableBuilder<ProgressBarState>(
valueListenable:
contentBytesController.progressNotifier,
builder: (context, value, _) {
return ProgressBar(
progress: value.current,
buffered: value.buffered,
total: value.total,
onSeek: contentBytesController.seek,
barHeight: 4,
thumbRadius: 6,
thumbGlowRadius: 15,
thumbColor: Colors.black,
baseBarColor: Colors.black.withOpacity(0.3),
progressBarColor: Colors.black,
bufferedBarColor: Colors.black.withOpacity(0.3),
);
},
),
],
),
),
Expanded(
flex: 1,
child: ValueListenableBuilder<ButtonState>(
valueListenable: contentBytesController.buttonNotifier,
builder: (context, value, _) {
switch (value) {
case ButtonState.paused:
return IconButton(
icon: const Icon(Icons.play_arrow_rounded),
iconSize: 50.0,
onPressed: () => contentBytesController.play(
contentBytesController.indexForAudios.value),
);
case ButtonState.playing:
return IconButton(
icon: const Icon(Icons.pause),
iconSize: 50.0,
onPressed: contentBytesController.pause,
);
}
},
),
),
],
),
)
: Container()),
backgroundColor: Colors.black,
extendBody: true,
appBar: const CommonAppbar(titleTxt: "Content Bytes"),
@@ -124,11 +239,7 @@ class _ContentBytesState extends State<ContentBytes> {
child: TabBarView(
children: [
Videos(images: reels),
Audios(
audio: audio,
audioname: audioname,
audionewimage: audionewimage,
audionamenewrelease: audionamenewrelease),
Audios(),
Reads(mostread: mostread),
],
),
@@ -162,27 +273,27 @@ class Reads extends StatelessWidget {
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,
),
// 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"'),
sizedBoxHeight(20.h),
commonGlassContainer(
@@ -391,19 +502,18 @@ class Reads extends StatelessWidget {
}
}
class Audios extends StatelessWidget {
class Audios extends StatefulWidget {
const Audios({
super.key,
required this.audio,
required this.audioname,
required this.audionewimage,
required this.audionamenewrelease,
});
final List<String> audio;
final List<String> audioname;
final List<String> audionewimage;
final List<String> audionamenewrelease;
@override
State<Audios> createState() => _AudiosState();
}
class _AudiosState extends State<Audios> {
ContentBytesController contentBytesController =
Get.put(ContentBytesController());
@override
Widget build(BuildContext context) {
@@ -411,89 +521,90 @@ class Audios extends StatelessWidget {
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,
),
// 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('Content Bytes'),
sizedBoxHeight(8.w),
text16W400_DADADA('The Beauty and Power of Video'),
text16W400_DADADA('The Beauty and Power of Audios'),
sizedBoxHeight(20.h),
Container(
height: 550,
child: GridView.builder(
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
),
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: 6, // total number of items
itemBuilder: (context, index) {
return 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.asset(
audio[index],
),
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(audioname[index]),
),
],
),
),
itemCount: contentBytesController
.contentBytesModel.data!.audio!.length, // total number of items
itemBuilder: (context, index) {
return 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!),
),
],
),
),
],
),
);
},
),
SizedBox(
height: 20.h,
@@ -511,7 +622,8 @@ class Audios extends StatelessWidget {
);
},
scrollDirection: Axis.horizontal,
itemCount: 3,
itemCount:
contentBytesController.contentBytesModel.data!.audio!.length,
itemBuilder: (context, index) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
@@ -536,7 +648,10 @@ class Audios extends StatelessWidget {
),
child: Stack(
children: [
Image.asset(audionewimage[index]),
Image.network(
contentBytesController
.contentBytesModel.data!.audio![index].image!,
),
const Positioned(
right: 5,
top: 5,
@@ -559,7 +674,10 @@ class Audios extends StatelessWidget {
children: [
SizedBox(
width: 148.w,
child: text14W500Overflow(audionamenewrelease[index]),
child: text14W500Overflow(
contentBytesController
.contentBytesModel.data!.audio![index].title!,
),
),
],
)
@@ -695,7 +813,7 @@ class _VideosState extends State<Videos> {
Widget videoCard(Video video) {
return InkWell(
onTap: () {
Get.to(() => PlayerWidget(), arguments: {
Get.to(() => const PlayerWidget(), arguments: {
"video_url": video.file,
});
},
@@ -756,23 +874,23 @@ class _VideosState extends State<Videos> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
const SizedBox(
width: 295,
child: CustomTextFormField(
leadingIcon: Icon(Icons.search),
),
),
SizedBox(
width: 15.w,
),
filter(),
],
),
SizedBox(
height: 10.h,
),
// Row(
// children: [
// const SizedBox(
// width: 295,
// child: CustomTextFormField(
// leadingIcon: Icon(Icons.search),
// ),
// ),
// SizedBox(
// width: 15.w,
// ),
// filter(),
// ],
// ),
// SizedBox(
// height: 10.h,
// ),
text22W600('Content Bytes'),
sizedBoxHeight(8.w),
text16W400_DADADA('The Beauty and Power of Video'),
@@ -808,64 +926,66 @@ class _VideosState extends State<Videos> {
: videoCard(contentBytesController
.contentBytesModel.data!.video![1]),
sizedBoxHeight(15.h),
text22W600("Reels"),
sizedBoxHeight(25.h),
Container(
height: 500,
child: GridView.builder(
physics: const NeverScrollableScrollPhysics(),
gridDelegate:
const SliverGridDelegateWithFixedCrossAxisCount(
mainAxisExtent: 215,
crossAxisCount: 2, // number of items in each row
mainAxisSpacing: 8.0, // spacing between rows
crossAxisSpacing: 8.0, // spacing between columns
),
// text22W600("Reels"),
// sizedBoxHeight(25.h),
// Container(
// height: 500,
// child: GridView.builder(
// physics: const NeverScrollableScrollPhysics(),
// gridDelegate:
// const SliverGridDelegateWithFixedCrossAxisCount(
// mainAxisExtent: 215,
// crossAxisCount: 2, // number of items in each row
// mainAxisSpacing: 8.0, // spacing between rows
// crossAxisSpacing: 8.0, // spacing between columns
// ),
// itemCount: 4, // total number of items
// itemBuilder: (context, index) {
// return InkWell(
// onTap: () {
// Get.to(
// () => const Reels(),
// );
// },
// 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: Image.asset(widget.images[index]),
// ),
// );
// },
// ),
// ),
itemCount: 4, // total number of items
itemBuilder: (context, index) {
return InkWell(
onTap: () {
Get.to(
() => const Reels(),
);
},
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: Image.asset(widget.images[index]),
),
);
},
),
),
// sizedBoxHeight(10.h),
contentBytesController
.contentBytesModel.data!.video!.length <
3
? const SizedBox()
: ListView.builder(
physics: NeverScrollableScrollPhysics(),
physics: const NeverScrollableScrollPhysics(),
itemCount: contentBytesController
.contentBytesModel.data!.video!.length -
2,
shrinkWrap: true,
itemBuilder: (ctx, index) {
return Container(
margin: EdgeInsets.only(
margin: const EdgeInsets.only(
bottom: 20,
),
child: videoCard(contentBytesController

View File

@@ -13,7 +13,9 @@ class PlayerWidget extends StatefulWidget {
class _PlayerWidgetState extends State<PlayerWidget> {
late VideoPlayerController videoPlayerController;
late ChewieController chewieController;
var videoUrl = Get.arguments["video_url"];
var videoUrl = Get.arguments["video_url"] == ""
? "https://player.vimeo.com/progressive_redirect/playback/930595309/rendition/360p/file.mp4?loc=external&signature=55ffa7ff72b807e1b3830cd6d308b092d4b1f82baadf6c20e7c235cd9a33bcdf"
: Get.arguments["video_url"];
@override
void initState() {
_initializePlayer();
@@ -41,6 +43,13 @@ class _PlayerWidgetState extends State<PlayerWidget> {
looping: false);
}
@override
void dispose() {
videoPlayerController.dispose();
chewieController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return videoPlayerController != null &&

View File

@@ -1,7 +1,10 @@
import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_svg/svg.dart';
import 'package:get/get.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:traderscircuit/Utils/Common/CommonAppBar.dart';
import 'package:traderscircuit/Utils/Common/CustomTextFormField.dart';
import 'package:traderscircuit/Utils/Common/comonGlassmorphicContainer.dart';
@@ -11,6 +14,8 @@ import 'package:traderscircuit/model/FAQModel/faq_model.dart';
import 'package:traderscircuit/view/onBoarding/splashScreen1.dart';
import 'package:traderscircuit/view_model/FaqApi/faq_api.dart';
Rx<FAQModel> faqModel = FAQModel().obs;
class FaqScreen extends StatefulWidget {
const FaqScreen({super.key});
@@ -22,23 +27,29 @@ class _FaqScreenState extends State<FaqScreen> {
List<String> categoryList = [];
RxBool isLoading = true.obs;
FAQModel faqModel = FAQModel();
@override
void initState() {
getData();
FAQApi().getFAQData().then((value) {
faqModel = FAQModel.fromJson(value.data);
for (var a in faqModel.data!) {
faqModel.value = FAQModel.fromJson(value.data);
for (var a in faqModel.value.data!) {
categoryList.add(a.categoryName!);
}
isExpandedList = RxList.generate(
faqModel.data![selectedIndex.value].faqQueAns!.length,
faqModel.value.data![selectedIndex.value].faqQueAns!.length,
(index) => index == 0);
isLoading.value = false;
});
super.initState();
}
String? token;
getData() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
token = prefs.getString('accessToken');
}
final selectedIndex = 0.obs;
late RxList<bool> isExpandedList;
@@ -95,6 +106,7 @@ class _FaqScreenState extends State<FaqScreen> {
selectedIndex.value = index;
isExpandedList = RxList.generate(
faqModel
.value
.data![selectedIndex.value]
.faqQueAns!
.length,
@@ -114,16 +126,33 @@ class _FaqScreenState extends State<FaqScreen> {
Obx(() {
return Column(
children: List.generate(
faqModel.data![selectedIndex.value]
.faqQueAns!.length, (index) {
faqModel
.value
.data![selectedIndex.value]
.faqQueAns!
.length, (index) {
return customExpandableItem(
index: index,
selectedIndex: selectedIndex.value,
faqModel1: faqModel.value,
isExpanded: isExpandedList[index],
title: faqModel.data![selectedIndex.value]
.faqQueAns![index].faqQuestion!,
content: faqModel.data![selectedIndex.value]
.faqQueAns![index].faqAnswer!,
title: faqModel
.value
.data![selectedIndex.value]
.faqQueAns![index]
.faqQuestion!,
content: faqModel
.value
.data![selectedIndex.value]
.faqQueAns![index]
.faqAnswer!,
toggleExpansion: () =>
toggleExpansion(index),
faqId: faqModel
.value
.data![selectedIndex.value]
.faqQueAns![index]
.id!,
);
}));
}),
@@ -144,13 +173,21 @@ class _FaqScreenState extends State<FaqScreen> {
borderRadius: BorderRadius.circular(5),
color: const Color(0XFF3F0502),
border: Border.all(color: const Color(0xFF9A0000), width: 1)),
child: Center(child: text16W500(text)),
child: Center(
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 8),
child: FittedBox(child: text16W500(text)),
)),
)
: commonGlassContainer(
width: 136.w,
height: 38.h,
borderradius: 5,
customWidget: Center(child: text16W400(text)),
customWidget: Center(
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 9),
child: FittedBox(child: text16W400(text)),
)),
);
});
}
@@ -171,6 +208,10 @@ class _FaqScreenState extends State<FaqScreen> {
required String title,
required String content,
required VoidCallback toggleExpansion,
required int faqId,
required FAQModel faqModel1,
required int selectedIndex,
required int index,
}) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
@@ -230,58 +271,123 @@ class _FaqScreenState extends State<FaqScreen> {
child: Text(
content,
style: TextStyle(
color: Color(0xFFFFFFFF),
color: const Color(0xFFFFFFFF),
fontFamily: 'hiragino',
fontSize: 14.sp,
fontWeight: FontWeight.w400,
),
),
),
),
sizedBoxHeight(12.h),
commonGlassContainer(
width: double.infinity,
height: 65.h,
borderradius: 8,
customWidget: Padding(
padding: EdgeInsets.only(right: 8.w, left: 13.w),
child: Center(
child: Row(children: [
Text(
'Was this answer helpful?',
style: TextStyle(
fontFamily: 'hiragino',
fontSize: 16.sp,
fontWeight: FontWeight.w500,
color: Colors.white,
),
),
const Spacer(),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
text16W500('Yes'),
sizedBoxWidth(2.w),
SvgPicture.asset(
'assets/images/svg/thumbs-up.svg'),
sizedBoxWidth(8.w),
text16W500('No'),
sizedBoxWidth(2.w),
Column(
mainAxisAlignment: MainAxisAlignment.center,
token == null || token!.isEmpty
? const SizedBox()
: sizedBoxHeight(12.h),
token == null || token!.isEmpty
? const SizedBox()
: commonGlassContainer(
width: double.infinity,
height: 65.h,
borderradius: 8,
customWidget: Padding(
padding: EdgeInsets.only(right: 8.w, left: 13.w),
child: Center(
child: Row(children: [
Text(
'Was this answer helpful?',
style: TextStyle(
fontFamily: 'hiragino',
fontSize: 16.sp,
fontWeight: FontWeight.w500,
color: Colors.white,
),
),
const Spacer(),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
sizedBoxHeight(5.h),
SvgPicture.asset(
'assets/images/svg/thumbs-down.svg'),
InkWell(
onTap: () {
FAQApi()
.updaeFAQLikeDisklikeData(faqId, 1)
.then((value) {
FAQApi().getFAQData().then((value) {
faqModel.value =
FAQModel.fromJson(value.data);
setState(() {});
});
});
},
child: Row(
children: [
text16W500('Yes'),
sizedBoxWidth(2.w),
(faqModel
.value
.data![selectedIndex]
.faqQueAns![index]
.userLikes!
.isNotEmpty &&
faqModel
.value
.data![selectedIndex]
.faqQueAns![index]
.userLikes![0]
.status! ==
1)
? Icon(Icons.check)
: SvgPicture.asset(
'assets/images/svg/thumbs-up.svg'),
],
),
),
sizedBoxWidth(8.w),
InkWell(
onTap: () {
FAQApi()
.updaeFAQLikeDisklikeData(faqId, 0)
.then((value) {
FAQApi().getFAQData().then((value) {
faqModel.value =
FAQModel.fromJson(value.data);
});
});
},
child: Row(
children: [
text16W500('No'),
sizedBoxWidth(2.w),
Column(
mainAxisAlignment:
MainAxisAlignment.center,
children: [
sizedBoxHeight(5.h),
(faqModel
.value
.data![selectedIndex]
.faqQueAns![index]
.userLikes!
.isNotEmpty &&
faqModel
.value
.data![
selectedIndex]
.faqQueAns![index]
.userLikes![0]
.status! ==
0)
? Icon(Icons.cancel)
: SvgPicture.asset(
'assets/images/svg/thumbs-down.svg'),
],
)
],
),
)
],
)
],
)
]),
)))
),
]),
)))
],
),
),

View File

@@ -9,6 +9,8 @@ import 'package:get/get.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:traderscircuit/resources/routes/route_name.dart';
import '../../Utils/Common/noInternet.dart';
class SplashScreen extends StatefulWidget {
const SplashScreen({super.key});
@@ -44,52 +46,55 @@ class _SplashScreenState extends State<SplashScreen>
void initState() {
super.initState();
checkInternet();
log(_connectionStatus.toString());
Future.delayed(Duration(seconds: 2), () async {
Get.toNamed(RouteName.sliderscreen1);
// if (_connectionStatus == ConnectivityResult.none) {
// var result = await Get.to(NoInternet());
// if (result != null && result) {
// Timer(const Duration(seconds: 1), () async {
// SharedPreferences prefs = await SharedPreferences.getInstance();
// token = prefs.getString('token');
// myusername = prefs.getString('name');
// phonenumber = prefs.getString('contact_number');
// OnBoard = prefs.getBool('OnBoard') ?? false;
// if (OnBoard == false) {
// Get.toNamed(RouteName.sliderscreen1);
// } else {
// if (token == null || token!.isEmpty) {
// Get.offAndToNamed(RouteName.loginScreen);
// } else {
// GetProfile().GetProfileAPI().then((value) {
// Get.toNamed(RouteName.mainScreen, arguments: 0);
// });
// }
// }
// });
// }
// } else {
// Timer(const Duration(seconds: 2), () async {
// SharedPreferences prefs = await SharedPreferences.getInstance();
// token = prefs.getString('token');
// myusername = prefs.getString('name');
// phonenumber = prefs.getString('contact_number');
// OnBoard = prefs.getBool('OnBoard') ?? false;
// if (OnBoard == false) {
// Get.toNamed(RouteName.sliderscreen1);
// } else {
// if (token == null || token!.isEmpty) {
// Get.offAndToNamed(RouteName.loginScreen);
// } else {
// GetProfile().GetProfileAPI().then((value) {
// Get.toNamed(RouteName.mainScreen, arguments: 0);
// });
// }
// }
// });
// }
Future.delayed(Duration(seconds: 2), () async {
if (_connectionStatus == ConnectivityResult.none) {
var result = await Get.to(NoInternet());
if (result != null && result) {
Timer(const Duration(seconds: 1), () async {
SharedPreferences prefs = await SharedPreferences.getInstance();
var token = prefs.getString('accessToken');
// myusername = prefs.getString('name');
// phonenumber = prefs.getString('contact_number');
// OnBoard = prefs.getBool('OnBoard') ?? false;
// if (OnBoard == false) {
// Get.toNamed(RouteName.sliderscreen1);
// }
// else {
if (token == null || token!.isEmpty) {
Get.offAndToNamed(RouteName.loginscreen);
} else {
// GetProfile().GetProfileAPI().then((value) {
// Get.toNamed(RouteName.mainScreen, arguments: 0);
// });
Get.toNamed(RouteName.mainscreen);
}
// }
});
}
} else {
Timer(const Duration(seconds: 2), () async {
SharedPreferences prefs = await SharedPreferences.getInstance();
var token = prefs.getString('accessToken');
// myusername = prefs.getString('name');
// phonenumber = prefs.getString('contact_number');
// OnBoard = prefs.getBool('OnBoard') ?? false;
// if (OnBoard == false) {
// Get.toNamed(RouteName.sliderscreen1);
// }
// else {
if (token == null || token!.isEmpty) {
Get.offAndToNamed(RouteName.loginscreen);
} else {
// GetProfile().GetProfileAPI().then((value) {
// Get.toNamed(RouteName.mainScreen, arguments: 0);
// });
Get.toNamed(RouteName.mainscreen);
}
// }
});
}
});
// for scaleTansition
_scaleController = AnimationController(
@@ -131,7 +136,8 @@ class _SplashScreenState extends State<SplashScreen>
scale: _scaleAnimation,
child: Text(
"Traders Circuit",
style: TextStyle(fontFamily: 'hiragino',
style: TextStyle(
fontFamily: 'hiragino',
fontSize: 50,
fontWeight: FontWeight.w600,
color: Colors.white),