Advertisement
muhaiminurabir

cart design flutter

Jun 20th, 2025
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 6.28 KB | None | 0 0
  1.  
  2.         floatingActionButton: Padding(
  3.           padding: const EdgeInsets.fromLTRB(20, 8, 20, 8),
  4.           child: SizedBox(
  5.             width: 45,
  6.             height: 45,
  7.             child: FloatingActionButton(
  8.               backgroundColor: ProjectColors().primaryColor,
  9.               shape: RoundedRectangleBorder(
  10.                 borderRadius: BorderRadiusGeometry.circular(30),
  11.               ),
  12.               onPressed: () {
  13.                 Navigator.pushNamed(context, cartPage);
  14.               },
  15.               child: Stack(
  16.                 children: [
  17.                   Align(
  18.                     alignment: Alignment.center,
  19.                     child: SvgPicture.asset(
  20.                       Assets.imagesIcCart,
  21.                       colorFilter:
  22.                           index == 2
  23.                               ? ColorFilter.mode(
  24.                                 ProjectColors().blue1,
  25.                                 BlendMode.srcIn,
  26.                               )
  27.                               : ColorFilter.mode(
  28.                                 ProjectColors().white,
  29.                                 BlendMode.srcIn,
  30.                               ),
  31.                     ),
  32.                   ),
  33.                   context.watch<CartProvider>().cartResponse != null &&
  34.                           context.watch<CartProvider>().cartResponse?.items !=
  35.                               null &&
  36.                           context
  37.                               .watch<CartProvider>()
  38.                               .cartResponse!
  39.                               .items!
  40.                               .isNotEmpty
  41.                       ? Positioned(
  42.                         right: 0,
  43.                         top: 0,
  44.                         child: Card(
  45.                           color: ProjectColors().red1,
  46.                           shape: RoundedRectangleBorder(
  47.                             borderRadius: BorderRadius.circular(100),
  48.                             side: BorderSide(
  49.                               width: 1,
  50.                               color: ProjectColors().white,
  51.                             ),
  52.                           ),
  53.                           child: Padding(
  54.                             padding: EdgeInsetsGeometry.fromLTRB(5, 0, 5, 0),
  55.                             child: Text(
  56.                               context
  57.                                   .watch<CartProvider>()
  58.                                   .cartResponse!
  59.                                   .items!
  60.                                   .length
  61.                                   .toString(),
  62.                               style: GoogleFonts.raleway(
  63.                                 color: ProjectColors().white,
  64.                                 fontSize: 12,
  65.                                 fontWeight: FontWeight.w800,
  66.                               ),
  67.                             ),
  68.                           ),
  69.                         ),
  70.                       )
  71.                       : SizedBox(),
  72.                 ],
  73.               ),
  74.             ),
  75.           ),
  76.         ),
  77.         floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
  78.         floatingActionButton: Padding(
  79.           padding: const EdgeInsets.fromLTRB(20, 8, 20, 8),
  80.           child: SizedBox(
  81.             width: 45,
  82.             height: 45,
  83.             child: FloatingActionButton(
  84.               backgroundColor: ProjectColors().primaryColor,
  85.               shape: RoundedRectangleBorder(
  86.                 borderRadius: BorderRadiusGeometry.circular(30),
  87.               ),
  88.               onPressed: () {
  89.                 Navigator.pushNamed(context, cartPage);
  90.               },
  91.               child: Stack(
  92.                 children: [
  93.                   Align(
  94.                     alignment: Alignment.center,
  95.                     child: SvgPicture.asset(
  96.                       Assets.imagesIcCart,
  97.                       colorFilter:
  98.                           index == 2
  99.                               ? ColorFilter.mode(
  100.                                 ProjectColors().blue1,
  101.                                 BlendMode.srcIn,
  102.                               )
  103.                               : ColorFilter.mode(
  104.                                 ProjectColors().white,
  105.                                 BlendMode.srcIn,
  106.                               ),
  107.                     ),
  108.                   ),
  109.                   context.watch<CartProvider>().cartResponse != null &&
  110.                           context.watch<CartProvider>().cartResponse?.items !=
  111.                               null &&
  112.                           context
  113.                               .watch<CartProvider>()
  114.                               .cartResponse!
  115.                               .items!
  116.                               .isNotEmpty
  117.                       ? Positioned(
  118.                         right: 0,
  119.                         top: 0,
  120.                         child: Card(
  121.                           color: ProjectColors().red1,
  122.                           shape: RoundedRectangleBorder(
  123.                             borderRadius: BorderRadius.circular(100),
  124.                             side: BorderSide(
  125.                               width: 1,
  126.                               color: ProjectColors().white,
  127.                             ),
  128.                           ),
  129.                           child: Padding(
  130.                             padding: EdgeInsetsGeometry.fromLTRB(5, 0, 5, 0),
  131.                             child: Text(
  132.                               context
  133.                                   .watch<CartProvider>()
  134.                                   .cartResponse!
  135.                                   .items!
  136.                                   .length
  137.                                   .toString(),
  138.                               style: GoogleFonts.raleway(
  139.                                 color: ProjectColors().white,
  140.                                 fontSize: 12,
  141.                                 fontWeight: FontWeight.w800,
  142.                               ),
  143.                             ),
  144.                           ),
  145.                         ),
  146.                       )
  147.                       : SizedBox(),
  148.                 ],
  149.               ),
  150.             ),
  151.           ),
  152.         ),
  153.         floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
Tags: cart
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement