| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- import 'package:flutter/cupertino.dart';
- import 'package:flutter/material.dart';
- import 'package:flutter_screenutil/flutter_screenutil.dart';
- import '../resource/assets.gen.dart';
- import '../resource/colors.gen.dart';
- class CommonView {
- static Widget getBackBtnView() {
- return Container(
- padding: EdgeInsets.all(3.w),
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.all(Radius.circular(10.w))),
- child: Assets.images.iconBlackBack.image(width: 24.w, height: 24.w));
- }
- static Widget buildAppBar(String title,
- {VoidCallback? backOnTap, Widget? rightWidget, bool titleCenter = true}) {
- return Container(
- width: double.infinity,
- padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 14.w),
- child: Stack(
- children: [
- GestureDetector(onTap: backOnTap, child: CommonView.getBackBtnView()),
- Positioned(
- left: titleCenter ? 0 : 40.w,
- right: titleCenter ? 0 : null,
- top: 0,
- bottom: 0,
- child: Center(
- child: Text(title,
- style: TextStyle(
- height: 1,
- fontSize: 16.sp,
- color: ColorName.black90,
- fontWeight: FontWeight.bold)),
- ),
- ),
- if (rightWidget != null)
- Positioned(
- right: 0,
- top: 0,
- bottom: 0,
- child: rightWidget,
- )
- ],
- ),
- );
- }
- }
|