Skip to content

Commit

Permalink
Fix #98 问题及优化部分代码 (#99)
Browse files Browse the repository at this point in the history
* Theme: 优化单例实现,初步优化 BrnAllThemeConfig 属性获取不为 null

* refactor:优化theme,暴露非null引用

* theme:去除无用信息及优化部分代码

* theme:增加属性类型

* 优化修复 EventBus

* 迁移example ,优化常量命名,增加export

* migrate brn_empty_status.dart

* 删除 BrnThemeImg

* fix:tagConfig merge方法增加判空处理

* fix:revert tagConfig

* fix:BrnAbnormalStateWidget空处理

* Migrated tabbar to null-safety

* Migrated scroll_anchor to null-safety

* fix:修复迁移tabar问题

* migrate form to null safety

* fix:修复tabbar报错及selection警告信息

* fix:修复迁移问题

* fix:优化迁移部分问题key和style非空问题

* migrate picker to null safety

* fix:修复picker空安全迁移问题

* fix:修复list没指定泛型及if判断错误问题

* fix:migrate dashed line to null safty

* migrate example to null safty

* fix:修复部分example warning

* fix:修复demo报错问题

* fix:追加未跟踪修复

* fix:优化部分接口可空参数为非空

* fix:修复tabar showmore overflow 问题 #98 以及 tabbar 标签颜色默认设置倒置问题

Co-authored-by: violinday <[email protected]>
  • Loading branch information
zhoujuanjuan and violinday authored Feb 16, 2022
1 parent 5401fba commit 140cd43
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 22 deletions.
1 change: 0 additions & 1 deletion lib/src/components/dialog/brn_scrollable_text_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ class BrnScrollableText extends StatelessWidget {
if (onSubmitClick != null) {
onSubmitClick!();
}
Navigator.pop(context);
},
isShowOperateWidget: isShowOperateWidget,
);
Expand Down
30 changes: 14 additions & 16 deletions lib/src/components/tabbar/normal/brn_tab_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import 'package:flutter/rendering.dart';
/// [state]:当前组件的State对象,[BrnTabBarState]
/// [index]:当前组件的角标
typedef BrnTabBarOnTap = Function(BrnTabBarState state, int index);

const double _tagDefaultSize = 75.0;
/// 带小红点的Tabbar
// ignore: must_be_immutable
class BrnTabBar extends StatefulWidget {
Expand Down Expand Up @@ -628,6 +628,7 @@ class BrnTabBarState extends State<BrnTabBar> {
// 更多弹框样式
// ignore: must_be_immutable
class _TabBarOverlayWidget extends StatefulWidget {

List<BadgeTab>? tabs;

String? moreWindowText;
Expand All @@ -637,30 +638,30 @@ class _TabBarOverlayWidget extends StatefulWidget {
BrnTabBarConfig themeData;

/// tag间距
double? spacing;
double spacing;

/// 每行tag数
int? preLineTagCount;
int preLineTagCount;

/// tag高度
double? tagHeight;

_TabBarOverlayWidget(
{this.tabs,
this.moreWindowText,
this.brnTabbarController,
required this.themeData,
this.spacing,
this.preLineTagCount,
this.tagHeight});
this.moreWindowText,
this.brnTabbarController,
required this.themeData,
this.spacing: 12.0,
this.preLineTagCount: 4,
this.tagHeight});

@override
_TabBarOverlayWidgetState createState() => _TabBarOverlayWidgetState();
}

class _TabBarOverlayWidgetState extends State<_TabBarOverlayWidget> {
/// tag宽度
double? _tagWidth;
double _tagWidth = _tagDefaultSize;

double _padding = 20;

Expand Down Expand Up @@ -724,11 +725,8 @@ class _TabBarOverlayWidgetState extends State<_TabBarOverlayWidget> {

Widget _createMoreItems() {
// 计算tag的宽度
_tagWidth = (_parentWidth -
widget.spacing! * (widget.preLineTagCount! - 1) -
_padding * 2) /
widget.preLineTagCount!;

_tagWidth = (_parentWidth - widget.spacing * (widget.preLineTagCount - 1) - _padding * 2) / widget.preLineTagCount;
_tagWidth = _tagWidth <= _tagDefaultSize ? _tagDefaultSize : _tagWidth;
List<Widget> widgets = <Widget>[];
List<BadgeTab>? tabList = widget.tabs;
if (tabList != null && tabList.isNotEmpty) {
Expand All @@ -738,7 +736,7 @@ class _TabBarOverlayWidgetState extends State<_TabBarOverlayWidget> {
}
}
return Wrap(
spacing: widget.spacing!,
spacing: widget.spacing,
runSpacing: 12,
children: widgets,
);
Expand Down
4 changes: 2 additions & 2 deletions lib/src/components/text/brn_expandable_text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class _BrnExpandableTextState extends State<BrnExpandableText> {
ellipsis: 'EllipseText');
tp.layout(maxWidth: size.maxWidth);
if (tp.didExceedMaxLines) {
if (this._expanded!) {
if (this._expanded) {
return _expandedText(context, widget.text);
} else {
return _foldedText(context, widget.text);
Expand Down Expand Up @@ -133,7 +133,7 @@ class _BrnExpandableTextState extends State<BrnExpandableText> {
setState(() {
_expanded = true;
if (null != widget.onExpanded) {
widget.onExpanded!(_expanded!);
widget.onExpanded!(_expanded);
}
});
},
Expand Down
4 changes: 2 additions & 2 deletions lib/src/theme/base/brn_default_config_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -596,12 +596,12 @@ class BrnDefaultConfigUtils {
color: defaultCommonConfig.colorTextBase,
fontSize: defaultCommonConfig.fontSizeCaption,
),
tagNormalBgColor: defaultCommonConfig.brandPrimary.withAlpha(0x14),
tagNormalBgColor: defaultCommonConfig.fillBody,
tagSelectedTextStyle: BrnTextStyle(
color: defaultCommonConfig.brandPrimary,
fontSize: defaultCommonConfig.fontSizeCaption,
),
tagSelectedBgColor: defaultCommonConfig.fillBody,
tagSelectedBgColor: defaultCommonConfig.brandPrimary.withAlpha(0x14),
tagSpacing: 12.0,
preLineTagCount: 4,
tagHeight: 32.0,
Expand Down
1 change: 0 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ dependencies:
photo_view: ^0.13.0
provider: ^6.0.1
badges: ^2.0.2
collection: ^1.15.0

dev_dependencies:
flutter_test:
Expand Down

0 comments on commit 140cd43

Please sign in to comment.