Skip to content

Commit

Permalink
Merge branch 'LianjiaTech:3.x' into 3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
zhoujuanjuan authored Sep 13, 2023
2 parents ad536e0 + acc11e8 commit 6d5efd2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
3 changes: 2 additions & 1 deletion lib/src/components/popup/brn_popup_window.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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 的方向
Expand Down Expand Up @@ -192,7 +193,7 @@ class _BrnPopupWindowState extends State<BrnPopupWindow> {
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);
Expand Down
18 changes: 10 additions & 8 deletions lib/src/components/tabbar/normal/brn_tab_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,10 @@ class BrnTabBarState extends State<BrnTabBar> {
late double _largeSize;

/// 小红点上偏移量
double _paddingTop = 0;
double _dy = 0;

/// 小红点右偏移量
double _paddingRight = 0;
double _dx = 0;

/// 展开更多的按钮宽度
final double _moreSpacing = 50;
Expand Down Expand Up @@ -408,7 +408,8 @@ class BrnTabBarState extends State<BrnTabBar> {
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(
Expand Down Expand Up @@ -483,7 +484,8 @@ class BrnTabBarState extends State<BrnTabBar> {
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!,
Expand Down Expand Up @@ -512,7 +514,7 @@ class BrnTabBarState extends State<BrnTabBar> {

/// 计算小红点尺寸相关参数
void caculateBadgeParams(BadgeTab badgeTab, BoxConstraints constraints) {
_paddingTop = -5.0;
_dy = -5.0;

if (badgeTab.badgeNum != null) {
if (badgeTab.badgeNum! < 10) {
Expand All @@ -537,7 +539,7 @@ class BrnTabBarState extends State<BrnTabBar> {
_badgePadding = EdgeInsets.only(left: 4.0, right: 4.0);
_largeSize = 8.0;
_badgeText = "";
_paddingTop = 1.0;
_dy = 1.0;
}
}

Expand Down Expand Up @@ -574,10 +576,10 @@ class BrnTabBarState extends State<BrnTabBar> {
// 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;
}
}

Expand Down

0 comments on commit 6d5efd2

Please sign in to comment.