12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- import 'package:flutter/material.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/images/blue_back.png", width: 15, height: 22.5, color: Colors.white)
- : MyAssetImage(backPath ?? "assets/images/blue_back.png", width: 15, height: 22.5),
- 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),
- ),
- 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);
- }
- }
|