101 lines
3.0 KiB
Dart
101 lines
3.0 KiB
Dart
// ignore_for_file: non_constant_identifier_names, file_names, prefer_const_constructors
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:traderscircuit/Utils/text.dart';
|
|
|
|
class CommonAppbar extends StatelessWidget implements PreferredSizeWidget {
|
|
@override
|
|
Size get preferredSize => Size.fromHeight(height!);
|
|
const CommonAppbar(
|
|
{Key? key,
|
|
required this.titleTxt,
|
|
this.suffixIcon,
|
|
this.showLeading = true,
|
|
this.customBack,
|
|
this.backPageName = '',
|
|
this.customActionWidget,
|
|
this.onCustomActionPressed,
|
|
this.height = 105})
|
|
: super(key: key);
|
|
|
|
final String titleTxt;
|
|
final String? suffixIcon;
|
|
final bool? showLeading;
|
|
final bool? customBack;
|
|
final String? backPageName;
|
|
final Widget? customActionWidget;
|
|
final VoidCallback? onCustomActionPressed;
|
|
final double? height;
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return PreferredSize(
|
|
preferredSize: Size.fromHeight(height ?? 130),
|
|
child: AppBar(
|
|
scrolledUnderElevation: 0.0,
|
|
backgroundColor: Colors.black,
|
|
elevation: 0,
|
|
leadingWidth: 56.w,
|
|
leading: Padding(
|
|
padding: EdgeInsets.only(left: 16.w, top: 20.h),
|
|
child: GestureDetector(
|
|
onTap: () {
|
|
customBack ?? false ? Get.toNamed(backPageName!) : Get.back();
|
|
},
|
|
child: Padding(
|
|
padding: EdgeInsets.only(left: 8.w),
|
|
child: Icon(
|
|
Icons.arrow_back_ios,
|
|
color: Colors.white,
|
|
size: 25.r,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
flexibleSpace: FlexibleSpaceBar(
|
|
centerTitle: false,
|
|
titlePadding: EdgeInsets.all(0),
|
|
title: Padding(
|
|
padding: EdgeInsets.only(left: 16.w, right: 16),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
children: [
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Text(
|
|
titleTxt,
|
|
style: TextStyle(
|
|
color: Colors.white,
|
|
fontSize: 24.sp,
|
|
fontWeight: FontWeight.w500,
|
|
fontFamily: 'hiragino'),
|
|
maxLines: 2,
|
|
softWrap: true,
|
|
),
|
|
],
|
|
),
|
|
|
|
// newTextfield(
|
|
// FontWeight.w400, 0)
|
|
],
|
|
),
|
|
),
|
|
),
|
|
actions: [
|
|
if (customActionWidget != null)
|
|
InkWell(
|
|
onTap: onCustomActionPressed,
|
|
child: Padding(
|
|
padding: EdgeInsets.only(right: 14.w),
|
|
child: customActionWidget,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|