Commit 4edeed61 by tanghuan

setBartitle指令增加控制setting的参数

1 parent 6be9b00f
...@@ -39,6 +39,7 @@ class WebState extends Equatable { ...@@ -39,6 +39,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;
...@@ -80,6 +81,7 @@ class WebState extends Equatable { ...@@ -80,6 +81,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,
...@@ -108,6 +110,7 @@ class WebState extends Equatable { ...@@ -108,6 +110,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,
...@@ -135,6 +138,7 @@ class WebState extends Equatable { ...@@ -135,6 +138,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,
...@@ -165,6 +169,7 @@ class WebState extends Equatable { ...@@ -165,6 +169,7 @@ class WebState extends Equatable {
titleColor, titleColor,
bgColor, bgColor,
opIcon, opIcon,
setting,
showAppBar, showAppBar,
showBottomNavBar, showBottomNavBar,
sessionCode, sessionCode,
...@@ -606,11 +611,11 @@ class WebCubit extends Cubit<WebState> with WidgetsBindingObserver { ...@@ -606,11 +611,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
icon: const Icon(Icons.settings), ? IconButton(
onPressed: () { icon: const Icon(Icons.settings),
router.push('/setting'); onPressed: () {
}, 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!