Commit 4edeed61 by tanghuan

setBartitle指令增加控制setting的参数

1 parent 6be9b00f
......@@ -39,6 +39,7 @@ class WebState extends Equatable {
final int titleColor;
final int bgColor;
final String opIcon;
final bool setting;
final bool showAppBar;
final bool showBottomNavBar;
......@@ -80,6 +81,7 @@ class WebState extends Equatable {
this.titleColor = 0xFFFFFFFF,
this.bgColor = 0xFF7691FA,
this.opIcon = 'none',
this.setting = true,
this.showAppBar = true,
this.showBottomNavBar = false,
this.loginOpFlag = false,
......@@ -108,6 +110,7 @@ class WebState extends Equatable {
int? titleColor,
int? bgColor,
String? opIcon,
bool? setting,
bool? showAppBar,
bool? showBottomNavBar,
bool? loginOpFlag,
......@@ -135,6 +138,7 @@ class WebState extends Equatable {
titleColor: titleColor ?? this.titleColor,
bgColor: bgColor ?? this.bgColor,
opIcon: opIcon ?? this.opIcon,
setting: setting ?? this.setting,
showAppBar: showAppBar ?? this.showAppBar,
showBottomNavBar: showBottomNavBar ?? this.showBottomNavBar,
loginOpFlag: loginOpFlag ?? this.loginOpFlag,
......@@ -165,6 +169,7 @@ class WebState extends Equatable {
titleColor,
bgColor,
opIcon,
setting,
showAppBar,
showBottomNavBar,
sessionCode,
......@@ -606,11 +611,11 @@ class WebCubit extends Cubit<WebState> with WidgetsBindingObserver {
_sendResponse(resp);
}
bool setTitleBar(bool hidden, String title, String color, String bgColor, String icon) {
bool setTitleBar(bool hidden, String title, String color, String bgColor, String icon, bool setting) {
int parsedTitleColor = _hexStringToInt(color);
int parsedBgColor = _hexStringToInt(bgColor);
emit(state.copyWith(showAppBar: !hidden, title: title, titleColor: parsedTitleColor, bgColor: parsedBgColor, opIcon: icon));
emit(state.copyWith(showAppBar: !hidden, title: title, titleColor: parsedTitleColor, bgColor: parsedBgColor, opIcon: icon, setting: setting));
return true;
}
......
......@@ -25,8 +25,9 @@ class TitleBarHandler extends MessageHandler {
final String color = params['color'] as String;
final String bgColor = params['bgColor'] as String;
final String icon = params['icon'] as String;
final bool setting = params['setting'] as bool? ?? true;
return _webCubit!.setTitleBar(hidden, title, color, bgColor, icon);
return _webCubit!.setTitleBar(hidden, title, color, bgColor, icon, setting);
} finally {
_unfollowCubit();
}
......
......@@ -202,12 +202,14 @@ class WebPage extends StatelessWidget {
)
: null),
actions: [
IconButton(
state.setting
? IconButton(
icon: const Icon(Icons.settings),
onPressed: () {
router.push('/setting');
},
),
)
: const SizedBox.shrink(),
],
toolbarHeight: 40.0,
);
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!