TabBar in Flutter with Scrolling Categories | Flutter eCommerce App

แชร์
ฝัง
  • เผยแพร่เมื่อ 8 ม.ค. 2025

ความคิดเห็น • 95

  • @CodingwithT
    @CodingwithT  3 หลายเดือนก่อน +6

    TBrandCard Class which every one was looking for.
    import 'package:flutter/material.dart';
    import '../../../features/shop/models/brand_model.dart';
    import '../../../utils/constants/colors.dart';
    import '../../../utils/constants/enums.dart';
    import '../../../utils/constants/sizes.dart';
    import '../../../utils/helpers/helper_functions.dart';
    import '../custom_shapes/containers/rounded_container.dart';
    import '../images/t_circular_image.dart';
    import '../texts/t_brand_title_text_with_verified_icon.dart';
    /// A card widget representing a brand.
    class TBrandCard extends StatelessWidget {
    /// Default constructor for the TBrandCard.
    ///
    /// Parameters:
    /// - brand: The brand model to display.
    /// - showBorder: A flag indicating whether to show a border around the card.
    /// - onTap: Callback function when the card is tapped.
    const TBrandCard({
    super.key,
    required this.brand,
    required this.showBorder,
    this.onTap,
    });
    final BrandModel brand;
    final bool showBorder;
    final void Function()? onTap;
    @override
    Widget build(BuildContext context) {
    final isDark = THelperFunctions.isDarkMode(context);
    return GestureDetector(
    onTap: onTap,
    /// Container Design
    child: TRoundedContainer(
    showBorder: showBorder,
    backgroundColor: Colors.transparent,
    padding: const EdgeInsets.all(TSizes.sm),
    child: Row(
    crossAxisAlignment: CrossAxisAlignment.center,
    children: [
    /// -- Icon
    Flexible(
    child: TCircularImage(
    image: brand.image,
    isNetworkImage: true,
    backgroundColor: Colors.transparent,
    overlayColor: isDark ? TColors.white : TColors.black,
    ),
    ),
    const SizedBox(width: TSizes.spaceBtwItems / 2),
    /// -- Texts
    // [Expanded] & Column [MainAxisSize.min] is important to keep the elements in the vertical center and also
    // to keep text inside the boundaries.
    Expanded(
    child: Column(
    mainAxisSize: MainAxisSize.min,
    crossAxisAlignment: CrossAxisAlignment.start,
    children: [
    TBrandTitleWithVerifiedIcon(title: brand.name, brandTextSize: TextSizes.large),
    Text(
    '${brand.productsCount ?? 0} products',
    overflow: TextOverflow.ellipsis,
    style: Theme.of(context).textTheme.labelMedium,
    ),
    ],
    ),
    ),
    ],
    ),
    ),
    );
    }
    }

    • @nazarobeziuk6150
      @nazarobeziuk6150 21 วันที่ผ่านมา

      Hi, can I get BrandModel code?

  • @mohamedalhamri9714
    @mohamedalhamri9714 7 หลายเดือนก่อน +9

    I encountered an issue where the TabBar was shifted to the right, creating a gap on the left. I resolved this by setting tabAlignment: TabAlignment.start in the TabBar widget. By default, the tabAlignment property is set to startOffset when both the isScrollable property of the TabBar and the useMaterial3 property of ThemeData are set to true. According to the documentation for tabs.dart: (/// If [TabBarTheme.tabAlignment] is null and [ThemeData.useMaterial3] is true,
    /// then [TabAlignment.startOffset] is used if [isScrollable] is true,
    /// otherwise [TabAlignment.fill] is used.)

  • @T-B-5
    @T-B-5 ปีที่แล้ว +5

    If anyone experiences a bottom overflow halfway through tutorial, this will be fixed at the end of the tutorial so don't panic. I made this mistake not going through tutorial till end, thinking it wasn't in the video. Sorry sir and I appreciate your work.

    • @CodingwithT
      @CodingwithT  ปีที่แล้ว +2

      Thank you so much for helping others 😊. I'm really glad for your response. 🎉💕

    • @T-B-5
      @T-B-5 ปีที่แล้ว +1

      It is you we should all thank for the free tutorials.

    • @lilykarmila4559
      @lilykarmila4559 ปีที่แล้ว +2

      your comment always save me broo 🤣🤣🤣

    • @T-B-5
      @T-B-5 ปีที่แล้ว +1

      We are on the same boat. That's hilarious

    • @lyshuanbroflovski7407
      @lyshuanbroflovski7407 7 หลายเดือนก่อน

      @@lilykarmila4559 x2

  • @muhendis_
    @muhendis_ 5 หลายเดือนก่อน

    14:43 I learnt a awesome new thing, wow 💯

    • @CodingwithT
      @CodingwithT  5 หลายเดือนก่อน

      I'm thrilled to hear that! Learning new things is always exciting. Keep up the great work! 💯🚀

  • @JirolBikes
    @JirolBikes 10 หลายเดือนก่อน +2

    thank you, this section is awesome

    • @CodingwithT
      @CodingwithT  10 หลายเดือนก่อน +1

      You're welcome! I'm glad you're enjoying this section.

  • @HamzaShoaib-h1v
    @HamzaShoaib-h1v ปีที่แล้ว +1

    I Appreciate your Hardwork

  • @geiseebag8754
    @geiseebag8754 10 หลายเดือนก่อน +2

    Hey, I have this problem in the tabbar when I only use 4 tabs or 3 they don't take the whole width of the screen and missing space stays in the edges also the line under the tabbar doesn't extend to the both edges.

    • @lyshuanbroflovski7407
      @lyshuanbroflovski7407 7 หลายเดือนก่อน

      To fix this issue, you can set isScrollable to false. Here is the modified code for your TTabBar:

  • @cromuelbarut9859
    @cromuelbarut9859 5 หลายเดือนก่อน

    Because of this tutorial, now i know how to implement the scrollable tab bar view, you're a life saver!
    thank you very much!!!

    • @CodingwithT
      @CodingwithT  5 หลายเดือนก่อน

      I'm glad to hear that! Thank you for your kind words and support. Happy coding! 🎉

  • @haikal1680
    @haikal1680 8 หลายเดือนก่อน

    hi , for the search, i didnt see which videos make the code for searching the products. for example when i type A , apple comes out

  • @nurullahozatak
    @nurullahozatak ปีที่แล้ว +2

    Hello T, I'm following your videos step by step and making good progress. However, I have a question. I am working on this project for a school assignment, and there is a requirement to use MSSQL. In my research, I found that I can use Prisma ORM. Can I use a local database instead of Firebase in the code you provided? Is the code you wrote suitable for this, and does it support the use of Prisma ORM for MSSQL?

    • @CodingwithT
      @CodingwithT  ปีที่แล้ว +1

      Yes, absolutely, 💯 You can use any Backend you like. Just grab the design and fit the backend of your choice.

    • @phantuoi_it_247
      @phantuoi_it_247 2 หลายเดือนก่อน

      Thanks you so much
      You are my savior

    • @phantuoi_it_247
      @phantuoi_it_247 2 หลายเดือนก่อน

      Thanks you so much
      You are my savior

  • @mcatrader
    @mcatrader 10 หลายเดือนก่อน

    hello , i need a help to you , i am using the same tabbar so i want set selected tab at the center of thr tabbar

  • @MuntasirHossain2100
    @MuntasirHossain2100 5 หลายเดือนก่อน +3

    can you kindly tell me on which video you create the TBrandcard() class or that dart file, I don't find it on previous video

    • @Dhara_Joshi
      @Dhara_Joshi 3 หลายเดือนก่อน

      Hello, Aapko mila ye code ?

    • @CodingwithT
      @CodingwithT  3 หลายเดือนก่อน

      Let me share that

    • @Dhara_Joshi
      @Dhara_Joshi 3 หลายเดือนก่อน

      @@CodingwithT Please sir share asap

    • @CodingwithT
      @CodingwithT  3 หลายเดือนก่อน +1

      @@Dhara_Joshi Comment Pinned in this video

    • @Dhara_Joshi
      @Dhara_Joshi 3 หลายเดือนก่อน

      ​@@CodingwithTThank you so much for the immediate response! Your quick support really helped me out. 😊🙏

  • @pinkisingh9218
    @pinkisingh9218 10 หลายเดือนก่อน +1

    can you tell me in which folder you create TBrandCard ? and what code you write in category_tab.dart within store 's widget folder?

    • @mahsolii
      @mahsolii 10 หลายเดือนก่อน

      Common>widgets>brands>brand_card.dart

    • @bubaygamingblogging5714
      @bubaygamingblogging5714 9 หลายเดือนก่อน

      @@mahsolii hi can you share brand_card.dart file code, becouse meroko pata nhi konsa video pe yea code lika giya.

    • @dhananjayjindal9580
      @dhananjayjindal9580 7 หลายเดือนก่อน

      @@bubaygamingblogging5714 it wasnt shown and many more things are skipped its too hard to catch up those things
      store me grid layout me jo gesture detector tha usi ko widget extract kiya hai

  • @gulammustufamomin2503
    @gulammustufamomin2503 ปีที่แล้ว +3

    Tab bar is taking horizontal space and then showing Sports tab. How to remove the space before Sports tab?

    • @CodingwithT
      @CodingwithT  ปีที่แล้ว

      I'll try to find the cause and will share it.

    • @AshwiniBhatBhat
      @AshwiniBhatBhat 11 หลายเดือนก่อน

      I also facing same problem@@CodingwithT

    • @ZeelaxJr
      @ZeelaxJr 10 หลายเดือนก่อน +5

      Im also facing this problem. Idk if it will help you or not, but the solution I found is to add tabAlightment: tabAlignment.center or tabAlignment.start property in TabBar under isScrollable: true. When isScrollable property is given, it creates that problem.

    • @aujdsfholsdfj
      @aujdsfholsdfj 8 หลายเดือนก่อน

      @@CodingwithT if you got the solution to the provided question please share it.

    • @gauravsethi17
      @gauravsethi17 8 หลายเดือนก่อน +1

      @@ZeelaxJr it worked thanks

  • @daniel_kiing3
    @daniel_kiing3 5 หลายเดือนก่อน

    Hello T
    Why did you suggest we don't use SingleChildScrollView when we got the render box error with the content in the Category Tab?
    I used it and the error went away for me
    Is there any technical reason or performance penalty for that?

    • @CodingwithT
      @CodingwithT  5 หลายเดือนก่อน +1

      Thanks for your question. The SingleChildScrollView can indeed resolve layout issues like render box errors by allowing content to overflow vertically. However, it’s generally advised to use SingleChildScrollView with caution in scenarios when there are multiple scrolling elements on the same screen.
      When used in combination with other scrollable widgets, it can lead to conflicting scroll behaviors and a less predictable user experience.

  • @NomotoSolutions
    @NomotoSolutions 7 หลายเดือนก่อน

    I have an error in the store.dart on this line images.map((image) => brandTopProductImageWidget(image, context)).toList() .. Error is The element type 'List' can't be assigned to the list type 'Widget'. I cannot get around this problem albeit following your instructions to the letter (Except for the TBrandCard which wasn't written from previous tut..I did it myself). Please help

    • @NomotoSolutions
      @NomotoSolutions 7 หลายเดือนก่อน

      I read something somewhere and ended up adding 3 dots at the begining like this ...images.map((image) => brandTopProductImageWidget(image, context)).toList() then it gave me this warning "Unnecessary use of 'toList' in a spread." I then removed the toList() and it was happy! Can you explain? have I messed up the logic?

    • @CodingwithT
      @CodingwithT  7 หลายเดือนก่อน

      Maybe the widget which in my case requested List and in your case you make it a single item type variable

  • @chiragpendharkar138
    @chiragpendharkar138 ปีที่แล้ว +2

    Please complete e-commerce app with admin panel many features 👍

  • @ayushmishra8505
    @ayushmishra8505 ปีที่แล้ว

    I am facing an issue, I have similar app with tabs in nested scroll view in tab bar view what I want that all the tab view should take only height they require. Currently my tab bar view is taking maximum height for all the tab views what should I do.

    • @CodingwithT
      @CodingwithT  ปีที่แล้ว

      You can use Listtile and shrinkWrap as true. Add background colors to check the height

  • @fizz1028
    @fizz1028 9 หลายเดือนก่อน +1

    TBrandCard dart code where? pls write

    • @CodingwithT
      @CodingwithT  3 หลายเดือนก่อน

      Sorry for the delayed reply. I will add it in the comments

  • @noxtube7937
    @noxtube7937 10 หลายเดือนก่อน

    thank you for this tutoriel I apreciate

    • @CodingwithT
      @CodingwithT  10 หลายเดือนก่อน

      Glad it was helpful!

  • @felipedahora9365
    @felipedahora9365 ปีที่แล้ว

    Hello, I have a question. The images I'm using aren't looking good, could you please tell me what dimensions the images you're using?

    • @CodingwithT
      @CodingwithT  ปีที่แล้ว

      You can download the starter kit for free from the product link in the description. Containing assets, folder structure, theme

  • @AlaminKarno
    @AlaminKarno 11 หลายเดือนก่อน

    Awesome video !!!

    • @CodingwithT
      @CodingwithT  11 หลายเดือนก่อน

      Thank you 😊

  • @arturochavezchibli6165
    @arturochavezchibli6165 11 หลายเดือนก่อน

    I cant stop watching your videos dude
    Just a question, am following your videos like crazy, and replacing everything trying to build a plataform for free ebooks and Audiobooks, is it possible to put a ePub reader? I cant seme to do it
    Thanks for everything man!

    • @CodingwithT
      @CodingwithT  11 หลายเดือนก่อน

      Thank you. I'll try to create a video on it.

    • @arturochavezchibli6165
      @arturochavezchibli6165 11 หลายเดือนก่อน

      @@CodingwithT oh my gosh seriously?? I fucking Love you man!

  • @eshu9838
    @eshu9838 11 หลายเดือนก่อน

    I just finished the featured brand section. But how to add different brands... I have Nike's in all 4 brands... How to add other brand like Adidas ..

    • @CodingwithT
      @CodingwithT  11 หลายเดือนก่อน +1

      Keep watching, in the backend tutorials of Section 5 you'll be able to handle all types of Brands.

    • @eshu9838
      @eshu9838 11 หลายเดือนก่อน

      thank you@@CodingwithT

  • @Juliendiesdegelendies
    @Juliendiesdegelendies ปีที่แล้ว +1

    11:15

  • @АйгульАбиева-х5е
    @АйгульАбиева-х5е ปีที่แล้ว

    Hello
    Tell me please
    The error appears specifically in TabBarView "Controller's length property (5) does not match the number of children (1) present in TabBarView's children property." How can I fix the error? Thanks for your reply

    • @CodingwithT
      @CodingwithT  ปีที่แล้ว +1

      It means your DefaultTabController length is different then TabBarView Screens

  • @blezzkayff3041
    @blezzkayff3041 11 หลายเดือนก่อน

    You are Awesome Bro

    • @CodingwithT
      @CodingwithT  11 หลายเดือนก่อน

      I am glad that you like it. Thank you for your love and support.

    • @fizz1028
      @fizz1028 9 หลายเดือนก่อน

      @@CodingwithT hello sir pls write(share) TBrandCard dart code

  • @naimatiqbal
    @naimatiqbal 4 หลายเดือนก่อน

    where is the TBrand Class?

    • @CodingwithT
      @CodingwithT  3 หลายเดือนก่อน

      I have pinned the comment. Please get it

  • @FarazAmeen-n4j
    @FarazAmeen-n4j ปีที่แล้ว

    BOTTOM OVERFLOWED BY 52 PIXELS how to fix it

    • @CodingwithT
      @CodingwithT  ปีที่แล้ว

      Have you used Listview the way I did?

    • @FarazAmeen-n4j
      @FarazAmeen-n4j ปีที่แล้ว

      @@CodingwithT yes sir i followed all steps but problem are not fix

  • @thyagosouza8087
    @thyagosouza8087 ปีที่แล้ว

    super bro!

  • @saran7403
    @saran7403 6 หลายเดือนก่อน

    Thank you

    • @CodingwithT
      @CodingwithT  6 หลายเดือนก่อน

      You welcome 🎊

  • @ghulammurtaza7959
    @ghulammurtaza7959 ปีที่แล้ว

    Bhai font size barhao android studio ki

  • @aouadicharaf1038
    @aouadicharaf1038 ปีที่แล้ว

    ❤❤❤

  • @mahmoud_hamdy_flutter
    @mahmoud_hamdy_flutter 10 หลายเดือนก่อน

    nice

    • @CodingwithT
      @CodingwithT  10 หลายเดือนก่อน

      Thank you

  • @caob1876
    @caob1876 10 หลายเดือนก่อน

    The page works well but the tab bar wont scroll to the top, it leaves a small space that means that you can see the under elements sliding past. How could i fix this? floating and pinned are true for the sliverappbar. The list view widget in the tabpage causes the gap. I've tried overriding the list view padding, wrapping in safearea and wrapping it in mediaquery.removepadding.

    • @BorisKouglof
      @BorisKouglof 10 หลายเดือนก่อน

      I have exactly the same behavior, obviously this is by design (built inside Flutter library). The gap is only a few pixels high, so it shouldn't display anything from the under layer except if you have no padding.