diff --git a/lib/view/Sidemenu/contactUs/contact_us_main.dart b/lib/view/Sidemenu/contactUs/contact_us_main.dart index 82fabe2..c26a374 100644 --- a/lib/view/Sidemenu/contactUs/contact_us_main.dart +++ b/lib/view/Sidemenu/contactUs/contact_us_main.dart @@ -1,3 +1,5 @@ +import 'dart:developer'; + import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:gap/gap.dart'; @@ -25,12 +27,16 @@ class _ContactUsMainScreenState extends State { @override void initState() { + contactUsController.isLoading.value == true; ContactUsApi().getContactUsCategoriesData().then((value) { contactUsController.contactCatModel = ContactUsCatModel.fromJson(value.data); - }); - ContactUsApi().getContactUsData().then((value) { - contactUsController.contactModel = ContactUsModel.fromJson(value.data); + + ContactUsApi().getContactUsData().then((value) { + contactUsController.contactModel = ContactUsModel.fromJson(value.data); + contactUsController.isLoading.value = false; + log(contactUsController.isLoading.value.toString()); + }); }); super.initState(); @@ -72,68 +78,80 @@ class _ContactUsMainScreenState extends State { Padding( padding: const EdgeInsets.symmetric( horizontal: 16, vertical: 16), - child: ListView( - physics: const NeverScrollableScrollPhysics(), - children: [ - text25W600("Contact Us"), - const Gap(20), - text16W400("Hi Afrid,"), - text16W400("We are here to help you Us"), - const Gap(12), - TabBar( - tabAlignment: TabAlignment.start, - labelStyle: TextStyle( - fontSize: 18.sp, - fontWeight: FontWeight.w400, - fontFamily: "hiragino", - ), - isScrollable: true, - labelColor: Colors.white, - unselectedLabelColor: const Color(0xFF464646), - indicatorColor: const Color(0xFF6C0000), - indicatorSize: TabBarIndicatorSize.tab, - unselectedLabelStyle: TextStyle( - fontSize: 18.sp, - fontWeight: FontWeight.w500, - fontFamily: "hiragino", - ), - tabs: [ - Tab( - text: - "All Tickets (${contactUsController.contactModel.data!.length.toString()})"), - Tab(text: "Open Tickets (2)"), - Tab(text: "Closed (1)"), - Tab(text: "Resolved (1)"), - ], - ), - SizedBox( - height: 0.5.sh, - child: TabBarView(children: [ - ListView.builder( - itemCount: contactUsController - .contactModel.data!.length, - itemBuilder: (ctx, index) { - return ticketCardWidget(index, "ALL"); - }), - ListView.builder( - itemCount: dataL.length, - itemBuilder: (ctx, index) { - return ticketCardWidget(index, "OPEN"); - }), - ListView.builder( - itemCount: dataL.length, - itemBuilder: (ctx, index) { - return ticketCardWidget(index, "CLOSED"); - }), - ListView.builder( - itemCount: dataL.length, - itemBuilder: (ctx, index) { - return ticketCardWidget(index, "RESOLVED"); - }), - ]), - ) - ], - )), + child: contactUsController.isLoading.value + ? Center( + child: CircularProgressIndicator( + color: Colors.redAccent, + )) + : contactUsController.contactModel.data!.isEmpty + ? Text("No Data Available") + : ListView( + physics: const NeverScrollableScrollPhysics(), + children: [ + text25W600("Contact Us"), + const Gap(20), + text16W400("Hi Afrid"), + text16W400("We are here to help you Us"), + const Gap(12), + TabBar( + tabAlignment: TabAlignment.start, + labelStyle: TextStyle( + fontSize: 18.sp, + fontWeight: FontWeight.w400, + fontFamily: "hiragino", + ), + isScrollable: true, + labelColor: Colors.white, + unselectedLabelColor: + const Color(0xFF464646), + indicatorColor: const Color(0xFF6C0000), + indicatorSize: TabBarIndicatorSize.tab, + unselectedLabelStyle: TextStyle( + fontSize: 18.sp, + fontWeight: FontWeight.w500, + fontFamily: "hiragino", + ), + tabs: [ + Tab( + text: + "All Tickets (${contactUsController.contactModel.data!.length.toString()})"), + Tab(text: "Open Tickets (2)"), + Tab(text: "Closed (1)"), + Tab(text: "Resolved (1)"), + ], + ), + SizedBox( + height: 0.5.sh, + child: TabBarView(children: [ + ListView.builder( + itemCount: contactUsController + .contactModel.data!.length, + itemBuilder: (ctx, index) { + return ticketCardWidget( + index, "ALL"); + }), + ListView.builder( + itemCount: dataL.length, + itemBuilder: (ctx, index) { + return ticketCardWidget( + index, "OPEN"); + }), + ListView.builder( + itemCount: dataL.length, + itemBuilder: (ctx, index) { + return ticketCardWidget( + index, "CLOSED"); + }), + ListView.builder( + itemCount: dataL.length, + itemBuilder: (ctx, index) { + return ticketCardWidget( + index, "RESOLVED"); + }), + ]), + ) + ], + )), ]), ], ),