1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- import 'package:flutter/material.dart';
- import 'package:ftrecruiter/generated/assets.dart';
- import 'package:get/get.dart';
- import 'package:ftrecruiter/comm/constants/color_constants.dart';
- import 'package:ftrecruiter/comm/widget/my_load_image.dart';
- import 'package:ftrecruiter/comm/utils/dark_theme_util.dart';
- import 'package:ftrecruiter/local/theme/theme_config.dart';
- class CommonWidget {
- //封装AppBar
- static AppBar appBar(BuildContext context, String title,
- {void Function()? backCallback,
- String? backPath,
- Color textColor = Colors.black,
- Color backgroundColor = Colors.white,
- List<Widget>? actions}) {
- return AppBar(
- leading: Container(
- padding: const EdgeInsets.only(top: 3.5),
- child: IconButton(
- icon: Get.isDarkMode
- ? MyAssetImage(backPath ?? Assets.imagesWhiteBack, width: 22, height: 22)
- : MyAssetImage(backPath ?? Assets.imagesBlackBack, width: 22, height: 22),
- onPressed: () {
- if (backCallback != null) {
- backCallback();
- } else {
- Get.back();
- // Navigator.pop(context);
- }
- },
- ),
- ),
- centerTitle: true,
- title: Text(
- title,
- style: TextStyle(color: Get.isDarkMode ? Colors.white : textColor, fontSize: 18, fontWeight: FontWeight.w500),
- ),
- actions: actions,
- backgroundColor: DarkThemeUtil.multiColors(backgroundColor),
- elevation: 0.0,
- bottom: const PreferredSize(
- preferredSize: Size.fromHeight(0.5),
- child: Divider(
- height: 1.0,
- indent: 0.0,
- color: ColorConstants.dividerColor,
- )),
- );
- }
- //自定义高度快
- static SizedBox rowHeight({double height = 30}) {
- return SizedBox(height: height);
- }
- //自定义宽度快
- static SizedBox rowWidth({double width = 30}) {
- return SizedBox(width: width);
- }
- }
|