|
@@ -1,3 +1,4 @@
|
|
|
+import 'package:cs_resources/generated/assets.dart';
|
|
|
import 'package:cs_resources/theme/app_colors_theme.dart';
|
|
|
import 'package:cs_resources/theme/theme_config.dart';
|
|
|
import 'package:flutter/cupertino.dart';
|
|
@@ -14,9 +15,9 @@ class MyAppBar {
|
|
|
static AppBar appBar(BuildContext context, String title,
|
|
|
{void Function()? backCallback,
|
|
|
Key? key,
|
|
|
- String? backIconPath,
|
|
|
- double? backIconWidth,
|
|
|
- double? backIconHeight,
|
|
|
+ String? backIconPath = Assets.baseLibNavbarBackIcon,
|
|
|
+ double? backIconWidth = 44,
|
|
|
+ double? backIconHeight = 44,
|
|
|
String? subTitle,
|
|
|
Color backgroundColor = Colors.transparent,
|
|
|
Color? titleColor,
|
|
@@ -42,7 +43,13 @@ class MyAppBar {
|
|
|
width: backIconWidth ?? 11,
|
|
|
height: backIconHeight ?? 18,
|
|
|
),
|
|
|
- onPressed: backCallback,
|
|
|
+ onPressed: (){
|
|
|
+ if (backCallback != null) {
|
|
|
+ backCallback();
|
|
|
+ } else {
|
|
|
+ appRouter.maybePop();
|
|
|
+ }
|
|
|
+ },
|
|
|
)
|
|
|
: null) // 使用系统默认返回按钮
|
|
|
: const SizedBox.shrink(),
|
|
@@ -87,9 +94,9 @@ class MyAppBar {
|
|
|
{void Function()? backCallback,
|
|
|
String? value,
|
|
|
String? hintText,
|
|
|
- String? backIconPath,
|
|
|
- double? backIconWidth,
|
|
|
- double? backIconHeight,
|
|
|
+ String? backIconPath = Assets.baseLibNavbarBackIcon,
|
|
|
+ double? backIconWidth = 44,
|
|
|
+ double? backIconHeight = 44,
|
|
|
Color textColor = Colors.black,
|
|
|
Color backgroundColor = Colors.transparent,
|
|
|
ValueChanged<String>? onSearch,
|
|
@@ -115,7 +122,13 @@ class MyAppBar {
|
|
|
width: backIconWidth ?? 11,
|
|
|
height: backIconHeight ?? 18,
|
|
|
),
|
|
|
- onPressed: backCallback,
|
|
|
+ onPressed: (){
|
|
|
+ if (backCallback != null) {
|
|
|
+ backCallback();
|
|
|
+ } else {
|
|
|
+ appRouter.maybePop();
|
|
|
+ }
|
|
|
+ },
|
|
|
)
|
|
|
: null,
|
|
|
iconTheme: IconThemeData(color: isDarkMode ? Colors.white : Theme.of(context).colorScheme.primary),
|
|
@@ -146,9 +159,9 @@ class MyAppBar {
|
|
|
BuildContext context,
|
|
|
String title, {
|
|
|
void Function()? backCallback,
|
|
|
- String? backIconPath,
|
|
|
- double? backIconWidth,
|
|
|
- double? backIconHeight,
|
|
|
+ String? backIconPath = Assets.baseLibNavbarBackIcon,
|
|
|
+ double? backIconWidth = 44,
|
|
|
+ double? backIconHeight = 44,
|
|
|
String? subTitle,
|
|
|
Color backgroundColor = Colors.transparent,
|
|
|
bool showBottomDivider = false,
|
|
@@ -265,9 +278,9 @@ class MyAppBar {
|
|
|
void Function()? backCallback,
|
|
|
String? value,
|
|
|
String? hintText,
|
|
|
- String? backIconPath,
|
|
|
- double? backIconWidth,
|
|
|
- double? backIconHeight,
|
|
|
+ String? backIconPath = Assets.baseLibNavbarBackIcon,
|
|
|
+ double? backIconWidth = 44,
|
|
|
+ double? backIconHeight = 44,
|
|
|
Color backgroundColor = Colors.transparent,
|
|
|
ValueChanged<String>? onSearch,
|
|
|
ValueChanged<String>? onChanged,
|