diff --git a/lib/src/components/popup/brn_popup_window.dart b/lib/src/components/popup/brn_popup_window.dart index 796fc00a..e0e724f0 100644 --- a/lib/src/components/popup/brn_popup_window.dart +++ b/lib/src/components/popup/brn_popup_window.dart @@ -4,6 +4,7 @@ import 'package:bruno/src/constants/brn_asset_constants.dart'; import 'package:bruno/src/theme/brn_theme_configurator.dart'; import 'package:bruno/src/utils/brn_text_util.dart'; import 'package:bruno/src/utils/brn_tools.dart'; +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; /// popup window 位于 targetView 的方向 @@ -192,7 +193,7 @@ class _BrnPopupWindowState extends State { void initState() { super.initState(); this._showRect = _getWidgetGlobalRect(widget.popKey); - this._screenSize = View.of(context).physicalSize / View.of(context).devicePixelRatio; + this._screenSize =PlatformDispatcher.instance.views.first.physicalSize/ PlatformDispatcher.instance.views.first.devicePixelRatio; _borderColor = (widget.borderColor ?? Colors.transparent).withAlpha(255); _backgroundColor = (widget.backgroundColor ?? Colors.transparent).withAlpha(255); diff --git a/lib/src/components/tabbar/normal/brn_tab_bar.dart b/lib/src/components/tabbar/normal/brn_tab_bar.dart index 279ae75b..366afd8e 100644 --- a/lib/src/components/tabbar/normal/brn_tab_bar.dart +++ b/lib/src/components/tabbar/normal/brn_tab_bar.dart @@ -177,10 +177,10 @@ class BrnTabBarState extends State { late double _largeSize; /// 小红点上偏移量 - double _paddingTop = 0; + double _dy = 0; /// 小红点右偏移量 - double _paddingRight = 0; + double _dx = 0; /// 展开更多的按钮宽度 final double _moreSpacing = 50; @@ -408,7 +408,8 @@ class BrnTabBarState extends State { color: Color(0xFFFFFFFF), fontSize: 10, height: 1), ), backgroundColor: Colors.red, - alignment: AlignmentDirectional(_paddingRight, _paddingTop), + alignment: Alignment.topLeft, + offset:Offset(_dx,_dy) , padding: _badgePadding, largeSize: _largeSize, child: Text( @@ -483,7 +484,8 @@ class BrnTabBarState extends State { style: TextStyle( color: Color(0xFFFFFFFF), fontSize: 10, height: 1), ), - alignment: AlignmentDirectional(_paddingRight, _paddingTop), + alignment: Alignment.topLeft, + offset: Offset(_dx,_dy), padding: _badgePadding, largeSize: _largeSize, child: Text(badgeTab.text!, @@ -512,7 +514,7 @@ class BrnTabBarState extends State { /// 计算小红点尺寸相关参数 void caculateBadgeParams(BadgeTab badgeTab, BoxConstraints constraints) { - _paddingTop = -5.0; + _dy = -5.0; if (badgeTab.badgeNum != null) { if (badgeTab.badgeNum! < 10) { @@ -537,7 +539,7 @@ class BrnTabBarState extends State { _badgePadding = EdgeInsets.only(left: 4.0, right: 4.0); _largeSize = 8.0; _badgeText = ""; - _paddingTop = 1.0; + _dy = 1.0; } } @@ -574,10 +576,10 @@ class BrnTabBarState extends State { // if(_badgeWidth > (constraints.maxWidth + _labelPadding.right)){ // _paddingRight = 0.0; // }else{ - _paddingRight = constraints.maxWidth + _labelPadding.right - _badgeWidth; + _dx = constraints.maxWidth + _labelPadding.right - _badgeWidth; // } } else { - _paddingRight = _tabTextWidth; + _dx = _tabTextWidth; } }