|
- 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
- ? InkWell(
- child: Row(
- mainAxisSize: MainAxisSize.min,
- 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),
- ),
- SizedBox(width: 4),
- Expanded(
- child: Align(
- alignment: Alignment.centerRight,
- child: action ?? SizedBox(),
- ))
- ],
- ),
- onTap: () {
- if (Get.isSnackbarOpen) Get.back();
- Get.back();
- },
- )
- : SizedBox(),
- automaticallyImplyLeading: false,
- actions: [SizedBox()],
- ),
- );
- }
-
- @override
- Size get preferredSize => AppBar().preferredSize;
- }
|