From d144e9b56217b939558811230c6bc89de9cf7b86 Mon Sep 17 00:00:00 2001 From: jayesh Date: Tue, 2 Apr 2024 18:45:38 +0530 Subject: [PATCH] one signal, faq api --- lib/main.dart | 2 +- lib/view/Sidemenu/FaqScreen.dart | 90 ++++++++++++++------------------ pubspec.lock | 8 +++ pubspec.yaml | 1 + 4 files changed, 48 insertions(+), 53 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index d049805..c5b6e7e 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -110,7 +110,7 @@ class _MyAppState extends State with WidgetsBindingObserver { fontFamily: 'manrope', ), debugShowCheckedModeBanner: false, - initialRoute: RouteName.contentbytes, + initialRoute: RouteName.splashScreen, getPages: AppRoutes.appRoutes(), ), designSize: const Size(390, 844), diff --git a/lib/view/Sidemenu/FaqScreen.dart b/lib/view/Sidemenu/FaqScreen.dart index 01ccdf1..30d8237 100644 --- a/lib/view/Sidemenu/FaqScreen.dart +++ b/lib/view/Sidemenu/FaqScreen.dart @@ -26,12 +26,14 @@ class _FaqScreenState extends State { @override void initState() { - // isExpandedList = RxList.generate(Faqcard.length, (index) => index == 0); FAQApi().getFAQData().then((value) { faqModel = FAQModel.fromJson(value.data); for (var a in faqModel.data!) { categoryList.add(a.categoryName!); } + isExpandedList = RxList.generate( + faqModel.data![selectedIndex.value].faqQueAns!.length, + (index) => index == 0); isLoading.value = false; }); super.initState(); @@ -43,15 +45,15 @@ class _FaqScreenState extends State { @override Widget build(BuildContext context) { return Scaffold( - appBar: CommonAppbar( + appBar: const CommonAppbar( titleTxt: "", ), backgroundColor: Colors.black, extendBody: true, body: Obx( () => Stack(children: [ - CommonBlurLeft(), - CommonBlurRight(), + const CommonBlurLeft(), + const CommonBlurRight(), isLoading.value ? const Center( child: CircularProgressIndicator( @@ -60,15 +62,15 @@ class _FaqScreenState extends State { ) : Stack(children: [ Padding( - padding: EdgeInsets.symmetric(horizontal: 16), + padding: const EdgeInsets.symmetric(horizontal: 16), child: ListView( - physics: BouncingScrollPhysics(), + physics: const BouncingScrollPhysics(), children: [ text25W600('FAQ'), sizedBoxHeight(20), CustomTextFormField1( hintText: 'Search Chats', - leadingIcon: Container( + leadingIcon: SizedBox( height: 20, width: 20, child: Center( @@ -91,6 +93,12 @@ class _FaqScreenState extends State { return GestureDetector( onTap: () { selectedIndex.value = index; + isExpandedList = RxList.generate( + faqModel + .data![selectedIndex.value] + .faqQueAns! + .length, + (index) => index == 0); }, child: Row( children: [ @@ -103,45 +111,22 @@ class _FaqScreenState extends State { }), ), sizedBoxHeight(20.h), - // Obx(() { - // return selectedIndex == 0 - // ? Column( - // children: List.generate(Faqcard.length, (index) { - // return customExpandableItem( - // isExpanded: isExpandedList[index], - // title: Faqcard[index]['title']!, - // content: Faqcard[index]['content']!, - // toggleExpansion: () => toggleExpansion(index), - // ); - // })) - // : Column( - // children: List.generate(Faqcard2.length, (index) { - // return customExpandableItem( - // isExpanded: isExpandedList[index], - // title: Faqcard2[index]['title']!, - // content: Faqcard2[index]['content']!, - // toggleExpansion: () => toggleExpansion(index), - // ); - // })); - // }), - - // ListView.builder( - // shrinkWrap: true, - // itemCount: Faqcard.length, - // itemBuilder: (BuildContext context, int index) { - // return Obx( - // () { - // return customExpandableItem( - // isExpanded: isExpandedList[index], - // title: Faqcard[index]['title']!, - // content: Faqcard[index]['content']!, - // toggleExpansion: () => toggleExpansion(index), - // ); - // }, - // ); - // }, - // ), - + Obx(() { + return Column( + children: List.generate( + faqModel.data![selectedIndex.value] + .faqQueAns!.length, (index) { + return customExpandableItem( + isExpanded: isExpandedList[index], + title: faqModel.data![selectedIndex.value] + .faqQueAns![index].faqQuestion!, + content: faqModel.data![selectedIndex.value] + .faqQueAns![index].faqAnswer!, + toggleExpansion: () => + toggleExpansion(index), + ); + })); + }), sizedBoxHeight(30.h), ])) ]) @@ -157,8 +142,8 @@ class _FaqScreenState extends State { width: 136.w, decoration: BoxDecoration( borderRadius: BorderRadius.circular(5), - color: Color(0XFF3F0502), - border: Border.all(color: Color(0xFF9A0000), width: 1)), + color: const Color(0XFF3F0502), + border: Border.all(color: const Color(0xFF9A0000), width: 1)), child: Center(child: text16W500(text)), ) : commonGlassContainer( @@ -210,7 +195,7 @@ class _FaqScreenState extends State { color: Colors.white, ), ), - Spacer(), + const Spacer(), Icon( isExpanded ? Icons.keyboard_arrow_up_outlined @@ -237,14 +222,15 @@ class _FaqScreenState extends State { bottomRight: Radius.circular(8.r), ), color: Colors.black, - border: Border.all(color: Color(0xFF3A3A3A), width: 0.5)), + border: + Border.all(color: const Color(0xFF3A3A3A), width: 0.5)), child: Padding( padding: EdgeInsets.only( top: 11.h, left: 14.w, bottom: 25.h, right: 28.w), child: Text( content, style: TextStyle( - color: Color(0xFFFFFFFF), + color: const Color(0xFFFFFFFF), fontFamily: 'manrope', fontSize: 14.sp, fontWeight: FontWeight.w400, @@ -270,7 +256,7 @@ class _FaqScreenState extends State { color: Colors.white, ), ), - Spacer(), + const Spacer(), Row( crossAxisAlignment: CrossAxisAlignment.center, children: [ diff --git a/pubspec.lock b/pubspec.lock index e0914ed..1957bec 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -177,6 +177,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.3.9" + expansion_tile_group: + dependency: "direct main" + description: + name: expansion_tile_group + sha256: "6918433891481c7d98cbc604d7b4c93509986e8134d52940853301ad6fbff404" + url: "https://pub.dev" + source: hosted + version: "1.2.4" fake_async: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 3614205..4de8d0e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -35,6 +35,7 @@ dependencies: cached_network_image: ^3.3.1 firebase_core: dio: ^5.1.2 + expansion_tile_group: ^1.2.4 dev_dependencies: flutter_test: