Untitled

 avatar
unknown
dart
2 years ago
5.2 kB
3
Indexable
import 'dart:math' as math;

import 'package:centro/app/services/translation_service.dart';
import 'package:centro/app/utilities/constants/app_colors.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:get/get.dart';

class PrimaryAppBar extends StatelessWidget implements PreferredSizeWidget {
  final bool? showBackButton;

  const PrimaryAppBar({super.key, this.showBackButton});

  @override
  Size get preferredSize => Size.fromHeight(Get.width * 0.2);

  @override
  Widget build(BuildContext context) {
    return PreferredSize(
      preferredSize: preferredSize,
      child: Container(
        decoration: const BoxDecoration(
          // borderRadius: BorderRadius.only(
          //   bottomLeft: Radius.elliptical(200, 10),
          //   bottomRight: Radius.elliptical(200, 10),
          // ),
          // color: AppColors.black,
          borderRadius: BorderRadius.vertical(
            bottom: Radius.elliptical(250, 15),
          ),
          image: DecorationImage(
            image: AssetImage('assets/images/appbar.png'),
            fit: BoxFit.fill,
          ),
        ),
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceAround,
          crossAxisAlignment: CrossAxisAlignment.stretch,
          children: [
            Row(
              children: [
                showBackButton == true
                    ? InkWell(
                        onTap: () {
                          Get.back();
                        },
                        radius: 100,
                        child: Transform.rotate(
                          angle: TranslationService().isLocaleArabic() ? (180 * math.pi / 180) : 0,
                          child: SvgPicture.asset(
                            'assets/icons/backArrow.svg',
                            width: Get.width * 0.06,
                          ),
                        ),
                      )
                    : InkWell(
                        onTap: () {},
                        child: SvgPicture.asset(
                          'assets/icons/search.svg',
                          width: Get.width * 0.05,
                        ),
                      ),
                const SizedBox(width: 16),
                SvgPicture.asset(
                  'assets/icons/search.svg',
                  width: Get.width * 0.05,
                  color: Colors.transparent,
                ),
                SvgPicture.asset(
                  'assets/icons/comments.svg',
                  width: Get.width * 0.05,
                  color: Colors.transparent,
                ),
              ],
            ),
            // const Spacer(
            //   flex: 3,
            // ),
            SvgPicture.asset(
              'assets/icons/MinistryLogo.svg',
              color: AppColors.white,
              width: Get.width * 0.25,
            ),
            // const Spacer(
            //   flex: 2,
            // ),
            Row(
              children: [
                showBackButton == true
                    ? InkWell(
                        onTap: () {},
                        child: SvgPicture.asset(
                          'assets/icons/search.svg',
                          width: Get.width * 0.05,
                        ),
                      )
                    : SvgPicture.asset(
                        'assets/icons/search.svg',
                        width: Get.width * 0.05,
                        color: Colors.transparent,
                      ),
                const SizedBox(width: 16),
                InkWell(
                  onTap: () {},
                  child: Stack(
                    alignment: Alignment.topRight,
                    children: [
                      SvgPicture.asset(
                        'assets/icons/comments.svg',
                        width: Get.width * 0.05,
                      ),
                      ClipOval(
                        child: Container(
                          color: AppColors.red,
                          width: 8,
                          height: 8,
                        ),
                      ),
                    ],
                  ),
                ),
                const SizedBox(width: 16),
                InkWell(
                  onTap: () {},
                  child: Stack(
                    alignment: Alignment.topRight,
                    children: [
                      SvgPicture.asset(
                        'assets/icons/notifications.svg',
                        width: Get.width * 0.05,
                      ),
                      ClipOval(
                        child: Container(
                          color: AppColors.red,
                          width: 8,
                          height: 8,
                        ),
                      ),
                    ],
                  ),
                ),
              ],
            ),
          ],
        ),
      ),
    );
  }
}
Editor is loading...