FahimHoque

appbar

Dec 14th, 2021 (edited)
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 3.84 KB | None | 0 0
  1. import 'package:app/src/components/buttons/about_merchant_button.dart';
  2. import 'package:app/src/components/buttons/back_button.dart';
  3. import 'package:app/src/components/buttons/follow_button.dart';
  4. import 'package:app/src/components/buttons/search_button.dart';
  5. import 'package:app/src/components/cards/followers_count_card.dart';
  6. import 'package:app/src/components/cards/merchant_thumbnail_card.dart';
  7. import 'package:app/src/models/merchant_model.dart';
  8. import 'package:flutter/material.dart';
  9.  
  10. class SingleMerchantAppBar extends StatefulWidget {
  11.   final MerchantModel? merchant;
  12.   const SingleMerchantAppBar({
  13.     Key? key,
  14.     this.merchant,
  15.   }) : super(key: key);
  16.  
  17.   @override
  18.   _SingleMerchantAppBarState createState() => _SingleMerchantAppBarState();
  19. }
  20.  
  21. class _SingleMerchantAppBarState extends State<SingleMerchantAppBar> {
  22.   @override
  23.   Widget build(BuildContext context) {
  24.     return Stack(
  25.       children: [
  26.         _buildBackgroundImage(context),
  27.         Container(
  28.           padding: EdgeInsets.all(20),
  29.           child: Column(
  30.             crossAxisAlignment: CrossAxisAlignment.start,
  31.             children: [
  32.               Row(
  33.                 mainAxisAlignment: MainAxisAlignment.spaceBetween,
  34.                 children: <Widget>[
  35.                   CustomBackButton(
  36.                     greyBackground: true,
  37.                   ),
  38.                   CustomSearchButton(
  39.                     greyBackground: true,
  40.                     onPressed: () {},
  41.                   ),
  42.                 ],
  43.               ),
  44.               SizedBox(
  45.                 height: 30,
  46.               ),
  47.               Row(
  48.                 crossAxisAlignment: CrossAxisAlignment.start,
  49.                 children: <Widget>[
  50.                   MerchantThumbnailCard(
  51.                     imageUrl: "assets/images/aarong_logo_small.png",
  52.                   ),
  53.                   SizedBox(width: 15),
  54.                   Column(
  55.                     crossAxisAlignment: CrossAxisAlignment.start,
  56.                     children: [
  57.                       _buildNameAndRating(),
  58.                       SizedBox(
  59.                         height: 15,
  60.                       ),
  61.                       _buildFollowRow(context),
  62.                     ],
  63.                   ),
  64.                 ],
  65.               ),
  66.             ],
  67.           ),
  68.         ),
  69.       ],
  70.     );
  71.   }
  72.  
  73.   Widget _buildFollowRow(BuildContext context) {
  74.     return Row(
  75.       children: <Widget>[
  76.         FollowButton(onPressed: () {}),
  77.         SizedBox(width: 20),
  78.         FollowersCountCard(),
  79.         SizedBox(width: 20),
  80.         AboutMerchantButton(onPressed: () {}),
  81.       ],
  82.     );
  83.   }
  84.  
  85.   Widget _buildBackgroundImage(BuildContext context) {
  86.     return Container(
  87.       decoration: BoxDecoration(
  88.         borderRadius: BorderRadius.only(
  89.           bottomRight: Radius.circular(20.0),
  90.           bottomLeft: Radius.circular(20.0),
  91.         ),
  92.         image: DecorationImage(
  93.           image: AssetImage('assets/images/mock_aarong_background_1.png'),
  94.           fit: BoxFit.fitWidth,
  95.         ),
  96.       ),
  97.     );
  98.   }
  99.  
  100.   Widget _buildNameAndRating() {
  101.     return Row(
  102.       children: <Widget>[
  103.         Text(
  104.           'AARONG',
  105.           style: TextStyle(
  106.             color: Colors.white,
  107.             fontSize: 18,
  108.             fontWeight: FontWeight.w600,
  109.           ),
  110.         ),
  111.         SizedBox(width: 30),
  112.         _buildRating(context),
  113.       ],
  114.     );
  115.   }
  116.  
  117.   Widget _buildRating(BuildContext context) {
  118.     return Row(
  119.       children: <Widget>[
  120.         Icon(
  121.           Icons.star,
  122.           color: Colors.amber,
  123.           size: 20,
  124.         ),
  125.         SizedBox(width: 5),
  126.         Text(
  127.           "4.5",
  128.           style: TextStyle(
  129.             color: Colors.white,
  130.             fontSize: 18,
  131.             fontWeight: FontWeight.w600,
  132.           ),
  133.         )
  134.       ],
  135.     );
  136.   }
  137. }
  138.  
Add Comment
Please, Sign In to add comment