From 9ef79cf9c183b60488cceb7a222529461ebef8ce Mon Sep 17 00:00:00 2001 From: Sandy <15143015732@163.com> Date: Thu, 13 Apr 2023 10:02:26 +0800 Subject: [PATCH 01/12] remove attribute tipLabel (#439) --- .../form/group_example/expansion_group_example.dart | 1 - .../form/group_example/normal_group_example.dart | 1 - .../items/group/brn_expandable_group_with_opreate.dart | 8 -------- lib/src/components/form/items/group/brn_normal_group.dart | 8 -------- 4 files changed, 18 deletions(-) diff --git a/example/lib/sample/components/form/group_example/expansion_group_example.dart b/example/lib/sample/components/form/group_example/expansion_group_example.dart index 9d2f2d98..2c91af66 100644 --- a/example/lib/sample/components/form/group_example/expansion_group_example.dart +++ b/example/lib/sample/components/form/group_example/expansion_group_example.dart @@ -104,7 +104,6 @@ class ExpansionGroupExample extends StatelessWidget { title: "展开收起分组", subTitle: "这里是副标题", deleteLabel: "删除", - tipLabel: "标签", error: "必填项不能为空", isRequire: true, isEdit: true, diff --git a/example/lib/sample/components/form/group_example/normal_group_example.dart b/example/lib/sample/components/form/group_example/normal_group_example.dart index 5b4b133a..2b1df98f 100644 --- a/example/lib/sample/components/form/group_example/normal_group_example.dart +++ b/example/lib/sample/components/form/group_example/normal_group_example.dart @@ -66,7 +66,6 @@ class NormalGroupExample extends StatelessWidget { title: "普通分组", subTitle: "这里是副标题", deleteLabel: "删除", - tipLabel: "标签", error: "必填项不能为空", isRequire: true, isEdit: true, diff --git a/lib/src/components/form/items/group/brn_expandable_group_with_opreate.dart b/lib/src/components/form/items/group/brn_expandable_group_with_opreate.dart index d4df61ce..290c05df 100644 --- a/lib/src/components/form/items/group/brn_expandable_group_with_opreate.dart +++ b/lib/src/components/form/items/group/brn_expandable_group_with_opreate.dart @@ -25,13 +25,6 @@ class BrnExpandFormGroup extends StatefulWidget { /// 录入项子标题 final String? subTitle; - /// 录入项提示(问号图标&文案) 用户点击时触发onTip回调。 - /// 1. 若赋值为 空字符串("")时仅展示"问号"图标, - /// 2. 若赋值为非空字符串时 展示"问号图标&文案", - /// 3. 若不赋值或赋值为null时 不显示提示项 - /// 默认值为 3 - final String? tipLabel; - /// 录入项错误提示 final String error; @@ -66,7 +59,6 @@ class BrnExpandFormGroup extends StatefulWidget { this.label, this.title = "", this.subTitle, - this.tipLabel, this.error = "", this.isEdit = true, this.isRequire = false, diff --git a/lib/src/components/form/items/group/brn_normal_group.dart b/lib/src/components/form/items/group/brn_normal_group.dart index af71d4b8..22a619d7 100644 --- a/lib/src/components/form/items/group/brn_normal_group.dart +++ b/lib/src/components/form/items/group/brn_normal_group.dart @@ -26,13 +26,6 @@ class BrnNormalFormGroup extends StatefulWidget { /// 录入项子标题 final String? subTitle; - /// 录入项提示(问号图标&文案) 用户点击时触发onTip回调。 - /// 1. 若赋值为 空字符串("")时仅展示"问号"图标, - /// 2. 若赋值为非空字符串时 展示"问号图标&文案", - /// 3. 若不赋值或赋值为null时 不显示提示项 - /// 默认值为 3 - final String? tipLabel; - /// 录入项错误提示 final String error; @@ -62,7 +55,6 @@ class BrnNormalFormGroup extends StatefulWidget { this.label, this.title = "", this.subTitle, - this.tipLabel, this.error = "", this.isEdit = true, this.isRequire = false, From 65d7dcdead96ba83d99843dbdffe0ca64c0e502b Mon Sep 17 00:00:00 2001 From: Sandy <15143015732@163.com> Date: Fri, 14 Apr 2023 11:17:02 +0800 Subject: [PATCH 02/12] fix the overlap of the icon and text positions (#440) * fix the overlap of the icon and text positions * update constraint layout --- lib/src/components/button/brn_icon_button.dart | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/src/components/button/brn_icon_button.dart b/lib/src/components/button/brn_icon_button.dart index 70b371da..074dafe8 100644 --- a/lib/src/components/button/brn_icon_button.dart +++ b/lib/src/components/button/brn_icon_button.dart @@ -95,7 +95,12 @@ class _BrnIconButtonState extends State { children: [ // 图片 Container( - height: widget.iconHeight, width: widget.iconWidth, child: widget.iconWidget), + height: widget.iconHeight, + width: widget.iconWidth, + child: FittedBox( + fit: BoxFit.contain, + child: widget.iconWidget), + ), Padding( padding: EdgeInsets.only(top: widget.padding), child: Text( From c3737a16d43cfc4eb1c481cb965544ce5aab0c7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=20v?= Date: Sun, 23 Jul 2023 18:39:37 +0800 Subject: [PATCH 03/12] Update build_test.yml --- .github/workflows/build_test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index 616607cf..272227f9 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -17,7 +17,7 @@ jobs: - uses: actions/checkout@v3 - uses: subosito/flutter-action@v2 with: - flutter-version: '3.3.0' + flutter-version: '3.7.0' - run: dart --version - run: flutter --version - run: flutter pub get @@ -37,7 +37,7 @@ jobs: java-version: '8.x' - uses: subosito/flutter-action@v1 with: - flutter-version: '3.3.0' + flutter-version: '3.7.0' - run: dart --version - run: flutter --version - run: flutter pub get From 53c5e100579b0cc358f37bb321313682b75fd0cb Mon Sep 17 00:00:00 2001 From: Yii Chen Date: Sun, 23 Jul 2023 18:53:50 +0800 Subject: [PATCH 04/12] optimize ui by using const (#425) --- .../card/bubble_card/brn_bubble_text.dart | 4 ++-- .../card/bubble_card/brn_insert_info.dart | 14 +++++++------- .../card/content_card/brn_pair_info_rich_grid.dart | 2 +- .../card/content_card/brn_pair_info_table.dart | 8 ++++---- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/src/components/card/bubble_card/brn_bubble_text.dart b/lib/src/components/card/bubble_card/brn_bubble_text.dart index 85e10402..549e4334 100644 --- a/lib/src/components/card/bubble_card/brn_bubble_text.dart +++ b/lib/src/components/card/bubble_card/brn_bubble_text.dart @@ -83,11 +83,11 @@ class BrnBubbleText extends StatelessWidget { color: bgColor, shape: BoxShape.rectangle, borderRadius: BorderRadius.only( - topLeft: Radius.circular(0), + topLeft: const Radius.circular(0), topRight: Radius.circular(radius), bottomLeft: Radius.circular(radius), bottomRight: Radius.circular(radius))), - padding: EdgeInsets.only(left: 20, right: 20, top: 12, bottom: 12), + padding: const EdgeInsets.only(left: 20, right: 20, top: 12, bottom: 12), child: BrnExpandableText( text: text, maxLines: maxLines, diff --git a/lib/src/components/card/bubble_card/brn_insert_info.dart b/lib/src/components/card/bubble_card/brn_insert_info.dart index a1872aa4..09d941d4 100644 --- a/lib/src/components/card/bubble_card/brn_insert_info.dart +++ b/lib/src/components/card/bubble_card/brn_insert_info.dart @@ -47,7 +47,7 @@ class BrnInsertInfo extends StatelessWidget { ), ); - Color color = Color(0xFFF8F8F8); + Color color = const Color(0xFFF8F8F8); Image image = BrunoTools.getAssetImage('icons/icon_right_top_pointer.png'); Widget bubbleText = Row( @@ -59,17 +59,17 @@ class BrnInsertInfo extends StatelessWidget { color: color, shape: BoxShape.rectangle, borderRadius: BorderRadius.only( - topLeft: Radius.circular(0), - topRight: Radius.circular(4), - bottomLeft: Radius.circular(4), - bottomRight: Radius.circular(4))), - padding: EdgeInsets.only(left: 20, right: 20, top: 12, bottom: 12), + topLeft: const Radius.circular(0), + topRight: const Radius.circular(4), + bottomLeft: const Radius.circular(4), + bottomRight: const Radius.circular(4))), + padding: const EdgeInsets.only(left: 20, right: 20, top: 12, bottom: 12), child: tx, ), ) ], ); - return Container( + return ColoredBox( color: Colors.transparent, child: Column( mainAxisSize: MainAxisSize.min, diff --git a/lib/src/components/card/content_card/brn_pair_info_rich_grid.dart b/lib/src/components/card/content_card/brn_pair_info_rich_grid.dart index ccea24d4..2a431e46 100644 --- a/lib/src/components/card/content_card/brn_pair_info_rich_grid.dart +++ b/lib/src/components/card/content_card/brn_pair_info_rich_grid.dart @@ -234,7 +234,7 @@ class BrnRichGridInfo { } }, child: Padding( - padding: EdgeInsets.only(left: 4), + padding: const EdgeInsets.only(left: 4), child: Container( constraints: BoxConstraints(maxWidth: 56), child: Text(clickTitle, diff --git a/lib/src/components/card/content_card/brn_pair_info_table.dart b/lib/src/components/card/content_card/brn_pair_info_table.dart index 8a967135..06fe225e 100644 --- a/lib/src/components/card/content_card/brn_pair_info_table.dart +++ b/lib/src/components/card/content_card/brn_pair_info_table.dart @@ -77,7 +77,7 @@ class BrnPairInfoTable extends StatefulWidget { final bool isValueAlign; /// TableCell 默认垂直对齐方式, 默认值为 [TableCellVerticalAlignment.baseline] - /// 当 [BrnInfoModal.valuePart] 为自定义 Widget 时,可设置该参数调整对齐方式,仅在 + /// 当 [BrnInfoModal.valuePart] 为自定义 Widget 时,可设置该参数调整对齐方式,仅在 /// [isValueAlign] 为 true 时设置才生效 final TableCellVerticalAlignment defaultVerticalAlignment; @@ -286,7 +286,7 @@ class _BrnPairInfoTableState extends State { Row row = Row( children: [ Padding( - padding: EdgeInsets.only(right: 4), + padding: const EdgeInsets.only(right: 4), child: Text( BrnIntl.currentResource.expand, style: TextStyle( @@ -308,7 +308,7 @@ class _BrnPairInfoTableState extends State { }); Container layerCtn = Container( - padding: EdgeInsets.only(left: 30), + padding: const EdgeInsets.only(left: 30), alignment: Alignment.center, child: gdt, decoration: BoxDecoration( @@ -345,7 +345,7 @@ class _BrnPairInfoTableState extends State { Row row = Row( children: [ Padding( - padding: EdgeInsets.only(right: 4), + padding: const EdgeInsets.only(right: 4), child: Text( BrnIntl.currentResource.collapse, style: TextStyle( From 1956586f918021f179e811513d1ad6fae0df458f Mon Sep 17 00:00:00 2001 From: MrDevil Date: Sun, 23 Jul 2023 18:54:30 +0800 Subject: [PATCH 05/12] Update theme.md (#437) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 代码片段中有一个括号打成了全角 --- doc/theme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/theme.md b/doc/theme.md index a569b59c..9eace13a 100644 --- a/doc/theme.md +++ b/doc/theme.md @@ -71,7 +71,7 @@ class XxxConfigUtils { static BrnCommonConfig defaultCommonConfig = BrnCommonConfig( brandPrimary: const Color(0xFF3072F6), - ); + ); /// Dialog配置 static BrnDialogConfig defaultDialogConfig = BrnDialogConfig( From c2825e0eb689190033e59ab3a8ad310669180eef Mon Sep 17 00:00:00 2001 From: Amos Date: Mon, 24 Jul 2023 12:25:52 +0800 Subject: [PATCH 06/12] fix doc bruno page (#451) --- doc/bruno.md | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/doc/bruno.md b/doc/bruno.md index 84cc788e..9c0f4c6f 100644 --- a/doc/bruno.md +++ b/doc/bruno.md @@ -12,13 +12,19 @@ Bruno 是基于一整套设计体系的 Flutter 组件库。 - 提炼自企业级移动端产品的交互和视觉风格 - 开箱即用的高质量 Flutter 组件 - 提供满足业务差异的主题定制能力 +- 设计工具赋能开发全链路 ### 适配 Flutter SDK 版本 -| Bruno 版本 | Flutter SDK 版本 | -| ---------- | ---------------- | -| 1.0.0 | 1.22.4 | -| 2.0.0 | 2.2.2 | +| Bruno 版本 | Flutter SDK 版本 | +| ---------- | ---------------- | +| 1.0.0 | 1.22.4 | +| 2.0.0 | 2.2.2 | +| 2.1.1 (支持空安全) | 2.2.2 | +| 2.2.0 | 2.10.5 | +| 3.0.0 | 3.0.3 | +| 3.1.0 | 3.3.0 | +| 3.2.0 | 3.3.0 | ### 接入 From 3179af403b76284b958dc810a42eb0b967a0444e Mon Sep 17 00:00:00 2001 From: leftcoding <137387869@qq.com> Date: Mon, 24 Jul 2023 12:29:08 +0800 Subject: [PATCH 07/12] =?UTF-8?q?fix:=20BrnTabBar=20More=20=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=86=85item=E7=82=B9=E5=87=BB=E5=88=87=E6=8D=A2?= =?UTF-8?q?=EF=BC=8C=E6=B2=A1=E6=9C=89=E8=A7=A6=E5=8F=91onTap=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6=E3=80=82=20(#393)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 修复传入居中对齐,bottomWidget不起作用的问题。 * fix: BrnTabBar More 组件内item点击切换,没有触发onTap事件。 --- .../content_card/brn_enhance_number_card.dart | 37 ++++++++++--------- .../components/tabbar/normal/brn_tab_bar.dart | 12 ++++++ 2 files changed, 31 insertions(+), 18 deletions(-) diff --git a/lib/src/components/card/content_card/brn_enhance_number_card.dart b/lib/src/components/card/content_card/brn_enhance_number_card.dart index 5e79a5fe..f050791f 100644 --- a/lib/src/components/card/content_card/brn_enhance_number_card.dart +++ b/lib/src/components/card/content_card/brn_enhance_number_card.dart @@ -1,5 +1,3 @@ - - import 'package:bruno/src/constants/brn_asset_constants.dart'; import 'package:bruno/src/constants/brn_strings_constants.dart'; import 'package:bruno/src/theme/brn_theme.dart'; @@ -237,35 +235,38 @@ class BrnEnhanceNumberCard extends StatelessWidget { style: config.descTextStyle.generateTextStyle(), overflow: TextOverflow.ellipsis, ); + Widget? icon; if (model.iconTapCallBack != null) { - Widget icon = BrunoTools.getAssetSizeImage(BrnAsset.iconQuestion, 14, 14); + icon = BrunoTools.getAssetSizeImage(BrnAsset.iconQuestion, 14, 14); if (model.numberInfoIcon == BrnNumberInfoIcon.arrow) { icon = BrunoTools.getAssetSizeImage(BrnAsset.iconRightArrow, 14, 14); } debugPrint('${tp.height}'); debugPrint(model.title); - text = Row( - mainAxisAlignment: itemTextAlign == TextAlign.center - ? MainAxisAlignment.center - : (itemTextAlign == TextAlign.right - ? MainAxisAlignment.end - : MainAxisAlignment.start), - crossAxisAlignment: - tp.height > 22 ? CrossAxisAlignment.end : CrossAxisAlignment.center, - children: [ - Flexible( - child: text, - ), + } + text = Row( + mainAxisAlignment: itemTextAlign == TextAlign.center + ? MainAxisAlignment.center + : (itemTextAlign == TextAlign.right + ? MainAxisAlignment.end + : MainAxisAlignment.start), + crossAxisAlignment: + tp.height > 22 ? CrossAxisAlignment.end : CrossAxisAlignment.center, + children: [ + Flexible( + child: text, + ), + if (icon != null) GestureDetector( onTap: () { model.iconTapCallBack!(model); }, child: icon, ) - ], - ); - } + ], + ); + return text; } diff --git a/lib/src/components/tabbar/normal/brn_tab_bar.dart b/lib/src/components/tabbar/normal/brn_tab_bar.dart index 894c7255..667dbd67 100644 --- a/lib/src/components/tabbar/normal/brn_tab_bar.dart +++ b/lib/src/components/tabbar/normal/brn_tab_bar.dart @@ -619,6 +619,11 @@ class BrnTabBarState extends State { padding: EdgeInsets.all(0), child: _TabBarOverlayWidget( tabs: widget.tabs, + onTap: (index) { + if (widget.onTap != null) { + widget.onTap!(this, index); + } + }, moreWindowText: widget.moreWindowText, brnTabbarController: _brnTabbarController, themeData: widget.themeData!, @@ -676,8 +681,12 @@ class _TabBarOverlayWidget extends StatefulWidget { /// tag高度 double? tagHeight; + /// Tab的选中点击事件 + final ValueChanged? onTap; + _TabBarOverlayWidget( {this.tabs, + this.onTap, this.moreWindowText, this.brnTabbarController, required this.themeData, @@ -785,6 +794,9 @@ class _TabBarOverlayWidgetState extends State<_TabBarOverlayWidget> { widget.brnTabbarController?.entry = null; setState(() {}); } else { + if (widget.onTap != null) { + widget.onTap!(index); + } widget.brnTabbarController!.setSelectIndex(index); widget.brnTabbarController?.isShow = false; widget.brnTabbarController?.entry?.remove(); From 0fd46dd28dca6b3fd958fdd7d76a0ab714365692 Mon Sep 17 00:00:00 2001 From: Sandy <15143015732@163.com> Date: Mon, 24 Jul 2023 12:48:58 +0800 Subject: [PATCH 08/12] adapt sdk 3.10.2 (#472) * adapt sdk 3.10.2 * fix appbar config --- example/android/build.gradle | 2 +- .../components/guide/force_guide_example.dart | 1 - .../components/guide/soft_intro_example.dart | 1 - .../navbar/nav_bar_example_page.dart | 18 +++---- example/pubspec.yaml | 4 +- .../gallery/page/brn_gallery_detail_page.dart | 5 +- lib/src/components/navbar/brn_appbar.dart | 50 ++++++------------- lib/src/components/navbar/brn_search_bar.dart | 37 ++++++++------ .../theme/base/brn_default_config_utils.dart | 2 +- lib/src/theme/configs/brn_appbar_config.dart | 20 ++++---- .../configs/brn_gallery_detail_config.dart | 26 +++++----- pubspec.yaml | 4 +- 12 files changed, 77 insertions(+), 93 deletions(-) diff --git a/example/android/build.gradle b/example/android/build.gradle index 4256f917..0a2d6a10 100644 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -26,6 +26,6 @@ subprojects { project.evaluationDependsOn(':app') } -task clean(type: Delete) { +tasks.register("clean", Delete) { delete rootProject.buildDir } diff --git a/example/lib/sample/components/guide/force_guide_example.dart b/example/lib/sample/components/guide/force_guide_example.dart index f8996bac..3a0ccc9d 100644 --- a/example/lib/sample/components/guide/force_guide_example.dart +++ b/example/lib/sample/components/guide/force_guide_example.dart @@ -58,7 +58,6 @@ class _ForceGuideExampleState extends State { return WillPopScope( child: Scaffold( appBar: BrnAppBar( - brightness: Brightness.light, title: Text( '强引导组件example', key: intro.keys[0], diff --git a/example/lib/sample/components/guide/soft_intro_example.dart b/example/lib/sample/components/guide/soft_intro_example.dart index bce101cd..fcae1e30 100644 --- a/example/lib/sample/components/guide/soft_intro_example.dart +++ b/example/lib/sample/components/guide/soft_intro_example.dart @@ -58,7 +58,6 @@ class _SoftGuideExampleState extends State { return WillPopScope( child: Scaffold( appBar: BrnAppBar( - brightness: Brightness.light, title: Text( '弱引导组件example', key: intro.keys[0], diff --git a/example/lib/sample/components/navbar/nav_bar_example_page.dart b/example/lib/sample/components/navbar/nav_bar_example_page.dart index 1f7e0cdd..2525a233 100644 --- a/example/lib/sample/components/navbar/nav_bar_example_page.dart +++ b/example/lib/sample/components/navbar/nav_bar_example_page.dart @@ -181,7 +181,7 @@ class _NavBarPageState extends State with TickerProviderStateMixin { width: 20, ), ), - brightness: Brightness.dark, + themeData: BrnAppBarConfig.dark(), title: Row( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, @@ -261,7 +261,7 @@ class _NavBarPageState extends State with TickerProviderStateMixin { //文字标题 下拉框 BrnAppBar _getBlackBar6() { return BrnAppBar( - brightness: Brightness.dark, + themeData: BrnAppBarConfig.dark(), title: Row( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.center, @@ -287,7 +287,7 @@ class _NavBarPageState extends State with TickerProviderStateMixin { //文字标题 左1个icon 右文本 bai BrnAppBar _getBlackBar9() { return BrnAppBar( - brightness: Brightness.light, + themeData: BrnAppBarConfig.light(), leading: Image.asset( 'assets/image/icon_navbar_sousuo_hei.png', scale: 3.0, @@ -301,7 +301,7 @@ class _NavBarPageState extends State with TickerProviderStateMixin { //文字标题 带标签 BrnAppBar _getBlackBar10() { return BrnAppBar( - brightness: Brightness.light, + themeData: BrnAppBarConfig.light(), leading: Image.asset( 'assets/image/icon_navbar_sousuo_hei.png', scale: 3.0, @@ -346,7 +346,7 @@ class _NavBarPageState extends State with TickerProviderStateMixin { //文字标题 左2个icon 右文本 BrnAppBar _getBlackBar11() { return BrnAppBar( - brightness: Brightness.light, + themeData: BrnAppBarConfig.light(), title: '标题名称', leading: BrnDoubleLeading( first: BrnBackLeading(), @@ -368,7 +368,7 @@ class _NavBarPageState extends State with TickerProviderStateMixin { //多icon的bar hei BrnAppBar _getBlackBar12() { return BrnAppBar( - brightness: Brightness.dark, + themeData: BrnAppBarConfig.dark(), automaticallyImplyLeading: true, title: "天通苑天通苑天通苑天通苑天通苑天通苑天通苑天通苑天通苑", actions: [ @@ -406,7 +406,7 @@ class _NavBarPageState extends State with TickerProviderStateMixin { //多icon的bar bai BrnAppBar _getBlackBar13() { return BrnAppBar( - brightness: Brightness.light, + themeData: BrnAppBarConfig.light(), automaticallyImplyLeading: true, title: "", actions: [ @@ -482,7 +482,7 @@ class _NavBarPageState extends State with TickerProviderStateMixin { PreferredSize _getWhiteSearchBar() { return BrnSearchAppbar( - brightness: Brightness.light, + themeData: BrnAppBarConfig.light(), showDivider: true, //自定义的leading显示 leading: Padding( @@ -653,7 +653,7 @@ class _NavBarPageState extends State with TickerProviderStateMixin { ], ); return BrnAppBar( - brightness: Brightness.dark, + themeData: BrnAppBarConfig.dark(), automaticallyImplyLeading: false, //自定义leading leading: BrnBackLeading( diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 1429a847..2dc9f193 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -14,7 +14,7 @@ description: A new Flutter project. version: 1.0.0+1 environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.17.0 <4.0.0' dependencies: flutter: @@ -28,7 +28,7 @@ dependencies: flutter_easyrefresh: ^2.2.1 lpinyin: ^2.0.3 badges: ^2.0.2 - intl: ^0.17.0 + intl: ^0.18.0 dev_dependencies: flutter_test: diff --git a/lib/src/components/gallery/page/brn_gallery_detail_page.dart b/lib/src/components/gallery/page/brn_gallery_detail_page.dart index ba4b5ef1..f7999967 100644 --- a/lib/src/components/gallery/page/brn_gallery_detail_page.dart +++ b/lib/src/components/gallery/page/brn_gallery_detail_page.dart @@ -91,10 +91,10 @@ class _BrnGalleryDetailPageState extends State _appBarConfig = BrnThemeConfigurator.instance .getConfig(configId: widget.themeData!.configId) .appBarConfig - .merge(BrnAppBarConfig( + .merge(widget.themeData!.appbarConfig).merge(BrnAppBarConfig( titleStyle: widget.themeData!.appbarTitleStyle, backgroundColor: widget.themeData!.appbarBackgroundColor, - actionsStyle: widget.themeData!.appbarActionStyle)); + actionsStyle: widget.themeData!.appbarActionStyle,)); // 打平 tabBar _tabBarConfig = BrnThemeConfigurator.instance @@ -254,7 +254,6 @@ class _BrnGalleryDetailPageState extends State return Scaffold( key: GlobalKey(), appBar: BrnAppBar( - brightness: widget.themeData!.appbarBrightness, backgroundColor: _appBarConfig!.backgroundColor, showDefaultBottom: false, themeData: _appBarConfig, diff --git a/lib/src/components/navbar/brn_appbar.dart b/lib/src/components/navbar/brn_appbar.dart index c68cb0e3..9cfdfd56 100644 --- a/lib/src/components/navbar/brn_appbar.dart +++ b/lib/src/components/navbar/brn_appbar.dart @@ -116,7 +116,6 @@ class BrnAppBar extends PreferredSize { final Color? backgroundColor; final PreferredSizeWidget? bottom; final double elevation; - final Brightness? brightness; final double toolbarOpacity; final double bottomOpacity; final Alignment titleAlignment; @@ -126,7 +125,6 @@ class BrnAppBar extends PreferredSize { final ShapeBorder? shape; final IconThemeData? iconTheme; final IconThemeData? actionsIconTheme; - final TextTheme? textTheme; final bool primary; final bool excludeHeaderSemantics; final double? titleSpacing; @@ -140,6 +138,7 @@ class BrnAppBar extends PreferredSize { final bool? showDefaultBottom; final bool showLeadingDivider; final BrnAppBarConfig? themeData; + final SystemUiOverlayStyle? systemOverlayStyle; BrnAppBar( {Key? key, @@ -151,7 +150,6 @@ class BrnAppBar extends PreferredSize { this.bottom, this.elevation = 0, this.automaticallyImplyLeading = true, - this.brightness, this.toolbarOpacity = 1.0, this.bottomOpacity = 1.0, this.titleAlignment = Alignment.center, @@ -166,7 +164,7 @@ class BrnAppBar extends PreferredSize { this.actionsIconTheme, this.excludeHeaderSemantics = false, this.primary = true, - this.textTheme, + this.systemOverlayStyle, this.titleSpacing}) : assert( actions == null || actions is Widget || (actions is List)), @@ -178,7 +176,6 @@ class BrnAppBar extends PreferredSize { String? title, this.backgroundColor, this.bottom, - this.brightness, this.showLeadingDivider = true, this.flexibleSpace, this.backLeadCallback, @@ -191,7 +188,7 @@ class BrnAppBar extends PreferredSize { this.actionsIconTheme, this.excludeHeaderSemantics = false, this.primary = true, - this.textTheme, + this.systemOverlayStyle, this.titleSpacing}) : this.actions = null, this.elevation = 0, @@ -205,7 +202,6 @@ class BrnAppBar extends PreferredSize { backgroundColor: backgroundColor, title: title, bottom: bottom, - brightness: brightness, showLeadingDivider: showLeadingDivider, flexibleSpace: flexibleSpace, backLeadCallback: backLeadCallback, @@ -227,14 +223,10 @@ class BrnAppBar extends PreferredSize { @override Widget build(BuildContext context) { BrnAppBarConfig _defaultConfig = themeData ?? BrnAppBarConfig(); - //当外部传入主题 - if (brightness == Brightness.light) { - _defaultConfig = _defaultConfig.merge(BrnAppBarConfig.light()); - } else if (brightness == Brightness.dark) { - _defaultConfig = _defaultConfig.merge(BrnAppBarConfig.dark()); - } - _defaultConfig = _defaultConfig - .merge(BrnAppBarConfig(backgroundColor: this.backgroundColor, showDefaultBottom: this.showDefaultBottom)); + _defaultConfig = _defaultConfig.merge(BrnAppBarConfig( + backgroundColor: this.backgroundColor, + showDefaultBottom: this.showDefaultBottom, + systemUiOverlayStyle: this.systemOverlayStyle)); _defaultConfig = BrnThemeConfigurator.instance .getConfig(configId: _defaultConfig.configId) @@ -242,13 +234,14 @@ class BrnAppBar extends PreferredSize { .merge(_defaultConfig); useWidgetsBinding().addPostFrameCallback((_) { - SystemChrome.setSystemUIOverlayStyle(_defaultConfig.systemUiOverlayStyle); + SystemChrome.setSystemUIOverlayStyle(_defaultConfig.systemOverlayStyle); }); return super.build(context); } PreferredSizeWidget? _buildBarBottom(BrnAppBarConfig defaultConfig) { - if (brightness == null || brightness == Brightness.light) { + if (defaultConfig.systemOverlayStyle.statusBarBrightness == + Brightness.light) { if (bottom == null && defaultConfig.showDefaultBottom) { return BrnBarBottomDivider(); } @@ -260,13 +253,9 @@ class BrnAppBar extends PreferredSize { Widget get child { BrnAppBarConfig _defaultConfig = themeData ?? BrnAppBarConfig(); //当外部传入主题 - if (brightness == Brightness.light) { - _defaultConfig = _defaultConfig.merge(BrnAppBarConfig.light()); - } else if (brightness == Brightness.dark) { - _defaultConfig = _defaultConfig.merge(BrnAppBarConfig.dark()); - } - _defaultConfig = - _defaultConfig.merge(BrnAppBarConfig(backgroundColor: backgroundColor)); + _defaultConfig = _defaultConfig.merge(BrnAppBarConfig( + backgroundColor: backgroundColor, + systemUiOverlayStyle: systemOverlayStyle)); _defaultConfig = BrnThemeConfigurator.instance .getConfig(configId: _defaultConfig.configId) @@ -294,7 +283,7 @@ class BrnAppBar extends PreferredSize { backgroundColor: _defaultConfig.backgroundColor, actions: _wrapActions(_defaultConfig), bottom: _buildBarBottom(_defaultConfig), - brightness: brightness ?? Brightness.light, + systemOverlayStyle: _defaultConfig.systemOverlayStyle, toolbarOpacity: toolbarOpacity, bottomOpacity: bottomOpacity, flexibleSpace: flexibleSpace, @@ -302,7 +291,6 @@ class BrnAppBar extends PreferredSize { shape: shape, iconTheme: iconTheme, actionsIconTheme: actionsIconTheme, - textTheme: textTheme, primary: primary, excludeHeaderSemantics: excludeHeaderSemantics, ); @@ -617,15 +605,7 @@ class _BrnSearchResultAppBar extends StatelessWidget { @override Widget build(BuildContext context) { BrnAppBarConfig _defaultConfig = appBarConfig ?? BrnAppBarConfig(); - - if (brightness == Brightness.light) { - _defaultConfig = _defaultConfig.merge(BrnAppBarConfig.light()); - } else if (brightness == Brightness.dark) { - _defaultConfig = _defaultConfig.merge(BrnAppBarConfig.dark()); - } - - _defaultConfig = _defaultConfig - .merge(BrnAppBarConfig( + _defaultConfig = _defaultConfig.merge(BrnAppBarConfig( backgroundColor: this.backgroundColor, showDefaultBottom: this.showDefaultBottom, )); diff --git a/lib/src/components/navbar/brn_search_bar.dart b/lib/src/components/navbar/brn_search_bar.dart index 0bc088a3..ce616f1a 100644 --- a/lib/src/components/navbar/brn_search_bar.dart +++ b/lib/src/components/navbar/brn_search_bar.dart @@ -1,11 +1,6 @@ -import 'package:bruno/src/components/navbar/brn_appbar.dart'; import 'package:bindings_compatible/bindings_compatible.dart'; +import 'package:bruno/bruno.dart'; import 'package:bruno/src/components/navbar/brn_appbar_theme.dart'; -import 'package:bruno/src/constants/brn_asset_constants.dart'; -import 'package:bruno/src/constants/brn_strings_constants.dart'; -import 'package:bruno/src/l10n/brn_intl.dart'; -import 'package:bruno/src/theme/brn_theme_configurator.dart'; -import 'package:bruno/src/utils/brn_tools.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -73,13 +68,14 @@ class BrnSearchAppbar extends PreferredSize { /// 是否默认获取焦点 final bool autoFocus; - /// searchBar 主题 - final Brightness brightness; - /// 清空回调 final VoidCallback? onClearTap; - const BrnSearchAppbar( + final SystemUiOverlayStyle? systemOverlayStyle; + + BrnAppBarConfig? themeData; + + BrnSearchAppbar( {this.controller, this.focusNode, this.leading, @@ -92,15 +88,24 @@ class BrnSearchAppbar extends PreferredSize { this.dismissStyle, this.showDivider = true, this.autoFocus = true, - this.brightness = Brightness.dark, this.onClearTap, - this.inputTextStyle}) - : super(child: const Center(), preferredSize: const Size(0, 0)); + this.systemOverlayStyle, + this.inputTextStyle, + this.themeData}) + : super(child: const Center(), preferredSize: const Size(0, 0)){ + this.themeData ??= BrnAppBarConfig.dark(); + this.themeData = BrnThemeConfigurator.instance + .getConfig(configId: this.themeData!.configId) + .appBarConfig + .merge(this.themeData) + .merge(BrnAppBarConfig(systemUiOverlayStyle: systemOverlayStyle)); + } @override Widget get child => BrnAppBar( - brightness: brightness, + systemOverlayStyle: systemOverlayStyle, automaticallyImplyLeading: false, + themeData: themeData, title: _createSearchChild(), ); @@ -137,7 +142,6 @@ class BrnSearchAppbar extends PreferredSize { dismissStyle: dismissStyle, showDivider: showDivider, clearTapCallback: onClearTap, - brightness: brightness, )), ], ); @@ -310,7 +314,8 @@ class __SearchInputWidgetState extends State<_SearchInputWidget> { color: _defaultHintTextColor, ), // 提示文本属性,提示字段接受哪种输入的文本。 - hintText: widget.hint ?? BrnIntl.of(context).localizedResource.inputSearchTip, + hintText: widget.hint ?? + BrnIntl.of(context).localizedResource.inputSearchTip, ), // 在改变属性,当正在编辑的文本发生更改时调用。 onChanged: (content) { diff --git a/lib/src/theme/base/brn_default_config_utils.dart b/lib/src/theme/base/brn_default_config_utils.dart index 6ceb6f1c..c1c69983 100644 --- a/lib/src/theme/base/brn_default_config_utils.dart +++ b/lib/src/theme/base/brn_default_config_utils.dart @@ -709,7 +709,7 @@ class BrnDefaultConfigUtils { fontWeight: FontWeight.w600, ), appbarBackgroundColor: Colors.black, - appbarBrightness: Brightness.dark, + appbarConfig: BrnAppBarConfig.dark(), tabBarUnSelectedLabelStyle: BrnTextStyle( fontSize: 16.0, color: Color(0XFFCCCCCC), diff --git a/lib/src/theme/configs/brn_appbar_config.dart b/lib/src/theme/configs/brn_appbar_config.dart index e5d2ee05..a92b8f3e 100644 --- a/lib/src/theme/configs/brn_appbar_config.dart +++ b/lib/src/theme/configs/brn_appbar_config.dart @@ -39,7 +39,7 @@ class BrnAppBarConfig extends BrnBaseConfig { _itemSpacing = itemSpacing, _titlePadding = titlePadding, _iconSize = iconSize, - _systemUiOverlayStyle = systemUiOverlayStyle, + _systemOverlayStyle = systemUiOverlayStyle, _showDefaultBottom = showDefaultBottom, super(configId: configId); @@ -76,7 +76,7 @@ class BrnAppBarConfig extends BrnBaseConfig { fontSize: BrnAppBarTheme.actionFontSize, fontWeight: FontWeight.w600, ); - _systemUiOverlayStyle = SystemUiOverlayStyle.light; + _systemOverlayStyle = SystemUiOverlayStyle.light; } BrnAppBarConfig.light({ @@ -112,7 +112,7 @@ class BrnAppBarConfig extends BrnBaseConfig { fontSize: BrnAppBarTheme.actionFontSize, fontWeight: FontWeight.w600, ); - _systemUiOverlayStyle = SystemUiOverlayStyle.dark; + _systemOverlayStyle = SystemUiOverlayStyle.dark; } /// AppBar 的背景色 @@ -192,11 +192,11 @@ class BrnAppBarConfig extends BrnBaseConfig { /// statusBar 样式 /// 默认为 [SystemUiOverlayStyle.dark] - SystemUiOverlayStyle? _systemUiOverlayStyle; + SystemUiOverlayStyle? _systemOverlayStyle; - SystemUiOverlayStyle get systemUiOverlayStyle => - _systemUiOverlayStyle ?? - BrnDefaultConfigUtils.defaultAppBarConfig.systemUiOverlayStyle; + SystemUiOverlayStyle get systemOverlayStyle => + _systemOverlayStyle ?? + BrnDefaultConfigUtils.defaultAppBarConfig.systemOverlayStyle; /// 是否展示Appbar bottom 分割线 /// 默认为 [false] @@ -231,7 +231,7 @@ class BrnAppBarConfig extends BrnBaseConfig { _itemSpacing ??= appbarConfig._itemSpacing; _titlePadding ??= appbarConfig._titlePadding; _iconSize ??= appbarConfig._iconSize; - _systemUiOverlayStyle ??= appbarConfig._systemUiOverlayStyle; + _systemOverlayStyle ??= appbarConfig._systemOverlayStyle; _showDefaultBottom ??= appbarConfig._showDefaultBottom; } @@ -260,7 +260,7 @@ class BrnAppBarConfig extends BrnBaseConfig { itemSpacing: itemSpacing ?? _itemSpacing, titlePadding: titlePadding ?? _titlePadding, iconSize: iconSize ?? _iconSize, - systemUiOverlayStyle: systemUiOverlayStyle ?? _systemUiOverlayStyle, + systemUiOverlayStyle: systemUiOverlayStyle ?? _systemOverlayStyle, showDefaultBottom: showDefaultBottom ?? _showDefaultBottom, ); } @@ -278,7 +278,7 @@ class BrnAppBarConfig extends BrnBaseConfig { itemSpacing: other._itemSpacing, titlePadding: other._titlePadding, iconSize: other._iconSize, - systemUiOverlayStyle: other._systemUiOverlayStyle, + systemUiOverlayStyle: other._systemOverlayStyle, showDefaultBottom: other._showDefaultBottom, ); } diff --git a/lib/src/theme/configs/brn_gallery_detail_config.dart b/lib/src/theme/configs/brn_gallery_detail_config.dart index b7155350..60cd9244 100644 --- a/lib/src/theme/configs/brn_gallery_detail_config.dart +++ b/lib/src/theme/configs/brn_gallery_detail_config.dart @@ -6,6 +6,8 @@ import 'package:bruno/src/theme/brn_theme_configurator.dart'; import 'package:bruno/src/theme/configs/brn_common_config.dart'; import 'package:flutter/material.dart'; +import 'brn_appbar_config.dart'; + /// 查看大图配置 class BrnGalleryDetailConfig extends BrnBaseConfig { /// 遵循全局配置 @@ -14,7 +16,7 @@ class BrnGalleryDetailConfig extends BrnBaseConfig { BrnTextStyle? appbarTitleStyle, BrnTextStyle? appbarActionStyle, Color? appbarBackgroundColor, - Brightness? appbarBrightness, + BrnAppBarConfig? appbarConfig, BrnTextStyle? tabBarUnSelectedLabelStyle, BrnTextStyle? tabBarLabelStyle, Color? tabBarBackgroundColor, @@ -28,7 +30,7 @@ class BrnGalleryDetailConfig extends BrnBaseConfig { }) : _appbarTitleStyle = appbarTitleStyle, _appbarActionStyle = appbarActionStyle, _appbarBackgroundColor = appbarBackgroundColor, - _appbarBrightness = appbarBrightness, + _appbarConfig = appbarConfig, _tabBarUnSelectedLabelStyle = tabBarUnSelectedLabelStyle, _tabBarLabelStyle = tabBarLabelStyle, _tabBarBackgroundColor = tabBarBackgroundColor, @@ -47,7 +49,7 @@ class BrnGalleryDetailConfig extends BrnBaseConfig { _appbarTitleStyle = BrnTextStyle(color: commonConfig.colorTextBaseInverse); _appbarActionStyle = BrnTextStyle(color: BrnAppBarTheme.lightTextColor); _appbarBackgroundColor = Colors.black; - _appbarBrightness = Brightness.dark; + _appbarConfig = BrnAppBarConfig.dark(); _tabBarUnSelectedLabelStyle = BrnTextStyle(color: Color(0XFFCCCCCC)); _tabBarLabelStyle = BrnTextStyle(color: commonConfig.colorTextBaseInverse); _tabBarBackgroundColor = Colors.black; @@ -66,7 +68,7 @@ class BrnGalleryDetailConfig extends BrnBaseConfig { _appbarTitleStyle = BrnTextStyle(color: commonConfig.colorTextBase); _appbarActionStyle = BrnTextStyle(color: commonConfig.colorTextBase); _appbarBackgroundColor = commonConfig.fillBody; - _appbarBrightness = Brightness.light; + _appbarConfig = BrnAppBarConfig.light(); _tabBarUnSelectedLabelStyle = BrnTextStyle( color: commonConfig.colorTextBase, ); @@ -106,7 +108,7 @@ class BrnGalleryDetailConfig extends BrnBaseConfig { /// appbar brightness /// 默认为 [Brightness.dark] - Brightness? _appbarBrightness; + BrnAppBarConfig? _appbarConfig; /// tabBar 标题普通样式 /// @@ -178,9 +180,9 @@ class BrnGalleryDetailConfig extends BrnBaseConfig { _appbarBackgroundColor ?? BrnDefaultConfigUtils.defaultGalleryDetailConfig.appbarBackgroundColor; - Brightness get appbarBrightness => - _appbarBrightness ?? - BrnDefaultConfigUtils.defaultGalleryDetailConfig.appbarBrightness; + BrnAppBarConfig get appbarConfig => + _appbarConfig ?? + BrnDefaultConfigUtils.defaultGalleryDetailConfig.appbarConfig; BrnTextStyle get tabBarUnSelectedLabelStyle => _tabBarUnSelectedLabelStyle ?? @@ -242,7 +244,7 @@ class BrnGalleryDetailConfig extends BrnBaseConfig { _appbarActionStyle = galleryDetailConfig.appbarActionStyle.merge( _appbarActionStyle, ); - _appbarBrightness ??= galleryDetailConfig.appbarBrightness; + _appbarConfig ??= galleryDetailConfig.appbarConfig; _appbarBackgroundColor ??= galleryDetailConfig.appbarBackgroundColor; _tabBarUnSelectedLabelStyle = galleryDetailConfig.tabBarUnSelectedLabelStyle .merge(BrnTextStyle(fontSize: commonConfig.fontSizeSubHead)) @@ -284,7 +286,7 @@ class BrnGalleryDetailConfig extends BrnBaseConfig { BrnTextStyle? appbarTitleStyle, BrnTextStyle? appbarActionStyle, Color? appbarBackgroundColor, - Brightness? appbarBrightness, + BrnAppBarConfig? appbarConfig, BrnTextStyle? tabBarUnSelectedLabelStyle, Color? tabBarUnselectedLabelColor, BrnTextStyle? tabBarLabelStyle, @@ -302,7 +304,7 @@ class BrnGalleryDetailConfig extends BrnBaseConfig { appbarTitleStyle: appbarTitleStyle ?? _appbarTitleStyle, appbarActionStyle: appbarActionStyle ?? _appbarActionStyle, appbarBackgroundColor: appbarBackgroundColor ?? _appbarBackgroundColor, - appbarBrightness: appbarBrightness ?? _appbarBrightness, + appbarConfig: appbarConfig ?? _appbarConfig, tabBarUnSelectedLabelStyle: tabBarUnSelectedLabelStyle ?? _tabBarUnSelectedLabelStyle, tabBarLabelStyle: tabBarLabelStyle ?? _tabBarLabelStyle, @@ -322,7 +324,7 @@ class BrnGalleryDetailConfig extends BrnBaseConfig { appbarTitleStyle: appbarTitleStyle.merge(other._appbarTitleStyle), appbarActionStyle: appbarActionStyle.merge(other._appbarActionStyle), appbarBackgroundColor: other._appbarBackgroundColor, - appbarBrightness: other._appbarBrightness, + appbarConfig: other._appbarConfig, tabBarUnSelectedLabelStyle: tabBarUnSelectedLabelStyle.merge(other._tabBarUnSelectedLabelStyle), tabBarLabelStyle: tabBarLabelStyle.merge(other._tabBarLabelStyle), diff --git a/pubspec.yaml b/pubspec.yaml index ffa7394c..be5061af 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,7 +4,7 @@ version: 3.3.0 homepage: https://github.com/LianjiaTech/bruno environment: - sdk: '>=2.17.0 <3.0.0' + sdk: '>=2.17.0 <4.0.0' flutter: '>=3.7.0' dependencies: @@ -14,7 +14,7 @@ dependencies: lpinyin: ^2.0.3 path_drawing: ^1.0.0 flutter_easyrefresh: ^2.2.1 - intl: ^0.17.0 + intl: ^0.18.0 photo_view: ^0.14.0 bindings_compatible: ^1.0.1 From 19023118d0e043bafa30ac52fb5169803d5d94c2 Mon Sep 17 00:00:00 2001 From: Kingtous Date: Mon, 24 Jul 2023 12:49:35 +0800 Subject: [PATCH 09/12] opt: add missing themeData configs for brn groups. (#445) --- lib/src/components/form/items/group/brn_normal_group.dart | 3 ++- .../components/form/items/group/brn_portrait_radio_group.dart | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/src/components/form/items/group/brn_normal_group.dart b/lib/src/components/form/items/group/brn_normal_group.dart index 22a619d7..263bade9 100644 --- a/lib/src/components/form/items/group/brn_normal_group.dart +++ b/lib/src/components/form/items/group/brn_normal_group.dart @@ -61,6 +61,7 @@ class BrnNormalFormGroup extends StatefulWidget { this.onRemoveTap, this.onTip, this.deleteLabel, + this.themeData, required this.children, }) : super(key: key) { this.themeData ??= BrnFormItemConfig(); @@ -86,7 +87,7 @@ class BrnNormalFormGroupState extends State { Widget build(BuildContext context) { return Container( padding: EdgeInsets.only(top: 14), - color: Colors.white, + color: widget.themeData!.backgroundColor, child: Column( mainAxisSize: MainAxisSize.min, children: [ diff --git a/lib/src/components/form/items/group/brn_portrait_radio_group.dart b/lib/src/components/form/items/group/brn_portrait_radio_group.dart index e48430b0..18573bd8 100644 --- a/lib/src/components/form/items/group/brn_portrait_radio_group.dart +++ b/lib/src/components/form/items/group/brn_portrait_radio_group.dart @@ -99,7 +99,7 @@ class BrnPortraitRadioGroupState extends State { @override Widget build(BuildContext context) { return Container( - color: Colors.white, + color: widget.themeData!.backgroundColor, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: getRadioList(widget.options), From 6b8fbd73daca8c3d03f0ea7b2d4006c659688780 Mon Sep 17 00:00:00 2001 From: lijuncai <42626941+JunCaiLi@users.noreply.github.com> Date: Mon, 24 Jul 2023 12:52:33 +0800 Subject: [PATCH 10/12] BrnSimpleSelection add themeData (#420) --- lib/src/components/selection/brn_simple_selection.dart | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/src/components/selection/brn_simple_selection.dart b/lib/src/components/selection/brn_simple_selection.dart index be9b1e05..79ecbd97 100644 --- a/lib/src/components/selection/brn_simple_selection.dart +++ b/lib/src/components/selection/brn_simple_selection.dart @@ -2,6 +2,7 @@ import 'package:bruno/src/components/selection/bean/brn_filter_entity.dart'; import 'package:bruno/src/components/selection/bean/brn_selection_common_entity.dart'; import 'package:bruno/src/components/selection/brn_selection_view.dart'; import 'package:bruno/src/constants/brn_constants.dart'; +import 'package:bruno/src/theme/configs/brn_selection_config.dart'; import 'package:flutter/material.dart'; typedef BrnSimpleSelectionOnSelectionChanged = void Function( @@ -35,6 +36,9 @@ class BrnSimpleSelection extends StatefulWidget { /// 是否单选 默认 radio模式 is true , checkbox模式 is false final bool isRadio; + /// SelectionView 配置 + final BrnSelectionConfig? themeData; + /// 单选构造函数 BrnSimpleSelection.radio({ Key? key, @@ -44,6 +48,7 @@ class BrnSimpleSelection extends StatefulWidget { required this.items, required this.onSimpleSelectionChanged, this.onMenuItemClick, + this.themeData, }) : this.isRadio = true, this.maxSelectedCount = BrnSelectionConstant.maxSelectCount, super(key: key); @@ -58,6 +63,7 @@ class BrnSimpleSelection extends StatefulWidget { required this.items, required this.onSimpleSelectionChanged, this.onMenuItemClick, + this.themeData, }) : this.isRadio = false, super(key: key); @@ -103,6 +109,7 @@ class BrnSimpleSelectionState extends State { @override Widget build(BuildContext context) { return BrnSelectionView( + themeData: widget.themeData, originalSelectionData: selectionEntityList, onSelectionChanged: (menuIndex, selectedParams, customParams, setCustomTitleFunction) { From bc4a369180c9b8974acae74eea0dc6c4335f0498 Mon Sep 17 00:00:00 2001 From: Sandy <15143015732@163.com> Date: Mon, 24 Jul 2023 15:44:39 +0800 Subject: [PATCH 11/12] update version to 3.4.0 (#474) * update version to 3.4.0 * add appbar change --- .github/workflows/build_test.yml | 4 ++-- CHANGELOG.md | 18 ++++++++++++++++++ README.en-US.md | 2 ++ README.md | 3 +++ pubspec.yaml | 2 +- 5 files changed, 26 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index 272227f9..10d51e98 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -17,7 +17,7 @@ jobs: - uses: actions/checkout@v3 - uses: subosito/flutter-action@v2 with: - flutter-version: '3.7.0' + flutter-version: '3.10.0' - run: dart --version - run: flutter --version - run: flutter pub get @@ -37,7 +37,7 @@ jobs: java-version: '8.x' - uses: subosito/flutter-action@v1 with: - flutter-version: '3.7.0' + flutter-version: '3.10.0' - run: dart --version - run: flutter --version - run: flutter pub get diff --git a/CHANGELOG.md b/CHANGELOG.md index a244b858..cb1f58c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,21 @@ +## [3.4.0] - 2023-7-24 + +### Changed + +#### base + +- Adapt flutter sdk 3.10.0. + +#### components + +- **Breaking change**: Since flutter sdk 3.10.0 deletes the brightness and textTheme attributes of Appbar, BrnAppBar is deleted synchronously. Instead, use themeData. BrnAppBarConfig will support all your needs. For details, see Demo usage. +- BrnSimpleSelection : support theme configuration [#420 ](https://github.com/LianjiaTech/bruno/pull/420) , thanks to **JunCaiLi** . +- Add missing themeData for BrnNormalFormGroup and BrnPortraitRadioGroup [#455](https://github.com/LianjiaTech/bruno/pull/445), thanks to **Kingtous**. +- BrnTabBar : add onTap method for _TabBarOverlayWidget [#393](https://github.com/LianjiaTech/bruno/pull/393). + + + + ## [3.3.0] - 2023-2-1 ### Changed diff --git a/README.en-US.md b/README.en-US.md index 214e5f9b..79e1ba95 100644 --- a/README.en-US.md +++ b/README.en-US.md @@ -55,6 +55,8 @@ Please download from [Releases](https://github.com/LianjiaTech/bruno/releases) o | 3.0.0 | 3.0.3 | | 3.1.0 | 3.3.0 | | 3.2.0 | 3.3.0 | +| 3.3.0 | 3.7.0 | +| 3.4.0 | 3.10.0 | ## Preparing for use diff --git a/README.md b/README.md index 4d97fb35..9e63c39d 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,9 @@ | 3.0.0 | 3.0.3 | | 3.1.0 | 3.3.0 | | 3.2.0 | 3.3.0 | +| 3.3.0 | 3.7.0 | +| 3.4.0 | 3.10.0 | + diff --git a/pubspec.yaml b/pubspec.yaml index be5061af..38683dbb 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: bruno description: An enterprise-class package of Flutter components for mobile applications. -version: 3.3.0 +version: 3.4.0 homepage: https://github.com/LianjiaTech/bruno environment: From 7519e8ef15686cf2d7efe3a2d476e3bb92b7703b Mon Sep 17 00:00:00 2001 From: Sandy <15143015732@163.com> Date: Mon, 24 Jul 2023 17:15:48 +0800 Subject: [PATCH 12/12] Updatedocs3.4.0 (#475) * update version to 3.4.0 * add appbar change * update docs * update appbar doc --- CHANGELOG.md | 4 +- doc/components/appbar/BrnAppBar/BrnAppBar.md | 79 +++++++++---------- .../appbar/BrnSearchAppbar/BrnSearchAppbar.md | 37 ++++----- .../BrnExpandFormGroup/BrnExpandFormGroup.md | 2 - .../BrnNormalFormGroup/BrnNormalFormGroup.md | 2 +- .../BrnSimpleSelection/BrnSimpleSelection.md | 3 + 6 files changed, 65 insertions(+), 62 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cb1f58c4..73ae34d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,10 +8,12 @@ #### components -- **Breaking change**: Since flutter sdk 3.10.0 deletes the brightness and textTheme attributes of Appbar, BrnAppBar is deleted synchronously. Instead, use themeData. BrnAppBarConfig will support all your needs. For details, see Demo usage. +- **Breaking change**: Since flutter sdk 3.10.0 deletes the brightness and textTheme attributes of Appbar, BrnAppBar BrnSearchAppbar is deleted synchronously. Instead, use themeData. BrnAppBarConfig will support all your needs. For details, see Demo usage. - BrnSimpleSelection : support theme configuration [#420 ](https://github.com/LianjiaTech/bruno/pull/420) , thanks to **JunCaiLi** . - Add missing themeData for BrnNormalFormGroup and BrnPortraitRadioGroup [#455](https://github.com/LianjiaTech/bruno/pull/445), thanks to **Kingtous**. - BrnTabBar : add onTap method for _TabBarOverlayWidget [#393](https://github.com/LianjiaTech/bruno/pull/393). +- BrnExpandFormGroup and BrnNormalFormGroup remove invalid attribute tipLabel. +- BrnIconButton : fix the abnormal position of icons and text. diff --git a/doc/components/appbar/BrnAppBar/BrnAppBar.md b/doc/components/appbar/BrnAppBar/BrnAppBar.md index 9c3f500a..87145236 100644 --- a/doc/components/appbar/BrnAppBar/BrnAppBar.md +++ b/doc/components/appbar/BrnAppBar/BrnAppBar.md @@ -30,36 +30,35 @@ group: ``` dart BrnAppBar( - {Key? key, - this.leading, - this.showLeadingDivider = false, - this.title, - this.actions, - this.backgroundColor, - this.bottom, - this.elevation = 0, - this.automaticallyImplyLeading = true, - this.brightness, - this.toolbarOpacity = 1.0, - this.bottomOpacity = 1.0, - this.titleAlignment = Alignment.center, - this.flexibleSpace, - this.backLeadCallback, - this.showDefaultBottom = true, - this.themeData, - this.leadingWidth, - this.shadowColor, - this.shape, - this.iconTheme, - this.actionsIconTheme, - this.excludeHeaderSemantics = false, - this.primary = true, - this.textTheme, - this.titleSpacing}) - : assert( - actions == null || actions is Widget || (actions is List)), - assert(title == null || title is String || title is Widget), - super(key: key, child: Container(), preferredSize: Size(0, 0)); + {Key? key, + this.leading, + this.showLeadingDivider = false, + this.title, + this.actions, + this.backgroundColor, + this.bottom, + this.elevation = 0, + this.automaticallyImplyLeading = true, + this.toolbarOpacity = 1.0, + this.bottomOpacity = 1.0, + this.titleAlignment = Alignment.center, + this.flexibleSpace, + this.backLeadCallback, + this.showDefaultBottom, + this.themeData, + this.leadingWidth, + this.shadowColor, + this.shape, + this.iconTheme, + this.actionsIconTheme, + this.excludeHeaderSemantics = false, + this.primary = true, + this.systemOverlayStyle, + this.titleSpacing}) + : assert( + actions == null || actions is Widget || (actions is List)), + assert(title == null || title is String || title is Widget), + super(key: key, child: Container(), preferredSize: Size(0, 0)); ``` @@ -73,7 +72,6 @@ BrnAppBar( | bottom | PreferredSizeWidget? | AppBar底部紧挨着的Widget | 否 | 无 | | bottomOpacity | double | AppBar 底部Widget透明度,即 bottom 字段的透明度 | 否 | 1.0 | | elevation | double | AppBar 阴影高度 | 否 | 0 | -| brightness | Brightness? | AppBar 主题,包括 dark、light 两种类型 | 否 | Brightness.dark | | toolbarOpacity | double | Appbar 透明度 | 否 | 1.0 | | titleAlignment | Alignment | title 对齐方式 | 否 | Alignment.center | | backLeadCallback | VoidCallback? | 自定义的返回事件 | 否 | 无 | @@ -84,7 +82,7 @@ BrnAppBar( | shape | ShapeBorder? | 边框形状,只有当elevation大于0的时候展示 | 否 | | | iconTheme | IconThemeData? | icon样式定制 | 否 | | | actionsIconTheme | IconThemeData? | icon主题定制 | 否 | | -| textTheme | TextTheme? | text主题定制 | 否 | | +| systemOverlayStyle | SystemUiOverlayStyle? | 同 Appbar systemOverlayStyle | 否 | | | primary | bool | 此应用栏是否显示在屏幕顶部 | 否 | | | excludeHeaderSemantics | bool | 是否用Semantics包裹 | 否 | | | themeData | BrnAppBarConfig? | BrnAppBar对应的主题定制类 | 否 | | @@ -101,7 +99,7 @@ BrnAppBar( ``` dart BrnAppBar( - brightness: Brightness.dark, + themeData: BrnAppBarConfig.dark(), title: Row( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.center, @@ -142,7 +140,7 @@ BrnAppBar( width: 20, height: 20, ), - brightness: Brightness.dark, + themeData: BrnAppBarConfig.dark(), //文本title title: '标题名称', ); @@ -164,7 +162,7 @@ BrnAppBar( actions: BrnTextAction( '文本按钮', //设置为深色背景,则显示白色 - brightness: Brightness.dark, + themeData: BrnAppBarConfig.dark(), ), ) ``` @@ -181,6 +179,7 @@ var actionKey = GlobalKey(); BrnAppBar( title: '标题名称', + themeData: BrnAppBarConfig.dark(), leading: BrnDoubleLeading( first: BrnBackLeading(), second: BrnBackLeading( @@ -212,7 +211,7 @@ BrnAppBar( ``` dart BrnAppBar( - brightness: Brightness.dark, + themeData: BrnAppBarConfig.dark(), automaticallyImplyLeading: false, //自定义显示的title 为切换的row title: Row( @@ -265,7 +264,7 @@ return GestureDetector( ``` dart BrnAppBar( - brightness: Brightness.dark, + themeData: BrnAppBarConfig.dark(), //自定义leading leading: BrnBackLeading( child: Image.asset( @@ -328,7 +327,7 @@ BrnAppBar( ``` dart BrnAppBar( - brightness: Brightness.dark, + themeData: BrnAppBarConfig.dark(), automaticallyImplyLeading: true, //多icon actions: [ @@ -378,13 +377,13 @@ BrnAppBar( BrnAppBar( //默认显示返回按钮 automaticallyImplyLeading: true, - brightness: Brightness.light, + themeData: BrnAppBarConfig.light(), title: '名称名称', //自定义的右侧文本 actions: BrnTextAction( '文本按钮', //设置为深色背景,则显示白色 - brightness: Brightness.light, + themeData: BrnAppBarConfig.light(), ), ) ``` diff --git a/doc/components/appbar/BrnSearchAppbar/BrnSearchAppbar.md b/doc/components/appbar/BrnSearchAppbar/BrnSearchAppbar.md index 96fa61e2..75247d6b 100644 --- a/doc/components/appbar/BrnSearchAppbar/BrnSearchAppbar.md +++ b/doc/components/appbar/BrnSearchAppbar/BrnSearchAppbar.md @@ -25,23 +25,24 @@ group: ```dart -const BrnSearchAppbar( - {this.controller, - this.focusNode, - this.leading, - this.leadClickCallback, - this.dismissClickCallback, - this.searchBarInputChangeCallback, - this.searchBarInputSubmitCallback, - this.hint, - this.hintStyle, - this.dismissStyle, - this.showDivider = true, - this.autoFocus = true, - this.brightness = Brightness.dark, - this.onClearTap, - this.inputTextStyle}) - : super(child: const Center(), preferredSize: const Size(0, 0)); +BrnSearchAppbar( + {this.controller, + this.focusNode, + this.leading, + this.leadClickCallback, + this.dismissClickCallback, + this.searchBarInputChangeCallback, + this.searchBarInputSubmitCallback, + this.hint, + this.hintStyle, + this.dismissStyle, + this.showDivider = true, + this.autoFocus = true, + this.onClearTap, + this.systemOverlayStyle, + this.inputTextStyle, + this.themeData}) + : super(child: const Center(), preferredSize: const Size(0, 0)); ``` @@ -60,7 +61,7 @@ const BrnSearchAppbar( | dismissStyle | TextStyle? | 右侧Action的文本Style | 否 | 无 | | showDivider | bool | 是否展示底部分割线 | 否 | bool | | autoFocus | bool | 是否自动聚焦 | 否 | bool | -| brightness | Brightness | 主题配置 | 否 | Brightness.dark | +| systemOverlayStyle | SystemUiOverlayStyle | 同 Appbar systemOverlayStyle | 否 | 无 | | onClearTap | VoidCallback? | 点击清除按钮回调 | 否 | | ## 四、效果及代码展示 diff --git a/doc/components/form/BrnExpandFormGroup/BrnExpandFormGroup.md b/doc/components/form/BrnExpandFormGroup/BrnExpandFormGroup.md index 642b803c..27544202 100644 --- a/doc/components/form/BrnExpandFormGroup/BrnExpandFormGroup.md +++ b/doc/components/form/BrnExpandFormGroup/BrnExpandFormGroup.md @@ -40,7 +40,6 @@ BrnExpandFormGroup({ this.label, this.title = "", this.subTitle, - this.tipLabel, this.error = "", this.isEdit = true, this.isRequire = false, @@ -61,7 +60,6 @@ BrnExpandFormGroup({ | type | Stirng | 录入项类型,主要用于录入类型页面框架中 | 否 | BrnInputItemType.normalGroupType | 外部可根据此字段判断表单项类型 | | title | String | 录入项标题 | 否 | '' | | | subTitle | String? | 录入项子标题 | 否 | 无 | | -| tipLabel | String? | 录入项提示(问号图标&文案) 用户点击时触发onTip回调。 | 否 | 备注中类型3 | 1. 设置"空字符串"时展示问号图标 2. 设置"非空字符串"时展示问号图标&文案 3. 若不赋值或赋值为null时,不显示提示项 | | error | String | 录入项错误提示 | 否 | '' | | | isRequire | bool | 录入项是否为必填项(展示`*`图标) 默认为 false 不必填 | 否 | false | | | isEdit | bool | 录入项 是否可编辑 | 否 | true | true:可编辑,false:禁用 | diff --git a/doc/components/form/BrnNormalFormGroup/BrnNormalFormGroup.md b/doc/components/form/BrnNormalFormGroup/BrnNormalFormGroup.md index e4f0eb5e..aac2cbb9 100644 --- a/doc/components/form/BrnNormalFormGroup/BrnNormalFormGroup.md +++ b/doc/components/form/BrnNormalFormGroup/BrnNormalFormGroup.md @@ -38,13 +38,13 @@ BrnNormalFormGroup({ this.label, this.title = "", this.subTitle, - this.tipLabel, this.error = "", this.isEdit = true, this.isRequire = false, this.onRemoveTap, this.onTip, this.deleteLabel, + this.themeData, required this.children, }) : super(key: key) { this.themeData ??= BrnFormItemConfig(); diff --git a/doc/components/selection/BrnSimpleSelection/BrnSimpleSelection.md b/doc/components/selection/BrnSimpleSelection/BrnSimpleSelection.md index d21b0ce6..58aff5db 100644 --- a/doc/components/selection/BrnSimpleSelection/BrnSimpleSelection.md +++ b/doc/components/selection/BrnSimpleSelection/BrnSimpleSelection.md @@ -38,6 +38,7 @@ BrnSimpleSelection.radio({ required this.items, required this.onSimpleSelectionChanged, this.onMenuItemClick, + this.themeData, }) : this.isRadio = true, this.maxSelectedCount = BrnSelectionConstant.maxSelectCount, super(key: key); @@ -55,6 +56,7 @@ BrnSimpleSelection.checkbox({ required this.items, required this.onSimpleSelectionChanged, this.onMenuItemClick, + this.themeData, }) : this.isRadio = false, super(key: key); ``` @@ -73,6 +75,7 @@ BrnSimpleSelection.checkbox({ | onSimpleSelectionChanged | BrnSimpleSelectionOnSelectionChanged | 选择回调 | 是 | | | onMenuItemClick | VoidCallback? | 菜单点击事件 | 否 | | | isRadio | bool | 是否单选 默认 radio模式 is true , checkbox模式 is false | 否 | radio模式默认true checkbox模式默认false | +| themeData | BrnSelectionConfig |筛选项配置类|否|| ## 四、代码演示