Commit 501d7919 by tanghuan

setBartitle指令增加控制setting的参数

1 parent aa0eb17a
...@@ -40,6 +40,7 @@ class WebState extends Equatable { ...@@ -40,6 +40,7 @@ class WebState extends Equatable {
final int titleColor; final int titleColor;
final int bgColor; final int bgColor;
final String opIcon; final String opIcon;
final bool setting;
final bool showAppBar; final bool showAppBar;
final bool showBottomNavBar; final bool showBottomNavBar;
...@@ -81,6 +82,7 @@ class WebState extends Equatable { ...@@ -81,6 +82,7 @@ class WebState extends Equatable {
this.titleColor = 0xFFFFFFFF, this.titleColor = 0xFFFFFFFF,
this.bgColor = 0xFF7691FA, this.bgColor = 0xFF7691FA,
this.opIcon = 'none', this.opIcon = 'none',
this.setting = true,
this.showAppBar = true, this.showAppBar = true,
this.showBottomNavBar = false, this.showBottomNavBar = false,
this.loginOpFlag = false, this.loginOpFlag = false,
...@@ -109,6 +111,7 @@ class WebState extends Equatable { ...@@ -109,6 +111,7 @@ class WebState extends Equatable {
int? titleColor, int? titleColor,
int? bgColor, int? bgColor,
String? opIcon, String? opIcon,
bool? setting,
bool? showAppBar, bool? showAppBar,
bool? showBottomNavBar, bool? showBottomNavBar,
bool? loginOpFlag, bool? loginOpFlag,
...@@ -136,6 +139,7 @@ class WebState extends Equatable { ...@@ -136,6 +139,7 @@ class WebState extends Equatable {
titleColor: titleColor ?? this.titleColor, titleColor: titleColor ?? this.titleColor,
bgColor: bgColor ?? this.bgColor, bgColor: bgColor ?? this.bgColor,
opIcon: opIcon ?? this.opIcon, opIcon: opIcon ?? this.opIcon,
setting: setting ?? this.setting,
showAppBar: showAppBar ?? this.showAppBar, showAppBar: showAppBar ?? this.showAppBar,
showBottomNavBar: showBottomNavBar ?? this.showBottomNavBar, showBottomNavBar: showBottomNavBar ?? this.showBottomNavBar,
loginOpFlag: loginOpFlag ?? this.loginOpFlag, loginOpFlag: loginOpFlag ?? this.loginOpFlag,
...@@ -166,6 +170,7 @@ class WebState extends Equatable { ...@@ -166,6 +170,7 @@ class WebState extends Equatable {
titleColor, titleColor,
bgColor, bgColor,
opIcon, opIcon,
setting,
showAppBar, showAppBar,
showBottomNavBar, showBottomNavBar,
sessionCode, sessionCode,
...@@ -610,11 +615,11 @@ class WebCubit extends Cubit<WebState> with WidgetsBindingObserver { ...@@ -610,11 +615,11 @@ class WebCubit extends Cubit<WebState> with WidgetsBindingObserver {
_sendResponse(resp); _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 parsedTitleColor = _hexStringToInt(color);
int parsedBgColor = _hexStringToInt(bgColor); 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; return true;
} }
......
...@@ -25,8 +25,9 @@ class TitleBarHandler extends MessageHandler { ...@@ -25,8 +25,9 @@ class TitleBarHandler extends MessageHandler {
final String color = params['color'] as String; final String color = params['color'] as String;
final String bgColor = params['bgColor'] as String; final String bgColor = params['bgColor'] as String;
final String icon = params['icon'] 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 { } finally {
_unfollowCubit(); _unfollowCubit();
} }
......
...@@ -202,12 +202,14 @@ class WebPage extends StatelessWidget { ...@@ -202,12 +202,14 @@ class WebPage extends StatelessWidget {
) )
: null), : null),
actions: [ actions: [
IconButton( state.setting
? IconButton(
icon: const Icon(Icons.settings), icon: const Icon(Icons.settings),
onPressed: () { onPressed: () {
router.push('/setting'); router.push('/setting');
}, },
), )
: const SizedBox.shrink(),
], ],
toolbarHeight: 40.0, 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!