import 'package:farm_tpf/utils/const_color.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; class AppBarWidget extends StatelessWidget implements PreferredSizeWidget { final bool isBack; final Widget? action; AppBarWidget({this.isBack = true, this.action}); @override Widget build(BuildContext context) { return Container( child: AppBar( backgroundColor: Colors.white, elevation: 0, centerTitle: false, title: isBack ? Row( mainAxisSize: MainAxisSize.min, children: [ InkWell( onTap: () { if (Get.isSnackbarOpen) Get.back(); Get.back(); }, child: Row( children: [ Icon( Icons.keyboard_arrow_left, color: AppColors.YELLOW, size: 35, ), Text( 'Quay lại', maxLines: 1, style: TextStyle(color: AppColors.YELLOW, fontWeight: FontWeight.normal), ), ], ), ), Expanded(child: Container()), Align( alignment: Alignment.centerRight, child: action ?? SizedBox(), ) ], ) : SizedBox(), automaticallyImplyLeading: false, actions: [SizedBox()], ), ); } @override Size get preferredSize => AppBar().preferredSize; }