From d2a37e0fd9153e138f10efefd78bd36f4415bccd Mon Sep 17 00:00:00 2001 From: zhoujuanjuan <15143015732@163.com> Date: Mon, 27 Dec 2021 15:07:49 +0800 Subject: [PATCH 01/14] =?UTF-8?q?Theme:=20=E4=BC=98=E5=8C=96=E5=8D=95?= =?UTF-8?q?=E4=BE=8B=E5=AE=9E=E7=8E=B0=EF=BC=8C=E5=88=9D=E6=AD=A5=E4=BC=98?= =?UTF-8?q?=E5=8C=96=20BrnAllThemeConfig=20=E5=B1=9E=E6=80=A7=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E4=B8=8D=E4=B8=BA=20null?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/src/theme/base/brn_base_config.dart | 3 +- .../theme/base/brn_default_config_utils.dart | 7 +- lib/src/theme/brn_theme_configurator.dart | 19 +- lib/src/theme/configs/brn_all_config.dart | 217 ++++++++++++------ .../brn_enhance_number_card_config.dart | 2 +- 5 files changed, 169 insertions(+), 79 deletions(-) diff --git a/lib/src/theme/base/brn_base_config.dart b/lib/src/theme/base/brn_base_config.dart index c339629d..ebbcf3a7 100644 --- a/lib/src/theme/base/brn_base_config.dart +++ b/lib/src/theme/base/brn_base_config.dart @@ -49,6 +49,5 @@ abstract class BrnBaseConfig { _currentLevelCommonConfig ?? BrnThemeConfigurator.instance .getConfig(configId: configId) - .commonConfig ?? - BrnDefaultConfigUtils.defaultCommonConfig; + .commonConfig; } diff --git a/lib/src/theme/base/brn_default_config_utils.dart b/lib/src/theme/base/brn_default_config_utils.dart index 92e6f5b0..bb5207a4 100644 --- a/lib/src/theme/base/brn_default_config_utils.dart +++ b/lib/src/theme/base/brn_default_config_utils.dart @@ -42,12 +42,15 @@ class BrnDefaultConfigUtils { buttonConfig: defaultButtonConfig, actionSheetConfig: defaultActionSheetConfig, pickerConfig: defaultPickerConfig, - enhanceNumberCardConfig: defaultNumberInfoConfig, + enhanceNumberCardConfig: defaultEnhanceNumberInfoConfig, tabBarConfig: defaultTabBarConfig, selectionConfig: defaultSelectionConfig, galleryDetailConfig: defaultGalleryDetailConfig, ); + + + /// 全局默认配置 static BrnCommonConfig defaultCommonConfig = BrnCommonConfig( /// 主题色相关 @@ -559,7 +562,7 @@ class BrnDefaultConfigUtils { ); /// 数字增强信息配置 - static BrnEnhanceNumberCardConfig defaultNumberInfoConfig = + static BrnEnhanceNumberCardConfig defaultEnhanceNumberInfoConfig = BrnEnhanceNumberCardConfig( runningSpace: 16, itemRunningSpace: 8, diff --git a/lib/src/theme/brn_theme_configurator.dart b/lib/src/theme/brn_theme_configurator.dart index 999b03a3..392030cb 100644 --- a/lib/src/theme/brn_theme_configurator.dart +++ b/lib/src/theme/brn_theme_configurator.dart @@ -5,9 +5,19 @@ const String BRUNO_CONFIG_ID = 'BRUNO_CONFIG_ID'; const String GLOBAL_CONFIG_ID = 'GLOBAL_CONFIG_ID'; class BrnThemeConfigurator { - BrnThemeConfigurator._(); - static late final BrnThemeConfigurator instance = BrnThemeConfigurator._(); + BrnThemeConfigurator._(){ + _checkAndInitBrunoConfig(); + } + + static BrnThemeConfigurator? _instance; + + static get instance { + if (null == _instance) { + _instance = BrnThemeConfigurator._(); + } + return _instance!; + } Map globalConfig = {}; @@ -16,12 +26,10 @@ class BrnThemeConfigurator { BrnAllThemeConfig? allThemeConfig, { String configId = GLOBAL_CONFIG_ID, }) { - // 先赋值默认配置 - _checkAndInitBrunoConfig(); // 打平内部字段 if (allThemeConfig != null) { // 赋值传入配置 - instance.globalConfig[configId] = allThemeConfig + globalConfig[configId] = allThemeConfig ..initThemeConfig(configId); } } @@ -31,7 +39,6 @@ class BrnThemeConfigurator { /// 2、若获取的为 null,则使用默认的全局配置。 /// 3、若没有配置 GLOBAL_CONFIG_ID ,则使用 BRUNO 的配置。 BrnAllThemeConfig getConfig({String configId = GLOBAL_CONFIG_ID}) { - _checkAndInitBrunoConfig(); BrnAllThemeConfig? allThemeConfig = globalConfig[configId] ?? globalConfig[GLOBAL_CONFIG_ID] ?? diff --git a/lib/src/theme/configs/brn_all_config.dart b/lib/src/theme/configs/brn_all_config.dart index 5d5712ff..d0ca3e93 100644 --- a/lib/src/theme/configs/brn_all_config.dart +++ b/lib/src/theme/configs/brn_all_config.dart @@ -1,3 +1,4 @@ +import 'package:bruno/bruno.dart'; import 'package:bruno/src/theme/brn_theme_configurator.dart'; import 'package:bruno/src/theme/configs/brn_abnormal_state_config.dart'; import 'package:bruno/src/theme/configs/brn_action_sheet_config.dart'; @@ -24,119 +25,199 @@ import 'package:bruno/src/theme/configs/brn_tag_config.dart'; /// 当没有配置组件的特定属性时使用上一级特定配置 class BrnAllThemeConfig { BrnAllThemeConfig({ - required this.commonConfig, - this.appBarConfig, - this.buttonConfig, - this.dialogConfig, - this.formItemConfig, - this.cardTitleConfig, - this.abnormalStateConfig, - this.tagConfig, - this.pairInfoTableConfig, - this.pairRichInfoGridConfig, - this.actionSheetConfig, - this.pickerConfig, - this.enhanceNumberCardConfig, - this.tabBarConfig, - this.selectionConfig, - this.galleryDetailConfig, + commonConfig, + appBarConfig, + buttonConfig, + dialogConfig, + formItemConfig, + cardTitleConfig, + abnormalStateConfig, + tagConfig, + pairInfoTableConfig, + pairRichInfoGridConfig, + actionSheetConfig, + pickerConfig, + enhanceNumberCardConfig, + tabBarConfig, + selectionConfig, + galleryDetailConfig, String configId = GLOBAL_CONFIG_ID, - }); - - BrnCommonConfig? commonConfig; - BrnAppBarConfig? appBarConfig; - BrnButtonConfig? buttonConfig; - BrnDialogConfig? dialogConfig; - BrnCardTitleConfig? cardTitleConfig; - BrnAbnormalStateConfig? abnormalStateConfig; - BrnTagConfig? tagConfig; - BrnPairInfoTableConfig? pairInfoTableConfig; - BrnPairRichInfoGridConfig? pairRichInfoGridConfig; - BrnActionSheetConfig? actionSheetConfig; - BrnPickerConfig? pickerConfig; - BrnEnhanceNumberCardConfig? enhanceNumberCardConfig; - BrnTabBarConfig? tabBarConfig; - BrnFormItemConfig? formItemConfig; - BrnSelectionConfig? selectionConfig; - BrnGalleryDetailConfig? galleryDetailConfig; + }) : _commonConfig = commonConfig, + _appBarConfig = appBarConfig, + _buttonConfig = buttonConfig, + _dialogConfig = dialogConfig, + _formItemConfig = formItemConfig, + _cardTitleConfig = cardTitleConfig, + _abnormalStateConfig = abnormalStateConfig, + _tagConfig = tagConfig, + _pairInfoTableConfig = pairInfoTableConfig, + _pairRichInfoGridConfig = pairRichInfoGridConfig, + _actionSheetConfig = actionSheetConfig, + _pickerConfig = pickerConfig, + _enhanceNumberCardConfig = enhanceNumberCardConfig, + _tabBarConfig = tabBarConfig, + _selectionConfig = selectionConfig, + _galleryDetailConfig = galleryDetailConfig; + + BrnCommonConfig? _commonConfig; + + BrnCommonConfig get commonConfig => + _commonConfig ?? BrnDefaultConfigUtils.defaultCommonConfig; + + BrnAppBarConfig? _appBarConfig; + + BrnAppBarConfig get appBarConfig => + _appBarConfig ?? BrnDefaultConfigUtils.defaultAppBarConfig; + + BrnButtonConfig? _buttonConfig; + + BrnButtonConfig get buttonConfig => + _buttonConfig ?? BrnDefaultConfigUtils.defaultButtonConfig; + + BrnDialogConfig? _dialogConfig; + + BrnDialogConfig get dialogConfig => + _dialogConfig ?? BrnDefaultConfigUtils.defaultDialogConfig; + + BrnCardTitleConfig? _cardTitleConfig; + + BrnCardTitleConfig get cardTitleConfig => + _cardTitleConfig ?? BrnDefaultConfigUtils.defaultCardTitleConfig; + + BrnAbnormalStateConfig? _abnormalStateConfig; + + BrnAbnormalStateConfig get abnormalStateConfig => + _abnormalStateConfig ?? BrnDefaultConfigUtils.defaultAbnormalStateConfig; + + BrnTagConfig? _tagConfig; + + BrnTagConfig get tagConfig => + _tagConfig ?? BrnDefaultConfigUtils.defaultTagConfig; + + BrnPairInfoTableConfig? _pairInfoTableConfig; + + BrnPairInfoTableConfig get pairInfoTableConfig => + _pairInfoTableConfig ?? BrnDefaultConfigUtils.defaultPairInfoTableConfig; + + BrnPairRichInfoGridConfig? _pairRichInfoGridConfig; + + BrnPairRichInfoGridConfig get pairRichInfoGridConfig => + _pairRichInfoGridConfig ?? + BrnDefaultConfigUtils.defaultPairRichInfoGridConfig; + + BrnActionSheetConfig? _actionSheetConfig; + + BrnActionSheetConfig get actionSheetConfig => + _actionSheetConfig ?? BrnDefaultConfigUtils.defaultActionSheetConfig; + + BrnPickerConfig? _pickerConfig; + + BrnPickerConfig get pickerConfig => + _pickerConfig ?? BrnDefaultConfigUtils.defaultPickerConfig; + + BrnEnhanceNumberCardConfig? _enhanceNumberCardConfig; + + BrnEnhanceNumberCardConfig get enhanceNumberCardConfig => + _enhanceNumberCardConfig ?? + BrnDefaultConfigUtils.defaultEnhanceNumberInfoConfig; + + BrnTabBarConfig? _tabBarConfig; + + BrnTabBarConfig get tabBarConfig => + _tabBarConfig ?? BrnDefaultConfigUtils.defaultTabBarConfig; + + BrnFormItemConfig? _formItemConfig; + + BrnFormItemConfig get formItemConfig => + _formItemConfig ?? BrnDefaultConfigUtils.defaultFormItemConfig; + + BrnSelectionConfig? _selectionConfig; + + BrnSelectionConfig get selectionConfig => + _selectionConfig ?? BrnDefaultConfigUtils.defaultSelectionConfig; + + BrnGalleryDetailConfig? _galleryDetailConfig; + + BrnGalleryDetailConfig get galleryDetailConfig => + _galleryDetailConfig ?? BrnDefaultConfigUtils.defaultGalleryDetailConfig; void initThemeConfig(String configId) { - this.commonConfig ??= BrnCommonConfig(); - this.appBarConfig ??= BrnAppBarConfig(); - this.buttonConfig ??= BrnButtonConfig(); - this.dialogConfig ??= BrnDialogConfig(); - this.formItemConfig ??= BrnFormItemConfig(); - this.cardTitleConfig ??= BrnCardTitleConfig(); - this.abnormalStateConfig ??= BrnAbnormalStateConfig(); - this.tagConfig ??= BrnTagConfig(); - this.appBarConfig ??= BrnAppBarConfig(); - this.pairInfoTableConfig ??= BrnPairInfoTableConfig(); - this.pairRichInfoGridConfig ??= BrnPairRichInfoGridConfig(); - this.actionSheetConfig ??= BrnActionSheetConfig(); - this.pickerConfig ??= BrnPickerConfig(); - this.enhanceNumberCardConfig ??= BrnEnhanceNumberCardConfig(); - this.tabBarConfig ??= BrnTabBarConfig(); - this.selectionConfig ??= BrnSelectionConfig(); - this.galleryDetailConfig ??= BrnGalleryDetailConfig(); - - commonConfig?.initThemeConfig(configId); - appBarConfig?.initThemeConfig( + this._commonConfig ??= BrnCommonConfig(); + this._appBarConfig ??= BrnAppBarConfig(); + this._buttonConfig ??= BrnButtonConfig(); + this._dialogConfig ??= BrnDialogConfig(); + this._formItemConfig ??= BrnFormItemConfig(); + this._cardTitleConfig ??= BrnCardTitleConfig(); + this._abnormalStateConfig ??= BrnAbnormalStateConfig(); + this._tagConfig ??= BrnTagConfig(); + this._appBarConfig ??= BrnAppBarConfig(); + this._pairInfoTableConfig ??= BrnPairInfoTableConfig(); + this._pairRichInfoGridConfig ??= BrnPairRichInfoGridConfig(); + this._actionSheetConfig ??= BrnActionSheetConfig(); + this._pickerConfig ??= BrnPickerConfig(); + this._enhanceNumberCardConfig ??= BrnEnhanceNumberCardConfig(); + this._tabBarConfig ??= BrnTabBarConfig(); + this._selectionConfig ??= BrnSelectionConfig(); + this._galleryDetailConfig ??= BrnGalleryDetailConfig(); + + commonConfig.initThemeConfig(configId); + appBarConfig.initThemeConfig( configId, currentLevelCommonConfig: commonConfig, ); - buttonConfig?.initThemeConfig( + buttonConfig.initThemeConfig( configId, currentLevelCommonConfig: commonConfig, ); - dialogConfig?.initThemeConfig( + dialogConfig.initThemeConfig( configId, currentLevelCommonConfig: commonConfig, ); - formItemConfig?.initThemeConfig( + formItemConfig.initThemeConfig( configId, currentLevelCommonConfig: commonConfig, ); - cardTitleConfig?.initThemeConfig( + cardTitleConfig.initThemeConfig( configId, currentLevelCommonConfig: commonConfig, ); - abnormalStateConfig?.initThemeConfig( + abnormalStateConfig.initThemeConfig( configId, currentLevelCommonConfig: commonConfig, ); - tagConfig?.initThemeConfig( + tagConfig.initThemeConfig( configId, currentLevelCommonConfig: commonConfig, ); - pairInfoTableConfig?.initThemeConfig( + pairInfoTableConfig.initThemeConfig( configId, currentLevelCommonConfig: commonConfig, ); - pairRichInfoGridConfig?.initThemeConfig( + pairRichInfoGridConfig.initThemeConfig( configId, currentLevelCommonConfig: commonConfig, ); - selectionConfig?.initThemeConfig( + selectionConfig.initThemeConfig( configId, currentLevelCommonConfig: commonConfig, ); - actionSheetConfig?.initThemeConfig( + actionSheetConfig.initThemeConfig( configId, currentLevelCommonConfig: commonConfig, ); - pickerConfig?.initThemeConfig( + pickerConfig.initThemeConfig( configId, currentLevelCommonConfig: commonConfig, ); - enhanceNumberCardConfig?.initThemeConfig( + enhanceNumberCardConfig.initThemeConfig( configId, currentLevelCommonConfig: commonConfig, ); - tabBarConfig?.initThemeConfig( + tabBarConfig.initThemeConfig( configId, currentLevelCommonConfig: commonConfig, ); - galleryDetailConfig?.initThemeConfig( + galleryDetailConfig.initThemeConfig( configId, currentLevelCommonConfig: commonConfig, ); diff --git a/lib/src/theme/configs/brn_enhance_number_card_config.dart b/lib/src/theme/configs/brn_enhance_number_card_config.dart index 8e710f8b..d0243fd4 100644 --- a/lib/src/theme/configs/brn_enhance_number_card_config.dart +++ b/lib/src/theme/configs/brn_enhance_number_card_config.dart @@ -6,7 +6,7 @@ import 'package:bruno/src/theme/configs/brn_common_config.dart'; /// 强化数字展示组件配置 class BrnEnhanceNumberCardConfig extends BrnBaseConfig { /// 遵循外部主题配置 - /// 默认为 [BrnDefaultConfigUtils.defaultNumberInfoConfig] + /// 默认为 [BrnDefaultConfigUtils.defaultEnhanceNumberInfoConfig] BrnEnhanceNumberCardConfig({ this.runningSpace, this.itemRunningSpace, From 75a2be37de2eb59568b4c982a33aa629ed675c58 Mon Sep 17 00:00:00 2001 From: zhoujuanjuan <15143015732@163.com> Date: Tue, 28 Dec 2021 00:42:45 +0800 Subject: [PATCH 02/14] =?UTF-8?q?refactor:=E4=BC=98=E5=8C=96theme,?= =?UTF-8?q?=E6=9A=B4=E9=9C=B2=E9=9D=9Enull=E5=BC=95=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/ios/Podfile | 86 +-- example/ios/Runner.xcodeproj/project.pbxproj | 16 - .../contents.xcworkspacedata | 2 +- example/lib/main.dart | 3 + .../items_example/title_select_example.dart | 2 +- .../scroll_actor_tab_example.dart | 1 + lib/src/components/navbar/brn_appbar.dart | 4 +- .../components/sugsearch/brn_search_text.dart | 2 +- .../theme/base/brn_default_config_utils.dart | 180 ++--- .../configs/brn_abnormal_state_config.dart | 137 ++-- .../configs/brn_action_sheet_config.dart | 191 +++-- lib/src/theme/configs/brn_all_config.dart | 32 +- lib/src/theme/configs/brn_appbar_config.dart | 256 ++++--- lib/src/theme/configs/brn_button_config.dart | 95 ++- .../theme/configs/brn_card_title_config.dart | 147 ++-- lib/src/theme/configs/brn_common_config.dart | 682 ++++++++++++------ lib/src/theme/configs/brn_dialog_config.dart | 404 +++++++---- .../brn_enhance_number_card_config.dart | 86 ++- lib/src/theme/configs/brn_form_config.dart | 297 +++++--- .../configs/brn_gallery_detail_config.dart | 336 +++++---- .../theme/configs/brn_pair_info_config.dart | 192 +++-- lib/src/theme/configs/brn_picker_config.dart | 182 +++-- .../theme/configs/brn_selection_config.dart | 455 +++++++----- lib/src/theme/configs/brn_tabbar_config.dart | 221 ++++-- lib/src/theme/configs/brn_tag_config.dart | 125 ++-- 25 files changed, 2539 insertions(+), 1595 deletions(-) diff --git a/example/ios/Podfile b/example/ios/Podfile index b30a428b..08502eec 100644 --- a/example/ios/Podfile +++ b/example/ios/Podfile @@ -1,90 +1,10 @@ -# Uncomment this line to define a global platform for your project +# Uncomment the next line to define a global platform for your project # platform :ios, '9.0' -# CocoaPods analytics sends network stats synchronously affecting flutter build latency. -ENV['COCOAPODS_DISABLE_STATS'] = 'true' - -project 'Runner', { - 'Debug' => :debug, - 'Profile' => :release, - 'Release' => :release, -} - -def parse_KV_file(file, separator='=') - file_abs_path = File.expand_path(file) - if !File.exists? file_abs_path - return []; - end - generated_key_values = {} - skip_line_start_symbols = ["#", "/"] - File.foreach(file_abs_path) do |line| - next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ } - plugin = line.split(pattern=separator) - if plugin.length == 2 - podname = plugin[0].strip() - path = plugin[1].strip() - podpath = File.expand_path("#{path}", file_abs_path) - generated_key_values[podname] = podpath - else - puts "Invalid plugin specification: #{line}" - end - end - generated_key_values -end - target 'Runner' do + # Comment the next line if you don't want to use dynamic frameworks use_frameworks! - use_modular_headers! - - # Flutter Pod - - copied_flutter_dir = File.join(__dir__, 'Flutter') - copied_framework_path = File.join(copied_flutter_dir, 'Flutter.framework') - copied_podspec_path = File.join(copied_flutter_dir, 'Flutter.podspec') - unless File.exist?(copied_framework_path) && File.exist?(copied_podspec_path) - # Copy Flutter.framework and Flutter.podspec to Flutter/ to have something to link against if the xcode backend script has not run yet. - # That script will copy the correct debug/profile/release version of the framework based on the currently selected Xcode configuration. - # CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist. - - generated_xcode_build_settings_path = File.join(copied_flutter_dir, 'Generated.xcconfig') - unless File.exist?(generated_xcode_build_settings_path) - raise "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first" - end - generated_xcode_build_settings = parse_KV_file(generated_xcode_build_settings_path) - cached_framework_dir = generated_xcode_build_settings['FLUTTER_FRAMEWORK_DIR']; - - unless File.exist?(copied_framework_path) - FileUtils.cp_r(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir) - end - unless File.exist?(copied_podspec_path) - FileUtils.cp(File.join(cached_framework_dir, 'Flutter.podspec'), copied_flutter_dir) - end - end - - # Keep pod path relative so it can be checked into Podfile.lock. - pod 'Flutter', :path => 'Flutter' - - # Plugin Pods - - # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock - # referring to absolute paths on developers' machines. - system('rm -rf .symlinks') - system('mkdir -p .symlinks/plugins') - plugin_pods = parse_KV_file('../.flutter-plugins') - plugin_pods.each do |name, path| - symlink = File.join('.symlinks', 'plugins', name) - File.symlink(path, symlink) - pod name, :path => File.join(symlink, 'ios') - end -end -# Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system. -install! 'cocoapods', :disable_input_output_paths => true + # Pods for Runner -post_install do |installer| - installer.pods_project.targets.each do |target| - target.build_configurations.each do |config| - config.build_settings['ENABLE_BITCODE'] = 'NO' - end - end end diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj index bacab8cf..e891e69b 100644 --- a/example/ios/Runner.xcodeproj/project.pbxproj +++ b/example/ios/Runner.xcodeproj/project.pbxproj @@ -146,7 +146,6 @@ 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, - DC926F330116FD87C8E402BA /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -256,21 +255,6 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; }; - DC926F330116FD87C8E402BA /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - name = "[CP] Embed Pods Frameworks"; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ diff --git a/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata index 1d526a16..919434a6 100644 --- a/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ b/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -2,6 +2,6 @@ + location = "self:"> diff --git a/example/lib/main.dart b/example/lib/main.dart index 202b0652..ec337f68 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -1,8 +1,11 @@ +import 'package:bruno/bruno.dart'; import 'package:example/sample/home/home.dart'; import 'package:flutter/material.dart'; void main() { + BrnInitializer.register(allThemeConfig: BrnAllThemeConfig(appBarConfig: BrnAppBarConfig(backgroundColor:Colors.orange))); runApp(MyApp()); + } class MyApp extends StatelessWidget { diff --git a/example/lib/sample/components/form/items_example/title_select_example.dart b/example/lib/sample/components/form/items_example/title_select_example.dart index 698237bf..9fe73327 100644 --- a/example/lib/sample/components/form/items_example/title_select_example.dart +++ b/example/lib/sample/components/form/items_example/title_select_example.dart @@ -47,7 +47,7 @@ class TitleSelectInputState extends State { title: _list[0], hint: "请输入", controller: controller, - inputFormatters: [FilteringTextInputFormatter(RegExp('[0-9"]'))], + inputFormatters: [FilteringTextInputFormatter.digitsOnly], selectedIndex: -1, selectList: _list, onTip: () { diff --git a/example/lib/sample/components/scroll_anchor/scroll_actor_tab_example.dart b/example/lib/sample/components/scroll_anchor/scroll_actor_tab_example.dart index 9060636a..0182569e 100644 --- a/example/lib/sample/components/scroll_anchor/scroll_actor_tab_example.dart +++ b/example/lib/sample/components/scroll_anchor/scroll_actor_tab_example.dart @@ -8,6 +8,7 @@ class ScrollActorTabExample extends StatelessWidget { Widget build(BuildContext context) { return Scaffold( appBar: BrnAppBar( + themeData: BrnAppBarConfig(backgroundColor: Colors.green), title: '锚点', ), body: BrnAnchorTab( diff --git a/lib/src/components/navbar/brn_appbar.dart b/lib/src/components/navbar/brn_appbar.dart index be1d1efc..23e426c6 100644 --- a/lib/src/components/navbar/brn_appbar.dart +++ b/lib/src/components/navbar/brn_appbar.dart @@ -276,12 +276,12 @@ class BrnAppBar extends PreferredSize { .merge(_defaultConfig); Widget flexibleSpace; - if (_defaultConfig.flexibleSpace != null) { + if (this.flexibleSpace != null) { flexibleSpace = Container( height: _defaultConfig.appBarHeight + MediaQueryData.fromWindow(window)?.padding?.top ?? 0, - child: _defaultConfig.flexibleSpace, + child: this.flexibleSpace, ); } diff --git a/lib/src/components/sugsearch/brn_search_text.dart b/lib/src/components/sugsearch/brn_search_text.dart index 98656f3c..421cb5a2 100644 --- a/lib/src/components/sugsearch/brn_search_text.dart +++ b/lib/src/components/sugsearch/brn_search_text.dart @@ -271,7 +271,7 @@ class _SearchTextState extends State { child: GestureDetector( onTap: () { if (widget.onTextClear != null) { - bool isIntercept = widget.onTextClear!() ?? false; + bool isIntercept = widget.onTextClear!(); if (isIntercept) return; } textEditingController!.clear(); diff --git a/lib/src/theme/base/brn_default_config_utils.dart b/lib/src/theme/base/brn_default_config_utils.dart index bb5207a4..66861fb3 100644 --- a/lib/src/theme/base/brn_default_config_utils.dart +++ b/lib/src/theme/base/brn_default_config_utils.dart @@ -122,29 +122,29 @@ class BrnDefaultConfigUtils { /// 文本字号 /// /// 特殊数据展示,DIN Condensed数字字体,用于强吸引 - fontSizeDIN: 28, + fontSizeDIN: 28.0, /// 标题字体 /// 名称/页面大标题 - fontSizeHeadLg: 22, + fontSizeHeadLg: 22.0, /// 标题字体 /// 内容模块标题/一级标题 - fontSizeHead: 18, + fontSizeHead: 18.0, /// 子标题字体 /// 标题/录入文字/大按钮文字/二级标题 - fontSizeSubHead: 16, + fontSizeSubHead: 16.0, /// 基础字体 /// 内容副文本/普通说明文字 - fontSizeBase: 14, + fontSizeBase: 14.0, /// 辅助字体-普通 - fontSizeCaption: 12, + fontSizeCaption: 12.0, ///辅助字体-小 - fontSizeCaptionSm: 11, + fontSizeCaptionSm: 11.0, /// 圆角尺寸 radiusXs: 2.0, @@ -154,31 +154,31 @@ class BrnDefaultConfigUtils { /// 边框尺寸 borderWidthSm: 0.5, - borderWidthMd: 1, - borderWidthLg: 2, + borderWidthMd: 1.0, + borderWidthLg: 2.0, /// 水平间距 - hSpacingXs: 8, - hSpacingSm: 12, - hSpacingMd: 16, - hSpacingLg: 20, - hSpacingXl: 24, - hSpacingXxl: 42, + hSpacingXs: 8.0, + hSpacingSm: 12.0, + hSpacingMd: 16.0, + hSpacingLg: 20.0, + hSpacingXl: 24.0, + hSpacingXxl: 42.0, /// 垂直间距 - vSpacingXs: 4, - vSpacingSm: 8, - vSpacingMd: 12, - vSpacingLg: 14, - vSpacingXl: 16, - vSpacingXxl: 28, + vSpacingXs: 4.0, + vSpacingSm: 8.0, + vSpacingMd: 12.0, + vSpacingLg: 14.0, + vSpacingXl: 16.0, + vSpacingXxl: 28.0, /// 图标大小 - iconSizeXxs: 8, - iconSizeXs: 12, - iconSizeSm: 14, - iconSizeMd: 16, - iconSizeLg: 32, + iconSizeXxs: 8.0, + iconSizeXs: 12.0, + iconSizeSm: 14.0, + iconSizeMd: 16.0, + iconSizeLg: 32.0, ); ///******** 以下是子配置项 ********/// @@ -210,7 +210,7 @@ class BrnDefaultConfigUtils { fontSize: defaultCommonConfig.fontSizeSubHead, ), optionsMiddlePadding: EdgeInsets.only( - left: defaultCommonConfig.hSpacingMd ?? 0, + left: defaultCommonConfig.hSpacingMd, ), optionTextStyle: BrnTextStyle( height: 1.3, @@ -223,20 +223,20 @@ class BrnDefaultConfigUtils { fontSize: defaultCommonConfig.fontSizeSubHead, ), formPadding: EdgeInsets.only( - left: 0, - top: defaultCommonConfig.vSpacingLg ?? 0, - right: defaultCommonConfig.hSpacingLg ?? 0, - bottom: defaultCommonConfig.vSpacingLg ?? 0, + left: 0.0, + top: defaultCommonConfig.vSpacingLg , + right: defaultCommonConfig.hSpacingLg , + bottom: defaultCommonConfig.vSpacingLg, ), titlePaddingSm: EdgeInsets.only(left: 10), - titlePaddingLg: EdgeInsets.only(left: defaultCommonConfig.hSpacingLg ?? 0), + titlePaddingLg: EdgeInsets.only(left: defaultCommonConfig.hSpacingLg), subTitlePadding: EdgeInsets.only( - left: defaultCommonConfig.hSpacingLg ?? 0, - top: defaultCommonConfig.vSpacingXs ?? 0, + left: defaultCommonConfig.hSpacingLg, + top: defaultCommonConfig.vSpacingXs, ), errorPadding: EdgeInsets.only( - left: defaultCommonConfig.hSpacingLg ?? 0, - top: defaultCommonConfig.vSpacingXs ?? 0, + left: defaultCommonConfig.hSpacingLg, + top: defaultCommonConfig.vSpacingXs, ), disableTextStyle: BrnTextStyle( color: defaultCommonConfig.colorTextDisabled, @@ -250,18 +250,18 @@ class BrnDefaultConfigUtils { /// Dialog默认配置 static BrnDialogConfig defaultDialogConfig = BrnDialogConfig( - dialogWidth: 300, + dialogWidth: 300.0, radius: defaultCommonConfig.radiusLg, - iconPadding: EdgeInsets.only(top: defaultCommonConfig.vSpacingXxl ?? 0), + iconPadding: EdgeInsets.only(top: defaultCommonConfig.vSpacingXxl), titlePaddingSm: EdgeInsets.only( - top: 12, - left: defaultCommonConfig.hSpacingXxl ?? 0, - right: defaultCommonConfig.hSpacingXxl ?? 0, + top: 12.0, + left: defaultCommonConfig.hSpacingXxl, + right: defaultCommonConfig.hSpacingXxl, ), titlePaddingLg: EdgeInsets.only( - top: 28, - left: defaultCommonConfig.hSpacingXxl ?? 0, - right: defaultCommonConfig.hSpacingXxl ?? 0, + top: 28.0, + left: defaultCommonConfig.hSpacingXxl, + right: defaultCommonConfig.hSpacingXxl, ), titleTextStyle: BrnTextStyle( fontWeight: FontWeight.w600, @@ -270,14 +270,14 @@ class BrnDefaultConfigUtils { ), titleTextAlign: TextAlign.center, contentPaddingSm: EdgeInsets.only( - top: 8, - left: defaultCommonConfig.hSpacingXl ?? 0, - right: defaultCommonConfig.hSpacingXl ?? 0, + top: 8.0, + left: defaultCommonConfig.hSpacingXl, + right: defaultCommonConfig.hSpacingXl, ), contentPaddingLg: EdgeInsets.only( - top: 28, - left: defaultCommonConfig.hSpacingXl ?? 0, - right: defaultCommonConfig.hSpacingXl ?? 0, + top: 28.0, + left: defaultCommonConfig.hSpacingXl, + right: defaultCommonConfig.hSpacingXl, ), contentTextStyle: BrnTextStyle( fontSize: defaultCommonConfig.fontSizeBase, @@ -286,14 +286,14 @@ class BrnDefaultConfigUtils { ), contentTextAlign: TextAlign.center, warningPaddingSm: EdgeInsets.only( - top: 6, - left: defaultCommonConfig.hSpacingXl ?? 0, - right: defaultCommonConfig.hSpacingXl ?? 0, + top: 6.0, + left: defaultCommonConfig.hSpacingXl, + right: defaultCommonConfig.hSpacingXl, ), warningPaddingLg: EdgeInsets.only( - top: 28, - left: defaultCommonConfig.hSpacingXl ?? 0, - right: defaultCommonConfig.hSpacingXl ?? 0, + top: 28.0, + left: defaultCommonConfig.hSpacingXl, + right: defaultCommonConfig.hSpacingXl, ), warningTextAlign: TextAlign.center, warningTextStyle: BrnTextStyle( @@ -301,7 +301,7 @@ class BrnDefaultConfigUtils { color: defaultCommonConfig.brandError, decoration: TextDecoration.none, ), - dividerPadding: EdgeInsets.only(top: 28), + dividerPadding: EdgeInsets.only(top: 28.0), mainActionTextStyle: BrnTextStyle( color: defaultCommonConfig.brandPrimary, fontWeight: FontWeight.w600, @@ -323,7 +323,7 @@ class BrnDefaultConfigUtils { titleWithHeightTextStyle: BrnTextStyle( color: defaultCommonConfig.colorTextBase, fontSize: defaultCommonConfig.fontSizeHead, - height: 25 / 18, + height: 25.0 / 18.0, fontWeight: FontWeight.w600, ), titleTextStyle: BrnTextStyle( @@ -344,8 +344,8 @@ class BrnDefaultConfigUtils { fontSize: defaultCommonConfig.fontSizeBase, ), cardTitlePadding: EdgeInsets.only( - top: defaultCommonConfig.vSpacingXl ?? 0, - bottom: defaultCommonConfig.vSpacingMd ?? 0, + top: defaultCommonConfig.vSpacingXl, + bottom: defaultCommonConfig.vSpacingMd, ), alignment: PlaceholderAlignment.middle, cardBackgroundColor: defaultCommonConfig.fillBase, @@ -376,8 +376,8 @@ class BrnDefaultConfigUtils { color: defaultCommonConfig.colorTextBaseInverse, fontSize: defaultCommonConfig.fontSizeSubHead, ), - singleMinWidth: 160, - doubleMinWidth: 120, + singleMinWidth: 160.0, + doubleMinWidth: 120.0, ); /// 标签配置 @@ -394,11 +394,12 @@ class BrnDefaultConfigUtils { tagBackgroundColor: defaultCommonConfig.fillBody, selectedTagBackgroundColor: defaultCommonConfig.brandPrimary, tagRadius: defaultCommonConfig.radiusXs, - tagHeight: 34, - tagWidth: 75, - tagMinWidth: 75, + tagHeight: 34.0, + tagWidth: 75.0, + tagMinWidth: 75.0, ); + /// 导航栏配置 static BrnAppBarConfig defaultAppBarConfig = BrnAppBarConfig( backgroundColor: Colors.white, @@ -421,7 +422,7 @@ class BrnDefaultConfigUtils { fontWeight: FontWeight.w600, ), titleMaxLength: BrnAppBarTheme.maxLength, - leftAndRightPadding: 20, + leftAndRightPadding: 20.0, itemSpacing: BrnAppBarTheme.iconMargin, titlePadding: EdgeInsets.zero, iconSize: BrnAppBarTheme.iconSize, @@ -452,9 +453,9 @@ class BrnDefaultConfigUtils { /// 内容信息(一列)配置 static BrnPairRichInfoGridConfig defaultPairRichInfoGridConfig = BrnPairRichInfoGridConfig( - rowSpacing: 4, - itemSpacing: 2, - itemHeight: 20, + rowSpacing: 4.0, + itemSpacing: 2.0, + itemHeight: 20.0, keyTextStyle: BrnTextStyle( color: defaultCommonConfig.colorTextSecondary, fontSize: defaultCommonConfig.fontSizeBase, @@ -475,12 +476,12 @@ class BrnDefaultConfigUtils { /// 按钮配置 static BrnButtonConfig defaultButtonConfig = BrnButtonConfig( - bigButtonRadius: 6, - bigButtonHeight: 48, - bigButtonFontSize: 16, - smallButtonRadius: 4, - smallButtonHeight: 32, - smallButtonFontSize: 14, + bigButtonRadius: 6.0, + bigButtonHeight: 48.0, + bigButtonFontSize: 16.0, + smallButtonRadius: 4.0, + smallButtonHeight: 32.0, + smallButtonFontSize: 14.0, configId: BRUNO_CONFIG_ID, ); @@ -525,8 +526,8 @@ class BrnDefaultConfigUtils { fontSize: defaultCommonConfig.fontSizeSubHead, fontWeight: FontWeight.w600, ), - titlePadding: EdgeInsets.symmetric(horizontal: 60, vertical: 16), - contentPadding: EdgeInsets.symmetric(horizontal: 60, vertical: 12), + titlePadding: EdgeInsets.symmetric(horizontal: 60.0, vertical: 16.0), + contentPadding: EdgeInsets.symmetric(horizontal: 60.0, vertical: 12.0), ); static BrnPickerConfig defaultPickerConfig = BrnPickerConfig( @@ -564,11 +565,11 @@ class BrnDefaultConfigUtils { /// 数字增强信息配置 static BrnEnhanceNumberCardConfig defaultEnhanceNumberInfoConfig = BrnEnhanceNumberCardConfig( - runningSpace: 16, - itemRunningSpace: 8, - titleTextStyle: BrnTextStyle(fontSize: 28, fontWeight: FontWeight.w600), + runningSpace: 16.0, + itemRunningSpace: 8.0, + titleTextStyle: BrnTextStyle(fontSize: 28.0, fontWeight: FontWeight.w600), descTextStyle: BrnTextStyle( - fontSize: 12, + fontSize: 12.0, color: defaultCommonConfig.colorTextSecondary, ), dividerWidth: 0.5, @@ -576,9 +577,10 @@ class BrnDefaultConfigUtils { /// TabBar配置 static BrnTabBarConfig defaultTabBarConfig = BrnTabBarConfig( - tabHeight: 50, - indicatorHeight: 2, - indicatorWidth: 24, + backgroundColor: Colors.white, + tabHeight: 50.0, + indicatorHeight: 2.0, + indicatorWidth: 24.0, labelStyle: BrnTextStyle( color: defaultCommonConfig.brandPrimary, fontSize: defaultCommonConfig.fontSizeSubHead, @@ -594,15 +596,15 @@ class BrnDefaultConfigUtils { color: defaultCommonConfig.colorTextBase, fontSize: defaultCommonConfig.fontSizeCaption, ), - tagNormalBgColor: defaultCommonConfig.brandPrimary?.withAlpha(0x14), + tagNormalBgColor: defaultCommonConfig.brandPrimary.withAlpha(0x14), tagSelectedTextStyle: BrnTextStyle( color: defaultCommonConfig.brandPrimary, fontSize: defaultCommonConfig.fontSizeCaption, ), tagSelectedBgColor: defaultCommonConfig.fillBody, - tagSpacing: 12, + tagSpacing: 12.0, preLineTagCount: 4, - tagHeight: 32, + tagHeight: 32.0, ); /// 筛选项配置 @@ -628,7 +630,7 @@ class BrnDefaultConfigUtils { tagRadius: defaultCommonConfig.radiusSm, tagNormalBackgroundColor: defaultCommonConfig.fillBody, tagSelectedBackgroundColor: - defaultCommonConfig.brandPrimary?.withOpacity(0.12), + defaultCommonConfig.brandPrimary.withOpacity(0.12), rangeTitleTextStyle: BrnTextStyle( color: defaultCommonConfig.colorTextBase, fontSize: defaultCommonConfig.fontSizeSubHead, @@ -711,7 +713,7 @@ class BrnDefaultConfigUtils { appbarBackgroundColor: Colors.black, appbarBrightness: Brightness.dark, tabBarUnSelectedLabelStyle: BrnTextStyle( - fontSize: 16, + fontSize: 16.0, color: Color(0XFFCCCCCC), ), tabBarLabelStyle: BrnTextStyle( diff --git a/lib/src/theme/configs/brn_abnormal_state_config.dart b/lib/src/theme/configs/brn_abnormal_state_config.dart index 805dc1ad..d39a889b 100644 --- a/lib/src/theme/configs/brn_abnormal_state_config.dart +++ b/lib/src/theme/configs/brn_abnormal_state_config.dart @@ -1,4 +1,5 @@ import 'package:bruno/src/theme/base/brn_base_config.dart'; +import 'package:bruno/src/theme/base/brn_default_config_utils.dart'; import 'package:bruno/src/theme/base/brn_text_style.dart'; import 'package:bruno/src/theme/brn_theme_configurator.dart'; import 'package:bruno/src/theme/configs/brn_common_config.dart'; @@ -6,16 +7,24 @@ import 'package:bruno/src/theme/configs/brn_common_config.dart'; /// 描述: 空页面配置类 class BrnAbnormalStateConfig extends BrnBaseConfig { BrnAbnormalStateConfig({ - this.titleTextStyle, - this.contentTextStyle, - this.operateTextStyle, - this.btnRadius, - this.singleTextStyle, - this.doubleTextStyle, - this.singleMinWidth, - this.doubleMinWidth, + BrnTextStyle? titleTextStyle, + BrnTextStyle? contentTextStyle, + BrnTextStyle? operateTextStyle, + double? btnRadius, + BrnTextStyle? singleTextStyle, + BrnTextStyle? doubleTextStyle, + double? singleMinWidth, + double? doubleMinWidth, String configId = GLOBAL_CONFIG_ID, - }) : super(configId: configId); + }) : _titleTextStyle = titleTextStyle, + _contentTextStyle = contentTextStyle, + _operateTextStyle = operateTextStyle, + _btnRadius = btnRadius, + _singleTextStyle = singleTextStyle, + _doubleTextStyle = doubleTextStyle, + _singleMinWidth = singleMinWidth, + _doubleMinWidth = doubleMinWidth, + super(configId: configId); /// 文案区域标题 /// @@ -24,7 +33,7 @@ class BrnAbnormalStateConfig extends BrnBaseConfig { /// fontSize: [BrnCommonConfig.fontSizeSubHead], /// fontWeight: FontWeight.w600, /// ) - BrnTextStyle? titleTextStyle; + BrnTextStyle? _titleTextStyle; /// 文案区域内容 /// @@ -32,7 +41,7 @@ class BrnAbnormalStateConfig extends BrnBaseConfig { /// color: [BrnCommonConfig.colorTextHint], /// fontSize: [BrnCommonConfig.fontSizeBase], /// ) - BrnTextStyle? contentTextStyle; + BrnTextStyle? _contentTextStyle; /// 操作区域文本样式 /// @@ -40,11 +49,11 @@ class BrnAbnormalStateConfig extends BrnBaseConfig { /// color: [BrnCommonConfig.brandPrimary], /// fontSize: [BrnCommonConfig.fontSizeBase], /// ) - BrnTextStyle? operateTextStyle; + BrnTextStyle? _operateTextStyle; /// 圆角 /// default value is [BrnCommonConfig.radiusSm] - double? btnRadius; + double? _btnRadius; /// 单按钮文本样式 /// @@ -52,7 +61,7 @@ class BrnAbnormalStateConfig extends BrnBaseConfig { /// color: [BrnCommonConfig.colorTextBaseInverse], /// fontSize: [BrnCommonConfig.fontSizeSubHead], /// ) - BrnTextStyle? singleTextStyle; + BrnTextStyle? _singleTextStyle; /// 双按钮文本样式 /// @@ -60,15 +69,46 @@ class BrnAbnormalStateConfig extends BrnBaseConfig { /// color: [BrnCommonConfig.brandPrimary], /// fontSize: [BrnCommonConfig.fontSizeSubHead], /// ) - BrnTextStyle? doubleTextStyle; + BrnTextStyle? _doubleTextStyle; /// 单按钮的按钮最小宽度 /// 默认值为 160 - double? singleMinWidth; + double? _singleMinWidth; /// 多按钮的按钮最小宽度 /// 默认值为 120 - double? doubleMinWidth; + double? _doubleMinWidth; + + BrnTextStyle get titleTextStyle => + _titleTextStyle ?? + BrnDefaultConfigUtils.defaultAbnormalStateConfig.titleTextStyle; + + BrnTextStyle get contentTextStyle => + _contentTextStyle ?? + BrnDefaultConfigUtils.defaultAbnormalStateConfig.contentTextStyle; + + BrnTextStyle get operateTextStyle => + _operateTextStyle ?? + BrnDefaultConfigUtils.defaultAbnormalStateConfig.operateTextStyle; + + double get btnRadius => + _btnRadius ?? BrnDefaultConfigUtils.defaultAbnormalStateConfig.btnRadius; + + BrnTextStyle get singleTextStyle => + _singleTextStyle ?? + BrnDefaultConfigUtils.defaultAbnormalStateConfig.singleTextStyle; + + BrnTextStyle get doubleTextStyle => + _doubleTextStyle ?? + BrnDefaultConfigUtils.defaultAbnormalStateConfig.doubleTextStyle; + + double get singleMinWidth => + _singleMinWidth ?? + BrnDefaultConfigUtils.defaultAbnormalStateConfig.singleMinWidth; + + double get doubleMinWidth => + _doubleMinWidth ?? + BrnDefaultConfigUtils.defaultAbnormalStateConfig.doubleMinWidth; @override void initThemeConfig( @@ -81,43 +121,43 @@ class BrnAbnormalStateConfig extends BrnBaseConfig { ); /// 用户全局组件配置 - BrnAbnormalStateConfig? abnormalStateConfig = BrnThemeConfigurator.instance + BrnAbnormalStateConfig abnormalStateConfig = BrnThemeConfigurator.instance .getConfig(configId: configId) .abnormalStateConfig; - titleTextStyle = abnormalStateConfig?.titleTextStyle?.merge( + _titleTextStyle = abnormalStateConfig.titleTextStyle.merge( BrnTextStyle( color: commonConfig.colorTextBase, fontSize: commonConfig.fontSizeSubHead, ).merge(titleTextStyle), ); - contentTextStyle = abnormalStateConfig?.contentTextStyle?.merge( + _contentTextStyle = abnormalStateConfig.contentTextStyle.merge( BrnTextStyle( color: commonConfig.colorTextHint, fontSize: commonConfig.fontSizeSubHead, - ).merge(contentTextStyle), + ).merge(_contentTextStyle), ); - operateTextStyle = abnormalStateConfig?.operateTextStyle?.merge( + _operateTextStyle = abnormalStateConfig.operateTextStyle.merge( BrnTextStyle( color: commonConfig.brandPrimary, fontSize: commonConfig.fontSizeBase, - ).merge(operateTextStyle), + ).merge(_operateTextStyle), ); - singleTextStyle = abnormalStateConfig?.singleTextStyle?.merge( + _singleTextStyle = abnormalStateConfig.singleTextStyle.merge( BrnTextStyle( color: commonConfig.colorTextBaseInverse, fontSize: commonConfig.fontSizeSubHead, - ).merge(singleTextStyle), + ).merge(_singleTextStyle), ); - doubleTextStyle = abnormalStateConfig?.doubleTextStyle?.merge( + _doubleTextStyle = abnormalStateConfig.doubleTextStyle.merge( BrnTextStyle( color: commonConfig.brandPrimary, fontSize: commonConfig.fontSizeSubHead, - ).merge(doubleTextStyle), + ).merge(_doubleTextStyle), ); - btnRadius ??= abnormalStateConfig?.btnRadius; - singleMinWidth ??= abnormalStateConfig?.singleMinWidth; - doubleMinWidth ??= abnormalStateConfig?.doubleMinWidth; + _btnRadius ??= abnormalStateConfig._btnRadius; + _singleMinWidth ??= abnormalStateConfig._singleMinWidth; + _doubleMinWidth ??= abnormalStateConfig._doubleMinWidth; } BrnAbnormalStateConfig copyWith({ @@ -131,33 +171,28 @@ class BrnAbnormalStateConfig extends BrnBaseConfig { double? doubleMinWidth, }) { return BrnAbnormalStateConfig( - titleTextStyle: titleTextStyle ?? this.titleTextStyle, - contentTextStyle: contentTextStyle ?? this.contentTextStyle, - operateTextStyle: operateTextStyle ?? this.operateTextStyle, - btnRadius: btnRadius ?? this.btnRadius, - singleTextStyle: singleTextStyle ?? this.singleTextStyle, - doubleTextStyle: doubleTextStyle ?? this.doubleTextStyle, - singleMinWidth: singleMinWidth ?? this.singleMinWidth, - doubleMinWidth: doubleMinWidth ?? this.doubleMinWidth, + titleTextStyle: titleTextStyle ?? _titleTextStyle, + contentTextStyle: contentTextStyle ?? _contentTextStyle, + operateTextStyle: operateTextStyle ?? _operateTextStyle, + btnRadius: btnRadius ?? _btnRadius, + singleTextStyle: singleTextStyle ?? _singleTextStyle, + doubleTextStyle: doubleTextStyle ?? _doubleTextStyle, + singleMinWidth: singleMinWidth ?? _singleMinWidth, + doubleMinWidth: doubleMinWidth ?? _doubleMinWidth, ); } BrnAbnormalStateConfig merge(BrnAbnormalStateConfig? other) { if (other == null) return this; return copyWith( - titleTextStyle: - titleTextStyle?.merge(other.titleTextStyle) ?? other.titleTextStyle, - contentTextStyle: contentTextStyle?.merge(other.contentTextStyle) ?? - other.contentTextStyle, - operateTextStyle: operateTextStyle?.merge(other.operateTextStyle) ?? - other.operateTextStyle, - btnRadius: other.btnRadius, - singleTextStyle: singleTextStyle?.merge(other.singleTextStyle) ?? - other.singleTextStyle, - doubleTextStyle: doubleTextStyle?.merge(other.doubleTextStyle) ?? - other.doubleTextStyle, - singleMinWidth: other.singleMinWidth, - doubleMinWidth: other.doubleMinWidth, + titleTextStyle: titleTextStyle.merge(other._titleTextStyle), + contentTextStyle: contentTextStyle.merge(other._contentTextStyle), + operateTextStyle: operateTextStyle.merge(other._operateTextStyle), + btnRadius: other._btnRadius, + singleTextStyle: singleTextStyle.merge(other._singleTextStyle), + doubleTextStyle: doubleTextStyle.merge(other._doubleTextStyle), + singleMinWidth: other._singleMinWidth, + doubleMinWidth: other._doubleMinWidth, ); } } diff --git a/lib/src/theme/configs/brn_action_sheet_config.dart b/lib/src/theme/configs/brn_action_sheet_config.dart index 6b975ac3..b383cf94 100644 --- a/lib/src/theme/configs/brn_action_sheet_config.dart +++ b/lib/src/theme/configs/brn_action_sheet_config.dart @@ -1,4 +1,5 @@ import 'package:bruno/src/theme/base/brn_base_config.dart'; +import 'package:bruno/src/theme/base/brn_default_config_utils.dart'; import 'package:bruno/src/theme/base/brn_text_style.dart'; import 'package:bruno/src/theme/brn_theme_configurator.dart'; import 'package:bruno/src/theme/configs/brn_common_config.dart'; @@ -9,23 +10,34 @@ class BrnActionSheetConfig extends BrnBaseConfig { /// 遵循外部主题配置 /// 默认为 [BrnDefaultConfigUtils.defaultActionSheetConfig] BrnActionSheetConfig({ - this.titleStyle, - this.itemTitleStyle, - this.itemTitleStyleLink, - this.itemTitleStyleAlert, - this.itemDescStyle, - this.itemDescStyleLink, - this.itemDescStyleAlert, - this.cancelStyle, - this.topRadius, - this.contentPadding, - this.titlePadding, + BrnTextStyle? titleStyle, + BrnTextStyle? itemTitleStyle, + BrnTextStyle? itemTitleStyleLink, + BrnTextStyle? itemTitleStyleAlert, + BrnTextStyle? itemDescStyle, + BrnTextStyle? itemDescStyleLink, + BrnTextStyle? itemDescStyleAlert, + BrnTextStyle? cancelStyle, + double? topRadius, + EdgeInsets? contentPadding, + EdgeInsets? titlePadding, String configId = GLOBAL_CONFIG_ID, - }) : super(configId: configId); + }) : _titleStyle = titleStyle, + _itemTitleStyle = itemTitleStyle, + _itemTitleStyleLink = itemTitleStyleLink, + _itemTitleStyleAlert = itemTitleStyleAlert, + _itemDescStyle = itemDescStyle, + _itemDescStyleLink = itemDescStyleLink, + _itemDescStyleAlert = itemDescStyleAlert, + _cancelStyle = cancelStyle, + _topRadius = topRadius, + _contentPadding = contentPadding, + _titlePadding = titlePadding, + super(configId: configId); /// ActionSheet 的顶部圆角 /// 默认值为 [BrnCommonConfig.radiusLg] - double? topRadius; + double? _topRadius; /// 标题样式 /// @@ -33,7 +45,7 @@ class BrnActionSheetConfig extends BrnBaseConfig { /// color: [BrnCommonConfig.colorTextSecondary], /// fontSize: [BrnCommonConfig.fontSizeBase], /// ) - BrnTextStyle? titleStyle; + BrnTextStyle? _titleStyle; /// 元素标题默认样式 /// @@ -41,7 +53,7 @@ class BrnActionSheetConfig extends BrnBaseConfig { /// color: [BrnCommonConfig.colorTextBase], /// fontSize:[BrnCommonConfig.fontSizeSubHead], /// ) - BrnTextStyle? itemTitleStyle; + BrnTextStyle? _itemTitleStyle; /// 元素标题链接样式 /// @@ -50,7 +62,7 @@ class BrnActionSheetConfig extends BrnBaseConfig { /// fontSize: [BrnCommonConfig.fontSizeSubHead], /// fontWeight: FontWeight.w600, /// ) - BrnTextStyle? itemTitleStyleLink; + BrnTextStyle? _itemTitleStyleLink; /// 元素警示项标题样式 /// @@ -59,7 +71,7 @@ class BrnActionSheetConfig extends BrnBaseConfig { /// fontSize: [BrnCommonConfig.fontSizeBase], /// fontWeight: FontWeight.w600, /// ) - BrnTextStyle? itemTitleStyleAlert; + BrnTextStyle? _itemTitleStyleAlert; /// 元素描述默认样式 /// @@ -68,7 +80,7 @@ class BrnActionSheetConfig extends BrnBaseConfig { /// fontSize: [BrnCommonConfig.fontSizeCaption], /// fontWeight: FontWeight.w600, /// ) - BrnTextStyle? itemDescStyle; + BrnTextStyle? _itemDescStyle; /// 元素标题描述链接样式 /// @@ -77,7 +89,7 @@ class BrnActionSheetConfig extends BrnBaseConfig { /// fontSize: [BrnCommonConfig.fontSizeCaption], /// fontWeight: FontWeight.w600, /// ) - BrnTextStyle? itemDescStyleLink; + BrnTextStyle? _itemDescStyleLink; /// 元素警示项标题描述样式 /// @@ -86,7 +98,7 @@ class BrnActionSheetConfig extends BrnBaseConfig { /// fontSize: [BrnCommonConfig.fontSizeCaption], /// fontWeight: FontWeight.w600, /// ) - BrnTextStyle? itemDescStyleAlert; + BrnTextStyle? _itemDescStyleAlert; /// 取消按钮样式 /// @@ -95,17 +107,59 @@ class BrnActionSheetConfig extends BrnBaseConfig { /// fontSize: [BrnCommonConfig.fontSizeSubHead], /// fontWeight: FontWeight.w600, /// ) - BrnTextStyle? cancelStyle; + BrnTextStyle? _cancelStyle; /// 内容左右间距 /// /// EdgeInsets.symmetric(horizontal: 60, vertical: 12) - EdgeInsets? contentPadding; + EdgeInsets? _contentPadding; /// 标题左右间距 /// /// EdgeInsets.symmetric(horizontal: 60, vertical: 16) - EdgeInsets? titlePadding; + EdgeInsets? _titlePadding; + + double get topRadius => + _topRadius ?? BrnDefaultConfigUtils.defaultActionSheetConfig.topRadius; + + BrnTextStyle get titleStyle => + _titleStyle ?? BrnDefaultConfigUtils.defaultActionSheetConfig.titleStyle; + + BrnTextStyle get itemTitleStyle => + _itemTitleStyle ?? + BrnDefaultConfigUtils.defaultActionSheetConfig.itemTitleStyle; + + BrnTextStyle get itemTitleStyleLink => + _itemTitleStyleLink ?? + BrnDefaultConfigUtils.defaultActionSheetConfig.itemTitleStyleLink; + + BrnTextStyle get itemTitleStyleAlert => + _itemTitleStyleAlert ?? + BrnDefaultConfigUtils.defaultActionSheetConfig.itemTitleStyleAlert; + + BrnTextStyle get itemDescStyle => + _itemDescStyle ?? + BrnDefaultConfigUtils.defaultActionSheetConfig.itemDescStyle; + + BrnTextStyle get itemDescStyleLink => + _itemDescStyleLink ?? + BrnDefaultConfigUtils.defaultActionSheetConfig.itemDescStyleLink; + + BrnTextStyle get itemDescStyleAlert => + _itemDescStyleAlert ?? + BrnDefaultConfigUtils.defaultActionSheetConfig.itemDescStyleAlert; + + BrnTextStyle get cancelStyle => + _cancelStyle ?? + BrnDefaultConfigUtils.defaultActionSheetConfig.cancelStyle; + + EdgeInsets get contentPadding => + _contentPadding ?? + BrnDefaultConfigUtils.defaultActionSheetConfig.contentPadding; + + EdgeInsets get titlePadding => + _titlePadding ?? + BrnDefaultConfigUtils.defaultActionSheetConfig.titlePadding; @override void initThemeConfig( @@ -118,61 +172,61 @@ class BrnActionSheetConfig extends BrnBaseConfig { ); /// 用户全局组件配置 - BrnActionSheetConfig? actionSheetConfig = BrnThemeConfigurator.instance + BrnActionSheetConfig actionSheetConfig = BrnThemeConfigurator.instance .getConfig(configId: configId) .actionSheetConfig; - titlePadding ??= actionSheetConfig?.titlePadding; - contentPadding ??= actionSheetConfig?.contentPadding; - titleStyle = actionSheetConfig?.titleStyle?.merge( + _titlePadding ??= actionSheetConfig.titlePadding; + _contentPadding ??= actionSheetConfig.contentPadding; + _titleStyle = actionSheetConfig.titleStyle.merge( BrnTextStyle( color: commonConfig.colorTextSecondary, fontSize: commonConfig.fontSizeBase, - ).merge(titleStyle), + ).merge(_titleStyle), ); - itemTitleStyle = actionSheetConfig?.itemTitleStyle?.merge( + _itemTitleStyle = actionSheetConfig.itemTitleStyle.merge( BrnTextStyle( color: commonConfig.colorTextBase, fontSize: commonConfig.fontSizeSubHead, - ).merge(itemTitleStyle), + ).merge(_itemTitleStyle), ); - itemTitleStyleLink = actionSheetConfig?.itemTitleStyleLink?.merge( + _itemTitleStyleLink = actionSheetConfig.itemTitleStyleLink.merge( BrnTextStyle( color: commonConfig.colorLink, fontSize: commonConfig.fontSizeSubHead, - ).merge(itemTitleStyleLink), + ).merge(_itemTitleStyleLink), ); - itemTitleStyleAlert = actionSheetConfig?.itemTitleStyleAlert?.merge( + _itemTitleStyleAlert = actionSheetConfig.itemTitleStyleAlert.merge( BrnTextStyle( color: commonConfig.brandError, fontSize: commonConfig.fontSizeBase, - ).merge(itemTitleStyleAlert), + ).merge(_itemTitleStyleAlert), ); - itemDescStyle = actionSheetConfig?.itemDescStyle?.merge( + _itemDescStyle = actionSheetConfig.itemDescStyle.merge( BrnTextStyle( color: commonConfig.colorTextBase, fontSize: commonConfig.fontSizeCaption, - ).merge(itemDescStyle), + ).merge(_itemDescStyle), ); - itemDescStyleLink = actionSheetConfig?.itemDescStyleLink?.merge( + _itemDescStyleLink = actionSheetConfig.itemDescStyleLink.merge( BrnTextStyle( color: commonConfig.colorLink, fontSize: commonConfig.fontSizeCaption, - ).merge(itemDescStyleLink), + ).merge(_itemDescStyleLink), ); - itemDescStyleAlert = actionSheetConfig?.itemDescStyleAlert?.merge( + _itemDescStyleAlert = actionSheetConfig.itemDescStyleAlert.merge( BrnTextStyle( color: commonConfig.brandError, fontSize: commonConfig.fontSizeCaption, - ).merge(itemDescStyleAlert), + ).merge(_itemDescStyleAlert), ); - cancelStyle = actionSheetConfig?.cancelStyle?.merge( + _cancelStyle = actionSheetConfig.cancelStyle.merge( BrnTextStyle( color: commonConfig.colorTextBase, fontSize: commonConfig.fontSizeSubHead, - ).merge(cancelStyle), + ).merge(_cancelStyle), ); - topRadius ??= commonConfig.radiusLg; + _topRadius ??= commonConfig.radiusLg; } BrnActionSheetConfig copyWith({ @@ -189,41 +243,34 @@ class BrnActionSheetConfig extends BrnBaseConfig { EdgeInsets? titlePadding, }) { return BrnActionSheetConfig( - titleStyle: titleStyle ?? this.titleStyle, - itemTitleStyle: itemTitleStyle ?? this.itemTitleStyle, - itemTitleStyleLink: itemTitleStyleLink ?? this.itemTitleStyleLink, - itemTitleStyleAlert: itemTitleStyleAlert ?? this.itemTitleStyleAlert, - itemDescStyle: itemDescStyle ?? this.itemDescStyle, - itemDescStyleLink: itemDescStyleLink ?? this.itemDescStyleLink, - itemDescStyleAlert: itemDescStyleAlert ?? this.itemDescStyleAlert, - cancelStyle: cancelStyle ?? this.cancelStyle, - topRadius: topRadius ?? this.topRadius, - contentPadding: contentPadding ?? this.contentPadding, - titlePadding: titlePadding ?? this.titlePadding, + titleStyle: titleStyle ?? _titleStyle, + itemTitleStyle: itemTitleStyle ?? _itemTitleStyle, + itemTitleStyleLink: itemTitleStyleLink ?? _itemTitleStyleLink, + itemTitleStyleAlert: itemTitleStyleAlert ?? _itemTitleStyleAlert, + itemDescStyle: itemDescStyle ?? _itemDescStyle, + itemDescStyleLink: itemDescStyleLink ?? _itemDescStyleLink, + itemDescStyleAlert: itemDescStyleAlert ?? _itemDescStyleAlert, + cancelStyle: cancelStyle ?? _cancelStyle, + topRadius: topRadius ?? _topRadius, + contentPadding: contentPadding ?? _contentPadding, + titlePadding: titlePadding ?? _titlePadding, ); } BrnActionSheetConfig merge(BrnActionSheetConfig? other) { if (other == null) return this; return copyWith( - titleStyle: titleStyle?.merge(other.titleStyle) ?? other.titleStyle, - itemTitleStyle: - itemTitleStyle?.merge(other.itemTitleStyle) ?? other.itemTitleStyle, - itemTitleStyleLink: itemTitleStyleLink?.merge(other.itemTitleStyleLink) ?? - other.itemTitleStyleLink, - itemTitleStyleAlert: - itemTitleStyleAlert?.merge(other.itemTitleStyleAlert) ?? - other.itemTitleStyleAlert, - itemDescStyle: - itemDescStyle?.merge(other.itemDescStyle) ?? other.itemDescStyle, - itemDescStyleLink: itemDescStyleLink?.merge(other.itemDescStyleLink) ?? - other.itemDescStyleLink, - itemDescStyleAlert: itemDescStyleAlert?.merge(other.itemDescStyleAlert) ?? - other.itemDescStyleAlert, - cancelStyle: cancelStyle?.merge(other.cancelStyle) ?? other.cancelStyle, - topRadius: other.topRadius, - contentPadding: other.contentPadding, - titlePadding: other.titlePadding, + titleStyle: titleStyle.merge(other._titleStyle), + itemTitleStyle: itemTitleStyle.merge(other._itemTitleStyle), + itemTitleStyleLink: itemTitleStyleLink.merge(other._itemTitleStyleLink), + itemTitleStyleAlert: itemTitleStyleAlert.merge(other._itemTitleStyleAlert), + itemDescStyle: itemDescStyle.merge(other._itemDescStyle), + itemDescStyleLink: itemDescStyleLink.merge(other._itemDescStyleLink), + itemDescStyleAlert: itemDescStyleAlert.merge(other._itemDescStyleAlert), + cancelStyle: cancelStyle.merge(other._cancelStyle), + topRadius: other._topRadius, + contentPadding: other._contentPadding, + titlePadding: other._titlePadding, ); } } diff --git a/lib/src/theme/configs/brn_all_config.dart b/lib/src/theme/configs/brn_all_config.dart index d0ca3e93..fe244f36 100644 --- a/lib/src/theme/configs/brn_all_config.dart +++ b/lib/src/theme/configs/brn_all_config.dart @@ -25,22 +25,22 @@ import 'package:bruno/src/theme/configs/brn_tag_config.dart'; /// 当没有配置组件的特定属性时使用上一级特定配置 class BrnAllThemeConfig { BrnAllThemeConfig({ - commonConfig, - appBarConfig, - buttonConfig, - dialogConfig, - formItemConfig, - cardTitleConfig, - abnormalStateConfig, - tagConfig, - pairInfoTableConfig, - pairRichInfoGridConfig, - actionSheetConfig, - pickerConfig, - enhanceNumberCardConfig, - tabBarConfig, - selectionConfig, - galleryDetailConfig, + BrnCommonConfig? commonConfig, + BrnAppBarConfig? appBarConfig, + BrnButtonConfig? buttonConfig, + BrnDialogConfig? dialogConfig, + BrnFormItemConfig? formItemConfig, + BrnCardTitleConfig? cardTitleConfig, + BrnAbnormalStateConfig? abnormalStateConfig, + BrnTagConfig? tagConfig, + BrnPairInfoTableConfig? pairInfoTableConfig, + BrnPairRichInfoGridConfig? pairRichInfoGridConfig, + BrnActionSheetConfig? actionSheetConfig, + BrnPickerConfig? pickerConfig, + BrnEnhanceNumberCardConfig? enhanceNumberCardConfig, + BrnTabBarConfig? tabBarConfig, + BrnSelectionConfig? selectionConfig, + BrnGalleryDetailConfig? galleryDetailConfig, String configId = GLOBAL_CONFIG_ID, }) : _commonConfig = commonConfig, _appBarConfig = appBarConfig, diff --git a/lib/src/theme/configs/brn_appbar_config.dart b/lib/src/theme/configs/brn_appbar_config.dart index fbcf1479..c8b07521 100644 --- a/lib/src/theme/configs/brn_appbar_config.dart +++ b/lib/src/theme/configs/brn_appbar_config.dart @@ -2,6 +2,7 @@ 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/theme/base/brn_base_config.dart'; +import 'package:bruno/src/theme/base/brn_default_config_utils.dart'; import 'package:bruno/src/theme/base/brn_text_style.dart'; import 'package:bruno/src/theme/brn_theme_configurator.dart'; import 'package:bruno/src/theme/configs/brn_common_config.dart'; @@ -15,36 +16,58 @@ class BrnAppBarConfig extends BrnBaseConfig { /// BrnAppBar 主题配置,遵循外部主题配置 /// 默认为 [BrnDefaultConfigUtils.defaultAppBarConfig] BrnAppBarConfig({ - this.backgroundColor, - this.appBarHeight, - this.leadIconBuilder, - this.titleStyle, - this.actionsStyle, - this.titleMaxLength, - this.leftAndRightPadding, - this.itemSpacing, - this.titlePadding, - this.iconSize, - this.flexibleSpace, - this.systemUiOverlayStyle, + Color? backgroundColor, + double? appBarHeight, + BrnWidgetBuilder? leadIconBuilder, + BrnTextStyle? titleStyle, + BrnTextStyle? actionsStyle, + int? titleMaxLength, + double? leftAndRightPadding, + double? itemSpacing, + EdgeInsets? titlePadding, + double? iconSize, + Widget? flexibleSpace, + SystemUiOverlayStyle? systemUiOverlayStyle, String configId = GLOBAL_CONFIG_ID, - }) : super(configId: configId); + }) : _backgroundColor = backgroundColor, + _appBarHeight = appBarHeight, + _leadIconBuilder = leadIconBuilder, + _titleStyle = titleStyle, + _actionsStyle = actionsStyle, + _titleMaxLength = titleMaxLength, + _leftAndRightPadding = leftAndRightPadding, + _itemSpacing = itemSpacing, + _titlePadding = titlePadding, + _iconSize = iconSize, + _systemUiOverlayStyle = systemUiOverlayStyle, + super(configId: configId); BrnAppBarConfig.dark({ - this.backgroundColor, - this.appBarHeight, - this.leadIconBuilder, - this.titleStyle, - this.actionsStyle, - this.titleMaxLength, - this.leftAndRightPadding, - this.itemSpacing, - this.titlePadding, - this.iconSize, - this.flexibleSpace, - this.systemUiOverlayStyle, + Color? backgroundColor, + double? appBarHeight, + BrnWidgetBuilder? leadIconBuilder, + BrnTextStyle? titleStyle, + BrnTextStyle? actionsStyle, + int? titleMaxLength, + double? leftAndRightPadding, + double? itemSpacing, + EdgeInsets? titlePadding, + double? iconSize, + Widget? flexibleSpace, + SystemUiOverlayStyle? systemUiOverlayStyle, String configId = GLOBAL_CONFIG_ID, - }) : super(configId: configId) { + }) : _backgroundColor = backgroundColor, + _appBarHeight = appBarHeight, + _leadIconBuilder = leadIconBuilder, + _titleStyle = titleStyle, + _actionsStyle = actionsStyle, + _titleMaxLength = titleMaxLength, + _leftAndRightPadding = leftAndRightPadding, + _itemSpacing = itemSpacing, + _titlePadding = titlePadding, + _iconSize = iconSize, + _systemUiOverlayStyle = systemUiOverlayStyle, + super(configId: configId) { backgroundColor = Color(0xff2E313B); leadIconBuilder = () => Image.asset( BrnAsset.ICON_BACK_WHITE, @@ -67,54 +90,79 @@ class BrnAppBarConfig extends BrnBaseConfig { } BrnAppBarConfig.light({ - this.backgroundColor, - this.appBarHeight, - this.leadIconBuilder, - this.titleStyle, - this.actionsStyle, - this.titleMaxLength, - this.leftAndRightPadding, - this.itemSpacing, - this.titlePadding, - this.iconSize, - this.flexibleSpace, - this.systemUiOverlayStyle, + Color? backgroundColor, + double? appBarHeight, + BrnWidgetBuilder? leadIconBuilder, + BrnTextStyle? titleStyle, + BrnTextStyle? actionsStyle, + int? titleMaxLength, + double? leftAndRightPadding, + double? itemSpacing, + EdgeInsets? titlePadding, + double? iconSize, + Widget? flexibleSpace, + SystemUiOverlayStyle? systemUiOverlayStyle, String configId = GLOBAL_CONFIG_ID, - }) : super(configId: configId) { - backgroundColor = Colors.white; - leadIconBuilder = () => Image.asset( + }) : _backgroundColor = backgroundColor, + _appBarHeight = appBarHeight, + _leadIconBuilder = leadIconBuilder, + _titleStyle = titleStyle, + _actionsStyle = actionsStyle, + _titleMaxLength = titleMaxLength, + _leftAndRightPadding = leftAndRightPadding, + _itemSpacing = itemSpacing, + _titlePadding = titlePadding, + _iconSize = iconSize, + _systemUiOverlayStyle = systemUiOverlayStyle, + super(configId: configId) { + _backgroundColor = Colors.white; + _leadIconBuilder = () => Image.asset( BrnAsset.ICON_BACK_BLACK, package: BrnStrings.flutterPackageName, width: BrnAppBarTheme.iconSize, height: BrnAppBarTheme.iconSize, fit: BoxFit.fitHeight, ); - titleStyle = BrnTextStyle( + _titleStyle = BrnTextStyle( fontSize: BrnAppBarTheme.titleFontSize, fontWeight: FontWeight.w600, color: BrnAppBarTheme.lightTextColor, ); - actionsStyle = BrnTextStyle( + _actionsStyle = BrnTextStyle( color: BrnAppBarTheme.lightTextColor, fontSize: BrnAppBarTheme.actionFontSize, fontWeight: FontWeight.w600, ); - systemUiOverlayStyle = SystemUiOverlayStyle.dark; + _systemUiOverlayStyle = SystemUiOverlayStyle.dark; } /// AppBar 的背景色 - Color? backgroundColor; + Color? _backgroundColor; + + Color get backgroundColor => + _backgroundColor ?? + BrnDefaultConfigUtils.defaultAppBarConfig.backgroundColor; /// AppBar 的高度 - double? appBarHeight; + double? _appBarHeight; + + double get appBarHeight => + _appBarHeight ?? BrnDefaultConfigUtils.defaultAppBarConfig.appBarHeight; /// 返回按钮的child widget,一般为Image - BrnWidgetBuilder? leadIconBuilder; + BrnWidgetBuilder? _leadIconBuilder; + + BrnWidgetBuilder get leadIconBuilder => + _leadIconBuilder ?? + BrnDefaultConfigUtils.defaultAppBarConfig.leadIconBuilder; /// 标题样式,仅当直接 title 设置为 String 生效 /// /// **注意**:`fontSize` 必须传大小,否则报错 - BrnTextStyle? titleStyle; + BrnTextStyle? _titleStyle; + + BrnTextStyle get titleStyle => + _titleStyle ?? BrnDefaultConfigUtils.defaultAppBarConfig.titleStyle; /// 右侧文字按钮样式,仅当直接actions里面元素为BrnTextAction类型生效 /// @@ -125,30 +173,52 @@ class BrnAppBarConfig extends BrnBaseConfig { /// fontSize: BrnAppBarTheme.actionFontSize, /// fontWeight: FontWeight.w600, /// ) - BrnTextStyle? actionsStyle; + BrnTextStyle? _actionsStyle; + + BrnTextStyle get actionsStyle => + _actionsStyle ?? BrnDefaultConfigUtils.defaultAppBarConfig.actionsStyle; /// AppBar title 的最大字符数 8 - int? titleMaxLength; + int? _titleMaxLength; + + int get titleMaxLength => + _titleMaxLength ?? + BrnDefaultConfigUtils.defaultAppBarConfig.titleMaxLength; /// 左右边距 - double? leftAndRightPadding; + double? _leftAndRightPadding; + + double get leftAndRightPadding => + _leftAndRightPadding ?? + BrnDefaultConfigUtils.defaultAppBarConfig.leftAndRightPadding; /// 元素间间距 - double? itemSpacing; + double? _itemSpacing; + + double get itemSpacing => + _itemSpacing ?? BrnDefaultConfigUtils.defaultAppBarConfig.itemSpacing; /// title的padding - EdgeInsets? titlePadding; + EdgeInsets? _titlePadding; + + EdgeInsets get titlePadding => + _titlePadding ?? BrnDefaultConfigUtils.defaultAppBarConfig.titlePadding; /// leadIcon 宽高,需要相同 /// 默认为 20 - double? iconSize; + double? _iconSize; + + double get iconSize => + _iconSize ?? BrnDefaultConfigUtils.defaultAppBarConfig.iconSize; - /// [AppBar] 中 flexibleSpace - Widget? flexibleSpace; /// statusBar 样式 /// 默认为 [SystemUiOverlayStyle.dark] - SystemUiOverlayStyle? systemUiOverlayStyle; + SystemUiOverlayStyle? _systemUiOverlayStyle; + + SystemUiOverlayStyle get systemUiOverlayStyle => + _systemUiOverlayStyle ?? + BrnDefaultConfigUtils.defaultAppBarConfig.systemUiOverlayStyle; @override void initThemeConfig( @@ -161,22 +231,21 @@ class BrnAppBarConfig extends BrnBaseConfig { ); /// 用户全局组件配置 - BrnAppBarConfig? appbarConfig = BrnThemeConfigurator.instance + BrnAppBarConfig appbarConfig = BrnThemeConfigurator.instance .getConfig(configId: configId) .appBarConfig; - this.backgroundColor ??= appbarConfig?.backgroundColor; - this.appBarHeight ??= appbarConfig?.appBarHeight; - this.leadIconBuilder ??= appbarConfig?.leadIconBuilder; - this.titleStyle = appbarConfig?.titleStyle?.merge(titleStyle); - this.actionsStyle = appbarConfig?.actionsStyle?.merge(actionsStyle); - this.titleMaxLength ??= appbarConfig?.titleMaxLength; - this.leftAndRightPadding ??= appbarConfig?.leftAndRightPadding; - this.itemSpacing ??= appbarConfig?.itemSpacing; - this.titlePadding ??= appbarConfig?.titlePadding; - this.iconSize ??= appbarConfig?.iconSize; - this.flexibleSpace ??= appbarConfig?.flexibleSpace; - this.systemUiOverlayStyle ??= appbarConfig?.systemUiOverlayStyle; + _backgroundColor ??= appbarConfig._backgroundColor; + _appBarHeight ??= appbarConfig._appBarHeight; + _leadIconBuilder ??= appbarConfig._leadIconBuilder; + _titleStyle = appbarConfig.titleStyle.merge(_titleStyle); + _actionsStyle = appbarConfig.actionsStyle.merge(_actionsStyle); + _titleMaxLength ??= appbarConfig._titleMaxLength; + _leftAndRightPadding ??= appbarConfig._leftAndRightPadding; + _itemSpacing ??= appbarConfig._itemSpacing; + _titlePadding ??= appbarConfig._titlePadding; + _iconSize ??= appbarConfig._iconSize; + _systemUiOverlayStyle ??= appbarConfig._systemUiOverlayStyle; } BrnAppBarConfig copyWith({ @@ -194,37 +263,34 @@ class BrnAppBarConfig extends BrnBaseConfig { SystemUiOverlayStyle? systemUiOverlayStyle, }) { return BrnAppBarConfig( - backgroundColor: backgroundColor ?? this.backgroundColor, - appBarHeight: appBarHeight ?? this.appBarHeight, - leadIconBuilder: leadIconBuilder ?? this.leadIconBuilder, - titleStyle: titleStyle ?? this.titleStyle, - actionsStyle: actionsStyle ?? this.actionsStyle, - titleMaxLength: titleMaxLength ?? this.titleMaxLength, - leftAndRightPadding: leftAndRightPadding ?? this.leftAndRightPadding, - itemSpacing: itemSpacing ?? this.itemSpacing, - titlePadding: titlePadding ?? this.titlePadding, - iconSize: iconSize ?? this.iconSize, - flexibleSpace: flexibleSpace ?? this.flexibleSpace, - systemUiOverlayStyle: systemUiOverlayStyle ?? this.systemUiOverlayStyle, + backgroundColor: backgroundColor ?? _backgroundColor, + appBarHeight: appBarHeight ?? _appBarHeight, + leadIconBuilder: leadIconBuilder ?? _leadIconBuilder, + titleStyle: titleStyle ?? _titleStyle, + actionsStyle: actionsStyle ?? _actionsStyle, + titleMaxLength: titleMaxLength ?? _titleMaxLength, + leftAndRightPadding: leftAndRightPadding ?? _leftAndRightPadding, + itemSpacing: itemSpacing ?? _itemSpacing, + titlePadding: titlePadding ?? _titlePadding, + iconSize: iconSize ?? _iconSize, + systemUiOverlayStyle: systemUiOverlayStyle ?? _systemUiOverlayStyle, ); } BrnAppBarConfig merge(BrnAppBarConfig? other) { if (other == null) return this; return copyWith( - backgroundColor: other.backgroundColor, - appBarHeight: other.appBarHeight, - leadIconBuilder: other.leadIconBuilder, - titleStyle: titleStyle?.merge(other.titleStyle) ?? other.titleStyle, - actionsStyle: - actionsStyle?.merge(other.actionsStyle) ?? other.actionsStyle, - titleMaxLength: other.titleMaxLength, - leftAndRightPadding: other.leftAndRightPadding, - itemSpacing: other.itemSpacing, - titlePadding: other.titlePadding, - iconSize: other.iconSize, - flexibleSpace: other.flexibleSpace, - systemUiOverlayStyle: other.systemUiOverlayStyle, + backgroundColor: other._backgroundColor, + appBarHeight: other._appBarHeight, + leadIconBuilder: other._leadIconBuilder, + titleStyle: titleStyle.merge(other._titleStyle), + actionsStyle: actionsStyle.merge(other._actionsStyle), + titleMaxLength: other._titleMaxLength, + leftAndRightPadding: other._leftAndRightPadding, + itemSpacing: other._itemSpacing, + titlePadding: other._titlePadding, + iconSize: other._iconSize, + systemUiOverlayStyle: other._systemUiOverlayStyle, ); } } diff --git a/lib/src/theme/configs/brn_button_config.dart b/lib/src/theme/configs/brn_button_config.dart index 7dafe47a..d6e29919 100644 --- a/lib/src/theme/configs/brn_button_config.dart +++ b/lib/src/theme/configs/brn_button_config.dart @@ -1,4 +1,5 @@ import 'package:bruno/src/theme/base/brn_base_config.dart'; +import 'package:bruno/src/theme/base/brn_default_config_utils.dart'; import 'package:bruno/src/theme/brn_theme_configurator.dart'; import 'package:bruno/src/theme/configs/brn_common_config.dart'; @@ -7,32 +8,62 @@ class BrnButtonConfig extends BrnBaseConfig { /// 遵循外部主题配置 /// 默认为 [BrnDefaultConfigUtils.defaultButtonConfig] BrnButtonConfig({ - this.bigButtonRadius, - this.bigButtonHeight, - this.bigButtonFontSize, - this.smallButtonRadius, - this.smallButtonHeight, - this.smallButtonFontSize, + double? bigButtonRadius, + double? bigButtonHeight, + double? bigButtonFontSize, + double? smallButtonRadius, + double? smallButtonHeight, + double? smallButtonFontSize, String configId = GLOBAL_CONFIG_ID, - }) : super(configId: configId); + }) : _bigButtonRadius = bigButtonRadius, + _bigButtonHeight = bigButtonHeight, + _bigButtonFontSize = bigButtonFontSize, + _smallButtonRadius = smallButtonRadius, + _smallButtonHeight = smallButtonHeight, + _smallButtonFontSize = smallButtonFontSize, + super(configId: configId); /// 默认为 6 - double? bigButtonRadius; + double? _bigButtonRadius; + + double get bigButtonRadius => + _bigButtonRadius ?? + BrnDefaultConfigUtils.defaultButtonConfig.bigButtonRadius; /// 默认为 48 - double? bigButtonHeight; + double? _bigButtonHeight; + + double get bigButtonHeight => + _bigButtonHeight ?? + BrnDefaultConfigUtils.defaultButtonConfig.bigButtonHeight; /// 默认为 16 - double? bigButtonFontSize; + double? _bigButtonFontSize; + + double get bigButtonFontSize => + _bigButtonFontSize ?? + BrnDefaultConfigUtils.defaultButtonConfig.bigButtonFontSize; /// 默认为 4 - double? smallButtonRadius; + double? _smallButtonRadius; + + double get smallButtonRadius => + _smallButtonRadius ?? + BrnDefaultConfigUtils.defaultButtonConfig.smallButtonRadius; /// 默认为 32 - double? smallButtonHeight; + double? _smallButtonHeight; + + double get smallButtonHeight => + _smallButtonHeight ?? + BrnDefaultConfigUtils.defaultButtonConfig.smallButtonHeight; /// 默认为 14 - double? smallButtonFontSize; + double? _smallButtonFontSize; + + double get smallButtonFontSize => + _smallButtonFontSize ?? + BrnDefaultConfigUtils.defaultButtonConfig.smallButtonFontSize; @override void initThemeConfig( @@ -44,16 +75,16 @@ class BrnButtonConfig extends BrnBaseConfig { currentLevelCommonConfig: currentLevelCommonConfig, ); - BrnButtonConfig? userConfig = BrnThemeConfigurator.instance + BrnButtonConfig userConfig = BrnThemeConfigurator.instance .getConfig(configId: configId) .buttonConfig; - bigButtonRadius ??= userConfig?.bigButtonRadius; - bigButtonHeight ??= userConfig?.bigButtonHeight; - bigButtonFontSize ??= userConfig?.bigButtonFontSize; - smallButtonRadius ??= userConfig?.smallButtonRadius; - smallButtonHeight ??= userConfig?.smallButtonHeight; - smallButtonFontSize ??= userConfig?.smallButtonFontSize; + _bigButtonRadius ??= userConfig._bigButtonRadius; + _bigButtonHeight ??= userConfig._bigButtonHeight; + _bigButtonFontSize ??= userConfig._bigButtonFontSize; + _smallButtonRadius ??= userConfig._smallButtonRadius; + _smallButtonHeight ??= userConfig._smallButtonHeight; + _smallButtonFontSize ??= userConfig._smallButtonFontSize; } BrnButtonConfig copyWith({ @@ -65,24 +96,24 @@ class BrnButtonConfig extends BrnBaseConfig { double? smallButtonFontSize, }) { return BrnButtonConfig( - bigButtonRadius: bigButtonRadius ?? this.bigButtonRadius, - bigButtonHeight: bigButtonHeight ?? this.bigButtonHeight, - bigButtonFontSize: bigButtonFontSize ?? this.bigButtonFontSize, - smallButtonRadius: smallButtonRadius ?? this.smallButtonRadius, - smallButtonHeight: smallButtonHeight ?? this.smallButtonHeight, - smallButtonFontSize: smallButtonFontSize ?? this.smallButtonFontSize, + bigButtonRadius: bigButtonRadius ?? _bigButtonRadius, + bigButtonHeight: bigButtonHeight ?? _bigButtonHeight, + bigButtonFontSize: bigButtonFontSize ?? _bigButtonFontSize, + smallButtonRadius: smallButtonRadius ?? _smallButtonRadius, + smallButtonHeight: smallButtonHeight ?? _smallButtonHeight, + smallButtonFontSize: smallButtonFontSize ?? _smallButtonFontSize, ); } BrnButtonConfig merge(BrnButtonConfig? other) { if (other == null) return this; return copyWith( - bigButtonRadius: other.bigButtonRadius, - bigButtonHeight: other.bigButtonHeight, - bigButtonFontSize: other.bigButtonFontSize, - smallButtonRadius: other.smallButtonRadius, - smallButtonHeight: other.smallButtonHeight, - smallButtonFontSize: other.smallButtonFontSize, + bigButtonRadius: other._bigButtonRadius, + bigButtonHeight: other._bigButtonHeight, + bigButtonFontSize: other._bigButtonFontSize, + smallButtonRadius: other._smallButtonRadius, + smallButtonHeight: other._smallButtonHeight, + smallButtonFontSize: other._smallButtonFontSize, ); } } diff --git a/lib/src/theme/configs/brn_card_title_config.dart b/lib/src/theme/configs/brn_card_title_config.dart index 84cc2242..95ea6a70 100644 --- a/lib/src/theme/configs/brn_card_title_config.dart +++ b/lib/src/theme/configs/brn_card_title_config.dart @@ -1,3 +1,4 @@ +import 'package:bruno/bruno.dart'; import 'package:bruno/src/theme/base/brn_base_config.dart'; import 'package:bruno/src/theme/base/brn_text_style.dart'; import 'package:bruno/src/theme/brn_theme_configurator.dart'; @@ -7,16 +8,24 @@ import 'package:flutter/material.dart'; /// 卡片标题 配置类 class BrnCardTitleConfig extends BrnBaseConfig { BrnCardTitleConfig({ - this.titleWithHeightTextStyle, - this.detailTextStyle, - this.accessoryTextStyle, - this.cardTitlePadding, - this.titleTextStyle, - this.subtitleTextStyle, - this.alignment, - this.cardBackgroundColor, + BrnTextStyle? titleWithHeightTextStyle, + BrnTextStyle? detailTextStyle, + BrnTextStyle? accessoryTextStyle, + EdgeInsets? cardTitlePadding, + BrnTextStyle? titleTextStyle, + BrnTextStyle? subtitleTextStyle, + PlaceholderAlignment? alignment, + Color? cardBackgroundColor, String configId = GLOBAL_CONFIG_ID, - }) : super(configId: configId); + }) : _titleWithHeightTextStyle = titleWithHeightTextStyle, + _detailTextStyle = detailTextStyle, + _accessoryTextStyle = accessoryTextStyle, + _cardTitlePadding = cardTitlePadding, + _titleTextStyle = titleTextStyle, + _subtitleTextStyle = subtitleTextStyle, + _alignment = alignment, + _cardBackgroundColor = cardBackgroundColor, + super(configId: configId); /// 标题外边距间距 /// @@ -24,7 +33,11 @@ class BrnCardTitleConfig extends BrnBaseConfig { /// top: [BrnCommonConfig.vSpacingXl], /// bottom: [BrnCommonConfig.vSpacingMd], /// ) - EdgeInsets? cardTitlePadding; + EdgeInsets? _cardTitlePadding; + + EdgeInsets get cardTitlePadding => + _cardTitlePadding ?? + BrnDefaultConfigUtils.defaultCardTitleConfig.cardTitlePadding; /// 标题文本样式 /// @@ -34,7 +47,11 @@ class BrnCardTitleConfig extends BrnBaseConfig { /// fontWeight: FontWeight.w600, /// height: 25 / 18, /// ) - BrnTextStyle? titleWithHeightTextStyle; + BrnTextStyle? _titleWithHeightTextStyle; + + BrnTextStyle get titleWithHeightTextStyle => + _titleWithHeightTextStyle ?? + BrnDefaultConfigUtils.defaultCardTitleConfig.titleWithHeightTextStyle; /// 标题文本样式 /// @@ -43,7 +60,11 @@ class BrnCardTitleConfig extends BrnBaseConfig { /// fontSize: [BrnCommonConfig.fontSizeHead], /// fontWeight: FontWeight.w600, /// ) - BrnTextStyle? titleTextStyle; + BrnTextStyle? _titleTextStyle; + + BrnTextStyle get titleTextStyle => + _titleTextStyle ?? + BrnDefaultConfigUtils.defaultCardTitleConfig.titleTextStyle; /// 标题右边的副标题文本样式 /// @@ -51,7 +72,11 @@ class BrnCardTitleConfig extends BrnBaseConfig { /// color: [BrnCommonConfig.colorTextSecondary], /// fontSize: [BrnCommonConfig.fontSizeBase], /// ) - BrnTextStyle? subtitleTextStyle; + BrnTextStyle? _subtitleTextStyle; + + BrnTextStyle get subtitleTextStyle => + _subtitleTextStyle ?? + BrnDefaultConfigUtils.defaultCardTitleConfig.subtitleTextStyle; /// 详情文本样式 /// @@ -59,7 +84,11 @@ class BrnCardTitleConfig extends BrnBaseConfig { /// color: [BrnCommonConfig.colorTextBase], /// fontSize: [BrnCommonConfig.fontSizeBase], /// ) - BrnTextStyle? detailTextStyle; + BrnTextStyle? _detailTextStyle; + + BrnTextStyle get detailTextStyle => + _detailTextStyle ?? + BrnDefaultConfigUtils.defaultCardTitleConfig.detailTextStyle; /// 辅助文本样式 /// @@ -67,15 +96,26 @@ class BrnCardTitleConfig extends BrnBaseConfig { /// color: [BrnCommonConfig.colorTextSecondary], /// fontSize: [BrnCommonConfig.fontSizeBase], /// ) - BrnTextStyle? accessoryTextStyle; + BrnTextStyle? _accessoryTextStyle; + + BrnTextStyle get accessoryTextStyle => + _accessoryTextStyle ?? + BrnDefaultConfigUtils.defaultCardTitleConfig.accessoryTextStyle; /// 对齐方式 /// 默认为 [PlaceholderAlignment.middle] - PlaceholderAlignment? alignment; + PlaceholderAlignment? _alignment; + + PlaceholderAlignment get alignment => + _alignment ?? BrnDefaultConfigUtils.defaultCardTitleConfig.alignment; /// 卡片背景 /// 默认为 [BrnCommonConfig.fillBase] - Color? cardBackgroundColor; + Color? _cardBackgroundColor; + + Color get cardBackgroundColor => + _cardBackgroundColor ?? + BrnDefaultConfigUtils.defaultCardTitleConfig.cardBackgroundColor; /// cardTitleConfig 获取逻辑详见 [BrnThemeConfigurator.getConfig] 方法 @override @@ -88,48 +128,48 @@ class BrnCardTitleConfig extends BrnBaseConfig { currentLevelCommonConfig: currentLevelCommonConfig, ); - BrnCardTitleConfig? cardTitleConfig = BrnThemeConfigurator.instance + BrnCardTitleConfig cardTitleConfig = BrnThemeConfigurator.instance .getConfig(configId: configId) .cardTitleConfig; - cardBackgroundColor ??= commonConfig.fillBase; - cardTitlePadding ??= EdgeInsets.only( - left: cardTitleConfig?.cardTitlePadding?.left ?? 0, - top: commonConfig.vSpacingXl ?? 0, - right: cardTitleConfig?.cardTitlePadding?.right ?? 0, - bottom: commonConfig.vSpacingMd ?? 0, + _cardBackgroundColor ??= commonConfig.fillBase; + _cardTitlePadding ??= EdgeInsets.only( + left: cardTitleConfig.cardTitlePadding.left, + top: commonConfig.vSpacingXl, + right: cardTitleConfig.cardTitlePadding.right, + bottom: commonConfig.vSpacingMd, ); - titleWithHeightTextStyle = cardTitleConfig?.titleWithHeightTextStyle?.merge( + _titleWithHeightTextStyle = cardTitleConfig.titleWithHeightTextStyle.merge( BrnTextStyle( color: commonConfig.colorTextBase, fontSize: commonConfig.fontSizeHead, - ).merge(titleWithHeightTextStyle), + ).merge(_titleWithHeightTextStyle), ); - titleTextStyle = cardTitleConfig?.titleTextStyle?.merge( + _titleTextStyle = cardTitleConfig.titleTextStyle.merge( BrnTextStyle( color: commonConfig.colorTextBase, fontSize: commonConfig.fontSizeHead, - ).merge(titleTextStyle), + ).merge(_titleTextStyle), ); - subtitleTextStyle = cardTitleConfig?.subtitleTextStyle?.merge( + _subtitleTextStyle = cardTitleConfig.subtitleTextStyle.merge( BrnTextStyle( color: commonConfig.colorTextBase, fontSize: commonConfig.fontSizeBase, - ).merge(subtitleTextStyle), + ).merge(_subtitleTextStyle), ); - accessoryTextStyle = cardTitleConfig?.accessoryTextStyle?.merge( + _accessoryTextStyle = cardTitleConfig.accessoryTextStyle.merge( BrnTextStyle( color: commonConfig.colorTextSecondary, fontSize: commonConfig.fontSizeHead, - ).merge(accessoryTextStyle), + ).merge(_accessoryTextStyle), ); - detailTextStyle = cardTitleConfig?.detailTextStyle?.merge( + _detailTextStyle = cardTitleConfig.detailTextStyle.merge( BrnTextStyle( color: commonConfig.colorTextBase, fontSize: commonConfig.fontSizeBase, - ).merge(detailTextStyle), + ).merge(_detailTextStyle), ); - alignment ??= cardTitleConfig?.alignment; + _alignment ??= cardTitleConfig._alignment; } BrnCardTitleConfig copyWith({ @@ -143,35 +183,30 @@ class BrnCardTitleConfig extends BrnBaseConfig { Color? cardBackgroundColor, }) { return BrnCardTitleConfig( - cardTitlePadding: cardTitlePadding ?? this.cardTitlePadding, + cardTitlePadding: cardTitlePadding ?? _cardTitlePadding, titleWithHeightTextStyle: - titleWithHeightTextStyle ?? this.titleWithHeightTextStyle, - titleTextStyle: titleTextStyle ?? this.titleTextStyle, - subtitleTextStyle: subtitleTextStyle ?? this.subtitleTextStyle, - detailTextStyle: detailTextStyle ?? this.detailTextStyle, - accessoryTextStyle: accessoryTextStyle ?? this.accessoryTextStyle, - alignment: alignment ?? this.alignment, - cardBackgroundColor: cardBackgroundColor ?? this.cardBackgroundColor, + titleWithHeightTextStyle ?? _titleWithHeightTextStyle, + titleTextStyle: titleTextStyle ?? _titleTextStyle, + subtitleTextStyle: subtitleTextStyle ?? _subtitleTextStyle, + detailTextStyle: detailTextStyle ?? _detailTextStyle, + accessoryTextStyle: accessoryTextStyle ?? _accessoryTextStyle, + alignment: alignment ?? _alignment, + cardBackgroundColor: cardBackgroundColor ?? _cardBackgroundColor, ); } BrnCardTitleConfig merge(BrnCardTitleConfig? other) { if (other == null) return this; return copyWith( - cardTitlePadding: other.cardTitlePadding, + cardTitlePadding: other._cardTitlePadding, titleWithHeightTextStyle: - titleWithHeightTextStyle?.merge(other.titleWithHeightTextStyle) ?? - other.titleWithHeightTextStyle, - titleTextStyle: - titleTextStyle?.merge(other.titleTextStyle) ?? other.titleTextStyle, - subtitleTextStyle: subtitleTextStyle?.merge(other.subtitleTextStyle) ?? - other.subtitleTextStyle, - detailTextStyle: detailTextStyle?.merge(other.detailTextStyle) ?? - other.detailTextStyle, - accessoryTextStyle: accessoryTextStyle?.merge(other.accessoryTextStyle) ?? - other.accessoryTextStyle, - alignment: other.alignment, - cardBackgroundColor: other.cardBackgroundColor, + titleWithHeightTextStyle.merge(other._titleWithHeightTextStyle), + titleTextStyle: titleTextStyle.merge(other._titleTextStyle), + subtitleTextStyle: subtitleTextStyle.merge(other._subtitleTextStyle), + detailTextStyle: detailTextStyle.merge(other._detailTextStyle), + accessoryTextStyle: accessoryTextStyle.merge(other._accessoryTextStyle), + alignment: other._alignment, + cardBackgroundColor: other._cardBackgroundColor, ); } } diff --git a/lib/src/theme/configs/brn_common_config.dart b/lib/src/theme/configs/brn_common_config.dart index c5b1e887..1e433123 100644 --- a/lib/src/theme/configs/brn_common_config.dart +++ b/lib/src/theme/configs/brn_common_config.dart @@ -1,4 +1,5 @@ import 'package:bruno/src/theme/base/brn_base_config.dart'; +import 'package:bruno/src/theme/base/brn_default_config_utils.dart'; import 'package:bruno/src/theme/brn_theme_configurator.dart'; import 'package:flutter/painting.dart'; @@ -6,114 +7,216 @@ import 'package:flutter/painting.dart'; /// 配置属性:色值、字体大小、间距、圆角 class BrnCommonConfig extends BrnBaseConfig { BrnCommonConfig({ - this.brandPrimary, - this.brandPrimaryTap, - this.brandSuccess, - this.brandWarning, - this.brandError, - this.brandImportant, - this.brandImportantValue, - this.brandAuxiliary, - this.colorTextBase, - this.colorTextImportant, - this.colorTextBaseInverse, - this.colorTextSecondary, - this.colorTextDisabled, - this.colorTextHint, - this.colorLink, - this.fillBase, - this.fillBody, - this.fillMask, - this.borderColorBase, - this.dividerColorBase, - this.fontSizeDIN, - this.fontSizeHeadLg, - this.fontSizeBase, - this.fontSizeHead, - this.fontSizeSubHead, - this.fontSizeCaption, - this.fontSizeCaptionSm, - this.radiusXs, - this.radiusSm, - this.radiusMd, - this.radiusLg, - this.borderWidthSm, - this.borderWidthMd, - this.borderWidthLg, - this.hSpacingXs, - this.hSpacingSm, - this.hSpacingMd, - this.hSpacingLg, - this.hSpacingXl, - this.hSpacingXxl, - this.vSpacingXs, - this.vSpacingSm, - this.vSpacingMd, - this.vSpacingLg, - this.vSpacingXl, - this.vSpacingXxl, - this.iconSizeXxs, - this.iconSizeXs, - this.iconSizeSm, - this.iconSizeMd, - this.iconSizeLg, + Color? brandPrimary, + Color? brandPrimaryTap, + Color? brandSuccess, + Color? brandWarning, + Color? brandError, + Color? brandImportant, + Color? brandImportantValue, + Color? brandAuxiliary, + Color? colorTextBase, + Color? colorTextImportant, + Color? colorTextBaseInverse, + Color? colorTextSecondary, + Color? colorTextDisabled, + Color? colorTextHint, + Color? colorLink, + Color? fillBase, + Color? fillBody, + Color? fillMask, + Color? borderColorBase, + Color? dividerColorBase, + double? fontSizeDIN, + double? fontSizeHeadLg, + double? fontSizeBase, + double? fontSizeHead, + double? fontSizeSubHead, + double? fontSizeCaption, + double? fontSizeCaptionSm, + double? radiusXs, + double? radiusSm, + double? radiusMd, + double? radiusLg, + double? borderWidthSm, + double? borderWidthMd, + double? borderWidthLg, + double? hSpacingXs, + double? hSpacingSm, + double? hSpacingMd, + double? hSpacingLg, + double? hSpacingXl, + double? hSpacingXxl, + double? vSpacingXs, + double? vSpacingSm, + double? vSpacingMd, + double? vSpacingLg, + double? vSpacingXl, + double? vSpacingXxl, + double? iconSizeXxs, + double? iconSizeXs, + double? iconSizeSm, + double? iconSizeMd, + double? iconSizeLg, String configId = GLOBAL_CONFIG_ID, - }) : super(configId: configId); + }) : _brandPrimary = brandPrimary, + _brandPrimaryTap = brandPrimaryTap, + _brandSuccess = brandSuccess, + _brandWarning = brandWarning, + _brandError = brandError, + _brandImportant = brandImportant, + _brandImportantValue = brandImportantValue, + _brandAuxiliary = brandAuxiliary, + _colorTextBase = colorTextBase, + _colorTextImportant = colorTextImportant, + _colorTextBaseInverse = colorTextBaseInverse, + _colorTextSecondary = colorTextSecondary, + _colorTextDisabled = colorTextDisabled, + _colorTextHint = colorTextHint, + _colorLink = colorLink, + _fillBase = fillBase, + _fillBody = fillBody, + _fillMask = fillMask, + _borderColorBase = borderColorBase, + _dividerColorBase = dividerColorBase, + _fontSizeDIN = fontSizeDIN, + _fontSizeHeadLg = fontSizeHeadLg, + _fontSizeBase = fontSizeBase, + _fontSizeHead = fontSizeHead, + _fontSizeSubHead = fontSizeSubHead, + _fontSizeCaption = fontSizeCaption, + _fontSizeCaptionSm = fontSizeCaptionSm, + _radiusXs = radiusXs, + _radiusSm = radiusSm, + _radiusMd = radiusMd, + _radiusLg = radiusLg, + _borderWidthSm = borderWidthSm, + _borderWidthMd = borderWidthMd, + _borderWidthLg = borderWidthLg, + _hSpacingXs = hSpacingXs, + _hSpacingSm = hSpacingSm, + _hSpacingMd = hSpacingMd, + _hSpacingLg = hSpacingLg, + _hSpacingXl = hSpacingXl, + _hSpacingXxl = hSpacingXxl, + _vSpacingXs = vSpacingXs, + _vSpacingSm = vSpacingSm, + _vSpacingMd = vSpacingMd, + _vSpacingLg = vSpacingLg, + _vSpacingXl = vSpacingXl, + _vSpacingXxl = vSpacingXxl, + _iconSizeXxs = iconSizeXxs, + _iconSizeXs = iconSizeXs, + _iconSizeSm = iconSizeSm, + _iconSizeMd = iconSizeMd, + _iconSizeLg = iconSizeLg, + super(configId: configId); BrnCommonConfig.autoFlatConfig({ - this.brandPrimary, - this.brandPrimaryTap, - this.brandSuccess, - this.brandWarning, - this.brandError, - this.brandImportant, - this.brandImportantValue, - this.brandAuxiliary, - this.colorTextBase, - this.colorTextImportant, - this.colorTextBaseInverse, - this.colorTextSecondary, - this.colorTextDisabled, - this.colorTextHint, - this.colorLink, - this.fillBase, - this.fillBody, - this.fillMask, - this.borderColorBase, - this.dividerColorBase, - this.fontSizeDIN, - this.fontSizeHeadLg, - this.fontSizeBase, - this.fontSizeHead, - this.fontSizeSubHead, - this.fontSizeCaption, - this.fontSizeCaptionSm, - this.radiusXs, - this.radiusSm, - this.radiusMd, - this.radiusLg, - this.borderWidthSm, - this.borderWidthMd, - this.borderWidthLg, - this.hSpacingXs, - this.hSpacingSm, - this.hSpacingMd, - this.hSpacingLg, - this.hSpacingXl, - this.hSpacingXxl, - this.vSpacingXs, - this.vSpacingSm, - this.vSpacingMd, - this.vSpacingLg, - this.vSpacingXl, - this.vSpacingXxl, - this.iconSizeXxs, - this.iconSizeXs, - this.iconSizeSm, - this.iconSizeMd, - this.iconSizeLg, + Color? brandPrimary, + Color? brandPrimaryTap, + Color? brandSuccess, + Color? brandWarning, + Color? brandError, + Color? brandImportant, + Color? brandImportantValue, + Color? brandAuxiliary, + Color? colorTextBase, + Color? colorTextImportant, + Color? colorTextBaseInverse, + Color? colorTextSecondary, + Color? colorTextDisabled, + Color? colorTextHint, + Color? colorLink, + Color? fillBase, + Color? fillBody, + Color? fillMask, + Color? borderColorBase, + Color? dividerColorBase, + double? fontSizeDIN, + double? fontSizeHeadLg, + double? fontSizeBase, + double? fontSizeHead, + double? fontSizeSubHead, + double? fontSizeCaption, + double? fontSizeCaptionSm, + double? radiusXs, + double? radiusSm, + double? radiusMd, + double? radiusLg, + double? borderWidthSm, + double? borderWidthMd, + double? borderWidthLg, + double? hSpacingXs, + double? hSpacingSm, + double? hSpacingMd, + double? hSpacingLg, + double? hSpacingXl, + double? hSpacingXxl, + double? vSpacingXs, + double? vSpacingSm, + double? vSpacingMd, + double? vSpacingLg, + double? vSpacingXl, + double? vSpacingXxl, + double? iconSizeXxs, + double? iconSizeXs, + double? iconSizeSm, + double? iconSizeMd, + double? iconSizeLg, String configId = GLOBAL_CONFIG_ID, - }) : super(configId: configId, autoFlatConfig: true); + }) : _brandPrimary = brandPrimary, + _brandPrimaryTap = brandPrimaryTap, + _brandSuccess = brandSuccess, + _brandWarning = brandWarning, + _brandError = brandError, + _brandImportant = brandImportant, + _brandImportantValue = brandImportantValue, + _brandAuxiliary = brandAuxiliary, + _colorTextBase = colorTextBase, + _colorTextImportant = colorTextImportant, + _colorTextBaseInverse = colorTextBaseInverse, + _colorTextSecondary = colorTextSecondary, + _colorTextDisabled = colorTextDisabled, + _colorTextHint = colorTextHint, + _colorLink = colorLink, + _fillBase = fillBase, + _fillBody = fillBody, + _fillMask = fillMask, + _borderColorBase = borderColorBase, + _dividerColorBase = dividerColorBase, + _fontSizeDIN = fontSizeDIN, + _fontSizeHeadLg = fontSizeHeadLg, + _fontSizeBase = fontSizeBase, + _fontSizeHead = fontSizeHead, + _fontSizeSubHead = fontSizeSubHead, + _fontSizeCaption = fontSizeCaption, + _fontSizeCaptionSm = fontSizeCaptionSm, + _radiusXs = radiusXs, + _radiusSm = radiusSm, + _radiusMd = radiusMd, + _radiusLg = radiusLg, + _borderWidthSm = borderWidthSm, + _borderWidthMd = borderWidthMd, + _borderWidthLg = borderWidthLg, + _hSpacingXs = hSpacingXs, + _hSpacingSm = hSpacingSm, + _hSpacingMd = hSpacingMd, + _hSpacingLg = hSpacingLg, + _hSpacingXl = hSpacingXl, + _hSpacingXxl = hSpacingXxl, + _vSpacingXs = vSpacingXs, + _vSpacingSm = vSpacingSm, + _vSpacingMd = vSpacingMd, + _vSpacingLg = vSpacingLg, + _vSpacingXl = vSpacingXl, + _vSpacingXxl = vSpacingXxl, + _iconSizeXxs = iconSizeXxs, + _iconSizeXs = iconSizeXs, + _iconSizeSm = iconSizeSm, + _iconSizeMd = iconSizeMd, + _iconSizeLg = iconSizeLg, + super(configId: configId, autoFlatConfig: true); /// 基本单位 static const double hd = 1; @@ -126,86 +229,86 @@ class BrnCommonConfig extends BrnBaseConfig { /// 品牌色 /// 默认为 Color(0xFF0984F9) - Color? brandPrimary; + Color? _brandPrimary; /// 主题色按下效果 /// 默认为 Color(0x190984F9) - Color? brandPrimaryTap; + Color? _brandPrimaryTap; /// 成功色 /// 默认为 Color(0xFF00AE66) - Color? brandSuccess; + Color? _brandSuccess; /// 警告色 /// 默认为 Color(0xFFFAAD14) - Color? brandWarning; + Color? _brandWarning; /// 失败色 /// 默认为 Color(0xFFFA3F3F) - Color? brandError; + Color? _brandError; /// 重要-多用于红点色 /// 默认为 Color(0xFFFA3F3F) - Color? brandImportant; + Color? _brandImportant; /// 重要数值色 /// 默认为 Color(0xFFFF5722) - Color? brandImportantValue; + Color? _brandImportantValue; /// 辅助色 /// 默认为 Color(0xFF44C2FF) - Color? brandAuxiliary; + Color? _brandAuxiliary; /// 文本色相关 /// /// 基础文字纯黑色 /// 默认为 Color(0xFF222222) - Color? colorTextBase; + Color? _colorTextBase; /// 基础文字重要色 /// 默认为 Color(0xFF666666) - Color? colorTextImportant; + Color? _colorTextImportant; /// 基础文字-反色 /// 默认为 Color(0xFFFFFFFF) - Color? colorTextBaseInverse; + Color? _colorTextBaseInverse; /// 辅助文字色 /// 默认为 Color(0xFF999999) - Color? colorTextSecondary; + Color? _colorTextSecondary; /// 失效或不可更改文字色 /// 默认为 Color(0xFF999999) - Color? colorTextDisabled; + Color? _colorTextDisabled; /// 文本框提示暗文文字色 /// 默认为 Color(0xFFCCCCCC) - Color? colorTextHint; + Color? _colorTextHint; /// 跟随主题色[brandPrimary] - Color? colorLink; + Color? _colorLink; /// 背景色相关 /// /// 组件背景色 /// 默认为 Color(0xFFFFFFFF) - Color? fillBase; + Color? _fillBase; /// 页面背景色 /// 默认为 Color(0xFFF8F8F8) - Color? fillBody; + Color? _fillBody; /// 遮罩背景 /// 默认为 Color(0x99000000) - Color? fillMask; + Color? _fillMask; /// 边框色 /// 默认为 Color(0xFFF0F0F0) - Color? borderColorBase; + Color? _borderColorBase; /// 分割线色 /// 默认为 Color(0xFFF0F0F0) - Color? dividerColorBase; + Color? _dividerColorBase; /////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////// 尺寸 ///////////////////////////////////// @@ -215,113 +318,280 @@ class BrnCommonConfig extends BrnBaseConfig { /// /// 特殊数据展示,DIN Condensed数字字体,用于强吸引 /// 默认为 28 - double? fontSizeDIN; + double? _fontSizeDIN; /// 标题字体 /// 名称/页面大标题 /// 默认为 22 - double? fontSizeHeadLg; + double? _fontSizeHeadLg; /// 标题字体 /// 内容模块标题/一级标题 /// 默认为 18 - double? fontSizeHead; + double? _fontSizeHead; /// 子标题字体 /// 标题/录入文字/大按钮文字/二级标题 /// 默认为 16 - double? fontSizeSubHead; + double? _fontSizeSubHead; /// 基础字体 /// 内容副文本/普通说明文字 /// 默认为 14 - double? fontSizeBase; + double? _fontSizeBase; /// 辅助字体-普通 /// 默认为 12 - double? fontSizeCaption; + double? _fontSizeCaption; ///辅助字体-小 /// 默认为 11 - double? fontSizeCaptionSm; + double? _fontSizeCaptionSm; /// 圆角尺寸 /// 默认为 2.0 - double? radiusXs; + double? _radiusXs; /// 默认为 4.0 - double? radiusSm; + double? _radiusSm; /// 默认为 6.0 - double? radiusMd; + double? _radiusMd; /// 默认为 8.0 - double? radiusLg; + double? _radiusLg; /// 边框尺寸 /// /// 默认为 0.5 - double? borderWidthSm; + double? _borderWidthSm; /// 默认为 1 - double? borderWidthMd; + double? _borderWidthMd; /// 默认为 2 - double? borderWidthLg; + double? _borderWidthLg; /// 水平间距 /// 默认为 8 - double? hSpacingXs; + double? _hSpacingXs; /// 默认为 12 - double? hSpacingSm; + double? _hSpacingSm; /// 默认为 16 - double? hSpacingMd; + double? _hSpacingMd; /// 默认为 20 - double? hSpacingLg; + double? _hSpacingLg; /// 默认为 24 - double? hSpacingXl; + double? _hSpacingXl; /// 默认为 42 - double? hSpacingXxl; + double? _hSpacingXxl; /// 垂直间距 /// 默认为 4 - double? vSpacingXs; + double? _vSpacingXs; /// 默认为 8 - double? vSpacingSm; + double? _vSpacingSm; /// 默认为 12 - double? vSpacingMd; + double? _vSpacingMd; /// 默认为 14 - double? vSpacingLg; + double? _vSpacingLg; /// 默认为 16 - double? vSpacingXl; + double? _vSpacingXl; /// 默认为 28 - double? vSpacingXxl; + double? _vSpacingXxl; /// 图标尺寸 /// 默认为 8 - double? iconSizeXxs; + double? _iconSizeXxs; /// 默认为 12 - double? iconSizeXs; + double? _iconSizeXs; /// 默认为 14 - double? iconSizeSm; + double? _iconSizeSm; /// 默认为 16 - double? iconSizeMd; + double? _iconSizeMd; /// 默认为 32 - double? iconSizeLg; + double? _iconSizeLg; + + Color get brandPrimary => + _brandPrimary ?? BrnDefaultConfigUtils.defaultCommonConfig.brandPrimary; + + Color get brandPrimaryTap => + _brandPrimaryTap ?? + BrnDefaultConfigUtils.defaultCommonConfig.brandPrimaryTap; + + Color get brandSuccess => + _brandSuccess ?? BrnDefaultConfigUtils.defaultCommonConfig.brandSuccess; + + Color get brandWarning => + _brandWarning ?? BrnDefaultConfigUtils.defaultCommonConfig.brandWarning; + + Color get brandError => + _brandError ?? BrnDefaultConfigUtils.defaultCommonConfig.brandError; + + Color get brandImportant => + _brandImportant ?? + BrnDefaultConfigUtils.defaultCommonConfig.brandImportant; + + Color get brandImportantValue => + _brandImportantValue ?? + BrnDefaultConfigUtils.defaultCommonConfig.brandImportantValue; + + Color get brandAuxiliary => + _brandAuxiliary ?? + BrnDefaultConfigUtils.defaultCommonConfig.brandAuxiliary; + + Color get colorTextBase => + _colorTextBase ?? BrnDefaultConfigUtils.defaultCommonConfig.colorTextBase; + + Color get colorTextImportant => + _colorTextImportant ?? + BrnDefaultConfigUtils.defaultCommonConfig.colorTextImportant; + + Color get colorTextBaseInverse => + _colorTextBaseInverse ?? + BrnDefaultConfigUtils.defaultCommonConfig.colorTextBaseInverse; + + Color get colorTextSecondary => + _colorTextSecondary ?? + BrnDefaultConfigUtils.defaultCommonConfig.colorTextSecondary; + + Color get colorTextDisabled => + _colorTextDisabled ?? + BrnDefaultConfigUtils.defaultCommonConfig.colorTextDisabled; + + Color get colorTextHint => + _colorTextHint ?? BrnDefaultConfigUtils.defaultCommonConfig.colorTextHint; + + Color get colorLink => + _colorLink ?? BrnDefaultConfigUtils.defaultCommonConfig.colorLink; + + Color get fillBase => + _fillBase ?? BrnDefaultConfigUtils.defaultCommonConfig.fillBase; + + Color get fillBody => + _fillBody ?? BrnDefaultConfigUtils.defaultCommonConfig.fillBody; + + Color get fillMask => + _fillMask ?? BrnDefaultConfigUtils.defaultCommonConfig.fillMask; + + Color get borderColorBase => + _borderColorBase ?? + BrnDefaultConfigUtils.defaultCommonConfig.borderColorBase; + + Color get dividerColorBase => + _dividerColorBase ?? + BrnDefaultConfigUtils.defaultCommonConfig.dividerColorBase; + + double get fontSizeDIN => + _fontSizeDIN ?? BrnDefaultConfigUtils.defaultCommonConfig.fontSizeDIN; + + double get fontSizeHeadLg => + _fontSizeHeadLg ?? + BrnDefaultConfigUtils.defaultCommonConfig.fontSizeHeadLg; + + double get fontSizeHead => + _fontSizeHead ?? BrnDefaultConfigUtils.defaultCommonConfig.fontSizeHead; + + double get fontSizeSubHead => + _fontSizeSubHead ?? + BrnDefaultConfigUtils.defaultCommonConfig.fontSizeSubHead; + + double get fontSizeBase => + _fontSizeBase ?? BrnDefaultConfigUtils.defaultCommonConfig.fontSizeBase; + + double get fontSizeCaption => + _fontSizeCaption ?? + BrnDefaultConfigUtils.defaultCommonConfig.fontSizeCaption; + + double get fontSizeCaptionSm => + _fontSizeCaptionSm ?? + BrnDefaultConfigUtils.defaultCommonConfig.fontSizeCaptionSm; + + double get radiusXs => + _radiusXs ?? BrnDefaultConfigUtils.defaultCommonConfig.radiusXs; + + double get radiusSm => + _radiusSm ?? BrnDefaultConfigUtils.defaultCommonConfig.radiusSm; + + double get radiusMd => + _radiusMd ?? BrnDefaultConfigUtils.defaultCommonConfig.radiusMd; + + double get radiusLg => + _radiusLg ?? BrnDefaultConfigUtils.defaultCommonConfig.radiusLg; + + double get borderWidthSm => + _borderWidthSm ?? BrnDefaultConfigUtils.defaultCommonConfig.borderWidthSm; + + double get borderWidthMd => + _borderWidthMd ?? BrnDefaultConfigUtils.defaultCommonConfig.borderWidthMd; + + double get borderWidthLg => + _borderWidthLg ?? BrnDefaultConfigUtils.defaultCommonConfig.borderWidthLg; + + double get hSpacingXs => + _hSpacingXs ?? BrnDefaultConfigUtils.defaultCommonConfig.hSpacingXs; + + double get hSpacingSm => + _hSpacingSm ?? BrnDefaultConfigUtils.defaultCommonConfig.hSpacingSm; + + double get hSpacingMd => + _hSpacingMd ?? BrnDefaultConfigUtils.defaultCommonConfig.hSpacingMd; + + double get hSpacingLg => + _hSpacingLg ?? BrnDefaultConfigUtils.defaultCommonConfig.hSpacingLg; + + double get hSpacingXl => + _hSpacingXl ?? BrnDefaultConfigUtils.defaultCommonConfig.hSpacingXl; + + double get hSpacingXxl => + _hSpacingXxl ?? BrnDefaultConfigUtils.defaultCommonConfig.hSpacingXxl; + + double get vSpacingXs => + _vSpacingXs ?? BrnDefaultConfigUtils.defaultCommonConfig.vSpacingXs; + + double get vSpacingSm => + _vSpacingSm ?? BrnDefaultConfigUtils.defaultCommonConfig.vSpacingSm; + + double get vSpacingMd => + _vSpacingMd ?? BrnDefaultConfigUtils.defaultCommonConfig.vSpacingMd; + + double get vSpacingLg => + _vSpacingLg ?? BrnDefaultConfigUtils.defaultCommonConfig.vSpacingLg; + + double get vSpacingXl => + _vSpacingXl ?? BrnDefaultConfigUtils.defaultCommonConfig.vSpacingXl; + + double get vSpacingXxl => + _vSpacingXxl ?? BrnDefaultConfigUtils.defaultCommonConfig.vSpacingXxl; + + double get iconSizeXxs => + _iconSizeXxs ?? BrnDefaultConfigUtils.defaultCommonConfig.iconSizeXxs; + + double get iconSizeXs => + _iconSizeXs ?? BrnDefaultConfigUtils.defaultCommonConfig.iconSizeXs; + + double get iconSizeSm => + _iconSizeSm ?? BrnDefaultConfigUtils.defaultCommonConfig.iconSizeSm; + + double get iconSizeMd => + _iconSizeMd ?? BrnDefaultConfigUtils.defaultCommonConfig.iconSizeMd; + + double get iconSizeLg => + _iconSizeLg ?? BrnDefaultConfigUtils.defaultCommonConfig.iconSizeLg; /// 优先级 [GLOBAL_CONFIG_ID] 获取配置 > [BRUNO_CONFIG_ID] 获取配置 @override @@ -335,56 +605,56 @@ class BrnCommonConfig extends BrnBaseConfig { ); /// 获取合适的 完整配置(BrnAllConfig) - this.colorTextBase ??= commonConfig.colorTextBase; - this.colorTextImportant ??= commonConfig.colorTextImportant; - this.colorTextBaseInverse ??= commonConfig.colorTextBaseInverse; - this.colorTextSecondary ??= commonConfig.colorTextSecondary; - this.colorTextHint ??= commonConfig.colorTextHint; - this.colorTextDisabled ??= commonConfig.colorTextDisabled; - this.brandAuxiliary ??= commonConfig.brandAuxiliary; - this.colorLink ??= commonConfig.colorLink; - this.fillBase ??= commonConfig.fillBase; - this.fillBody ??= commonConfig.fillBody; - this.fillMask ??= commonConfig.fillMask; - this.brandPrimary ??= commonConfig.brandPrimary; - this.brandPrimaryTap ??= commonConfig.brandPrimaryTap; - this.brandSuccess ??= commonConfig.brandSuccess; - this.brandWarning ??= commonConfig.brandWarning; - this.brandError ??= commonConfig.brandError; - this.brandImportant ??= commonConfig.brandImportant; - this.brandImportantValue ??= commonConfig.brandImportantValue; - this.borderColorBase ??= commonConfig.borderColorBase; - this.dividerColorBase ??= commonConfig.dividerColorBase; - this.fontSizeDIN ??= commonConfig.fontSizeDIN; - this.fontSizeHeadLg ??= commonConfig.fontSizeHeadLg; - this.fontSizeBase ??= commonConfig.fontSizeBase; - this.fontSizeHead ??= commonConfig.fontSizeHead; - this.fontSizeSubHead ??= commonConfig.fontSizeSubHead; - this.fontSizeCaption ??= commonConfig.fontSizeCaption; - this.fontSizeCaptionSm ??= commonConfig.fontSizeCaptionSm; - this.radiusXs ??= commonConfig.radiusXs; - this.radiusSm ??= commonConfig.radiusSm; - this.radiusMd ??= commonConfig.radiusMd; - this.radiusLg ??= commonConfig.radiusLg; - this.borderWidthSm ??= commonConfig.borderWidthSm; - this.borderWidthMd ??= commonConfig.borderWidthMd; - this.borderWidthLg ??= commonConfig.borderWidthLg; - this.hSpacingXs ??= commonConfig.hSpacingXs; - this.hSpacingSm ??= commonConfig.hSpacingSm; - this.hSpacingMd ??= commonConfig.hSpacingMd; - this.hSpacingLg ??= commonConfig.hSpacingLg; - this.hSpacingXl ??= commonConfig.hSpacingXl; - this.hSpacingXxl ??= commonConfig.hSpacingXxl; - this.vSpacingXs ??= commonConfig.vSpacingXs; - this.vSpacingSm ??= commonConfig.vSpacingSm; - this.vSpacingMd ??= commonConfig.vSpacingMd; - this.vSpacingLg ??= commonConfig.vSpacingLg; - this.vSpacingXl ??= commonConfig.vSpacingXl; - this.vSpacingXxl ??= commonConfig.vSpacingXxl; - this.iconSizeXxs ??= commonConfig.iconSizeXxs; - this.iconSizeXs ??= commonConfig.iconSizeXs; - this.iconSizeSm ??= commonConfig.iconSizeSm; - this.iconSizeMd ??= commonConfig.iconSizeMd; - this.iconSizeLg ??= commonConfig.iconSizeLg; + _colorTextBase ??= commonConfig._colorTextBase; + _colorTextImportant ??= commonConfig._colorTextImportant; + _colorTextBaseInverse ??= commonConfig._colorTextBaseInverse; + _colorTextSecondary ??= commonConfig._colorTextSecondary; + _colorTextHint ??= commonConfig._colorTextHint; + _colorTextDisabled ??= commonConfig._colorTextDisabled; + _brandAuxiliary ??= commonConfig._brandAuxiliary; + _colorLink ??= commonConfig._colorLink; + _fillBase ??= commonConfig._fillBase; + _fillBody ??= commonConfig._fillBody; + _fillMask ??= commonConfig._fillMask; + _brandPrimary ??= commonConfig._brandPrimary; + _brandPrimaryTap ??= commonConfig._brandPrimaryTap; + _brandSuccess ??= commonConfig._brandSuccess; + _brandWarning ??= commonConfig._brandWarning; + _brandError ??= commonConfig._brandError; + _brandImportant ??= commonConfig._brandImportant; + _brandImportantValue ??= commonConfig._brandImportantValue; + _borderColorBase ??= commonConfig._borderColorBase; + _dividerColorBase ??= commonConfig._dividerColorBase; + _fontSizeDIN ??= commonConfig._fontSizeDIN; + _fontSizeHeadLg ??= commonConfig._fontSizeHeadLg; + _fontSizeBase ??= commonConfig._fontSizeBase; + _fontSizeHead ??= commonConfig._fontSizeHead; + _fontSizeSubHead ??= commonConfig._fontSizeSubHead; + _fontSizeCaption ??= commonConfig._fontSizeCaption; + _fontSizeCaptionSm ??= commonConfig._fontSizeCaptionSm; + _radiusXs ??= commonConfig._radiusXs; + _radiusSm ??= commonConfig._radiusSm; + _radiusMd ??= commonConfig._radiusMd; + _radiusLg ??= commonConfig._radiusLg; + _borderWidthSm ??= commonConfig._borderWidthSm; + _borderWidthMd ??= commonConfig._borderWidthMd; + _borderWidthLg ??= commonConfig._borderWidthLg; + _hSpacingXs ??= commonConfig._hSpacingXs; + _hSpacingSm ??= commonConfig._hSpacingSm; + _hSpacingMd ??= commonConfig._hSpacingMd; + _hSpacingLg ??= commonConfig._hSpacingLg; + _hSpacingXl ??= commonConfig._hSpacingXl; + _hSpacingXxl ??= commonConfig._hSpacingXxl; + _vSpacingXs ??= commonConfig._vSpacingXs; + _vSpacingSm ??= commonConfig._vSpacingSm; + _vSpacingMd ??= commonConfig._vSpacingMd; + _vSpacingLg ??= commonConfig._vSpacingLg; + _vSpacingXl ??= commonConfig._vSpacingXl; + _vSpacingXxl ??= commonConfig._vSpacingXxl; + _iconSizeXxs ??= commonConfig._iconSizeXxs; + _iconSizeXs ??= commonConfig._iconSizeXs; + _iconSizeSm ??= commonConfig._iconSizeSm; + _iconSizeMd ??= commonConfig._iconSizeMd; + _iconSizeLg ??= commonConfig._iconSizeLg; } } diff --git a/lib/src/theme/configs/brn_dialog_config.dart b/lib/src/theme/configs/brn_dialog_config.dart index 75b949fb..7bd99306 100644 --- a/lib/src/theme/configs/brn_dialog_config.dart +++ b/lib/src/theme/configs/brn_dialog_config.dart @@ -1,4 +1,5 @@ import 'package:bruno/src/theme/base/brn_base_config.dart'; +import 'package:bruno/src/theme/base/brn_default_config_utils.dart'; import 'package:bruno/src/theme/base/brn_text_style.dart'; import 'package:bruno/src/theme/brn_theme_configurator.dart'; import 'package:bruno/src/theme/configs/brn_common_config.dart'; @@ -7,43 +8,74 @@ import 'package:flutter/material.dart'; /// 描述: Dialog 弹框主配置类 class BrnDialogConfig extends BrnBaseConfig { BrnDialogConfig({ - this.dialogWidth, - this.radius, - this.iconPadding, - this.titlePaddingSm, - this.titlePaddingLg, - this.titleTextStyle, - this.titleTextAlign, - this.contentPaddingSm, - this.contentPaddingLg, - this.contentTextStyle, - this.contentTextAlign, - this.warningPaddingSm, - this.warningPaddingLg, - this.warningTextStyle, - this.warningTextAlign, - this.dividerPadding, - this.mainActionTextStyle, - this.assistActionsTextStyle, - this.mainActionBackgroundColor, - this.assistActionsBackgroundColor, - this.bottomHeight, - this.backgroundColor, + dialogWidth, + radius, + iconPadding, + titlePaddingSm, + titlePaddingLg, + titleTextStyle, + titleTextAlign, + contentPaddingSm, + contentPaddingLg, + contentTextStyle, + contentTextAlign, + warningPaddingSm, + warningPaddingLg, + warningTextStyle, + warningTextAlign, + dividerPadding, + mainActionTextStyle, + assistActionsTextStyle, + mainActionBackgroundColor, + assistActionsBackgroundColor, + bottomHeight, + backgroundColor, String configId = GLOBAL_CONFIG_ID, - }) : super(configId: configId); + }) : _dialogWidth = dialogWidth, + _radius = radius, + _iconPadding = iconPadding, + _titlePaddingSm = titlePaddingSm, + _titlePaddingLg = titlePaddingLg, + _titleTextStyle = titleTextStyle, + _titleTextAlign = titleTextAlign, + _contentPaddingSm = contentPaddingSm, + _contentPaddingLg = contentPaddingLg, + _contentTextStyle = contentTextStyle, + _contentTextAlign = contentTextAlign, + _warningPaddingSm = warningPaddingSm, + _warningPaddingLg = warningPaddingLg, + _warningTextStyle = warningTextStyle, + _warningTextAlign = warningTextAlign, + _dividerPadding = dividerPadding, + _mainActionTextStyle = mainActionTextStyle, + _assistActionsTextStyle = assistActionsTextStyle, + _mainActionBackgroundColor = mainActionBackgroundColor, + _assistActionsBackgroundColor = assistActionsBackgroundColor, + _bottomHeight = bottomHeight, + _backgroundColor = backgroundColor, + super(configId: configId); /// Dialog 宽度 /// 默认为 300 - double? dialogWidth; + double? _dialogWidth; + + double get dialogWidth => + _dialogWidth ?? BrnDefaultConfigUtils.defaultDialogConfig.dialogWidth; /// Dialog 四周圆角 /// 默认为 [BrnCommonConfig.radiusLg] - double? radius; + double? _radius; + + double get radius => + _radius ?? BrnDefaultConfigUtils.defaultDialogConfig.radius; /// Dialog icon 距离顶部的边距 /// /// EdgeInsets.only(top: [BrnCommonConfig.vSpacingXxl]) - EdgeInsets? iconPadding; + EdgeInsets? _iconPadding; + + EdgeInsets get iconPadding => + _iconPadding ?? BrnDefaultConfigUtils.defaultDialogConfig.iconPadding; /// title 在顶部有 icon 时的边距 /// @@ -52,7 +84,11 @@ class BrnDialogConfig extends BrnBaseConfig { /// left: [BrnCommonConfig.hSpacingXxl], /// right: [BrnCommonConfig.hSpacingXxl], /// ) - EdgeInsets? titlePaddingSm; + EdgeInsets? _titlePaddingSm; + + EdgeInsets get titlePaddingSm => + _titlePaddingSm ?? + BrnDefaultConfigUtils.defaultDialogConfig.titlePaddingSm; /// title 当顶部无 icon 时的边距 /// @@ -61,7 +97,11 @@ class BrnDialogConfig extends BrnBaseConfig { /// left: [BrnCommonConfig.hSpacingXxl], /// right: [BrnCommonConfig.hSpacingXxl], /// ) - EdgeInsets? titlePaddingLg; + EdgeInsets? _titlePaddingLg; + + EdgeInsets get titlePaddingLg => + _titlePaddingLg ?? + BrnDefaultConfigUtils.defaultDialogConfig.titlePaddingLg; /// title 标题样式 /// @@ -70,11 +110,19 @@ class BrnDialogConfig extends BrnBaseConfig { /// fontSize: [BrnCommonConfig.fontSizeHead], /// fontWeight: FontWeight.w600, /// ) - BrnTextStyle? titleTextStyle; + BrnTextStyle? _titleTextStyle; + + BrnTextStyle get titleTextStyle => + _titleTextStyle ?? + BrnDefaultConfigUtils.defaultDialogConfig.titleTextStyle; /// 标题的文字对齐 /// 默认为 [TextAlign.center] - TextAlign? titleTextAlign; + TextAlign? _titleTextAlign; + + TextAlign get titleTextAlign => + _titleTextAlign ?? + BrnDefaultConfigUtils.defaultDialogConfig.titleTextAlign; /// content 当顶部有 title 或者 icon 时的边距 /// @@ -83,7 +131,11 @@ class BrnDialogConfig extends BrnBaseConfig { /// left: [BrnCommonConfig.hSpacingXl], /// right: [BrnCommonConfig.hSpacingXl], /// ) - EdgeInsets? contentPaddingSm; + EdgeInsets? _contentPaddingSm; + + EdgeInsets get contentPaddingSm => + _contentPaddingSm ?? + BrnDefaultConfigUtils.defaultDialogConfig.contentPaddingSm; /// content 当顶部无 title 或者 icon 时的边距 /// @@ -92,7 +144,11 @@ class BrnDialogConfig extends BrnBaseConfig { /// left: [BrnCommonConfig.hSpacingXl], /// right: [BrnCommonConfig.hSpacingXl], /// ) - EdgeInsets? contentPaddingLg; + EdgeInsets? _contentPaddingLg; + + EdgeInsets get contentPaddingLg => + _contentPaddingLg ?? + BrnDefaultConfigUtils.defaultDialogConfig.contentPaddingLg; /// message 内容样式 /// @@ -100,11 +156,19 @@ class BrnDialogConfig extends BrnBaseConfig { /// color: [BrnCommonConfig.colorTextImportant], /// fontSize: [BrnCommonConfig.fontSizeBase], /// ) - BrnTextStyle? contentTextStyle; + BrnTextStyle? _contentTextStyle; + + BrnTextStyle get contentTextStyle => + _contentTextStyle ?? + BrnDefaultConfigUtils.defaultDialogConfig.contentTextStyle; /// 内容文字的对齐 /// 默认为 [TextAlign.center] - TextAlign? contentTextAlign; + TextAlign? _contentTextAlign; + + TextAlign get contentTextAlign => + _contentTextAlign ?? + BrnDefaultConfigUtils.defaultDialogConfig.contentTextAlign; /// warning 当顶部有 title/icon/content 时的边距 /// @@ -113,7 +177,11 @@ class BrnDialogConfig extends BrnBaseConfig { /// left: [BrnCommonConfig.hSpacingXl], /// right: [BrnCommonConfig.hSpacingXl], /// ) - EdgeInsets? warningPaddingSm; + EdgeInsets? _warningPaddingSm; + + EdgeInsets get warningPaddingSm => + _warningPaddingSm ?? + BrnDefaultConfigUtils.defaultDialogConfig.warningPaddingSm; /// warning 当顶部无 title/icon/content 时的边距 /// @@ -122,7 +190,11 @@ class BrnDialogConfig extends BrnBaseConfig { /// left: [BrnCommonConfig.hSpacingXl], /// right: [BrnCommonConfig.hSpacingXl], /// ) - EdgeInsets? warningPaddingLg; + EdgeInsets? _warningPaddingLg; + + EdgeInsets get warningPaddingLg => + _warningPaddingLg ?? + BrnDefaultConfigUtils.defaultDialogConfig.warningPaddingLg; /// 警告样式 /// @@ -130,16 +202,28 @@ class BrnDialogConfig extends BrnBaseConfig { /// color: [BrnCommonConfig.brandError], /// fontSize: [BrnCommonConfig.fontSizeBase], /// ) - BrnTextStyle? warningTextStyle; + BrnTextStyle? _warningTextStyle; + + BrnTextStyle get warningTextStyle => + _warningTextStyle ?? + BrnDefaultConfigUtils.defaultDialogConfig.warningTextStyle; /// 警示文案文字的对齐 /// 默认为 [TextAlign.center] - TextAlign? warningTextAlign; + TextAlign? _warningTextAlign; + + TextAlign get warningTextAlign => + _warningTextAlign ?? + BrnDefaultConfigUtils.defaultDialogConfig.warningTextAlign; /// action 顶部 divider 的上方边距 /// /// EdgeInsets.only(top: 28) - EdgeInsets? dividerPadding; + EdgeInsets? _dividerPadding; + + EdgeInsets get dividerPadding => + _dividerPadding ?? + BrnDefaultConfigUtils.defaultDialogConfig.dividerPadding; /// 主色调按钮样式 /// @@ -148,11 +232,19 @@ class BrnDialogConfig extends BrnBaseConfig { /// fontSize: [BrnCommonConfig.fontSizeSubHead], /// fontWeight: FontWeight.w600, /// ) - BrnTextStyle? mainActionTextStyle; + BrnTextStyle? _mainActionTextStyle; + + BrnTextStyle get mainActionTextStyle => + _mainActionTextStyle ?? + BrnDefaultConfigUtils.defaultDialogConfig.mainActionTextStyle; /// 主色调按钮的背景 /// 默认为 [BrnCommonConfig.fillBase] - Color? mainActionBackgroundColor; + Color? _mainActionBackgroundColor; + + Color get mainActionBackgroundColor => + _mainActionBackgroundColor ?? + BrnDefaultConfigUtils.defaultDialogConfig.mainActionBackgroundColor; /// 其他按钮的样式(超2个时按钮样式) /// BrnTextStyle( @@ -160,19 +252,34 @@ class BrnDialogConfig extends BrnBaseConfig { /// fontSize: [BrnCommonConfig.fontSizeSubHead], /// fontWeight: FontWeight.w600, /// ) - BrnTextStyle? assistActionsTextStyle; + BrnTextStyle? _assistActionsTextStyle; + + BrnTextStyle get assistActionsTextStyle => + _assistActionsTextStyle ?? + BrnDefaultConfigUtils.defaultDialogConfig.assistActionsTextStyle; /// 其他按钮的背景 /// 默认为 [BrnCommonConfig.fillBase] - Color? assistActionsBackgroundColor; + Color? _assistActionsBackgroundColor; + + Color get assistActionsBackgroundColor => + _assistActionsBackgroundColor ?? + BrnDefaultConfigUtils.defaultDialogConfig.assistActionsBackgroundColor; /// 底部按钮高度 /// 默认为 44.0 - double? bottomHeight; + double? _bottomHeight; + + double get bottomHeight => + _bottomHeight ?? BrnDefaultConfigUtils.defaultDialogConfig.bottomHeight; /// Dialog背景 /// 默认为 [BrnCommonConfig.fillBase] - Color? backgroundColor; + Color? _backgroundColor; + + Color get backgroundColor => + _backgroundColor ?? + BrnDefaultConfigUtils.defaultDialogConfig.backgroundColor; /// 按优先级,打平 【Bruno 内置配置】 < 【用户全局的默认配置】 < 【用户特殊配置】 < 【临时组件配置】 /// @@ -192,92 +299,92 @@ class BrnDialogConfig extends BrnBaseConfig { ); /// 用户全局组件配置 - BrnDialogConfig? dialogConfig = BrnThemeConfigurator.instance + BrnDialogConfig dialogConfig = BrnThemeConfigurator.instance .getConfig(configId: configId) .dialogConfig; - dialogWidth ??= dialogConfig?.dialogWidth; - radius ??= commonConfig.radiusLg; - titlePaddingSm ??= EdgeInsets.only( - left: commonConfig.hSpacingXxl ?? 0, - right: commonConfig.hSpacingXxl ?? 0, - top: dialogConfig?.titlePaddingSm?.top ?? 0, - bottom: dialogConfig?.titlePaddingSm?.bottom ?? 0, + _dialogWidth ??= dialogConfig.dialogWidth; + _radius ??= commonConfig.radiusLg; + _titlePaddingSm ??= EdgeInsets.only( + left: commonConfig.hSpacingXxl, + right: commonConfig.hSpacingXxl, + top: dialogConfig.titlePaddingSm.top, + bottom: dialogConfig.titlePaddingSm.bottom, ); - titlePaddingLg ??= EdgeInsets.only( - left: commonConfig.hSpacingXxl ?? 0, - right: commonConfig.hSpacingXxl ?? 0, - top: dialogConfig?.titlePaddingLg?.top ?? 0, - bottom: dialogConfig?.titlePaddingLg?.bottom ?? 0, + _titlePaddingLg ??= EdgeInsets.only( + left: commonConfig.hSpacingXxl, + right: commonConfig.hSpacingXxl, + top: dialogConfig.titlePaddingLg.top, + bottom: dialogConfig.titlePaddingLg.bottom, ); - iconPadding ??= EdgeInsets.only( - left: dialogConfig?.iconPadding?.left ?? 0, - top: commonConfig.vSpacingXxl ?? 0, - right: dialogConfig?.iconPadding?.right ?? 0, - bottom: dialogConfig?.iconPadding?.bottom ?? 0, + _iconPadding ??= EdgeInsets.only( + left: dialogConfig.iconPadding.left, + top: commonConfig.vSpacingXxl, + right: dialogConfig.iconPadding.right, + bottom: dialogConfig.iconPadding.bottom, ); - titleTextStyle = dialogConfig?.titleTextStyle?.merge( + _titleTextStyle = dialogConfig.titleTextStyle.merge( BrnTextStyle( color: commonConfig.colorTextBase, fontSize: commonConfig.fontSizeHead, - ).merge(titleTextStyle), + ).merge(_titleTextStyle), ); - contentTextStyle = dialogConfig?.contentTextStyle?.merge( + _contentTextStyle = dialogConfig.contentTextStyle.merge( BrnTextStyle( color: commonConfig.colorTextImportant, fontSize: commonConfig.fontSizeBase, - ).merge(contentTextStyle), + ).merge(_contentTextStyle), ); - warningTextStyle = dialogConfig?.warningTextStyle?.merge( + _warningTextStyle = dialogConfig.warningTextStyle.merge( BrnTextStyle( color: commonConfig.brandError, fontSize: commonConfig.fontSizeBase, - ).merge(warningTextStyle), + ).merge(_warningTextStyle), ); - mainActionTextStyle = dialogConfig?.mainActionTextStyle?.merge( + _mainActionTextStyle = dialogConfig.mainActionTextStyle.merge( BrnTextStyle( color: commonConfig.brandPrimary, fontSize: commonConfig.fontSizeSubHead, - ).merge(mainActionTextStyle), + ).merge(_mainActionTextStyle), ); - assistActionsTextStyle = dialogConfig?.assistActionsTextStyle?.merge( + _assistActionsTextStyle = dialogConfig.assistActionsTextStyle.merge( BrnTextStyle( color: commonConfig.colorTextBase, fontSize: commonConfig.fontSizeSubHead, - ).merge(assistActionsTextStyle), + ).merge(_assistActionsTextStyle), ); - contentPaddingSm ??= EdgeInsets.only( - left: commonConfig.hSpacingXl ?? 0, - right: commonConfig.hSpacingXl ?? 0, - top: dialogConfig?.contentPaddingSm?.top ?? 0, - bottom: dialogConfig?.contentPaddingSm?.bottom ?? 0, + _contentPaddingSm ??= EdgeInsets.only( + left: commonConfig.hSpacingXl, + right: commonConfig.hSpacingXl, + top: dialogConfig.contentPaddingSm.top, + bottom: dialogConfig.contentPaddingSm.bottom, ); - contentPaddingSm ??= EdgeInsets.only( - left: commonConfig.hSpacingXl ?? 0, - right: commonConfig.hSpacingXl ?? 0, - top: dialogConfig?.contentPaddingLg?.top ?? 0, - bottom: dialogConfig?.contentPaddingLg?.bottom ?? 0, + _contentPaddingSm ??= EdgeInsets.only( + left: commonConfig.hSpacingXl, + right: commonConfig.hSpacingXl, + top: dialogConfig.contentPaddingLg.top, + bottom: dialogConfig.contentPaddingLg.bottom, ); - warningPaddingSm ??= EdgeInsets.only( - left: commonConfig.hSpacingXl ?? 0, - right: commonConfig.hSpacingXl ?? 0, - top: dialogConfig?.warningPaddingSm?.top ?? 0, - bottom: dialogConfig?.warningPaddingSm?.bottom ?? 0, + _warningPaddingSm ??= EdgeInsets.only( + left: commonConfig.hSpacingXl, + right: commonConfig.hSpacingXl, + top: dialogConfig.warningPaddingSm.top, + bottom: dialogConfig.warningPaddingSm.bottom, ); - warningPaddingLg ??= EdgeInsets.only( - left: commonConfig.hSpacingXl ?? 0, - right: commonConfig.hSpacingXl ?? 0, - top: dialogConfig?.warningPaddingLg?.top ?? 0, - bottom: dialogConfig?.warningPaddingLg?.bottom ?? 0, + _warningPaddingLg ??= EdgeInsets.only( + left: commonConfig.hSpacingXl, + right: commonConfig.hSpacingXl, + top: dialogConfig.warningPaddingLg.top, + bottom: dialogConfig.warningPaddingLg.bottom, ); - titleTextAlign ??= dialogConfig?.titleTextAlign; - contentTextAlign ??= dialogConfig?.contentTextAlign; - warningTextAlign ??= dialogConfig?.warningTextAlign; - mainActionBackgroundColor ??= commonConfig.fillBase; - assistActionsBackgroundColor ??= commonConfig.fillBase; - bottomHeight ??= dialogConfig?.bottomHeight; - dividerPadding ??= dialogConfig?.dividerPadding; - backgroundColor ??= commonConfig.fillBase; + _titleTextAlign ??= dialogConfig.titleTextAlign; + _contentTextAlign ??= dialogConfig.contentTextAlign; + _warningTextAlign ??= dialogConfig.warningTextAlign; + _mainActionBackgroundColor ??= commonConfig.fillBase; + _assistActionsBackgroundColor ??= commonConfig.fillBase; + _bottomHeight ??= dialogConfig.bottomHeight; + _dividerPadding ??= dialogConfig.dividerPadding; + _backgroundColor ??= commonConfig.fillBase; } BrnDialogConfig copyWith({ @@ -305,66 +412,59 @@ class BrnDialogConfig extends BrnBaseConfig { Color? backgroundColor, }) { return BrnDialogConfig( - dialogWidth: dialogWidth ?? this.dialogWidth, - radius: radius ?? this.radius, - iconPadding: iconPadding ?? this.iconPadding, - titlePaddingSm: titlePaddingSm ?? this.titlePaddingSm, - titlePaddingLg: titlePaddingLg ?? this.titlePaddingLg, - titleTextStyle: titleTextStyle ?? this.titleTextStyle, - titleTextAlign: titleTextAlign ?? this.titleTextAlign, - contentPaddingSm: contentPaddingSm ?? this.contentPaddingSm, - contentPaddingLg: contentPaddingLg ?? this.contentPaddingLg, - contentTextStyle: contentTextStyle ?? this.contentTextStyle, - contentTextAlign: contentTextAlign ?? this.contentTextAlign, - warningPaddingSm: warningPaddingSm ?? this.warningPaddingSm, - warningPaddingLg: warningPaddingLg ?? this.warningPaddingLg, - warningTextStyle: warningTextStyle ?? this.warningTextStyle, - warningTextAlign: warningTextAlign ?? this.warningTextAlign, - dividerPadding: dividerPadding ?? this.dividerPadding, - mainActionTextStyle: mainActionTextStyle ?? this.mainActionTextStyle, - assistActionsTextStyle: - assistActionsTextStyle ?? this.assistActionsTextStyle, + dialogWidth: dialogWidth ?? _dialogWidth, + radius: radius ?? _radius, + iconPadding: iconPadding ?? _iconPadding, + titlePaddingSm: titlePaddingSm ?? _titlePaddingSm, + titlePaddingLg: titlePaddingLg ?? _titlePaddingLg, + titleTextStyle: titleTextStyle ?? _titleTextStyle, + titleTextAlign: titleTextAlign ?? _titleTextAlign, + contentPaddingSm: contentPaddingSm ?? _contentPaddingSm, + contentPaddingLg: contentPaddingLg ?? _contentPaddingLg, + contentTextStyle: contentTextStyle ?? _contentTextStyle, + contentTextAlign: contentTextAlign ?? _contentTextAlign, + warningPaddingSm: warningPaddingSm ?? _warningPaddingSm, + warningPaddingLg: warningPaddingLg ?? _warningPaddingLg, + warningTextStyle: warningTextStyle ?? _warningTextStyle, + warningTextAlign: warningTextAlign ?? _warningTextAlign, + dividerPadding: dividerPadding ?? _dividerPadding, + mainActionTextStyle: mainActionTextStyle ?? _mainActionTextStyle, + assistActionsTextStyle: assistActionsTextStyle ?? _assistActionsTextStyle, mainActionBackgroundColor: - mainActionBackgroundColor ?? this.mainActionBackgroundColor, + mainActionBackgroundColor ?? _mainActionBackgroundColor, assistActionsBackgroundColor: - assistActionsBackgroundColor ?? this.assistActionsBackgroundColor, - bottomHeight: bottomHeight ?? this.bottomHeight, - backgroundColor: backgroundColor ?? this.backgroundColor, + assistActionsBackgroundColor ?? _assistActionsBackgroundColor, + bottomHeight: bottomHeight ?? _bottomHeight, + backgroundColor: backgroundColor ?? _backgroundColor, ); } BrnDialogConfig merge(BrnDialogConfig? other) { if (other == null) return this; return copyWith( - dialogWidth: other.dialogWidth, - radius: other.radius, - iconPadding: other.iconPadding, - titlePaddingSm: other.titlePaddingSm, - titlePaddingLg: other.titlePaddingLg, - titleTextStyle: - titleTextStyle?.merge(other.titleTextStyle) ?? other.titleTextStyle, - titleTextAlign: other.titleTextAlign, - contentPaddingSm: other.contentPaddingSm, - contentPaddingLg: other.contentPaddingLg, - contentTextStyle: contentTextStyle?.merge(other.contentTextStyle) ?? - other.contentTextStyle, - contentTextAlign: other.contentTextAlign, - warningPaddingSm: other.warningPaddingSm, - warningPaddingLg: other.warningPaddingLg, - warningTextStyle: warningTextStyle?.merge(other.warningTextStyle) ?? - other.warningTextStyle, - warningTextAlign: other.warningTextAlign, - dividerPadding: other.dividerPadding, - mainActionTextStyle: - mainActionTextStyle?.merge(other.mainActionTextStyle) ?? - other.mainActionTextStyle, + dialogWidth: other._dialogWidth, + radius: other._radius, + iconPadding: other._iconPadding, + titlePaddingSm: other._titlePaddingSm, + titlePaddingLg: other._titlePaddingLg, + titleTextStyle: titleTextStyle.merge(other._titleTextStyle), + titleTextAlign: other._titleTextAlign, + contentPaddingSm: other._contentPaddingSm, + contentPaddingLg: other._contentPaddingLg, + contentTextStyle: contentTextStyle.merge(other._contentTextStyle), + contentTextAlign: other._contentTextAlign, + warningPaddingSm: other._warningPaddingSm, + warningPaddingLg: other._warningPaddingLg, + warningTextStyle: warningTextStyle.merge(other._warningTextStyle), + warningTextAlign: other._warningTextAlign, + dividerPadding: other._dividerPadding, + mainActionTextStyle: mainActionTextStyle.merge(other._mainActionTextStyle), assistActionsTextStyle: - assistActionsTextStyle?.merge(other.assistActionsTextStyle) ?? - other.assistActionsTextStyle, - mainActionBackgroundColor: other.mainActionBackgroundColor, - assistActionsBackgroundColor: other.assistActionsBackgroundColor, - bottomHeight: other.bottomHeight, - backgroundColor: other.backgroundColor, + assistActionsTextStyle.merge(other._assistActionsTextStyle), + mainActionBackgroundColor: other._mainActionBackgroundColor, + assistActionsBackgroundColor: other._assistActionsBackgroundColor, + bottomHeight: other._bottomHeight, + backgroundColor: other._backgroundColor, ); } } diff --git a/lib/src/theme/configs/brn_enhance_number_card_config.dart b/lib/src/theme/configs/brn_enhance_number_card_config.dart index d0243fd4..12c261aa 100644 --- a/lib/src/theme/configs/brn_enhance_number_card_config.dart +++ b/lib/src/theme/configs/brn_enhance_number_card_config.dart @@ -1,4 +1,5 @@ import 'package:bruno/src/theme/base/brn_base_config.dart'; +import 'package:bruno/src/theme/base/brn_default_config_utils.dart'; import 'package:bruno/src/theme/base/brn_text_style.dart'; import 'package:bruno/src/theme/brn_theme_configurator.dart'; import 'package:bruno/src/theme/configs/brn_common_config.dart'; @@ -8,23 +9,48 @@ class BrnEnhanceNumberCardConfig extends BrnBaseConfig { /// 遵循外部主题配置 /// 默认为 [BrnDefaultConfigUtils.defaultEnhanceNumberInfoConfig] BrnEnhanceNumberCardConfig({ - this.runningSpace, - this.itemRunningSpace, - this.titleTextStyle, - this.descTextStyle, - this.dividerWidth, + double? runningSpace, + double? itemRunningSpace, + BrnTextStyle? titleTextStyle, + BrnTextStyle? descTextStyle, + double? dividerWidth, String configId: GLOBAL_CONFIG_ID, - }) : super(configId: configId); + }) : _runningSpace = runningSpace, + _itemRunningSpace = itemRunningSpace, + _titleTextStyle = titleTextStyle, + _descTextStyle = descTextStyle, + _dividerWidth = dividerWidth, + super(configId: configId); /// 如果超过一行,行间距 - double? runningSpace; + double? _runningSpace; + + double get runningSpace => + _runningSpace ?? + BrnDefaultConfigUtils.defaultEnhanceNumberInfoConfig.runningSpace; /// Item的上半部分和下半部分的间距 - double? itemRunningSpace; - double? dividerWidth; + double? _itemRunningSpace; + + double get itemRunningSpace => + _itemRunningSpace ?? + BrnDefaultConfigUtils.defaultEnhanceNumberInfoConfig.itemRunningSpace; + + double? _dividerWidth; + + double get dividerWidth => + _dividerWidth ?? + BrnDefaultConfigUtils.defaultEnhanceNumberInfoConfig.dividerWidth; + BrnTextStyle? _titleTextStyle; + + BrnTextStyle get titleTextStyle => + _titleTextStyle ?? + BrnDefaultConfigUtils.defaultEnhanceNumberInfoConfig.titleTextStyle; + BrnTextStyle? _descTextStyle; - BrnTextStyle? titleTextStyle; - BrnTextStyle? descTextStyle; + BrnTextStyle get descTextStyle => + _descTextStyle ?? + BrnDefaultConfigUtils.defaultEnhanceNumberInfoConfig.descTextStyle; @override void initThemeConfig( @@ -36,18 +62,18 @@ class BrnEnhanceNumberCardConfig extends BrnBaseConfig { currentLevelCommonConfig: currentLevelCommonConfig, ); - BrnEnhanceNumberCardConfig? userConfig = BrnThemeConfigurator.instance + BrnEnhanceNumberCardConfig userConfig = BrnThemeConfigurator.instance .getConfig(configId: configId) .enhanceNumberCardConfig; - runningSpace ??= userConfig?.runningSpace; - itemRunningSpace ??= userConfig?.itemRunningSpace; - dividerWidth ??= userConfig?.dividerWidth; - titleTextStyle = userConfig?.titleTextStyle?.merge( - BrnTextStyle(color: commonConfig.colorTextBase).merge(titleTextStyle), + _runningSpace ??= userConfig._runningSpace; + _itemRunningSpace ??= userConfig._itemRunningSpace; + _dividerWidth ??= userConfig._dividerWidth; + _titleTextStyle = userConfig.titleTextStyle.merge( + BrnTextStyle(color: commonConfig.colorTextBase).merge(_titleTextStyle), ); - descTextStyle = userConfig?.descTextStyle?.merge( - BrnTextStyle(color: commonConfig.colorTextSecondary).merge(descTextStyle), + _descTextStyle = userConfig.descTextStyle.merge( + BrnTextStyle(color: commonConfig.colorTextSecondary).merge(_descTextStyle), ); } @@ -59,24 +85,22 @@ class BrnEnhanceNumberCardConfig extends BrnBaseConfig { BrnTextStyle? descTextStyle, }) { return BrnEnhanceNumberCardConfig( - runningSpace: runningSpace ?? this.runningSpace, - itemRunningSpace: itemRunningSpace ?? this.itemRunningSpace, - dividerWidth: dividerWidth ?? this.dividerWidth, - titleTextStyle: titleTextStyle ?? this.titleTextStyle, - descTextStyle: descTextStyle ?? this.descTextStyle, + runningSpace: runningSpace ?? _runningSpace, + itemRunningSpace: itemRunningSpace ?? _itemRunningSpace, + dividerWidth: dividerWidth ?? _dividerWidth, + titleTextStyle: titleTextStyle ?? _titleTextStyle, + descTextStyle: descTextStyle ?? _descTextStyle, ); } BrnEnhanceNumberCardConfig merge(BrnEnhanceNumberCardConfig? other) { if (other == null) return this; return copyWith( - runningSpace: other.runningSpace, - itemRunningSpace: other.itemRunningSpace, - dividerWidth: other.dividerWidth, - titleTextStyle: - titleTextStyle?.merge(other.titleTextStyle) ?? other.titleTextStyle, - descTextStyle: - descTextStyle?.merge(other.descTextStyle) ?? other.descTextStyle, + runningSpace: other._runningSpace, + itemRunningSpace: other._itemRunningSpace, + dividerWidth: other._dividerWidth, + titleTextStyle: titleTextStyle.merge(other._titleTextStyle), + descTextStyle: descTextStyle.merge(other._descTextStyle), ); } } diff --git a/lib/src/theme/configs/brn_form_config.dart b/lib/src/theme/configs/brn_form_config.dart index 210e3e95..0a932215 100644 --- a/lib/src/theme/configs/brn_form_config.dart +++ b/lib/src/theme/configs/brn_form_config.dart @@ -1,4 +1,5 @@ import 'package:bruno/src/theme/base/brn_base_config.dart'; +import 'package:bruno/src/theme/base/brn_default_config_utils.dart'; import 'package:bruno/src/theme/base/brn_text_style.dart'; import 'package:bruno/src/theme/brn_theme_configurator.dart'; import 'package:bruno/src/theme/configs/brn_common_config.dart'; @@ -9,24 +10,40 @@ class BrnFormItemConfig extends BrnBaseConfig { /// 遵循全局配置 /// 默认为 [BrnDefaultConfigUtils.defaultFormItemConfig] BrnFormItemConfig({ - this.titleTextStyle, - this.subTitleTextStyle, - this.errorTextStyle, - this.hintTextStyle, - this.contentTextStyle, - this.formPadding, - this.titlePaddingSm, - this.titlePaddingLg, - this.optionsMiddlePadding, - this.subTitlePadding, - this.errorPadding, - this.disableTextStyle, - this.tipsTextStyle, - this.headTitleTextStyle, - this.optionTextStyle, - this.optionSelectedTextStyle, + BrnTextStyle? titleTextStyle, + BrnTextStyle? subTitleTextStyle, + BrnTextStyle? errorTextStyle, + BrnTextStyle? hintTextStyle, + BrnTextStyle? contentTextStyle, + EdgeInsets? formPadding, + EdgeInsets? titlePaddingSm, + EdgeInsets? titlePaddingLg, + EdgeInsets? optionsMiddlePadding, + EdgeInsets? subTitlePadding, + EdgeInsets? errorPadding, + BrnTextStyle? disableTextStyle, + BrnTextStyle? tipsTextStyle, + BrnTextStyle? headTitleTextStyle, + BrnTextStyle? optionTextStyle, + BrnTextStyle? optionSelectedTextStyle, String configId = GLOBAL_CONFIG_ID, - }) : super(configId: configId); + }) : _titleTextStyle = titleTextStyle, + _subTitleTextStyle = subTitleTextStyle, + _errorTextStyle = errorTextStyle, + _hintTextStyle = hintTextStyle, + _contentTextStyle = contentTextStyle, + _formPadding = formPadding, + _titlePaddingSm = titlePaddingSm, + _titlePaddingLg = titlePaddingLg, + _optionsMiddlePadding = optionsMiddlePadding, + _subTitlePadding = subTitlePadding, + _errorPadding = errorPadding, + _disableTextStyle = disableTextStyle, + _tipsTextStyle = tipsTextStyle, + _headTitleTextStyle = headTitleTextStyle, + _optionTextStyle = optionTextStyle, + _optionSelectedTextStyle = optionSelectedTextStyle, + super(configId: configId); BrnFormItemConfig.generatorFromConfigId(String configId) { initThemeConfig(configId); @@ -38,7 +55,7 @@ class BrnFormItemConfig extends BrnBaseConfig { /// color: [BrnCommonConfig.colorTextBase], /// fontSize: [BrnCommonConfig.fontSizeHead], /// ) - BrnTextStyle? headTitleTextStyle; + BrnTextStyle? _headTitleTextStyle; /// 左侧标题文本样式 /// @@ -46,7 +63,7 @@ class BrnFormItemConfig extends BrnBaseConfig { /// color: [BrnCommonConfig.colorTextBase], /// fontSize: [BrnCommonConfig.fontSizeSubHead], /// ) - BrnTextStyle? titleTextStyle; + BrnTextStyle? _titleTextStyle; /// 左侧辅助文本样式 /// @@ -54,7 +71,7 @@ class BrnFormItemConfig extends BrnBaseConfig { /// color: [BrnCommonConfig.colorTextSecondary], /// fontSize: [BrnCommonConfig.fontSizeCaption], /// ) - BrnTextStyle? subTitleTextStyle; + BrnTextStyle? _subTitleTextStyle; /// 左侧 Error 文本样式 /// @@ -62,7 +79,7 @@ class BrnFormItemConfig extends BrnBaseConfig { /// color: [BrnCommonConfig.brandError], /// fontSize: [BrnCommonConfig.fontSizeCaption], /// ) - BrnTextStyle? errorTextStyle; + BrnTextStyle? _errorTextStyle; /// 右侧 输入、选择提示文本样式 /// @@ -70,7 +87,7 @@ class BrnFormItemConfig extends BrnBaseConfig { /// color: [BrnCommonConfig.colorTextHint], /// fontSize: [BrnCommonConfig.fontSizeSubHead], /// ) - BrnTextStyle? hintTextStyle; + BrnTextStyle? _hintTextStyle; /// 右侧 主要内容样式 /// @@ -78,7 +95,7 @@ class BrnFormItemConfig extends BrnBaseConfig { /// color: [BrnCommonConfig.colorTextBase], /// fontSize: [BrnCommonConfig.fontSizeSubHead], /// ) - BrnTextStyle? contentTextStyle; + BrnTextStyle? _contentTextStyle; /// 表单项 当有星号标识 上下右边距 /// @@ -88,22 +105,22 @@ class BrnFormItemConfig extends BrnBaseConfig { /// right: [BrnCommonConfig.hSpacingLg], /// bottom: [BrnCommonConfig.vSpacingLg], /// ) - EdgeInsets? formPadding; + EdgeInsets? _formPadding; /// 表单项 当有星号标识 左边距 /// /// EdgeInsets.only(left: 10) - EdgeInsets? titlePaddingSm; + EdgeInsets? _titlePaddingSm; /// 表单项 当无星号标识 左右边距 /// /// EdgeInsets.only(left: [BrnCommonConfig.hSpacingLg]) - EdgeInsets? titlePaddingLg; + EdgeInsets? _titlePaddingLg; /// 选项之间间距 单选 or 多选 /// /// EdgeInsets.only(left: [BrnCommonConfig.hSpacingMd]) - EdgeInsets? optionsMiddlePadding; + EdgeInsets? _optionsMiddlePadding; /// 选项普通文本样式 /// @@ -112,7 +129,7 @@ class BrnFormItemConfig extends BrnBaseConfig { /// fontSize: [BrnCommonConfig.fontSizeSubHead], /// height: 1.3, /// ) - BrnTextStyle? optionTextStyle; + BrnTextStyle? _optionTextStyle; /// 选项选中文本样式 /// @@ -121,7 +138,7 @@ class BrnFormItemConfig extends BrnBaseConfig { /// fontSize: [BrnCommonConfig.fontSizeSubHead], /// height: 1.3, /// ) - BrnTextStyle? optionSelectedTextStyle; + BrnTextStyle? _optionSelectedTextStyle; /// 子标题 左上间距 /// @@ -129,7 +146,7 @@ class BrnFormItemConfig extends BrnBaseConfig { /// left: [BrnCommonConfig.hSpacingLg], /// top: [BrnCommonConfig.vSpacingXs], /// ) - EdgeInsets? subTitlePadding; + EdgeInsets? _subTitlePadding; /// error提示 左上间距 /// @@ -137,7 +154,7 @@ class BrnFormItemConfig extends BrnBaseConfig { /// left: [BrnCommonConfig.hSpacingLg], /// top: [BrnCommonConfig.vSpacingXs], /// ) - EdgeInsets? errorPadding; + EdgeInsets? _errorPadding; /// 不可修改内容展示 /// @@ -145,7 +162,7 @@ class BrnFormItemConfig extends BrnBaseConfig { /// color: [BrnCommonConfig.colorTextDisabled], /// fontSize: [BrnCommonConfig.fontSizeSubHead], /// ) - BrnTextStyle? disableTextStyle; + BrnTextStyle? _disableTextStyle; /// 提示文本样式 /// @@ -153,7 +170,69 @@ class BrnFormItemConfig extends BrnBaseConfig { /// color: [BrnCommonConfig.colorTextSecondary], /// fontSize: [BrnCommonConfig.fontSizeBase], /// ) - BrnTextStyle? tipsTextStyle; + BrnTextStyle? _tipsTextStyle; + + BrnTextStyle get headTitleTextStyle => + _headTitleTextStyle ?? + BrnDefaultConfigUtils.defaultFormItemConfig.headTitleTextStyle; + + BrnTextStyle get titleTextStyle => + _titleTextStyle ?? + BrnDefaultConfigUtils.defaultFormItemConfig.titleTextStyle; + + BrnTextStyle get subTitleTextStyle => + _subTitleTextStyle ?? + BrnDefaultConfigUtils.defaultFormItemConfig.subTitleTextStyle; + + BrnTextStyle get errorTextStyle => + _errorTextStyle ?? + BrnDefaultConfigUtils.defaultFormItemConfig.errorTextStyle; + + BrnTextStyle get hintTextStyle => + _hintTextStyle ?? + BrnDefaultConfigUtils.defaultFormItemConfig.hintTextStyle; + + BrnTextStyle get contentTextStyle => + _contentTextStyle ?? + BrnDefaultConfigUtils.defaultFormItemConfig.contentTextStyle; + + EdgeInsets get formPadding => + _formPadding ?? BrnDefaultConfigUtils.defaultFormItemConfig.formPadding; + + EdgeInsets get titlePaddingSm => + _titlePaddingSm ?? + BrnDefaultConfigUtils.defaultFormItemConfig.titlePaddingSm; + + EdgeInsets get titlePaddingLg => + _titlePaddingLg ?? + BrnDefaultConfigUtils.defaultFormItemConfig.titlePaddingLg; + + EdgeInsets get optionsMiddlePadding => + _optionsMiddlePadding ?? + BrnDefaultConfigUtils.defaultFormItemConfig.optionsMiddlePadding; + + BrnTextStyle get optionTextStyle => + _optionTextStyle ?? + BrnDefaultConfigUtils.defaultFormItemConfig.optionTextStyle; + + BrnTextStyle get optionSelectedTextStyle => + _optionSelectedTextStyle ?? + BrnDefaultConfigUtils.defaultFormItemConfig.optionSelectedTextStyle; + + EdgeInsets get subTitlePadding => + _subTitlePadding ?? + BrnDefaultConfigUtils.defaultFormItemConfig.subTitlePadding; + + EdgeInsets get errorPadding => + _errorPadding ?? BrnDefaultConfigUtils.defaultFormItemConfig.errorPadding; + + BrnTextStyle get disableTextStyle => + _disableTextStyle ?? + BrnDefaultConfigUtils.defaultFormItemConfig.disableTextStyle; + + BrnTextStyle get tipsTextStyle => + _tipsTextStyle ?? + BrnDefaultConfigUtils.defaultFormItemConfig.tipsTextStyle; /// 举例: /// ① 尝试获取最近的配置 [topRadius] 若配不为 null,直接使用该配置. @@ -171,91 +250,91 @@ class BrnFormItemConfig extends BrnBaseConfig { ); /// 用户全局form组件配置 - BrnFormItemConfig? formItemThemeData = BrnThemeConfigurator.instance + BrnFormItemConfig formItemThemeData = BrnThemeConfigurator.instance .getConfig(configId: configId) .formItemConfig; - titlePaddingSm ??= formItemThemeData?.titlePaddingSm; - titlePaddingLg ??= formItemThemeData?.titlePaddingLg; - optionSelectedTextStyle = formItemThemeData?.optionSelectedTextStyle?.merge( + _titlePaddingSm ??= formItemThemeData.titlePaddingSm; + _titlePaddingLg ??= formItemThemeData.titlePaddingLg; + _optionSelectedTextStyle = formItemThemeData.optionSelectedTextStyle.merge( BrnTextStyle( color: commonConfig.brandPrimary, fontSize: commonConfig.fontSizeSubHead, - ).merge(optionSelectedTextStyle), + ).merge(_optionSelectedTextStyle), ); - optionTextStyle = formItemThemeData?.optionTextStyle?.merge( + _optionTextStyle = formItemThemeData.optionTextStyle.merge( BrnTextStyle( color: commonConfig.colorTextBase, fontSize: commonConfig.fontSizeSubHead, - ).merge(optionTextStyle), + ).merge(_optionTextStyle), ); - headTitleTextStyle = formItemThemeData?.headTitleTextStyle?.merge( + _headTitleTextStyle = formItemThemeData.headTitleTextStyle.merge( BrnTextStyle( color: commonConfig.colorTextBase, fontSize: commonConfig.fontSizeHead, - ).merge(headTitleTextStyle), + ).merge(_headTitleTextStyle), ); - errorPadding ??= EdgeInsets.only( - left: commonConfig.hSpacingLg ?? 0, - right: formItemThemeData?.errorPadding?.right ?? 0, - top: commonConfig.vSpacingXs ?? 0, - bottom: formItemThemeData?.errorPadding?.bottom ?? 0, + _errorPadding ??= EdgeInsets.only( + left: commonConfig.hSpacingLg, + right: formItemThemeData.errorPadding.right, + top: commonConfig.vSpacingXs, + bottom: formItemThemeData.errorPadding.bottom, ); - subTitlePadding ??= EdgeInsets.only( - left: commonConfig.hSpacingLg ?? 0, - right: formItemThemeData?.subTitlePadding?.right ?? 0, - top: commonConfig.vSpacingXs ?? 0, - bottom: formItemThemeData?.subTitlePadding?.bottom ?? 0, + _subTitlePadding ??= EdgeInsets.only( + left: commonConfig.hSpacingLg, + right: formItemThemeData.subTitlePadding.right, + top: commonConfig.vSpacingXs, + bottom: formItemThemeData.subTitlePadding.bottom, ); - formPadding ??= EdgeInsets.only( - left: formItemThemeData?.formPadding?.left ?? 0, - right: commonConfig.hSpacingLg ?? 0, - top: commonConfig.vSpacingLg ?? 0, - bottom: commonConfig.vSpacingLg ?? 0, + _formPadding ??= EdgeInsets.only( + left: formItemThemeData.formPadding.left, + right: commonConfig.hSpacingLg, + top: commonConfig.vSpacingLg, + bottom: commonConfig.vSpacingLg, ); - tipsTextStyle = formItemThemeData?.tipsTextStyle?.merge( + _tipsTextStyle = formItemThemeData.tipsTextStyle.merge( BrnTextStyle( color: commonConfig.colorTextSecondary, fontSize: commonConfig.fontSizeBase, - ).merge(tipsTextStyle), + ).merge(_tipsTextStyle), ); - disableTextStyle = formItemThemeData?.disableTextStyle?.merge( + _disableTextStyle = formItemThemeData.disableTextStyle.merge( BrnTextStyle( color: commonConfig.colorTextDisabled, fontSize: commonConfig.fontSizeSubHead, - ).merge(disableTextStyle), + ).merge(_disableTextStyle), ); - contentTextStyle = formItemThemeData?.contentTextStyle?.merge( + _contentTextStyle = formItemThemeData.contentTextStyle.merge( BrnTextStyle( color: commonConfig.colorTextBase, fontSize: commonConfig.fontSizeSubHead, - ).merge(contentTextStyle), + ).merge(_contentTextStyle), ); - hintTextStyle = formItemThemeData?.hintTextStyle?.merge( + _hintTextStyle = formItemThemeData.hintTextStyle.merge( BrnTextStyle( color: commonConfig.colorTextHint, fontSize: commonConfig.fontSizeSubHead, - ).merge(hintTextStyle), + ).merge(_hintTextStyle), ); - titleTextStyle = formItemThemeData?.titleTextStyle?.merge( + _titleTextStyle = formItemThemeData.titleTextStyle.merge( BrnTextStyle( color: commonConfig.colorTextBase, fontSize: commonConfig.fontSizeSubHead, - ).merge(titleTextStyle), + ).merge(_titleTextStyle), ); - subTitleTextStyle = formItemThemeData?.subTitleTextStyle?.merge( + _subTitleTextStyle = formItemThemeData.subTitleTextStyle.merge( BrnTextStyle( color: commonConfig.colorTextSecondary, fontSize: commonConfig.fontSizeCaption, - ).merge(subTitleTextStyle), + ).merge(_subTitleTextStyle), ); - errorTextStyle = formItemThemeData?.errorTextStyle?.merge( + _errorTextStyle = formItemThemeData.errorTextStyle.merge( BrnTextStyle( color: commonConfig.brandError, fontSize: commonConfig.fontSizeCaption, - ).merge(errorTextStyle), + ).merge(_errorTextStyle), ); - optionsMiddlePadding ??= formItemThemeData?.optionsMiddlePadding; + _optionsMiddlePadding ??= formItemThemeData.optionsMiddlePadding; } BrnFormItemConfig copyWith({ @@ -277,56 +356,46 @@ class BrnFormItemConfig extends BrnBaseConfig { BrnTextStyle? optionSelectedTextStyle, }) { return BrnFormItemConfig( - titleTextStyle: titleTextStyle ?? this.titleTextStyle, - subTitleTextStyle: subTitleTextStyle ?? this.subTitleTextStyle, - errorTextStyle: errorTextStyle ?? this.errorTextStyle, - hintTextStyle: hintTextStyle ?? this.hintTextStyle, - contentTextStyle: contentTextStyle ?? this.contentTextStyle, - formPadding: formPadding ?? this.formPadding, - titlePaddingSm: titlePaddingSm ?? this.titlePaddingSm, - titlePaddingLg: titlePaddingLg ?? this.titlePaddingLg, - optionsMiddlePadding: optionsMiddlePadding ?? this.optionsMiddlePadding, - subTitlePadding: subTitlePadding ?? this.subTitlePadding, - errorPadding: errorPadding ?? this.errorPadding, - disableTextStyle: disableTextStyle ?? this.disableTextStyle, - tipsTextStyle: tipsTextStyle ?? this.tipsTextStyle, - headTitleTextStyle: headTitleTextStyle ?? this.headTitleTextStyle, - optionTextStyle: optionTextStyle ?? this.optionTextStyle, + titleTextStyle: titleTextStyle ?? _titleTextStyle, + subTitleTextStyle: subTitleTextStyle ?? _subTitleTextStyle, + errorTextStyle: errorTextStyle ?? _errorTextStyle, + hintTextStyle: hintTextStyle ?? _hintTextStyle, + contentTextStyle: contentTextStyle ?? _contentTextStyle, + formPadding: formPadding ?? _formPadding, + titlePaddingSm: titlePaddingSm ?? _titlePaddingSm, + titlePaddingLg: titlePaddingLg ?? _titlePaddingLg, + optionsMiddlePadding: optionsMiddlePadding ?? _optionsMiddlePadding, + subTitlePadding: subTitlePadding ?? _subTitlePadding, + errorPadding: errorPadding ?? _errorPadding, + disableTextStyle: disableTextStyle ?? _disableTextStyle, + tipsTextStyle: tipsTextStyle ?? _tipsTextStyle, + headTitleTextStyle: headTitleTextStyle ?? _headTitleTextStyle, + optionTextStyle: optionTextStyle ?? _optionTextStyle, optionSelectedTextStyle: - optionSelectedTextStyle ?? this.optionSelectedTextStyle, + optionSelectedTextStyle ?? _optionSelectedTextStyle, ); } BrnFormItemConfig merge(BrnFormItemConfig? other) { if (other == null) return this; return copyWith( - titleTextStyle: - titleTextStyle?.merge(other.titleTextStyle) ?? other.titleTextStyle, - subTitleTextStyle: subTitleTextStyle?.merge(other.subTitleTextStyle) ?? - other.subTitleTextStyle, - errorTextStyle: - errorTextStyle?.merge(other.errorTextStyle) ?? other.errorTextStyle, - hintTextStyle: - hintTextStyle?.merge(other.hintTextStyle) ?? other.hintTextStyle, - contentTextStyle: contentTextStyle?.merge(other.contentTextStyle) ?? - other.contentTextStyle, - formPadding: other.formPadding, - titlePaddingSm: other.titlePaddingSm, - titlePaddingLg: other.titlePaddingLg, - optionsMiddlePadding: other.optionsMiddlePadding, - subTitlePadding: other.subTitlePadding, - errorPadding: other.errorPadding, - disableTextStyle: disableTextStyle?.merge(other.disableTextStyle) ?? - other.disableTextStyle, - tipsTextStyle: - tipsTextStyle?.merge(other.tipsTextStyle) ?? other.tipsTextStyle, - headTitleTextStyle: headTitleTextStyle?.merge(other.headTitleTextStyle) ?? - other.headTitleTextStyle, - optionTextStyle: optionTextStyle?.merge(other.optionTextStyle) ?? - other.optionTextStyle, + titleTextStyle: titleTextStyle.merge(other._titleTextStyle), + subTitleTextStyle: subTitleTextStyle.merge(other._subTitleTextStyle), + errorTextStyle: errorTextStyle.merge(other._errorTextStyle), + hintTextStyle: hintTextStyle.merge(other._hintTextStyle), + contentTextStyle: contentTextStyle.merge(other._contentTextStyle), + formPadding: other._formPadding, + titlePaddingSm: other._titlePaddingSm, + titlePaddingLg: other._titlePaddingLg, + optionsMiddlePadding: other._optionsMiddlePadding, + subTitlePadding: other._subTitlePadding, + errorPadding: other._errorPadding, + disableTextStyle: disableTextStyle.merge(other._disableTextStyle), + tipsTextStyle: tipsTextStyle.merge(other._tipsTextStyle), + headTitleTextStyle: headTitleTextStyle.merge(other._headTitleTextStyle), + optionTextStyle: optionTextStyle.merge(other._optionTextStyle), optionSelectedTextStyle: - optionSelectedTextStyle?.merge(other.optionSelectedTextStyle) ?? - other.optionSelectedTextStyle, + optionSelectedTextStyle.merge(other._optionSelectedTextStyle), ); } } diff --git a/lib/src/theme/configs/brn_gallery_detail_config.dart b/lib/src/theme/configs/brn_gallery_detail_config.dart index 2dcbd9cb..0030e8e4 100644 --- a/lib/src/theme/configs/brn_gallery_detail_config.dart +++ b/lib/src/theme/configs/brn_gallery_detail_config.dart @@ -1,5 +1,6 @@ import 'package:bruno/src/components/navbar/brn_appbar_theme.dart'; import 'package:bruno/src/theme/base/brn_base_config.dart'; +import 'package:bruno/src/theme/base/brn_default_config_utils.dart'; import 'package:bruno/src/theme/base/brn_text_style.dart'; import 'package:bruno/src/theme/brn_theme_configurator.dart'; import 'package:bruno/src/theme/configs/brn_common_config.dart'; @@ -10,86 +11,99 @@ class BrnGalleryDetailConfig extends BrnBaseConfig { /// 遵循全局配置 /// 默认为 [BrnDefaultConfigUtils.defaultGalleryDetailConfig] BrnGalleryDetailConfig({ - this.appbarTitleStyle, - this.appbarActionStyle, - this.appbarBackgroundColor, - this.appbarBrightness, - this.tabBarUnSelectedLabelStyle, - this.tabBarLabelStyle, - this.tabBarBackgroundColor, - this.pageBackgroundColor, - this.bottomBackgroundColor, - this.titleStyle, - this.contentStyle, - this.actionStyle, - this.iconColor, + BrnTextStyle? appbarTitleStyle, + BrnTextStyle? appbarActionStyle, + Color? appbarBackgroundColor, + Brightness? appbarBrightness, + BrnTextStyle? tabBarUnSelectedLabelStyle, + BrnTextStyle? tabBarLabelStyle, + Color? tabBarBackgroundColor, + Color? pageBackgroundColor, + Color? bottomBackgroundColor, + BrnTextStyle? titleStyle, + BrnTextStyle? contentStyle, + BrnTextStyle? actionStyle, + Color? iconColor, String configId = GLOBAL_CONFIG_ID, - }) : super(configId: configId); + }) : _appbarTitleStyle = appbarTitleStyle, + _appbarActionStyle = appbarActionStyle, + _appbarBackgroundColor = appbarBackgroundColor, + _appbarBrightness = appbarBrightness, + _tabBarUnSelectedLabelStyle = tabBarUnSelectedLabelStyle, + _tabBarLabelStyle = tabBarLabelStyle, + _tabBarBackgroundColor = tabBarBackgroundColor, + _pageBackgroundColor = pageBackgroundColor, + _bottomBackgroundColor = bottomBackgroundColor, + _titleStyle = titleStyle, + _contentStyle = contentStyle, + _actionStyle = actionStyle, + _iconColor = iconColor, + super(configId: configId); /// 黑色主题 BrnGalleryDetailConfig.dark({ - this.appbarTitleStyle, - this.appbarActionStyle, - this.appbarBackgroundColor, - this.appbarBrightness, - this.tabBarUnSelectedLabelStyle, - this.tabBarLabelStyle, - this.tabBarBackgroundColor, - this.pageBackgroundColor, - this.bottomBackgroundColor, - this.titleStyle, - this.contentStyle, - this.actionStyle, - this.iconColor, + appbarTitleStyle, + appbarActionStyle, + appbarBackgroundColor, + appbarBrightness, + tabBarUnSelectedLabelStyle, + tabBarLabelStyle, + tabBarBackgroundColor, + pageBackgroundColor, + bottomBackgroundColor, + titleStyle, + contentStyle, + actionStyle, + iconColor, String configId = GLOBAL_CONFIG_ID, }) : super(configId: configId) { - appbarTitleStyle = BrnTextStyle(color: commonConfig.colorTextBaseInverse); - appbarActionStyle = BrnTextStyle(color: BrnAppBarTheme.lightTextColor); - appbarBackgroundColor = Colors.black; - appbarBrightness = Brightness.dark; - tabBarUnSelectedLabelStyle = BrnTextStyle(color: Color(0XFFCCCCCC)); - tabBarLabelStyle = BrnTextStyle(color: commonConfig.colorTextBaseInverse); - tabBarBackgroundColor = Colors.black; - pageBackgroundColor = Colors.black; - bottomBackgroundColor = Color(0X88000000); - titleStyle = BrnTextStyle(color: commonConfig.colorTextBaseInverse); - contentStyle = BrnTextStyle(color: Color(0xFFCCCCCC)); - actionStyle = BrnTextStyle(color: commonConfig.colorTextBaseInverse); - iconColor = Colors.white; + _appbarTitleStyle = BrnTextStyle(color: commonConfig.colorTextBaseInverse); + _appbarActionStyle = BrnTextStyle(color: BrnAppBarTheme.lightTextColor); + _appbarBackgroundColor = Colors.black; + _appbarBrightness = Brightness.dark; + _tabBarUnSelectedLabelStyle = BrnTextStyle(color: Color(0XFFCCCCCC)); + _tabBarLabelStyle = BrnTextStyle(color: commonConfig.colorTextBaseInverse); + _tabBarBackgroundColor = Colors.black; + _pageBackgroundColor = Colors.black; + _bottomBackgroundColor = Color(0X88000000); + _titleStyle = BrnTextStyle(color: commonConfig.colorTextBaseInverse); + _contentStyle = BrnTextStyle(color: Color(0xFFCCCCCC)); + _actionStyle = BrnTextStyle(color: commonConfig.colorTextBaseInverse); + _iconColor = Colors.white; } /// 白色主题 BrnGalleryDetailConfig.light({ - this.appbarTitleStyle, - this.appbarActionStyle, - this.appbarBackgroundColor, - this.appbarBrightness, - this.tabBarUnSelectedLabelStyle, - this.tabBarLabelStyle, - this.tabBarBackgroundColor, - this.pageBackgroundColor, - this.bottomBackgroundColor, - this.titleStyle, - this.contentStyle, - this.actionStyle, - this.iconColor, + appbarTitleStyle, + appbarActionStyle, + appbarBackgroundColor, + appbarBrightness, + tabBarUnSelectedLabelStyle, + tabBarLabelStyle, + tabBarBackgroundColor, + pageBackgroundColor, + bottomBackgroundColor, + titleStyle, + contentStyle, + actionStyle, + iconColor, String configId = GLOBAL_CONFIG_ID, }) : super(configId: configId) { - appbarTitleStyle = BrnTextStyle(color: commonConfig.colorTextBase); - appbarActionStyle = BrnTextStyle(color: commonConfig.colorTextBase); - appbarBackgroundColor = commonConfig.fillBody; - appbarBrightness = Brightness.light; - tabBarUnSelectedLabelStyle = BrnTextStyle( + _appbarTitleStyle = BrnTextStyle(color: commonConfig.colorTextBase); + _appbarActionStyle = BrnTextStyle(color: commonConfig.colorTextBase); + _appbarBackgroundColor = commonConfig.fillBody; + _appbarBrightness = Brightness.light; + _tabBarUnSelectedLabelStyle = BrnTextStyle( color: commonConfig.colorTextBase, ); - tabBarLabelStyle = BrnTextStyle(color: commonConfig.brandPrimary); - tabBarBackgroundColor = commonConfig.fillBody; - pageBackgroundColor = commonConfig.fillBody; - bottomBackgroundColor = commonConfig.fillBody?.withOpacity(.85); - titleStyle = BrnTextStyle(color: commonConfig.colorTextBase); - contentStyle = BrnTextStyle(color: commonConfig.colorTextBase); - actionStyle = BrnTextStyle(color: commonConfig.colorTextSecondary); - iconColor = commonConfig.colorTextSecondary; + _tabBarLabelStyle = BrnTextStyle(color: commonConfig.brandPrimary); + _tabBarBackgroundColor = commonConfig.fillBody; + _pageBackgroundColor = commonConfig.fillBody; + _bottomBackgroundColor = commonConfig.fillBody.withOpacity(.85); + _titleStyle = BrnTextStyle(color: commonConfig.colorTextBase); + _contentStyle = BrnTextStyle(color: commonConfig.colorTextBase); + _actionStyle = BrnTextStyle(color: commonConfig.colorTextSecondary); + _iconColor = commonConfig.colorTextSecondary; } /// appbar brightness待定 @@ -101,7 +115,7 @@ class BrnGalleryDetailConfig extends BrnBaseConfig { /// fontSize: [BrnCommonConfig.fontSizeHead], /// fontWeight: FontWeight.w600, /// ) - BrnTextStyle? appbarTitleStyle; + BrnTextStyle? _appbarTitleStyle; /// 右侧操作区域文案样式 /// @@ -110,15 +124,15 @@ class BrnGalleryDetailConfig extends BrnBaseConfig { /// fontSize: BrnAppBarTheme.actionFontSize, /// fontWeight: FontWeight.w600, /// ) - BrnTextStyle? appbarActionStyle; + BrnTextStyle? _appbarActionStyle; /// appBar 背景色 /// 默认为 Colors.black - Color? appbarBackgroundColor; + Color? _appbarBackgroundColor; /// appbar brightness /// 默认为 [Brightness.dark] - Brightness? appbarBrightness; + Brightness? _appbarBrightness; /// tabBar 标题普通样式 /// @@ -126,7 +140,7 @@ class BrnGalleryDetailConfig extends BrnBaseConfig { /// color: Colors.red, /// fontSize: [BrnCommonConfig.fontSizeSubHead], /// ) - BrnTextStyle? tabBarUnSelectedLabelStyle; + BrnTextStyle? _tabBarUnSelectedLabelStyle; /// tabBar 标题选中样式 /// @@ -135,19 +149,19 @@ class BrnGalleryDetailConfig extends BrnBaseConfig { /// fontSize: [BrnCommonConfig.fontSizeSubHead], /// fontWeight: FontWeight.w600, /// ) - BrnTextStyle? tabBarLabelStyle; + BrnTextStyle? _tabBarLabelStyle; /// tabBar 背景色 /// 默认为 Colors.black - Color? tabBarBackgroundColor; + Color? _tabBarBackgroundColor; /// 页面 背景色 /// 默认为 Colors.black - Color? pageBackgroundColor; + Color? _pageBackgroundColor; /// 底部内容区域的背景色 /// 默认为 Color(0x88000000) - Color? bottomBackgroundColor; + Color? _bottomBackgroundColor; /// 标题文案样式 /// @@ -156,7 +170,7 @@ class BrnGalleryDetailConfig extends BrnBaseConfig { /// fontSize: [BrnCommonConfig.fontSizeHead], /// fontWeight: FontWeight.w600, /// ) - BrnTextStyle? titleStyle; + BrnTextStyle? _titleStyle; /// 内容文案样式 /// @@ -164,7 +178,7 @@ class BrnGalleryDetailConfig extends BrnBaseConfig { /// color: Color(0xFFCCCCCC), /// fontSize: [BrnCommonConfig.fontSizeBase], /// ) - BrnTextStyle? contentStyle; + BrnTextStyle? _contentStyle; /// 右侧展开收起样式 /// @@ -172,11 +186,63 @@ class BrnGalleryDetailConfig extends BrnBaseConfig { /// color: [BrnCommonConfig.colorTextBaseInverse], /// fontSize: [BrnCommonConfig.fontSizeBase], /// ) - BrnTextStyle? actionStyle; + BrnTextStyle? _actionStyle; /// icon 颜色 /// 默认为 Colors.white - Color? iconColor; + Color? _iconColor; + + BrnTextStyle get appbarTitleStyle => + _appbarTitleStyle ?? + BrnDefaultConfigUtils.defaultGalleryDetailConfig.appbarTitleStyle; + + BrnTextStyle get appbarActionStyle => + _appbarActionStyle ?? + BrnDefaultConfigUtils.defaultGalleryDetailConfig.appbarActionStyle; + + Color get appbarBackgroundColor => + _appbarBackgroundColor ?? + BrnDefaultConfigUtils.defaultGalleryDetailConfig.appbarBackgroundColor; + + Brightness get appbarBrightness => + _appbarBrightness ?? + BrnDefaultConfigUtils.defaultGalleryDetailConfig.appbarBrightness; + + BrnTextStyle get tabBarUnSelectedLabelStyle => + _tabBarUnSelectedLabelStyle ?? + BrnDefaultConfigUtils + .defaultGalleryDetailConfig.tabBarUnSelectedLabelStyle; + + BrnTextStyle get tabBarLabelStyle => + _tabBarLabelStyle ?? + BrnDefaultConfigUtils.defaultGalleryDetailConfig.tabBarLabelStyle; + + Color get tabBarBackgroundColor => + _tabBarBackgroundColor ?? + BrnDefaultConfigUtils.defaultGalleryDetailConfig.tabBarBackgroundColor; + + Color get pageBackgroundColor => + _pageBackgroundColor ?? + BrnDefaultConfigUtils.defaultGalleryDetailConfig.pageBackgroundColor; + + Color get bottomBackgroundColor => + _bottomBackgroundColor ?? + BrnDefaultConfigUtils.defaultGalleryDetailConfig.bottomBackgroundColor; + + BrnTextStyle get titleStyle => + _titleStyle ?? + BrnDefaultConfigUtils.defaultGalleryDetailConfig.titleStyle; + + BrnTextStyle get contentStyle => + _contentStyle ?? + BrnDefaultConfigUtils.defaultGalleryDetailConfig.contentStyle; + + BrnTextStyle get actionStyle => + _actionStyle ?? + BrnDefaultConfigUtils.defaultGalleryDetailConfig.actionStyle; + + Color get iconColor => + _iconColor ?? BrnDefaultConfigUtils.defaultGalleryDetailConfig.iconColor; @override void initThemeConfig( @@ -189,55 +255,56 @@ class BrnGalleryDetailConfig extends BrnBaseConfig { ); /// 用户全局组件配置 - BrnGalleryDetailConfig? galleryDetailConfig = BrnThemeConfigurator.instance + BrnGalleryDetailConfig galleryDetailConfig = BrnThemeConfigurator.instance .getConfig(configId: configId) .galleryDetailConfig; - appbarTitleStyle = galleryDetailConfig?.appbarTitleStyle?.merge( + _appbarTitleStyle = galleryDetailConfig.appbarTitleStyle.merge( BrnTextStyle( color: commonConfig.colorTextBaseInverse, fontSize: commonConfig.fontSizeSubHead, - ).merge(appbarTitleStyle), + ).merge(_appbarTitleStyle), ); - appbarActionStyle = galleryDetailConfig?.appbarActionStyle?.merge( - appbarActionStyle, + _appbarActionStyle = galleryDetailConfig.appbarActionStyle.merge( + _appbarActionStyle, ); - appbarBrightness ??= galleryDetailConfig?.appbarBrightness; - appbarBackgroundColor ??= galleryDetailConfig?.appbarBackgroundColor; - tabBarUnSelectedLabelStyle = galleryDetailConfig?.tabBarUnSelectedLabelStyle - ?.merge(BrnTextStyle(fontSize: commonConfig.fontSizeSubHead)) - .merge(tabBarUnSelectedLabelStyle); - tabBarLabelStyle = galleryDetailConfig?.tabBarLabelStyle - ?.merge( + _appbarBrightness ??= galleryDetailConfig.appbarBrightness; + _appbarBackgroundColor ??= galleryDetailConfig.appbarBackgroundColor; + _tabBarUnSelectedLabelStyle = galleryDetailConfig + .tabBarUnSelectedLabelStyle + .merge(BrnTextStyle(fontSize: commonConfig.fontSizeSubHead)) + .merge(_tabBarUnSelectedLabelStyle); + _tabBarLabelStyle = galleryDetailConfig.tabBarLabelStyle + .merge( BrnTextStyle( color: commonConfig.colorTextBaseInverse, fontSize: commonConfig.fontSizeSubHead, ), ) - .merge(tabBarLabelStyle); - tabBarBackgroundColor ??= galleryDetailConfig?.tabBarBackgroundColor; - pageBackgroundColor ??= galleryDetailConfig?.pageBackgroundColor; - bottomBackgroundColor ??= galleryDetailConfig?.bottomBackgroundColor; - titleStyle = galleryDetailConfig?.titleStyle - ?.merge( + .merge(_tabBarLabelStyle); + _tabBarBackgroundColor ??= galleryDetailConfig._tabBarBackgroundColor; + _pageBackgroundColor ??= galleryDetailConfig._pageBackgroundColor; + _bottomBackgroundColor ??= galleryDetailConfig._bottomBackgroundColor; + _titleStyle = galleryDetailConfig.titleStyle + .merge( BrnTextStyle( color: commonConfig.colorTextBaseInverse, fontSize: commonConfig.fontSizeHead, ), ) - .merge(titleStyle); - contentStyle = galleryDetailConfig?.contentStyle - ?.merge(BrnTextStyle(fontSize: commonConfig.fontSizeBase)) - .merge(contentStyle); - actionStyle = galleryDetailConfig?.actionStyle - ?.merge( + .merge(_titleStyle); + _contentStyle = galleryDetailConfig.contentStyle + .merge(BrnTextStyle(fontSize: commonConfig.fontSizeBase)) + .merge(_contentStyle); + _actionStyle = galleryDetailConfig.actionStyle + .merge( BrnTextStyle( color: commonConfig.colorTextBaseInverse, fontSize: commonConfig.fontSizeBase, ), ) - .merge(actionStyle); - iconColor ??= galleryDetailConfig?.iconColor; + .merge(_actionStyle); + _iconColor ??= galleryDetailConfig._iconColor; } BrnGalleryDetailConfig copyWith({ @@ -259,48 +326,41 @@ class BrnGalleryDetailConfig extends BrnBaseConfig { Color? iconColor, }) { return BrnGalleryDetailConfig( - appbarTitleStyle: appbarTitleStyle ?? this.appbarTitleStyle, - appbarActionStyle: appbarActionStyle ?? this.appbarActionStyle, - appbarBackgroundColor: - appbarBackgroundColor ?? this.appbarBackgroundColor, - appbarBrightness: appbarBrightness ?? this.appbarBrightness, + appbarTitleStyle: appbarTitleStyle ?? _appbarTitleStyle, + appbarActionStyle: appbarActionStyle ?? _appbarActionStyle, + appbarBackgroundColor: appbarBackgroundColor ?? _appbarBackgroundColor, + appbarBrightness: appbarBrightness ?? _appbarBrightness, tabBarUnSelectedLabelStyle: - tabBarUnSelectedLabelStyle ?? this.tabBarUnSelectedLabelStyle, - tabBarLabelStyle: tabBarLabelStyle ?? this.tabBarLabelStyle, - tabBarBackgroundColor: - tabBarBackgroundColor ?? this.tabBarBackgroundColor, - pageBackgroundColor: pageBackgroundColor ?? this.pageBackgroundColor, - bottomBackgroundColor: - bottomBackgroundColor ?? this.bottomBackgroundColor, - titleStyle: titleStyle ?? this.titleStyle, - contentStyle: contentStyle ?? this.contentStyle, - actionStyle: actionStyle ?? this.actionStyle, - iconColor: iconColor ?? this.iconColor, + tabBarUnSelectedLabelStyle ?? _tabBarUnSelectedLabelStyle, + tabBarLabelStyle: tabBarLabelStyle ?? _tabBarLabelStyle, + tabBarBackgroundColor: tabBarBackgroundColor ?? _tabBarBackgroundColor, + pageBackgroundColor: pageBackgroundColor ?? _pageBackgroundColor, + bottomBackgroundColor: bottomBackgroundColor ?? _bottomBackgroundColor, + titleStyle: titleStyle ?? _titleStyle, + contentStyle: contentStyle ?? _contentStyle, + actionStyle: actionStyle ?? _actionStyle, + iconColor: iconColor ?? _iconColor, ); } BrnGalleryDetailConfig merge(BrnGalleryDetailConfig? other) { if (other == null) return this; return copyWith( - appbarTitleStyle: appbarTitleStyle?.merge(other.appbarTitleStyle) ?? - other.appbarTitleStyle, - appbarActionStyle: appbarActionStyle?.merge(other.appbarActionStyle) ?? - other.appbarActionStyle, - appbarBackgroundColor: other.appbarBackgroundColor, - appbarBrightness: other.appbarBrightness, + appbarTitleStyle: appbarTitleStyle.merge(other._appbarTitleStyle), + appbarActionStyle: appbarActionStyle.merge(other._appbarActionStyle), + appbarBackgroundColor: other._appbarBackgroundColor, + appbarBrightness: other._appbarBrightness, tabBarUnSelectedLabelStyle: - tabBarUnSelectedLabelStyle?.merge(other.tabBarUnSelectedLabelStyle) ?? - other.tabBarUnSelectedLabelStyle, - tabBarLabelStyle: tabBarLabelStyle?.merge(other.tabBarLabelStyle) ?? - other.tabBarLabelStyle, - tabBarBackgroundColor: other.tabBarBackgroundColor, - pageBackgroundColor: other.pageBackgroundColor, - bottomBackgroundColor: other.bottomBackgroundColor, - titleStyle: titleStyle?.merge(other.titleStyle) ?? other.titleStyle, + tabBarUnSelectedLabelStyle.merge(other._tabBarUnSelectedLabelStyle), + tabBarLabelStyle: tabBarLabelStyle.merge(other._tabBarLabelStyle), + tabBarBackgroundColor: other._tabBarBackgroundColor, + pageBackgroundColor: other._pageBackgroundColor, + bottomBackgroundColor: other._bottomBackgroundColor, + titleStyle: titleStyle.merge(other._titleStyle), contentStyle: - contentStyle?.merge(other.contentStyle) ?? other.contentStyle, - actionStyle: actionStyle?.merge(other.actionStyle) ?? other.actionStyle, - iconColor: other.iconColor, + contentStyle.merge(other._contentStyle), + actionStyle: actionStyle.merge(other._actionStyle), + iconColor: other._iconColor, ); } } diff --git a/lib/src/theme/configs/brn_pair_info_config.dart b/lib/src/theme/configs/brn_pair_info_config.dart index 50b68802..987dfb67 100644 --- a/lib/src/theme/configs/brn_pair_info_config.dart +++ b/lib/src/theme/configs/brn_pair_info_config.dart @@ -1,4 +1,5 @@ import 'package:bruno/src/theme/base/brn_base_config.dart'; +import 'package:bruno/src/theme/base/brn_default_config_utils.dart'; import 'package:bruno/src/theme/base/brn_text_style.dart'; import 'package:bruno/src/theme/brn_theme_configurator.dart'; import 'package:bruno/src/theme/configs/brn_common_config.dart'; @@ -8,19 +9,24 @@ class BrnPairInfoTableConfig extends BrnBaseConfig { /// 遵循外部主题配置 /// 默认为 [BrnDefaultConfigUtils.defaultPairInfoTableConfig] BrnPairInfoTableConfig({ - this.rowSpacing, - this.itemSpacing, - this.keyTextStyle, - this.valueTextStyle, - this.linkTextStyle, + double? rowSpacing, + double? itemSpacing, + BrnTextStyle? keyTextStyle, + BrnTextStyle? valueTextStyle, + BrnTextStyle? linkTextStyle, String configId: GLOBAL_CONFIG_ID, - }) : super(configId: configId); + }) : _rowSpacing = rowSpacing, + _itemSpacing = itemSpacing, + _keyTextStyle = keyTextStyle, + _valueTextStyle = valueTextStyle, + _linkTextStyle = linkTextStyle, + super(configId: configId); /// 行间距 纵向 - double? rowSpacing; + double? _rowSpacing; /// BrnInfoModal 属性配置 行间距 - double? itemSpacing; + double? _itemSpacing; /// BrnInfoModal key文字样式 /// @@ -29,7 +35,7 @@ class BrnPairInfoTableConfig extends BrnBaseConfig { /// fontSize: [BrnCommonConfig.fontSizeBase], /// fontWeight: FontWeight.w400, /// ) - BrnTextStyle? keyTextStyle; + BrnTextStyle? _keyTextStyle; /// BrnInfoModal value文字样式 /// @@ -38,7 +44,7 @@ class BrnPairInfoTableConfig extends BrnBaseConfig { /// fontSize: [BrnCommonConfig.fontSizeBase], /// fontWeight: FontWeight.w400, /// ) - BrnTextStyle? valueTextStyle; + BrnTextStyle? _valueTextStyle; /// BrnInfoModal 链接文字样式 /// @@ -47,7 +53,27 @@ class BrnPairInfoTableConfig extends BrnBaseConfig { /// fontWeight: FontWeight.w400, /// fontSize: [BrnCommonConfig.fontSizeBase] /// ) - BrnTextStyle? linkTextStyle; + BrnTextStyle? _linkTextStyle; + + double get rowSpacing => + _rowSpacing ?? + BrnDefaultConfigUtils.defaultPairInfoTableConfig.rowSpacing; + + double get itemSpacing => + _itemSpacing ?? + BrnDefaultConfigUtils.defaultPairInfoTableConfig.itemSpacing; + + BrnTextStyle get keyTextStyle => + _keyTextStyle ?? + BrnDefaultConfigUtils.defaultPairInfoTableConfig.keyTextStyle; + + BrnTextStyle get valueTextStyle => + _valueTextStyle ?? + BrnDefaultConfigUtils.defaultPairInfoTableConfig.valueTextStyle; + + BrnTextStyle get linkTextStyle => + _linkTextStyle ?? + BrnDefaultConfigUtils.defaultPairInfoTableConfig.linkTextStyle; @override void initThemeConfig( @@ -60,30 +86,30 @@ class BrnPairInfoTableConfig extends BrnBaseConfig { ); /// 用户全局组件配置 - BrnPairInfoTableConfig? pairInfoTableConfig = BrnThemeConfigurator.instance + BrnPairInfoTableConfig pairInfoTableConfig = BrnThemeConfigurator.instance .getConfig(configId: configId) .pairInfoTableConfig; - rowSpacing ??= pairInfoTableConfig?.rowSpacing; - keyTextStyle = pairInfoTableConfig?.keyTextStyle?.merge( + _rowSpacing ??= pairInfoTableConfig._rowSpacing; + _keyTextStyle = pairInfoTableConfig.keyTextStyle.merge( BrnTextStyle( color: commonConfig.colorTextSecondary, fontSize: commonConfig.fontSizeBase, - ).merge(keyTextStyle), + ).merge(_keyTextStyle), ); - valueTextStyle = pairInfoTableConfig?.valueTextStyle?.merge( + _valueTextStyle = pairInfoTableConfig.valueTextStyle.merge( BrnTextStyle( color: commonConfig.colorTextBase, fontSize: commonConfig.fontSizeBase, - ).merge(valueTextStyle), + ).merge(_valueTextStyle), ); - linkTextStyle = pairInfoTableConfig?.linkTextStyle?.merge( + _linkTextStyle = pairInfoTableConfig.linkTextStyle.merge( BrnTextStyle( color: commonConfig.brandPrimary, fontSize: commonConfig.fontSizeBase, - ).merge(linkTextStyle), + ).merge(_linkTextStyle), ); - itemSpacing ??= pairInfoTableConfig?.itemSpacing; + _itemSpacing ??= pairInfoTableConfig._itemSpacing; } BrnPairInfoTableConfig copyWith({ @@ -94,25 +120,22 @@ class BrnPairInfoTableConfig extends BrnBaseConfig { BrnTextStyle? linkTextStyle, }) { return BrnPairInfoTableConfig( - rowSpacing: rowSpacing ?? this.rowSpacing, - itemSpacing: itemSpacing ?? this.itemSpacing, - keyTextStyle: keyTextStyle ?? this.keyTextStyle, - valueTextStyle: valueTextStyle ?? this.valueTextStyle, - linkTextStyle: linkTextStyle ?? this.linkTextStyle, + rowSpacing: rowSpacing ?? _rowSpacing, + itemSpacing: itemSpacing ?? _itemSpacing, + keyTextStyle: keyTextStyle ?? _keyTextStyle, + valueTextStyle: valueTextStyle ?? _valueTextStyle, + linkTextStyle: linkTextStyle ?? _linkTextStyle, ); } BrnPairInfoTableConfig merge(BrnPairInfoTableConfig? other) { if (other == null) return this; return copyWith( - rowSpacing: other.rowSpacing, - itemSpacing: other.itemSpacing, - keyTextStyle: - keyTextStyle?.merge(other.keyTextStyle) ?? other.keyTextStyle, - valueTextStyle: - valueTextStyle?.merge(other.valueTextStyle) ?? other.valueTextStyle, - linkTextStyle: - linkTextStyle?.merge(other.linkTextStyle) ?? other.linkTextStyle, + rowSpacing: other._rowSpacing, + itemSpacing: other._itemSpacing, + keyTextStyle: keyTextStyle.merge(other._keyTextStyle), + valueTextStyle: valueTextStyle.merge(other._valueTextStyle), + linkTextStyle: linkTextStyle.merge(other._linkTextStyle), ); } } @@ -121,23 +144,29 @@ class BrnPairRichInfoGridConfig extends BrnBaseConfig { /// 遵循外部主题配置 /// 默认为 [BrnDefaultConfigUtils.defaultPairRichInfoGridConfig] BrnPairRichInfoGridConfig({ - this.rowSpacing, - this.itemSpacing, - this.itemHeight, - this.keyTextStyle, - this.valueTextStyle, - this.linkTextStyle, + double? rowSpacing, + double? itemSpacing, + double? itemHeight, + BrnTextStyle? keyTextStyle, + BrnTextStyle? valueTextStyle, + BrnTextStyle? linkTextStyle, String configId: GLOBAL_CONFIG_ID, - }) : super(configId: configId); + }) : _rowSpacing = rowSpacing, + _itemSpacing = itemSpacing, + _itemHeight = itemHeight, + _keyTextStyle = keyTextStyle, + _valueTextStyle = valueTextStyle, + _linkTextStyle = linkTextStyle, + super(configId: configId); /// 行间距 纵向 - double? rowSpacing; + double? _rowSpacing; /// 元素间距 横向 - double? itemSpacing; + double? _itemSpacing; /// 元素高度 - double? itemHeight; + double? _itemHeight; /// key文字样式 /// @@ -146,7 +175,7 @@ class BrnPairRichInfoGridConfig extends BrnBaseConfig { /// fontSize: [BrnCommonConfig.fontSizeBase], /// fontWeight: FontWeight.w400, /// ) - BrnTextStyle? keyTextStyle; + BrnTextStyle? _keyTextStyle; /// value文字样式 /// @@ -155,7 +184,7 @@ class BrnPairRichInfoGridConfig extends BrnBaseConfig { /// color: [BrnCommonConfig.colorTextBase], /// fontSize: [BrnCommonConfig.fontSizeBase], /// ) - BrnTextStyle? valueTextStyle; + BrnTextStyle? _valueTextStyle; /// 链接文字样式 /// @@ -164,7 +193,31 @@ class BrnPairRichInfoGridConfig extends BrnBaseConfig { /// color: [BrnCommonConfig.brandPrimary], /// fontSize: [BrnCommonConfig.fontSizeBase], /// ) - BrnTextStyle? linkTextStyle; + BrnTextStyle? _linkTextStyle; + + double get rowSpacing => + _rowSpacing ?? + BrnDefaultConfigUtils.defaultPairRichInfoGridConfig.rowSpacing; + + double get itemSpacing => + _itemSpacing ?? + BrnDefaultConfigUtils.defaultPairRichInfoGridConfig.itemSpacing; + + double get itemHeight => + _itemHeight ?? + BrnDefaultConfigUtils.defaultPairRichInfoGridConfig.itemHeight; + + BrnTextStyle get keyTextStyle => + _keyTextStyle ?? + BrnDefaultConfigUtils.defaultPairRichInfoGridConfig.keyTextStyle; + + BrnTextStyle get valueTextStyle => + _valueTextStyle ?? + BrnDefaultConfigUtils.defaultPairRichInfoGridConfig.valueTextStyle; + + BrnTextStyle get linkTextStyle => + _linkTextStyle ?? + BrnDefaultConfigUtils.defaultPairRichInfoGridConfig.linkTextStyle; @override void initThemeConfig( @@ -177,31 +230,31 @@ class BrnPairRichInfoGridConfig extends BrnBaseConfig { ); /// 用户全局组件配置 - BrnPairRichInfoGridConfig? pairRichInfoGridConfig = BrnThemeConfigurator + BrnPairRichInfoGridConfig pairRichInfoGridConfig = BrnThemeConfigurator .instance .getConfig(configId: configId) .pairRichInfoGridConfig; - rowSpacing ??= pairRichInfoGridConfig?.rowSpacing; - itemSpacing ??= pairRichInfoGridConfig?.itemSpacing; - itemHeight ??= pairRichInfoGridConfig?.itemHeight; - keyTextStyle = pairRichInfoGridConfig?.keyTextStyle?.merge( + _rowSpacing ??= pairRichInfoGridConfig._rowSpacing; + _itemSpacing ??= pairRichInfoGridConfig._itemSpacing; + _itemHeight ??= pairRichInfoGridConfig._itemHeight; + _keyTextStyle = pairRichInfoGridConfig.keyTextStyle.merge( BrnTextStyle( color: commonConfig.colorTextSecondary, fontSize: commonConfig.fontSizeBase, - ).merge(keyTextStyle), + ).merge(_keyTextStyle), ); - valueTextStyle = pairRichInfoGridConfig?.valueTextStyle?.merge( + _valueTextStyle = pairRichInfoGridConfig.valueTextStyle.merge( BrnTextStyle( color: commonConfig.colorTextBase, fontSize: commonConfig.fontSizeBase, - ).merge(valueTextStyle), + ).merge(_valueTextStyle), ); - linkTextStyle = pairRichInfoGridConfig?.linkTextStyle?.merge( + _linkTextStyle = pairRichInfoGridConfig.linkTextStyle.merge( BrnTextStyle( color: commonConfig.brandPrimary, fontSize: commonConfig.fontSizeBase, - ).merge(linkTextStyle), + ).merge(_linkTextStyle), ); } @@ -215,27 +268,24 @@ class BrnPairRichInfoGridConfig extends BrnBaseConfig { BrnTextStyle? titleTextsStyle, }) { return BrnPairRichInfoGridConfig( - rowSpacing: rowSpacing ?? this.rowSpacing, - itemSpacing: itemSpacing ?? this.itemSpacing, - itemHeight: itemHeight ?? this.itemHeight, - keyTextStyle: keyTextStyle ?? this.keyTextStyle, - valueTextStyle: valueTextStyle ?? this.valueTextStyle, - linkTextStyle: linkTextStyle ?? this.linkTextStyle, + rowSpacing: rowSpacing ?? _rowSpacing, + itemSpacing: itemSpacing ?? _itemSpacing, + itemHeight: itemHeight ?? _itemHeight, + keyTextStyle: keyTextStyle ?? _keyTextStyle, + valueTextStyle: valueTextStyle ?? _valueTextStyle, + linkTextStyle: linkTextStyle ?? _linkTextStyle, ); } BrnPairRichInfoGridConfig merge(BrnPairRichInfoGridConfig? other) { if (other == null) return this; return copyWith( - rowSpacing: other.rowSpacing, - itemSpacing: other.itemSpacing, - itemHeight: other.itemHeight, - keyTextStyle: - keyTextStyle?.merge(other.keyTextStyle) ?? other.keyTextStyle, - valueTextStyle: - valueTextStyle?.merge(other.valueTextStyle) ?? other.valueTextStyle, - linkTextStyle: - linkTextStyle?.merge(other.linkTextStyle) ?? other.linkTextStyle, + rowSpacing: other._rowSpacing, + itemSpacing: other._itemSpacing, + itemHeight: other._itemHeight, + keyTextStyle: keyTextStyle.merge(other._keyTextStyle), + valueTextStyle: valueTextStyle.merge(other._valueTextStyle), + linkTextStyle: linkTextStyle.merge(other._linkTextStyle), ); } } diff --git a/lib/src/theme/configs/brn_picker_config.dart b/lib/src/theme/configs/brn_picker_config.dart index ec23f606..92b903ba 100644 --- a/lib/src/theme/configs/brn_picker_config.dart +++ b/lib/src/theme/configs/brn_picker_config.dart @@ -1,4 +1,5 @@ import 'package:bruno/src/theme/base/brn_base_config.dart'; +import 'package:bruno/src/theme/base/brn_default_config_utils.dart'; import 'package:bruno/src/theme/base/brn_text_style.dart'; import 'package:bruno/src/theme/brn_theme_configurator.dart'; import 'package:bruno/src/theme/configs/brn_common_config.dart'; @@ -9,23 +10,34 @@ class BrnPickerConfig extends BrnBaseConfig { /// 遵循外部主题配置 /// 默认为 [BrnDefaultConfigUtils.defaultPickerConfig] BrnPickerConfig({ - this.backgroundColor, - this.cancelTextStyle, - this.confirmTextStyle, - this.titleTextStyle, - this.pickerHeight, - this.titleHeight, - this.itemHeight, - this.itemTextStyle, - this.itemTextSelectedStyle, - this.dividerColor, - this.cornerRadius, + Color? backgroundColor, + BrnTextStyle? cancelTextStyle, + BrnTextStyle? confirmTextStyle, + BrnTextStyle? titleTextStyle, + double? pickerHeight, + double? titleHeight, + double? itemHeight, + BrnTextStyle? itemTextStyle, + BrnTextStyle? itemTextSelectedStyle, + Color? dividerColor, + double? cornerRadius, String configId = GLOBAL_CONFIG_ID, - }) : super(configId: configId); + }) : _backgroundColor = backgroundColor, + _cancelTextStyle = cancelTextStyle, + _confirmTextStyle = confirmTextStyle, + _titleTextStyle = titleTextStyle, + _pickerHeight = pickerHeight, + _titleHeight = titleHeight, + _itemHeight = itemHeight, + _itemTextStyle = itemTextStyle, + _itemTextSelectedStyle = itemTextSelectedStyle, + _dividerColor = dividerColor, + _cornerRadius = cornerRadius, + super(configId: configId); /// 日期选择器的背景色 /// 默认为 [PICKER_BACKGROUND_COLOR] - Color? backgroundColor; + Color? _backgroundColor; /// 取消文字的样式 /// @@ -33,7 +45,7 @@ class BrnPickerConfig extends BrnBaseConfig { /// color: [BrnCommonConfig.colorTextBase], /// fontSize: [BrnCommonConfig.fontSizeSubHead], /// ) - BrnTextStyle? cancelTextStyle; + BrnTextStyle? _cancelTextStyle; /// 确认文字的样式 /// @@ -41,7 +53,7 @@ class BrnPickerConfig extends BrnBaseConfig { /// color: [BrnCommonConfig.brandPrimary], /// fontSize: [BrnCommonConfig.fontSizeSubHead], /// ) - BrnTextStyle? confirmTextStyle; + BrnTextStyle? _confirmTextStyle; /// 标题文字的样式 /// @@ -50,19 +62,19 @@ class BrnPickerConfig extends BrnBaseConfig { /// fontSize: [BrnCommonConfig.fontSizeSubHead], /// fontWidget:FontWeight.w600, /// ) - BrnTextStyle? titleTextStyle; + BrnTextStyle? _titleTextStyle; /// 日期选择器的高度 /// 默认为 [PICKER_HEIGHT] - double? pickerHeight; + double? _pickerHeight; /// 日期选择器标题的高度 /// 默认为 [PICKER_TITLE_HEIGHT] - double? titleHeight; + double? _titleHeight; /// 日期选择器列表的高度 /// 默认为 [PICKER_ITEM_HEIGHT] - double? itemHeight; + double? _itemHeight; /// 日期选择器列表的文字样式 /// @@ -70,7 +82,7 @@ class BrnPickerConfig extends BrnBaseConfig { /// color: [BrnCommonConfig.colorTextBase], /// fontSize: [BrnCommonConfig.fontSizeHead], /// ) - BrnTextStyle? itemTextStyle; + BrnTextStyle? _itemTextStyle; /// 日期选择器列表选中的文字样式 /// @@ -79,10 +91,48 @@ class BrnPickerConfig extends BrnBaseConfig { /// fontSize: [BrnCommonConfig.fontSizeHead], /// fontWidget: FontWeight.w600, /// ) - BrnTextStyle? itemTextSelectedStyle; + BrnTextStyle? _itemTextSelectedStyle; + + Color? _dividerColor; + double? _cornerRadius; - Color? dividerColor; - double? cornerRadius; + Color get backgroundColor => + _backgroundColor ?? + BrnDefaultConfigUtils.defaultPickerConfig.backgroundColor; + + BrnTextStyle get cancelTextStyle => + _cancelTextStyle ?? + BrnDefaultConfigUtils.defaultPickerConfig.cancelTextStyle; + + BrnTextStyle get confirmTextStyle => + _confirmTextStyle ?? + BrnDefaultConfigUtils.defaultPickerConfig.confirmTextStyle; + + BrnTextStyle get titleTextStyle => + _titleTextStyle ?? + BrnDefaultConfigUtils.defaultPickerConfig.titleTextStyle; + + double get pickerHeight => + _pickerHeight ?? BrnDefaultConfigUtils.defaultPickerConfig.pickerHeight; + + double get titleHeight => + _titleHeight ?? BrnDefaultConfigUtils.defaultPickerConfig.titleHeight; + + double get itemHeight => + _itemHeight ?? BrnDefaultConfigUtils.defaultPickerConfig.itemHeight; + + BrnTextStyle get itemTextStyle => + _itemTextStyle ?? BrnDefaultConfigUtils.defaultPickerConfig.itemTextStyle; + + BrnTextStyle get itemTextSelectedStyle => + _itemTextSelectedStyle ?? + BrnDefaultConfigUtils.defaultPickerConfig.itemTextSelectedStyle; + + Color get dividerColor => + _dividerColor ?? BrnDefaultConfigUtils.defaultPickerConfig.dividerColor; + + double get cornerRadius => + _cornerRadius ?? BrnDefaultConfigUtils.defaultPickerConfig.cornerRadius; @override void initThemeConfig( @@ -95,47 +145,47 @@ class BrnPickerConfig extends BrnBaseConfig { ); /// 用户全局组件配置 - BrnPickerConfig? pickerConfig = BrnThemeConfigurator.instance + BrnPickerConfig pickerConfig = BrnThemeConfigurator.instance .getConfig(configId: configId) .pickerConfig; - backgroundColor ??= pickerConfig?.backgroundColor; - pickerHeight ??= pickerConfig?.pickerHeight; - titleHeight ??= pickerConfig?.titleHeight; - itemHeight ??= pickerConfig?.itemHeight; - dividerColor ??= pickerConfig?.dividerColor; - cornerRadius ??= pickerConfig?.cornerRadius; - titleTextStyle = pickerConfig?.titleTextStyle?.merge( + _backgroundColor ??= pickerConfig.backgroundColor; + _pickerHeight ??= pickerConfig.pickerHeight; + _titleHeight ??= pickerConfig.titleHeight; + _itemHeight ??= pickerConfig.itemHeight; + _dividerColor ??= pickerConfig.dividerColor; + _cornerRadius ??= pickerConfig.cornerRadius; + _titleTextStyle = pickerConfig.titleTextStyle.merge( BrnTextStyle( color: commonConfig.colorTextBase, fontSize: commonConfig.fontSizeSubHead, - ).merge(titleTextStyle), + ).merge(_titleTextStyle), ); - cancelTextStyle = pickerConfig?.cancelTextStyle - ?.merge( + _cancelTextStyle = pickerConfig.cancelTextStyle + .merge( BrnTextStyle( color: commonConfig.colorTextBase, fontSize: commonConfig.fontSizeSubHead, ), ) - .merge(cancelTextStyle); - confirmTextStyle = pickerConfig?.confirmTextStyle?.merge( + .merge(_cancelTextStyle); + _confirmTextStyle = pickerConfig.confirmTextStyle.merge( BrnTextStyle( color: commonConfig.brandPrimary, fontSize: commonConfig.fontSizeSubHead, - ).merge(confirmTextStyle), + ).merge(_confirmTextStyle), ); - itemTextStyle = pickerConfig?.itemTextStyle?.merge( + _itemTextStyle = pickerConfig.itemTextStyle.merge( BrnTextStyle( color: commonConfig.colorTextBase, fontSize: commonConfig.fontSizeHead, - ).merge(itemTextStyle), + ).merge(_itemTextStyle), ); - itemTextSelectedStyle = pickerConfig?.itemTextSelectedStyle?.merge( + _itemTextSelectedStyle = pickerConfig.itemTextSelectedStyle.merge( BrnTextStyle( color: commonConfig.brandPrimary, fontSize: commonConfig.fontSizeHead, - ).merge(itemTextSelectedStyle), + ).merge(_itemTextSelectedStyle), ); } @@ -153,41 +203,35 @@ class BrnPickerConfig extends BrnBaseConfig { double? cornerRadius, }) { return BrnPickerConfig( - backgroundColor: backgroundColor ?? this.backgroundColor, - cancelTextStyle: cancelTextStyle ?? this.cancelTextStyle, - confirmTextStyle: confirmTextStyle ?? this.confirmTextStyle, - titleTextStyle: titleTextStyle ?? this.titleTextStyle, - pickerHeight: pickerHeight ?? this.pickerHeight, - titleHeight: titleHeight ?? this.titleHeight, - itemHeight: itemHeight ?? this.itemHeight, - itemTextStyle: itemTextStyle ?? this.itemTextStyle, - itemTextSelectedStyle: - itemTextSelectedStyle ?? this.itemTextSelectedStyle, - dividerColor: dividerColor ?? this.dividerColor, - cornerRadius: cornerRadius ?? this.cornerRadius, + backgroundColor: backgroundColor ?? _backgroundColor, + cancelTextStyle: cancelTextStyle ?? _cancelTextStyle, + confirmTextStyle: confirmTextStyle ?? _confirmTextStyle, + titleTextStyle: titleTextStyle ?? _titleTextStyle, + pickerHeight: pickerHeight ?? _pickerHeight, + titleHeight: titleHeight ?? _titleHeight, + itemHeight: itemHeight ?? _itemHeight, + itemTextStyle: itemTextStyle ?? _itemTextStyle, + itemTextSelectedStyle: itemTextSelectedStyle ?? _itemTextSelectedStyle, + dividerColor: dividerColor ?? _dividerColor, + cornerRadius: cornerRadius ?? _cornerRadius, ); } BrnPickerConfig merge(BrnPickerConfig? other) { if (other == null) return this; return copyWith( - backgroundColor: other.backgroundColor, - cancelTextStyle: cancelTextStyle?.merge(other.cancelTextStyle) ?? - other.cancelTextStyle, - confirmTextStyle: confirmTextStyle?.merge(other.confirmTextStyle) ?? - other.confirmTextStyle, - titleTextStyle: - titleTextStyle?.merge(other.titleTextStyle) ?? other.titleTextStyle, - pickerHeight: other.pickerHeight, - titleHeight: other.titleHeight, - itemHeight: other.itemHeight, - itemTextStyle: - itemTextStyle?.merge(other.itemTextStyle) ?? other.itemTextStyle, + backgroundColor: other._backgroundColor, + cancelTextStyle: cancelTextStyle.merge(other._cancelTextStyle), + confirmTextStyle: confirmTextStyle.merge(other._confirmTextStyle), + titleTextStyle: titleTextStyle.merge(other._titleTextStyle), + pickerHeight: other._pickerHeight, + titleHeight: other._titleHeight, + itemHeight: other._itemHeight, + itemTextStyle: itemTextStyle.merge(other._itemTextStyle), itemTextSelectedStyle: - itemTextSelectedStyle?.merge(other.itemTextSelectedStyle) ?? - other.itemTextSelectedStyle, - dividerColor: other.dividerColor, - cornerRadius: other.cornerRadius, + itemTextSelectedStyle.merge(other._itemTextSelectedStyle), + dividerColor: other._dividerColor, + cornerRadius: other._cornerRadius, ); } } diff --git a/lib/src/theme/configs/brn_selection_config.dart b/lib/src/theme/configs/brn_selection_config.dart index 25f7b8cd..1dc0019b 100644 --- a/lib/src/theme/configs/brn_selection_config.dart +++ b/lib/src/theme/configs/brn_selection_config.dart @@ -1,4 +1,5 @@ import 'package:bruno/src/theme/base/brn_base_config.dart'; +import 'package:bruno/src/theme/base/brn_default_config_utils.dart'; import 'package:bruno/src/theme/base/brn_text_style.dart'; import 'package:bruno/src/theme/brn_theme_configurator.dart'; import 'package:bruno/src/theme/configs/brn_common_config.dart'; @@ -9,34 +10,60 @@ class BrnSelectionConfig extends BrnBaseConfig { /// 遵循外部主题配置 /// 默认为 [BrnDefaultConfigUtils.defaultSelectionConfig] BrnSelectionConfig({ - this.menuNormalTextStyle, - this.menuSelectedTextStyle, - this.tagNormalTextStyle, - this.tagSelectedTextStyle, - this.tagRadius, - this.tagNormalBackgroundColor, - this.tagSelectedBackgroundColor, - this.hintTextStyle, - this.rangeTitleTextStyle, - this.inputTextStyle, - this.itemNormalTextStyle, - this.itemSelectedTextStyle, - this.itemBoldTextStyle, - this.deepNormalBgColor, - this.deepSelectBgColor, - this.middleNormalBgColor, - this.middleSelectBgColor, - this.lightNormalBgColor, - this.lightSelectBgColor, - this.resetTextStyle, - this.titleForMoreTextStyle, - this.optionTextStyle, - this.moreTextStyle, - this.flayerNormalTextStyle, - this.flayerSelectedTextStyle, - this.flayerBoldTextStyle, + BrnTextStyle? menuNormalTextStyle, + BrnTextStyle? menuSelectedTextStyle, + BrnTextStyle? tagNormalTextStyle, + BrnTextStyle? tagSelectedTextStyle, + double? tagRadius, + Color? tagNormalBackgroundColor, + Color? tagSelectedBackgroundColor, + BrnTextStyle? hintTextStyle, + BrnTextStyle? rangeTitleTextStyle, + BrnTextStyle? inputTextStyle, + BrnTextStyle? itemNormalTextStyle, + BrnTextStyle? itemSelectedTextStyle, + BrnTextStyle? itemBoldTextStyle, + Color? deepNormalBgColor, + Color? deepSelectBgColor, + Color? middleNormalBgColor, + Color? middleSelectBgColor, + Color? lightNormalBgColor, + Color? lightSelectBgColor, + BrnTextStyle? resetTextStyle, + BrnTextStyle? titleForMoreTextStyle, + BrnTextStyle? optionTextStyle, + BrnTextStyle? moreTextStyle, + BrnTextStyle? flayerNormalTextStyle, + BrnTextStyle? flayerSelectedTextStyle, + BrnTextStyle? flayerBoldTextStyle, String configId = GLOBAL_CONFIG_ID, - }) : super(configId: configId); + }) : _menuNormalTextStyle = menuNormalTextStyle, + _menuSelectedTextStyle = menuSelectedTextStyle, + _tagNormalTextStyle = tagNormalTextStyle, + _tagSelectedTextStyle = tagSelectedTextStyle, + _tagRadius = tagRadius, + _tagNormalBackgroundColor = tagNormalBackgroundColor, + _tagSelectedBackgroundColor = tagSelectedBackgroundColor, + _hintTextStyle = hintTextStyle, + _rangeTitleTextStyle = rangeTitleTextStyle, + _inputTextStyle = inputTextStyle, + _itemNormalTextStyle = itemNormalTextStyle, + _itemSelectedTextStyle = itemSelectedTextStyle, + _itemBoldTextStyle = itemBoldTextStyle, + _deepNormalBgColor = deepNormalBgColor, + _deepSelectBgColor = deepSelectBgColor, + _middleNormalBgColor = middleNormalBgColor, + _middleSelectBgColor = middleSelectBgColor, + _lightNormalBgColor = lightNormalBgColor, + _lightSelectBgColor = lightSelectBgColor, + _resetTextStyle = resetTextStyle, + _titleForMoreTextStyle = titleForMoreTextStyle, + _optionTextStyle = optionTextStyle, + _moreTextStyle = moreTextStyle, + _flayerNormalTextStyle = flayerNormalTextStyle, + _flayerSelectedTextStyle = flayerSelectedTextStyle, + _flayerBoldTextStyle = flayerBoldTextStyle, + super(configId: configId); /// menu 正常文本样式 /// @@ -45,7 +72,7 @@ class BrnSelectionConfig extends BrnBaseConfig { /// fontSize: [BrnCommonConfig.fontSizeBase], /// fontWeight: FontWeight.normal, /// ) - BrnTextStyle? menuNormalTextStyle; + BrnTextStyle? _menuNormalTextStyle; /// menu 选中文本样式 /// @@ -54,7 +81,7 @@ class BrnSelectionConfig extends BrnBaseConfig { /// fontSize: [BrnCommonConfig.fontSizeBase], /// fontWeight: FontWeight.w600, /// ) - BrnTextStyle? menuSelectedTextStyle; + BrnTextStyle? _menuSelectedTextStyle; /// tag 正常文本样式 /// @@ -63,7 +90,7 @@ class BrnSelectionConfig extends BrnBaseConfig { /// fontSize: [BrnCommonConfig.fontSizeCaption], /// fontWeight: FontWeight.w400, /// ) - BrnTextStyle? tagNormalTextStyle; + BrnTextStyle? _tagNormalTextStyle; /// tag 选中文本样式 /// @@ -72,19 +99,19 @@ class BrnSelectionConfig extends BrnBaseConfig { /// fontSize: [BrnCommonConfig.fontSizeCaption], /// fontWeight: FontWeight.w600, /// ) - BrnTextStyle? tagSelectedTextStyle; + BrnTextStyle? _tagSelectedTextStyle; /// tag 圆角 /// 默认为 [BrnCommonConfig.radiusSm] - double? tagRadius; + double? _tagRadius; /// tag 正常背景色 /// 默认为 [BrnCommonConfig.fillBody] - Color? tagNormalBackgroundColor; + Color? _tagNormalBackgroundColor; /// tag 选中背景色 /// 默认为 [BrnCommonConfig.brandPrimary].withOpacity(0.12) - Color? tagSelectedBackgroundColor; + Color? _tagSelectedBackgroundColor; /// 输入选项标题文本样式 /// @@ -93,7 +120,7 @@ class BrnSelectionConfig extends BrnBaseConfig { /// fontSize: [BrnCommonConfig.fontSizeSubHead], /// fontWeight: FontWeight.w600, /// ) - BrnTextStyle? rangeTitleTextStyle; + BrnTextStyle? _rangeTitleTextStyle; /// 输入提示文本样式 /// @@ -101,7 +128,7 @@ class BrnSelectionConfig extends BrnBaseConfig { /// color: [BrnCommonConfig.colorTextHint], /// fontSize: [BrnCommonConfig.fontSizeBase], /// ) - BrnTextStyle? hintTextStyle; + BrnTextStyle? _hintTextStyle; /// 输入框默认文本样式 /// @@ -109,7 +136,7 @@ class BrnSelectionConfig extends BrnBaseConfig { /// color: [BrnCommonConfig.colorTextBase], /// fontSize: [BrnCommonConfig.fontSizeBase], /// ) - BrnTextStyle? inputTextStyle; + BrnTextStyle? _inputTextStyle; /// item 正常字体样式 /// @@ -117,7 +144,7 @@ class BrnSelectionConfig extends BrnBaseConfig { /// color: [BrnCommonConfig.colorTextBase], /// fontSize: [BrnCommonConfig.fontSizeBase], /// ) - BrnTextStyle? itemNormalTextStyle; + BrnTextStyle? _itemNormalTextStyle; /// item 选中文本样式 /// @@ -126,7 +153,7 @@ class BrnSelectionConfig extends BrnBaseConfig { /// fontSize: [BrnCommonConfig.fontSizeBase], /// fontWeight: FontWeight.w600, /// ) - BrnTextStyle? itemSelectedTextStyle; + BrnTextStyle? _itemSelectedTextStyle; /// item 仅加粗样式 /// @@ -135,31 +162,31 @@ class BrnSelectionConfig extends BrnBaseConfig { /// fontSize: [BrnCommonConfig.fontSizeBase], /// fontWeight: FontWeight.w600, /// ) - BrnTextStyle? itemBoldTextStyle; + BrnTextStyle? _itemBoldTextStyle; /// 三级 item 背景色 /// 默认为 Color(0xFFF0F0F0) - Color? deepNormalBgColor; + Color? _deepNormalBgColor; /// 三级 item 选中背景色 /// 默认为 Color(0xFFF8F8F8) - Color? deepSelectBgColor; + Color? _deepSelectBgColor; /// 二级 item 背景色 /// 默认为 Color(0xFFF8F8F8) - Color? middleNormalBgColor; + Color? _middleNormalBgColor; /// 二级 item 选中背景色 /// 默认为 Colors.white - Color? middleSelectBgColor; + Color? _middleSelectBgColor; /// 一级 item 背景色 /// 默认为 Colors.white - Color? lightNormalBgColor; + Color? _lightNormalBgColor; /// 一级 item 选中背景色 /// 默认为 Colors.white - Color? lightSelectBgColor; + Color? _lightSelectBgColor; /// 重置按钮颜色 /// @@ -167,7 +194,7 @@ class BrnSelectionConfig extends BrnBaseConfig { /// color: [BrnCommonConfig.colorTextImportant], /// fontSize: [BrnCommonConfig.fontSizeCaption] /// ) - BrnTextStyle? resetTextStyle; + BrnTextStyle? _resetTextStyle; /// 更多筛选-标题文本样式 /// @@ -176,7 +203,7 @@ class BrnSelectionConfig extends BrnBaseConfig { /// fontSize: [BrnCommonConfig.fontSizeBase], /// fontWeight: FontWeight.w600, /// ) - BrnTextStyle? titleForMoreTextStyle; + BrnTextStyle? _titleForMoreTextStyle; /// 选项-显示文本 /// @@ -184,7 +211,7 @@ class BrnSelectionConfig extends BrnBaseConfig { /// color: [BrnCommonConfig.brandPrimary], /// fontSize: [BrnCommonConfig.fontSizeBase], /// ) - BrnTextStyle? optionTextStyle; + BrnTextStyle? _optionTextStyle; /// 更多文本样式 /// @@ -192,7 +219,7 @@ class BrnSelectionConfig extends BrnBaseConfig { /// color: [BrnCommonConfig.colorTextSecondary], /// fontSize: [BrnCommonConfig.fontSizeCaption], /// ) - BrnTextStyle? moreTextStyle; + BrnTextStyle? _moreTextStyle; /// 跳转二级页-正常文本样式 /// @@ -201,7 +228,7 @@ class BrnSelectionConfig extends BrnBaseConfig { /// fontSize: [BrnCommonConfig.fontSizeSubHead], /// fontWeight: FontWeight.normal, /// ) - BrnTextStyle? flayerNormalTextStyle; + BrnTextStyle? _flayerNormalTextStyle; /// 跳转二级页-选中文本样式 /// @@ -210,7 +237,7 @@ class BrnSelectionConfig extends BrnBaseConfig { /// fontSize: [BrnCommonConfig.fontSizeSubHead], /// fontWeight: FontWeight.w600, /// ) - BrnTextStyle? flayerSelectedTextStyle; + BrnTextStyle? _flayerSelectedTextStyle; /// 跳转二级页-加粗文本样式 /// @@ -219,7 +246,110 @@ class BrnSelectionConfig extends BrnBaseConfig { /// fontSize: [BrnCommonConfig.fontSizeSubHead], /// fontWeight: FontWeight.w600 /// ) - BrnTextStyle? flayerBoldTextStyle; + BrnTextStyle? _flayerBoldTextStyle; + + BrnTextStyle get menuNormalTextStyle => + _menuNormalTextStyle ?? + BrnDefaultConfigUtils.defaultSelectionConfig.menuNormalTextStyle; + + BrnTextStyle get menuSelectedTextStyle => + _menuSelectedTextStyle ?? + BrnDefaultConfigUtils.defaultSelectionConfig.menuSelectedTextStyle; + + BrnTextStyle get tagNormalTextStyle => + _tagNormalTextStyle ?? + BrnDefaultConfigUtils.defaultSelectionConfig.tagNormalTextStyle; + + BrnTextStyle get tagSelectedTextStyle => + _tagSelectedTextStyle ?? + BrnDefaultConfigUtils.defaultSelectionConfig.tagSelectedTextStyle; + + double get tagRadius => + _tagRadius ?? BrnDefaultConfigUtils.defaultSelectionConfig.tagRadius; + + Color get tagNormalBackgroundColor => + _tagNormalBackgroundColor ?? + BrnDefaultConfigUtils.defaultSelectionConfig.tagNormalBackgroundColor; + + Color get tagSelectedBackgroundColor => + _tagSelectedBackgroundColor ?? + BrnDefaultConfigUtils.defaultSelectionConfig.tagSelectedBackgroundColor; + + BrnTextStyle get rangeTitleTextStyle => + _rangeTitleTextStyle ?? + BrnDefaultConfigUtils.defaultSelectionConfig.rangeTitleTextStyle; + + BrnTextStyle get hintTextStyle => + _hintTextStyle ?? + BrnDefaultConfigUtils.defaultSelectionConfig.hintTextStyle; + + BrnTextStyle get inputTextStyle => + _inputTextStyle ?? + BrnDefaultConfigUtils.defaultSelectionConfig.inputTextStyle; + + BrnTextStyle get itemNormalTextStyle => + _itemNormalTextStyle ?? + BrnDefaultConfigUtils.defaultSelectionConfig.itemNormalTextStyle; + + BrnTextStyle get itemSelectedTextStyle => + _itemSelectedTextStyle ?? + BrnDefaultConfigUtils.defaultSelectionConfig.itemSelectedTextStyle; + + BrnTextStyle get itemBoldTextStyle => + _itemBoldTextStyle ?? + BrnDefaultConfigUtils.defaultSelectionConfig.itemBoldTextStyle; + + Color get deepNormalBgColor => + _deepNormalBgColor ?? + BrnDefaultConfigUtils.defaultSelectionConfig.deepNormalBgColor; + + Color get deepSelectBgColor => + _deepSelectBgColor ?? + BrnDefaultConfigUtils.defaultSelectionConfig.deepSelectBgColor; + + Color get middleNormalBgColor => + _middleNormalBgColor ?? + BrnDefaultConfigUtils.defaultSelectionConfig.middleNormalBgColor; + + Color get middleSelectBgColor => + _middleSelectBgColor ?? + BrnDefaultConfigUtils.defaultSelectionConfig.middleSelectBgColor; + + Color get lightNormalBgColor => + _lightNormalBgColor ?? + BrnDefaultConfigUtils.defaultSelectionConfig.lightNormalBgColor; + + Color get lightSelectBgColor => + _lightSelectBgColor ?? + BrnDefaultConfigUtils.defaultSelectionConfig.lightSelectBgColor; + + BrnTextStyle get resetTextStyle => + _resetTextStyle ?? + BrnDefaultConfigUtils.defaultSelectionConfig.resetTextStyle; + + BrnTextStyle get titleForMoreTextStyle => + _titleForMoreTextStyle ?? + BrnDefaultConfigUtils.defaultSelectionConfig.titleForMoreTextStyle; + + BrnTextStyle get optionTextStyle => + _optionTextStyle ?? + BrnDefaultConfigUtils.defaultSelectionConfig.optionTextStyle; + + BrnTextStyle get moreTextStyle => + _moreTextStyle ?? + BrnDefaultConfigUtils.defaultSelectionConfig.moreTextStyle; + + BrnTextStyle get flayerNormalTextStyle => + _flayerNormalTextStyle ?? + BrnDefaultConfigUtils.defaultSelectionConfig.flayerNormalTextStyle; + + BrnTextStyle get flayerSelectedTextStyle => + _flayerSelectedTextStyle ?? + BrnDefaultConfigUtils.defaultSelectionConfig.flayerSelectedTextStyle; + + BrnTextStyle get flayerBoldTextStyle => + _flayerBoldTextStyle ?? + BrnDefaultConfigUtils.defaultSelectionConfig.flayerBoldTextStyle; @override void initThemeConfig( @@ -232,118 +362,119 @@ class BrnSelectionConfig extends BrnBaseConfig { ); /// 用户全局筛选配置 - BrnSelectionConfig? selectionConfig = BrnThemeConfigurator.instance + BrnSelectionConfig selectionConfig = BrnThemeConfigurator.instance .getConfig(configId: configId) .selectionConfig; - lightSelectBgColor ??= selectionConfig?.lightSelectBgColor; - lightNormalBgColor ??= selectionConfig?.lightNormalBgColor; - middleSelectBgColor ??= selectionConfig?.middleSelectBgColor; - middleNormalBgColor ??= selectionConfig?.middleNormalBgColor; - deepSelectBgColor ??= selectionConfig?.deepSelectBgColor; - deepNormalBgColor ??= selectionConfig?.deepNormalBgColor; - tagSelectedBackgroundColor ??= commonConfig.brandPrimary?.withOpacity(0.12); - tagNormalBackgroundColor ??= commonConfig.fillBody; - tagRadius ??= commonConfig.radiusSm; - flayerBoldTextStyle = selectionConfig?.flayerBoldTextStyle?.merge( + _lightSelectBgColor ??= selectionConfig._lightSelectBgColor; + _lightNormalBgColor ??= selectionConfig._lightNormalBgColor; + _middleSelectBgColor ??= selectionConfig._middleSelectBgColor; + _middleNormalBgColor ??= selectionConfig._middleNormalBgColor; + _deepSelectBgColor ??= selectionConfig._deepSelectBgColor; + _deepNormalBgColor ??= selectionConfig._deepNormalBgColor; + _tagSelectedBackgroundColor ??= + commonConfig.brandPrimary.withOpacity(0.12); + _tagNormalBackgroundColor ??= commonConfig.fillBody; + _tagRadius ??= commonConfig.radiusSm; + _flayerBoldTextStyle = selectionConfig.flayerBoldTextStyle.merge( BrnTextStyle( color: commonConfig.colorTextBase, fontSize: commonConfig.fontSizeSubHead, - ).merge(flayerBoldTextStyle), + ).merge(_flayerBoldTextStyle), ); - flayerSelectedTextStyle = selectionConfig?.flayerSelectedTextStyle?.merge( + _flayerSelectedTextStyle = selectionConfig.flayerSelectedTextStyle.merge( BrnTextStyle( color: commonConfig.brandPrimary, fontSize: commonConfig.fontSizeSubHead, - ).merge(flayerSelectedTextStyle), + ).merge(_flayerSelectedTextStyle), ); - flayerNormalTextStyle = selectionConfig?.flayerNormalTextStyle?.merge( + _flayerNormalTextStyle = selectionConfig.flayerNormalTextStyle.merge( BrnTextStyle( color: commonConfig.colorTextBase, fontSize: commonConfig.fontSizeSubHead, - ).merge(flayerNormalTextStyle), + ).merge(_flayerNormalTextStyle), ); - moreTextStyle = selectionConfig?.moreTextStyle?.merge( + _moreTextStyle = selectionConfig.moreTextStyle.merge( BrnTextStyle( color: commonConfig.colorTextSecondary, fontSize: commonConfig.fontSizeCaption, - ).merge(moreTextStyle), + ).merge(_moreTextStyle), ); - optionTextStyle = selectionConfig?.optionTextStyle?.merge( + _optionTextStyle = selectionConfig.optionTextStyle.merge( BrnTextStyle( color: commonConfig.brandPrimary, fontSize: commonConfig.fontSizeBase, - ).merge(optionTextStyle), + ).merge(_optionTextStyle), ); - titleForMoreTextStyle = selectionConfig?.titleForMoreTextStyle?.merge( + _titleForMoreTextStyle = selectionConfig.titleForMoreTextStyle.merge( BrnTextStyle( color: commonConfig.colorTextBase, fontSize: commonConfig.fontSizeBase, - ).merge(titleForMoreTextStyle), + ).merge(_titleForMoreTextStyle), ); - resetTextStyle = selectionConfig?.resetTextStyle?.merge(BrnTextStyle( + _resetTextStyle = selectionConfig.resetTextStyle.merge(BrnTextStyle( color: commonConfig.colorTextImportant, fontSize: commonConfig.fontSizeCaption, - ).merge(resetTextStyle)); - itemBoldTextStyle = selectionConfig?.itemBoldTextStyle?.merge( + ).merge(_resetTextStyle)); + _itemBoldTextStyle = selectionConfig.itemBoldTextStyle.merge( BrnTextStyle( color: commonConfig.colorTextBase, fontSize: commonConfig.fontSizeBase, - ).merge(itemBoldTextStyle), + ).merge(_itemBoldTextStyle), ); - itemSelectedTextStyle = selectionConfig?.itemSelectedTextStyle?.merge( + _itemSelectedTextStyle = selectionConfig.itemSelectedTextStyle.merge( BrnTextStyle( color: commonConfig.brandPrimary, fontSize: commonConfig.fontSizeBase, - ).merge(itemSelectedTextStyle), + ).merge(_itemSelectedTextStyle), ); - itemNormalTextStyle = selectionConfig?.itemNormalTextStyle?.merge( + _itemNormalTextStyle = selectionConfig.itemNormalTextStyle.merge( BrnTextStyle( color: commonConfig.colorTextBase, fontSize: commonConfig.fontSizeBase, - ).merge(itemNormalTextStyle), + ).merge(_itemNormalTextStyle), ); - inputTextStyle = selectionConfig?.inputTextStyle?.merge( + _inputTextStyle = selectionConfig.inputTextStyle.merge( BrnTextStyle( color: commonConfig.colorTextBase, fontSize: commonConfig.fontSizeBase, - ).merge(inputTextStyle), + ).merge(_inputTextStyle), ); - hintTextStyle = selectionConfig?.hintTextStyle?.merge( + _hintTextStyle = selectionConfig.hintTextStyle.merge( BrnTextStyle( color: commonConfig.colorTextHint, fontSize: commonConfig.fontSizeBase, - ).merge(hintTextStyle), + ).merge(_hintTextStyle), ); - rangeTitleTextStyle = selectionConfig?.rangeTitleTextStyle?.merge( + _rangeTitleTextStyle = selectionConfig.rangeTitleTextStyle.merge( BrnTextStyle( color: commonConfig.colorTextBase, fontSize: commonConfig.fontSizeSubHead, - ).merge(rangeTitleTextStyle), + ).merge(_rangeTitleTextStyle), ); - tagSelectedTextStyle = selectionConfig?.tagSelectedTextStyle?.merge( + _tagSelectedTextStyle = selectionConfig.tagSelectedTextStyle.merge( BrnTextStyle( color: commonConfig.brandPrimary, fontSize: commonConfig.fontSizeCaption, - ).merge(tagSelectedTextStyle), + ).merge(_tagSelectedTextStyle), ); - tagNormalTextStyle = selectionConfig?.tagNormalTextStyle?.merge( + _tagNormalTextStyle = selectionConfig.tagNormalTextStyle.merge( BrnTextStyle( color: commonConfig.colorTextBase, fontSize: commonConfig.fontSizeCaption, - ).merge(tagNormalTextStyle), + ).merge(_tagNormalTextStyle), ); - menuNormalTextStyle = selectionConfig?.menuNormalTextStyle?.merge( + _menuNormalTextStyle = selectionConfig.menuNormalTextStyle.merge( BrnTextStyle( color: commonConfig.colorTextBase, fontSize: commonConfig.fontSizeBase, - ).merge(menuNormalTextStyle), + ).merge(_menuNormalTextStyle), ); - menuSelectedTextStyle = selectionConfig?.menuSelectedTextStyle?.merge( + _menuSelectedTextStyle = selectionConfig.menuSelectedTextStyle.merge( BrnTextStyle( color: commonConfig.brandPrimary, fontSize: commonConfig.fontSizeBase, - ).merge(menuSelectedTextStyle), + ).merge(_menuSelectedTextStyle), ); } @@ -376,97 +507,71 @@ class BrnSelectionConfig extends BrnBaseConfig { BrnTextStyle? flayerBoldTextStyle, }) { return BrnSelectionConfig( - menuNormalTextStyle: menuNormalTextStyle ?? this.menuNormalTextStyle, - menuSelectedTextStyle: - menuSelectedTextStyle ?? this.menuSelectedTextStyle, - tagNormalTextStyle: tagTextStyle ?? this.tagNormalTextStyle, - tagSelectedTextStyle: tagSelectedTextStyle ?? this.tagSelectedTextStyle, - tagRadius: tagRadius ?? this.tagRadius, - tagNormalBackgroundColor: - tagBackgroundColor ?? this.tagNormalBackgroundColor, + menuNormalTextStyle: menuNormalTextStyle ?? _menuNormalTextStyle, + menuSelectedTextStyle: menuSelectedTextStyle ?? _menuSelectedTextStyle, + tagNormalTextStyle: tagTextStyle ?? _tagNormalTextStyle, + tagSelectedTextStyle: tagSelectedTextStyle ?? _tagSelectedTextStyle, + tagRadius: tagRadius ?? _tagRadius, + tagNormalBackgroundColor: tagBackgroundColor ?? _tagNormalBackgroundColor, tagSelectedBackgroundColor: - tagSelectedBackgroundColor ?? this.tagSelectedBackgroundColor, - hintTextStyle: hintTextStyle ?? this.hintTextStyle, - rangeTitleTextStyle: rangeTitleTextStyle ?? this.rangeTitleTextStyle, - inputTextStyle: inputTextStyle ?? this.inputTextStyle, - itemNormalTextStyle: itemNormalTextStyle ?? this.itemNormalTextStyle, - itemSelectedTextStyle: - itemSelectedTextStyle ?? this.itemSelectedTextStyle, - itemBoldTextStyle: itemBoldTextStyle ?? this.itemBoldTextStyle, - deepNormalBgColor: deepNormalBgColor ?? this.deepNormalBgColor, - deepSelectBgColor: deepSelectBgColor ?? this.deepSelectBgColor, - middleNormalBgColor: middleNormalBgColor ?? this.middleNormalBgColor, - middleSelectBgColor: middleSelectBgColor ?? this.middleSelectBgColor, - lightNormalBgColor: lightNormalBgColor ?? this.lightNormalBgColor, - lightSelectBgColor: lightSelectBgColor ?? this.lightSelectBgColor, - resetTextStyle: resetTextStyle ?? this.resetTextStyle, - titleForMoreTextStyle: - titleForMoreTextStyle ?? this.titleForMoreTextStyle, - optionTextStyle: optionTextStyle ?? this.optionTextStyle, - moreTextStyle: moreTextStyle ?? this.moreTextStyle, - flayerNormalTextStyle: - flayerNormalTextStyle ?? this.flayerNormalTextStyle, + tagSelectedBackgroundColor ?? _tagSelectedBackgroundColor, + hintTextStyle: hintTextStyle ?? _hintTextStyle, + rangeTitleTextStyle: rangeTitleTextStyle ?? _rangeTitleTextStyle, + inputTextStyle: inputTextStyle ?? _inputTextStyle, + itemNormalTextStyle: itemNormalTextStyle ?? _itemNormalTextStyle, + itemSelectedTextStyle: itemSelectedTextStyle ?? _itemSelectedTextStyle, + itemBoldTextStyle: itemBoldTextStyle ?? _itemBoldTextStyle, + deepNormalBgColor: deepNormalBgColor ?? _deepNormalBgColor, + deepSelectBgColor: deepSelectBgColor ?? _deepSelectBgColor, + middleNormalBgColor: middleNormalBgColor ?? _middleNormalBgColor, + middleSelectBgColor: middleSelectBgColor ?? _middleSelectBgColor, + lightNormalBgColor: lightNormalBgColor ?? _lightNormalBgColor, + lightSelectBgColor: lightSelectBgColor ?? _lightSelectBgColor, + resetTextStyle: resetTextStyle ?? _resetTextStyle, + titleForMoreTextStyle: titleForMoreTextStyle ?? _titleForMoreTextStyle, + optionTextStyle: optionTextStyle ?? _optionTextStyle, + moreTextStyle: moreTextStyle ?? _moreTextStyle, + flayerNormalTextStyle: flayerNormalTextStyle ?? _flayerNormalTextStyle, flayerSelectedTextStyle: - flayerSelectedTextStyle ?? this.flayerSelectedTextStyle, - flayerBoldTextStyle: flayerBoldTextStyle ?? this.flayerBoldTextStyle, + flayerSelectedTextStyle ?? _flayerSelectedTextStyle, + flayerBoldTextStyle: flayerBoldTextStyle ?? _flayerBoldTextStyle, ); } BrnSelectionConfig merge(BrnSelectionConfig other) { return copyWith( - menuNormalTextStyle: - menuNormalTextStyle?.merge(other.menuNormalTextStyle) ?? - other.menuNormalTextStyle, + menuNormalTextStyle: menuNormalTextStyle.merge(other._menuNormalTextStyle), menuSelectedTextStyle: - menuSelectedTextStyle?.merge(other.menuSelectedTextStyle) ?? - other.menuSelectedTextStyle, - tagTextStyle: tagNormalTextStyle?.merge(other.tagNormalTextStyle) ?? - other.tagNormalTextStyle, + menuSelectedTextStyle.merge(other._menuSelectedTextStyle), + tagTextStyle: tagNormalTextStyle.merge(other._tagNormalTextStyle), tagSelectedTextStyle: - tagSelectedTextStyle?.merge(other.tagSelectedTextStyle) ?? - other.tagSelectedTextStyle, - tagRadius: other.tagRadius, - tagBackgroundColor: other.tagNormalBackgroundColor, - tagSelectedBackgroundColor: other.tagSelectedBackgroundColor, - hintTextStyle: - hintTextStyle?.merge(other.hintTextStyle) ?? other.hintTextStyle, - rangeTitleTextStyle: - rangeTitleTextStyle?.merge(other.rangeTitleTextStyle) ?? - other.rangeTitleTextStyle, - inputTextStyle: - inputTextStyle?.merge(other.inputTextStyle) ?? other.inputTextStyle, - itemNormalTextStyle: - itemNormalTextStyle?.merge(other.itemNormalTextStyle) ?? - other.itemNormalTextStyle, + tagSelectedTextStyle.merge(other._tagSelectedTextStyle), + tagRadius: other._tagRadius, + tagBackgroundColor: other._tagNormalBackgroundColor, + tagSelectedBackgroundColor: other._tagSelectedBackgroundColor, + hintTextStyle: hintTextStyle.merge(other._hintTextStyle), + rangeTitleTextStyle: rangeTitleTextStyle.merge(other._rangeTitleTextStyle), + inputTextStyle: inputTextStyle.merge(other._inputTextStyle), + itemNormalTextStyle: itemNormalTextStyle.merge(other._itemNormalTextStyle), itemSelectedTextStyle: - itemSelectedTextStyle?.merge(other.itemSelectedTextStyle) ?? - other.itemSelectedTextStyle, - itemBoldTextStyle: itemBoldTextStyle?.merge(other.itemBoldTextStyle) ?? - other.itemBoldTextStyle, - deepNormalBgColor: other.deepNormalBgColor, - deepSelectBgColor: other.deepSelectBgColor, - middleNormalBgColor: other.middleNormalBgColor, - middleSelectBgColor: other.middleSelectBgColor, - lightNormalBgColor: other.lightNormalBgColor, - lightSelectBgColor: other.lightSelectBgColor, - resetTextStyle: - resetTextStyle?.merge(other.resetTextStyle) ?? other.resetTextStyle, + itemSelectedTextStyle.merge(other._itemSelectedTextStyle), + itemBoldTextStyle: itemBoldTextStyle.merge(other._itemBoldTextStyle), + deepNormalBgColor: other._deepNormalBgColor, + deepSelectBgColor: other._deepSelectBgColor, + middleNormalBgColor: other._middleNormalBgColor, + middleSelectBgColor: other._middleSelectBgColor, + lightNormalBgColor: other._lightNormalBgColor, + lightSelectBgColor: other._lightSelectBgColor, + resetTextStyle: resetTextStyle.merge(other._resetTextStyle), titleForMoreTextStyle: - titleForMoreTextStyle?.merge(other.titleForMoreTextStyle) ?? - other.titleForMoreTextStyle, - optionTextStyle: optionTextStyle?.merge(other.optionTextStyle) ?? - other.optionTextStyle, - moreTextStyle: - moreTextStyle?.merge(other.moreTextStyle) ?? other.moreTextStyle, + titleForMoreTextStyle.merge(other._titleForMoreTextStyle), + optionTextStyle: optionTextStyle.merge(other._optionTextStyle), + moreTextStyle: moreTextStyle.merge(other._moreTextStyle), flayerNormalTextStyle: - flayerNormalTextStyle?.merge(other.flayerNormalTextStyle) ?? - other.flayerNormalTextStyle, + flayerNormalTextStyle.merge(other._flayerNormalTextStyle), flayerSelectedTextStyle: - flayerSelectedTextStyle?.merge(other.flayerSelectedTextStyle) ?? - other.flayerSelectedTextStyle, - flayerBoldTextStyle: - flayerBoldTextStyle?.merge(other.flayerBoldTextStyle) ?? - other.flayerBoldTextStyle, + flayerSelectedTextStyle.merge(other._flayerSelectedTextStyle), + flayerBoldTextStyle: flayerBoldTextStyle.merge(other._flayerBoldTextStyle), ); } } diff --git a/lib/src/theme/configs/brn_tabbar_config.dart b/lib/src/theme/configs/brn_tabbar_config.dart index 69a3e7b1..457ae2c8 100644 --- a/lib/src/theme/configs/brn_tabbar_config.dart +++ b/lib/src/theme/configs/brn_tabbar_config.dart @@ -1,4 +1,5 @@ import 'package:bruno/src/theme/base/brn_base_config.dart'; +import 'package:bruno/src/theme/base/brn_default_config_utils.dart'; import 'package:bruno/src/theme/base/brn_text_style.dart'; import 'package:bruno/src/theme/brn_theme_configurator.dart'; import 'package:bruno/src/theme/configs/brn_common_config.dart'; @@ -9,34 +10,48 @@ class BrnTabBarConfig extends BrnBaseConfig { /// 遵循外部主题配置 /// 默认为 [BrnDefaultConfigUtils.tabBarConfig] BrnTabBarConfig({ - this.tabHeight, - this.indicatorHeight, - this.indicatorWidth, - this.labelStyle, - this.unselectedLabelStyle, - this.backgroundColor, - this.tagNormalTextStyle, - this.tagNormalBgColor, - this.tagSelectedTextStyle, - this.tagSelectedBgColor, - this.tagRadius, - this.tagSpacing, - this.preLineTagCount, - this.tagHeight, + double? tabHeight, + double? indicatorHeight, + double? indicatorWidth, + BrnTextStyle? labelStyle, + BrnTextStyle? unselectedLabelStyle, + Color? backgroundColor, + BrnTextStyle? tagNormalTextStyle, + Color? tagNormalBgColor, + BrnTextStyle? tagSelectedTextStyle, + Color? tagSelectedBgColor, + double? tagRadius, + double? tagSpacing, + int? preLineTagCount, + double? tagHeight, String configId: GLOBAL_CONFIG_ID, - }) : super(configId: configId); + }) : _tabHeight = tabHeight, + _indicatorHeight = indicatorHeight, + _indicatorWidth = indicatorWidth, + _labelStyle = labelStyle, + _unselectedLabelStyle = unselectedLabelStyle, + _backgroundColor = backgroundColor, + _tagNormalTextStyle = tagNormalTextStyle, + _tagNormalBgColor = tagNormalBgColor, + _tagSelectedTextStyle = tagSelectedTextStyle, + _tagSelectedBgColor = tagSelectedBgColor, + _tagRadius = tagRadius, + _tagSpacing = tagSpacing, + _preLineTagCount = preLineTagCount, + _tagHeight = tagHeight, + super(configId: configId); /// TabBar 的整体高度 /// 默认为 50 - double? tabHeight; + double? _tabHeight; /// 指示器的高度 /// 默认为 2 - double? indicatorHeight; + double? _indicatorHeight; /// 指示器的宽度 /// 默认为 24 - double? indicatorWidth; + double? _indicatorWidth; /// 选中 Tab 文本的样式 /// @@ -44,7 +59,7 @@ class BrnTabBarConfig extends BrnBaseConfig { /// color: [BrnCommonConfig.brandPrimary], /// fontSize: [BrnCommonConfig.fontSizeSubHead], /// ) - BrnTextStyle? labelStyle; + BrnTextStyle? _labelStyle; /// 未选中 Tab 文本的样式 /// @@ -52,11 +67,11 @@ class BrnTabBarConfig extends BrnBaseConfig { /// color: [BrnCommonConfig.colorTextBase], /// fontSize: [BrnCommonConfig.fontSizeSubHead], /// ) - BrnTextStyle? unselectedLabelStyle; + BrnTextStyle? _unselectedLabelStyle; /// 背景色 /// 默认为 [BrnCommonConfig.fillBase] - Color? backgroundColor; + Color? _backgroundColor; /// 标签字体样式 /// @@ -64,11 +79,11 @@ class BrnTabBarConfig extends BrnBaseConfig { /// color: [BrnCommonConfig.colorTextBase], /// fontSize: [BrnCommonConfig.fontSizeCaption], /// ) - BrnTextStyle? tagNormalTextStyle; + BrnTextStyle? _tagNormalTextStyle; /// 标签背景色 /// 默认为 [BrnCommonConfig.brandPrimary].withAlpha(0x14), - Color? tagNormalBgColor; + Color? _tagNormalBgColor; /// 标签字体样式 /// @@ -76,27 +91,78 @@ class BrnTabBarConfig extends BrnBaseConfig { /// color:[BrnCommonConfig.brandPrimary], /// fontSize: [BrnCommonConfig.fontSizeCaption], /// ) - BrnTextStyle? tagSelectedTextStyle; + BrnTextStyle? _tagSelectedTextStyle; /// 标签选中背景色 /// 默认为 [BrnCommonConfig.fillBody] - Color? tagSelectedBgColor; + Color? _tagSelectedBgColor; /// tag圆角 /// 默认为 [BrnCommonConfig.radiusSm] - double? tagRadius; + double? _tagRadius; /// tag间距 /// 默认为 12 - double? tagSpacing; + double? _tagSpacing; /// 每行的tag数 /// 默认为 4 - int? preLineTagCount; + int? _preLineTagCount; /// tag高度 /// 默认为 32 - double? tagHeight; + double? _tagHeight; + + double get tabHeight => + _tabHeight ?? BrnDefaultConfigUtils.defaultTabBarConfig.tabHeight; + + double get indicatorHeight => + _indicatorHeight ?? + BrnDefaultConfigUtils.defaultTabBarConfig.indicatorHeight; + + double get indicatorWidth => + _indicatorWidth ?? + BrnDefaultConfigUtils.defaultTabBarConfig.indicatorWidth; + + BrnTextStyle get labelStyle => + _labelStyle ?? BrnDefaultConfigUtils.defaultTabBarConfig.labelStyle; + + BrnTextStyle get unselectedLabelStyle => + _unselectedLabelStyle ?? + BrnDefaultConfigUtils.defaultTabBarConfig.unselectedLabelStyle; + + Color get backgroundColor => + _backgroundColor ?? + BrnDefaultConfigUtils.defaultTabBarConfig.backgroundColor; + + BrnTextStyle get tagNormalTextStyle => + _tagNormalTextStyle ?? + BrnDefaultConfigUtils.defaultTabBarConfig.tagNormalTextStyle; + + Color get tagNormalBgColor => + _tagNormalBgColor ?? + BrnDefaultConfigUtils.defaultTabBarConfig.tagNormalBgColor; + + BrnTextStyle get tagSelectedTextStyle => + _tagSelectedTextStyle ?? + BrnDefaultConfigUtils.defaultTabBarConfig.tagSelectedTextStyle; + + Color get tagSelectedBgColor => + _tagSelectedBgColor ?? + BrnDefaultConfigUtils.defaultTabBarConfig.tagSelectedBgColor; + + double get tagRadius => + _tagRadius ?? BrnDefaultConfigUtils.defaultTabBarConfig.tagRadius; + + double get tagSpacing => + _tagSpacing ?? BrnDefaultConfigUtils.defaultTabBarConfig.tagSpacing; + + int get preLineTagCount => + _preLineTagCount ?? + BrnDefaultConfigUtils.defaultTabBarConfig.preLineTagCount; + + double get tagHeight => + _tagHeight ?? BrnDefaultConfigUtils.defaultTabBarConfig.tagHeight; @override void initThemeConfig( @@ -108,44 +174,44 @@ class BrnTabBarConfig extends BrnBaseConfig { currentLevelCommonConfig: currentLevelCommonConfig, ); - BrnTabBarConfig? tabBarConfig = BrnThemeConfigurator.instance + BrnTabBarConfig tabBarConfig = BrnThemeConfigurator.instance .getConfig(configId: configId) .tabBarConfig; - tabHeight ??= tabBarConfig?.tabHeight; - indicatorHeight ??= tabBarConfig?.indicatorHeight; - indicatorWidth ??= tabBarConfig?.indicatorWidth; - labelStyle = tabBarConfig?.labelStyle?.merge( + _tabHeight ??= tabBarConfig._tabHeight; + _indicatorHeight ??= tabBarConfig._indicatorHeight; + _indicatorWidth ??= tabBarConfig._indicatorWidth; + _labelStyle = tabBarConfig.labelStyle.merge( BrnTextStyle( color: commonConfig.brandPrimary, fontSize: commonConfig.fontSizeSubHead, - ).merge(labelStyle), + ).merge(_labelStyle), ); - unselectedLabelStyle = tabBarConfig?.unselectedLabelStyle?.merge( + _unselectedLabelStyle = tabBarConfig.unselectedLabelStyle.merge( BrnTextStyle( color: commonConfig.colorTextBase, fontSize: commonConfig.fontSizeSubHead, - ).merge(unselectedLabelStyle), + ).merge(_unselectedLabelStyle), ); - backgroundColor ??= tabBarConfig?.backgroundColor; - tagNormalTextStyle = tabBarConfig?.tagNormalTextStyle?.merge( + _backgroundColor ??= tabBarConfig._backgroundColor; + _tagNormalTextStyle = tabBarConfig.tagNormalTextStyle.merge( BrnTextStyle( color: commonConfig.colorTextBase, fontSize: commonConfig.fontSizeCaption, - ).merge(tagNormalTextStyle), + ).merge(_tagNormalTextStyle), ); - tagSelectedTextStyle = tabBarConfig?.tagSelectedTextStyle?.merge( + _tagSelectedTextStyle = tabBarConfig.tagSelectedTextStyle.merge( BrnTextStyle( color: commonConfig.brandPrimary, fontSize: commonConfig.fontSizeCaption, - ).merge(tagSelectedTextStyle), + ).merge(_tagSelectedTextStyle), ); - tagNormalBgColor ??= tabBarConfig?.tagNormalBgColor; - tagSelectedBgColor ??= tabBarConfig?.tagSelectedBgColor; - tagRadius ??= commonConfig.radiusSm; - tagSpacing ??= tabBarConfig?.tagSpacing; - preLineTagCount ??= tabBarConfig?.preLineTagCount; - tagHeight ??= tabBarConfig?.tagHeight; + _tagNormalBgColor ??= tabBarConfig._tagNormalBgColor; + _tagSelectedBgColor ??= tabBarConfig._tagSelectedBgColor; + _tagRadius ??= commonConfig.radiusSm; + _tagSpacing ??= tabBarConfig._tagSpacing; + _preLineTagCount ??= tabBarConfig._preLineTagCount; + _tagHeight ??= tabBarConfig._tagHeight; } BrnTabBarConfig copyWith({ @@ -165,45 +231,42 @@ class BrnTabBarConfig extends BrnBaseConfig { double? tagHeight, }) { return BrnTabBarConfig( - tabHeight: tabHeight ?? this.tabHeight, - indicatorHeight: indicatorHeight ?? this.indicatorHeight, - indicatorWidth: indicatorWidth ?? this.indicatorWidth, - labelStyle: labelStyle ?? this.labelStyle, - unselectedLabelStyle: unselectedLabelStyle ?? this.unselectedLabelStyle, - backgroundColor: backgroundColor ?? this.backgroundColor, - tagNormalTextStyle: tagNormalTextStyle ?? this.tagNormalTextStyle, - tagNormalBgColor: tagNormalColor ?? this.tagNormalBgColor, - tagSelectedTextStyle: tagSelectedTextStyle ?? this.tagSelectedTextStyle, - tagSelectedBgColor: tagSelectedColor ?? this.tagSelectedBgColor, - tagRadius: tagRadius ?? this.tagRadius, - tagSpacing: tagSpacing ?? this.tagSpacing, - preLineTagCount: preLineTagSize ?? this.preLineTagCount, - tagHeight: tagHeight ?? this.tagHeight, + tabHeight: tabHeight ?? _tabHeight, + indicatorHeight: indicatorHeight ?? _indicatorHeight, + indicatorWidth: indicatorWidth ?? _indicatorWidth, + labelStyle: labelStyle ?? _labelStyle, + unselectedLabelStyle: unselectedLabelStyle ?? _unselectedLabelStyle, + backgroundColor: backgroundColor ?? _backgroundColor, + tagNormalTextStyle: tagNormalTextStyle ?? _tagNormalTextStyle, + tagNormalBgColor: tagNormalColor ?? _tagNormalBgColor, + tagSelectedTextStyle: tagSelectedTextStyle ?? _tagSelectedTextStyle, + tagSelectedBgColor: tagSelectedColor ?? _tagSelectedBgColor, + tagRadius: tagRadius ?? _tagRadius, + tagSpacing: tagSpacing ?? _tagSpacing, + preLineTagCount: preLineTagSize ?? _preLineTagCount, + tagHeight: tagHeight ?? _tagHeight, ); } BrnTabBarConfig merge(BrnTabBarConfig? other) { if (other == null) return this; return copyWith( - tabHeight: other.tabHeight, - indicatorHeight: other.indicatorHeight, - indicatorWidth: other.indicatorWidth, - labelStyle: labelStyle?.merge(other.labelStyle) ?? other.labelStyle, + tabHeight: other._tabHeight, + indicatorHeight: other._indicatorHeight, + indicatorWidth: other._indicatorWidth, + labelStyle: labelStyle.merge(other._labelStyle), unselectedLabelStyle: - unselectedLabelStyle?.merge(other.unselectedLabelStyle) ?? - other.unselectedLabelStyle, - backgroundColor: other.backgroundColor, - tagNormalTextStyle: tagNormalTextStyle?.merge(other.tagNormalTextStyle) ?? - other.tagNormalTextStyle, - tagNormalColor: other.tagNormalBgColor, + unselectedLabelStyle.merge(other._unselectedLabelStyle), + backgroundColor: other._backgroundColor, + tagNormalTextStyle: tagNormalTextStyle.merge(other._tagNormalTextStyle), + tagNormalColor: other._tagNormalBgColor, tagSelectedTextStyle: - tagSelectedTextStyle?.merge(other.tagSelectedTextStyle) ?? - other.tagSelectedTextStyle, - tagSelectedColor: other.tagSelectedBgColor, - tagRadius: other.tagRadius, - tagSpacing: other.tagSpacing, - preLineTagSize: other.preLineTagCount, - tagHeight: other.tagHeight, + tagSelectedTextStyle.merge(other._tagSelectedTextStyle), + tagSelectedColor: other._tagSelectedBgColor, + tagRadius: other._tagRadius, + tagSpacing: other._tagSpacing, + preLineTagSize: other._preLineTagCount, + tagHeight: other._tagHeight, ); } } diff --git a/lib/src/theme/configs/brn_tag_config.dart b/lib/src/theme/configs/brn_tag_config.dart index 113493c6..39b03a26 100644 --- a/lib/src/theme/configs/brn_tag_config.dart +++ b/lib/src/theme/configs/brn_tag_config.dart @@ -1,4 +1,5 @@ import 'package:bruno/src/theme/base/brn_base_config.dart'; +import 'package:bruno/src/theme/base/brn_default_config_utils.dart'; import 'package:bruno/src/theme/base/brn_text_style.dart'; import 'package:bruno/src/theme/brn_theme_configurator.dart'; import 'package:bruno/src/theme/configs/brn_common_config.dart'; @@ -7,16 +8,24 @@ import 'package:flutter/painting.dart'; /// 标签配置类 class BrnTagConfig extends BrnBaseConfig { BrnTagConfig({ - this.tagTextStyle, - this.selectTagTextStyle, - this.tagRadius, - this.tagBackgroundColor, - this.selectedTagBackgroundColor, - this.tagHeight, - this.tagWidth, - this.tagMinWidth, + BrnTextStyle? tagTextStyle, + BrnTextStyle? selectTagTextStyle, + double? tagRadius, + Color? tagBackgroundColor, + Color? selectedTagBackgroundColor, + double? tagHeight, + double? tagWidth, + double? tagMinWidth, String configId = GLOBAL_CONFIG_ID, - }) : super(configId: configId); + }) : _tagTextStyle = tagTextStyle, + _selectTagTextStyle = selectTagTextStyle, + _tagRadius = tagRadius, + _tagBackgroundColor = tagBackgroundColor, + _selectedTagBackgroundColor = selectedTagBackgroundColor, + _tagHeight = tagHeight, + _tagWidth = tagWidth, + _tagMinWidth = tagMinWidth, + super(configId: configId); /// tag 文本样式 /// @@ -24,7 +33,7 @@ class BrnTagConfig extends BrnBaseConfig { /// color: [BrnCommonConfig.colorTextBase], /// fontSize: [BrnCommonConfig.fontSizeCaption], /// ) - BrnTextStyle? tagTextStyle; + BrnTextStyle? _tagTextStyle; /// tag选中文本样式 /// @@ -33,31 +42,58 @@ class BrnTagConfig extends BrnBaseConfig { /// fontSize: [BrnCommonConfig.fontSizeCaption], /// fontWeight: FontWeight.w600, /// ) - BrnTextStyle? selectTagTextStyle; + BrnTextStyle? _selectTagTextStyle; /// 标签背景色 /// default [BrnCommonConfig.fillBody] - Color? tagBackgroundColor; + Color? _tagBackgroundColor; /// 选中背景色 /// default [BrnCommonConfig.brandPrimary] - Color? selectedTagBackgroundColor; + Color? _selectedTagBackgroundColor; /// 标签圆角 /// 默认为 [BrnCommonConfig.radiusXs] - double? tagRadius; + double? _tagRadius; /// 标签高度,跟 fixWidthMode 无关 /// 默认为 34 - double? tagHeight; + double? _tagHeight; /// 标签宽度,且仅在组件设置了固定宽度(fixWidthMode 为 true)时才生效 /// 默认为 75 - double? tagWidth; + double? _tagWidth; /// 标签最小宽度 /// 默认为 75 - double? tagMinWidth; + double? _tagMinWidth; + + BrnTextStyle get tagTextStyle => + _tagTextStyle ?? BrnDefaultConfigUtils.defaultTagConfig.tagTextStyle; + + BrnTextStyle get selectTagTextStyle => + _selectTagTextStyle ?? + BrnDefaultConfigUtils.defaultTagConfig.selectTagTextStyle; + + Color get tagBackgroundColor => + _tagBackgroundColor ?? + BrnDefaultConfigUtils.defaultTagConfig.tagBackgroundColor; + + Color get selectedTagBackgroundColor => + _selectedTagBackgroundColor ?? + BrnDefaultConfigUtils.defaultTagConfig.selectedTagBackgroundColor; + + double get tagRadius => + _tagRadius ?? BrnDefaultConfigUtils.defaultTagConfig.tagRadius; + + double get tagHeight => + _tagHeight ?? BrnDefaultConfigUtils.defaultTagConfig.tagHeight; + + double get tagWidth => + _tagWidth ?? BrnDefaultConfigUtils.defaultTagConfig.tagWidth; + + double get tagMinWidth => + _tagMinWidth ?? BrnDefaultConfigUtils.defaultTagConfig.tagMinWidth; @override void initThemeConfig( @@ -70,26 +106,26 @@ class BrnTagConfig extends BrnBaseConfig { ); /// 用户全局组件配置 - BrnTagConfig? tagConfig = + BrnTagConfig tagConfig = BrnThemeConfigurator.instance.getConfig(configId: configId).tagConfig; - tagHeight ??= tagConfig?.tagHeight; - tagWidth ??= tagConfig?.tagWidth; - tagMinWidth ??= tagConfig?.tagMinWidth; - tagRadius ??= commonConfig.radiusXs; - tagBackgroundColor ??= commonConfig.fillBody; - selectedTagBackgroundColor ??= commonConfig.brandPrimary; - tagTextStyle = tagConfig?.tagTextStyle?.merge( + _tagHeight ??= tagConfig._tagHeight; + _tagWidth ??= tagConfig._tagWidth; + _tagMinWidth ??= tagConfig._tagMinWidth; + _tagRadius ??= commonConfig.radiusXs; + _tagBackgroundColor ??= commonConfig.fillBody; + _selectedTagBackgroundColor ??= commonConfig.brandPrimary; + _tagTextStyle = tagConfig.tagTextStyle.merge( BrnTextStyle( color: commonConfig.colorTextBase, fontSize: commonConfig.fontSizeCaption, - ).merge(tagTextStyle), + ).merge(_tagTextStyle), ); - selectTagTextStyle = tagConfig?.selectTagTextStyle?.merge( + _selectTagTextStyle = tagConfig.selectTagTextStyle.merge( BrnTextStyle( color: commonConfig.brandPrimary, fontSize: commonConfig.fontSizeCaption, - ).merge(selectTagTextStyle), + ).merge(_selectTagTextStyle), ); } @@ -104,29 +140,28 @@ class BrnTagConfig extends BrnBaseConfig { double? tagMinWidth, }) { return BrnTagConfig( - tagTextStyle: textStyle ?? this.tagTextStyle, - selectTagTextStyle: selectTextStyle ?? this.selectTagTextStyle, - tagRadius: radius ?? this.tagRadius, - tagBackgroundColor: backgroundColor ?? this.tagBackgroundColor, + tagTextStyle: textStyle ?? _tagTextStyle, + selectTagTextStyle: selectTextStyle ?? _selectTagTextStyle, + tagRadius: radius ?? _tagRadius, + tagBackgroundColor: backgroundColor ?? _tagBackgroundColor, selectedTagBackgroundColor: - selectedBackgroundColor ?? this.selectedTagBackgroundColor, - tagHeight: height ?? this.tagHeight, - tagWidth: width ?? this.tagWidth, - tagMinWidth: tagMinWidth ?? this.tagMinWidth, + selectedBackgroundColor ?? _selectedTagBackgroundColor, + tagHeight: height ?? _tagHeight, + tagWidth: width ?? _tagWidth, + tagMinWidth: tagMinWidth ?? _tagMinWidth, ); } BrnTagConfig merge(BrnTagConfig other) { return copyWith( - textStyle: tagTextStyle?.merge(other.tagTextStyle) ?? other.tagTextStyle, - selectTextStyle: selectTagTextStyle?.merge(other.selectTagTextStyle) ?? - other.selectTagTextStyle, - radius: other.tagRadius, - backgroundColor: other.tagBackgroundColor, - selectedBackgroundColor: other.selectedTagBackgroundColor, - height: other.tagHeight, - width: other.tagWidth, - tagMinWidth: other.tagMinWidth, + textStyle: tagTextStyle.merge(other._tagTextStyle), + selectTextStyle: selectTagTextStyle.merge(other._selectTagTextStyle), + radius: other._tagRadius, + backgroundColor: other._tagBackgroundColor, + selectedBackgroundColor: other._selectedTagBackgroundColor, + height: other._tagHeight, + width: other._tagWidth, + tagMinWidth: other._tagMinWidth, ); } } From f97bf0754f020d0570d345dd9ed81f146796664d Mon Sep 17 00:00:00 2001 From: zhoujuanjuan <15143015732@163.com> Date: Tue, 28 Dec 2021 20:29:51 +0800 Subject: [PATCH 03/14] =?UTF-8?q?theme:=E5=8E=BB=E9=99=A4=E6=97=A0?= =?UTF-8?q?=E7=94=A8=E4=BF=A1=E6=81=AF=E5=8F=8A=E4=BC=98=E5=8C=96=E9=83=A8?= =?UTF-8?q?=E5=88=86=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/ios/Podfile | 86 ++++++++++++++++++- example/ios/Runner.xcodeproj/project.pbxproj | 16 ++++ .../contents.xcworkspacedata | 2 +- example/lib/main.dart | 3 - .../scroll_actor_tab_example.dart | 1 - .../lib/sample/theme/config_test_utils.dart | 10 --- .../configs/brn_abnormal_state_config.dart | 2 +- lib/src/theme/configs/brn_appbar_config.dart | 79 ++++++----------- .../configs/brn_gallery_detail_config.dart | 32 +------ 9 files changed, 130 insertions(+), 101 deletions(-) diff --git a/example/ios/Podfile b/example/ios/Podfile index 08502eec..0ee4a537 100644 --- a/example/ios/Podfile +++ b/example/ios/Podfile @@ -1,10 +1,90 @@ -# Uncomment the next line to define a global platform for your project +# Uncomment this line to define a global platform for your project # platform :ios, '9.0' +# CocoaPods analytics sends network stats synchronously affecting flutter build latency. +ENV['COCOAPODS_DISABLE_STATS'] = 'true' + +project 'Runner', { + 'Debug' => :debug, + 'Profile' => :release, + 'Release' => :release, +} + +def parse_KV_file(file, separator='=') + file_abs_path = File.expand_path(file) + if !File.exists? file_abs_path + return []; + end + generated_key_values = {} + skip_line_start_symbols = ["#", "/"] + File.foreach(file_abs_path) do |line| + next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ } + plugin = line.split(pattern=separator) + if plugin.length == 2 + podname = plugin[0].strip() + path = plugin[1].strip() + podpath = File.expand_path("#{path}", file_abs_path) + generated_key_values[podname] = podpath + else + puts "Invalid plugin specification: #{line}" + end + end + generated_key_values +end + target 'Runner' do - # Comment the next line if you don't want to use dynamic frameworks use_frameworks! + use_modular_headers! + + # Flutter Pod + + copied_flutter_dir = File.join(__dir__, 'Flutter') + copied_framework_path = File.join(copied_flutter_dir, 'Flutter.framework') + copied_podspec_path = File.join(copied_flutter_dir, 'Flutter.podspec') + unless File.exist?(copied_framework_path) && File.exist?(copied_podspec_path) + # Copy Flutter.framework and Flutter.podspec to Flutter/ to have something to link against if the xcode backend script has not run yet. + # That script will copy the correct debug/profile/release version of the framework based on the currently selected Xcode configuration. + # CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist. + + generated_xcode_build_settings_path = File.join(copied_flutter_dir, 'Generated.xcconfig') + unless File.exist?(generated_xcode_build_settings_path) + raise "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first" + end + generated_xcode_build_settings = parse_KV_file(generated_xcode_build_settings_path) + cached_framework_dir = generated_xcode_build_settings['FLUTTER_FRAMEWORK_DIR']; + + unless File.exist?(copied_framework_path) + FileUtils.cp_r(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir) + end + unless File.exist?(copied_podspec_path) + FileUtils.cp(File.join(cached_framework_dir, 'Flutter.podspec'), copied_flutter_dir) + end + end + + # Keep pod path relative so it can be checked into Podfile.lock. + pod 'Flutter', :path => 'Flutter' + + # Plugin Pods + + # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock + # referring to absolute paths on developers' machines. + system('rm -rf .symlinks') + system('mkdir -p .symlinks/plugins') + plugin_pods = parse_KV_file('../.flutter-plugins') + plugin_pods.each do |name, path| + symlink = File.join('.symlinks', 'plugins', name) + File.symlink(path, symlink) + pod name, :path => File.join(symlink, 'ios') + end +end - # Pods for Runner +# Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system. +install! 'cocoapods', :disable_input_output_paths => true +post_install do |installer| + installer.pods_project.targets.each do |target| + target.build_configurations.each do |config| + config.build_settings['ENABLE_BITCODE'] = 'NO' + end + end end diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj index e891e69b..bacab8cf 100644 --- a/example/ios/Runner.xcodeproj/project.pbxproj +++ b/example/ios/Runner.xcodeproj/project.pbxproj @@ -146,6 +146,7 @@ 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + DC926F330116FD87C8E402BA /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -255,6 +256,21 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; }; + DC926F330116FD87C8E402BA /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "[CP] Embed Pods Frameworks"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ diff --git a/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata index 919434a6..1d526a16 100644 --- a/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ b/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -2,6 +2,6 @@ + location = "group:Runner.xcodeproj"> diff --git a/example/lib/main.dart b/example/lib/main.dart index ec337f68..202b0652 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -1,11 +1,8 @@ -import 'package:bruno/bruno.dart'; import 'package:example/sample/home/home.dart'; import 'package:flutter/material.dart'; void main() { - BrnInitializer.register(allThemeConfig: BrnAllThemeConfig(appBarConfig: BrnAppBarConfig(backgroundColor:Colors.orange))); runApp(MyApp()); - } class MyApp extends StatelessWidget { diff --git a/example/lib/sample/components/scroll_anchor/scroll_actor_tab_example.dart b/example/lib/sample/components/scroll_anchor/scroll_actor_tab_example.dart index 0182569e..9060636a 100644 --- a/example/lib/sample/components/scroll_anchor/scroll_actor_tab_example.dart +++ b/example/lib/sample/components/scroll_anchor/scroll_actor_tab_example.dart @@ -8,7 +8,6 @@ class ScrollActorTabExample extends StatelessWidget { Widget build(BuildContext context) { return Scaffold( appBar: BrnAppBar( - themeData: BrnAppBarConfig(backgroundColor: Colors.green), title: '锚点', ), body: BrnAnchorTab( diff --git a/example/lib/sample/theme/config_test_utils.dart b/example/lib/sample/theme/config_test_utils.dart index f91dd885..0d741da6 100644 --- a/example/lib/sample/theme/config_test_utils.dart +++ b/example/lib/sample/theme/config_test_utils.dart @@ -158,16 +158,6 @@ class TestConfigUtils { titleMaxLength: 20, titleStyle: BrnTextStyle(color: Color(0xff222222), fontWeight: FontWeight.w600, fontSize: 24), actionsStyle: BrnTextStyle(color: Color(0xFF3072F6), fontWeight: FontWeight.w600, fontSize: 18), - flexibleSpace: Container( - width: double.infinity, - height: MediaQueryData.fromWindow(window).padding.top + 57, - decoration: BoxDecoration( - gradient: LinearGradient(colors: [ - Color(0xfffafafa), - Color(0xfff5f5f5), - ], begin: Alignment.topCenter, end: Alignment.bottomCenter), - ), - ), ); static BrnButtonConfig defaultButtonConfig = BrnButtonConfig( diff --git a/lib/src/theme/configs/brn_abnormal_state_config.dart b/lib/src/theme/configs/brn_abnormal_state_config.dart index d39a889b..67b829ff 100644 --- a/lib/src/theme/configs/brn_abnormal_state_config.dart +++ b/lib/src/theme/configs/brn_abnormal_state_config.dart @@ -129,7 +129,7 @@ class BrnAbnormalStateConfig extends BrnBaseConfig { BrnTextStyle( color: commonConfig.colorTextBase, fontSize: commonConfig.fontSizeSubHead, - ).merge(titleTextStyle), + ).merge(_titleTextStyle), ); _contentTextStyle = abnormalStateConfig.contentTextStyle.merge( BrnTextStyle( diff --git a/lib/src/theme/configs/brn_appbar_config.dart b/lib/src/theme/configs/brn_appbar_config.dart index c8b07521..a220c951 100644 --- a/lib/src/theme/configs/brn_appbar_config.dart +++ b/lib/src/theme/configs/brn_appbar_config.dart @@ -26,7 +26,6 @@ class BrnAppBarConfig extends BrnBaseConfig { double? itemSpacing, EdgeInsets? titlePadding, double? iconSize, - Widget? flexibleSpace, SystemUiOverlayStyle? systemUiOverlayStyle, String configId = GLOBAL_CONFIG_ID, }) : _backgroundColor = backgroundColor, @@ -43,86 +42,64 @@ class BrnAppBarConfig extends BrnBaseConfig { super(configId: configId); BrnAppBarConfig.dark({ - Color? backgroundColor, double? appBarHeight, - BrnWidgetBuilder? leadIconBuilder, - BrnTextStyle? titleStyle, - BrnTextStyle? actionsStyle, int? titleMaxLength, double? leftAndRightPadding, double? itemSpacing, EdgeInsets? titlePadding, double? iconSize, - Widget? flexibleSpace, - SystemUiOverlayStyle? systemUiOverlayStyle, String configId = GLOBAL_CONFIG_ID, - }) : _backgroundColor = backgroundColor, - _appBarHeight = appBarHeight, - _leadIconBuilder = leadIconBuilder, - _titleStyle = titleStyle, - _actionsStyle = actionsStyle, + }) : _appBarHeight = appBarHeight, _titleMaxLength = titleMaxLength, _leftAndRightPadding = leftAndRightPadding, _itemSpacing = itemSpacing, _titlePadding = titlePadding, _iconSize = iconSize, - _systemUiOverlayStyle = systemUiOverlayStyle, super(configId: configId) { - backgroundColor = Color(0xff2E313B); - leadIconBuilder = () => Image.asset( - BrnAsset.ICON_BACK_WHITE, - package: BrnStrings.flutterPackageName, - width: BrnAppBarTheme.iconSize, - height: BrnAppBarTheme.iconSize, - fit: BoxFit.fitHeight, - ); - titleStyle = BrnTextStyle( + _backgroundColor = Color(0xff2E313B); + _leadIconBuilder = () => Image.asset( + BrnAsset.ICON_BACK_WHITE, + package: BrnStrings.flutterPackageName, + width: BrnAppBarTheme.iconSize, + height: BrnAppBarTheme.iconSize, + fit: BoxFit.fitHeight, + ); + _titleStyle = BrnTextStyle( fontSize: BrnAppBarTheme.titleFontSize, fontWeight: FontWeight.w600, color: BrnAppBarTheme.darkTextColor, ); - actionsStyle = BrnTextStyle( + _actionsStyle = BrnTextStyle( color: BrnAppBarTheme.darkTextColor, fontSize: BrnAppBarTheme.actionFontSize, fontWeight: FontWeight.w600, ); - systemUiOverlayStyle = SystemUiOverlayStyle.light; + _systemUiOverlayStyle = SystemUiOverlayStyle.light; } BrnAppBarConfig.light({ - Color? backgroundColor, double? appBarHeight, - BrnWidgetBuilder? leadIconBuilder, - BrnTextStyle? titleStyle, - BrnTextStyle? actionsStyle, int? titleMaxLength, double? leftAndRightPadding, double? itemSpacing, EdgeInsets? titlePadding, double? iconSize, - Widget? flexibleSpace, - SystemUiOverlayStyle? systemUiOverlayStyle, String configId = GLOBAL_CONFIG_ID, - }) : _backgroundColor = backgroundColor, - _appBarHeight = appBarHeight, - _leadIconBuilder = leadIconBuilder, - _titleStyle = titleStyle, - _actionsStyle = actionsStyle, + }) : _appBarHeight = appBarHeight, _titleMaxLength = titleMaxLength, _leftAndRightPadding = leftAndRightPadding, _itemSpacing = itemSpacing, _titlePadding = titlePadding, _iconSize = iconSize, - _systemUiOverlayStyle = systemUiOverlayStyle, super(configId: configId) { _backgroundColor = Colors.white; _leadIconBuilder = () => Image.asset( - BrnAsset.ICON_BACK_BLACK, - package: BrnStrings.flutterPackageName, - width: BrnAppBarTheme.iconSize, - height: BrnAppBarTheme.iconSize, - fit: BoxFit.fitHeight, - ); + BrnAsset.ICON_BACK_BLACK, + package: BrnStrings.flutterPackageName, + width: BrnAppBarTheme.iconSize, + height: BrnAppBarTheme.iconSize, + fit: BoxFit.fitHeight, + ); _titleStyle = BrnTextStyle( fontSize: BrnAppBarTheme.titleFontSize, fontWeight: FontWeight.w600, @@ -141,7 +118,7 @@ class BrnAppBarConfig extends BrnBaseConfig { Color get backgroundColor => _backgroundColor ?? - BrnDefaultConfigUtils.defaultAppBarConfig.backgroundColor; + BrnDefaultConfigUtils.defaultAppBarConfig.backgroundColor; /// AppBar 的高度 double? _appBarHeight; @@ -154,7 +131,7 @@ class BrnAppBarConfig extends BrnBaseConfig { BrnWidgetBuilder get leadIconBuilder => _leadIconBuilder ?? - BrnDefaultConfigUtils.defaultAppBarConfig.leadIconBuilder; + BrnDefaultConfigUtils.defaultAppBarConfig.leadIconBuilder; /// 标题样式,仅当直接 title 设置为 String 生效 /// @@ -183,14 +160,14 @@ class BrnAppBarConfig extends BrnBaseConfig { int get titleMaxLength => _titleMaxLength ?? - BrnDefaultConfigUtils.defaultAppBarConfig.titleMaxLength; + BrnDefaultConfigUtils.defaultAppBarConfig.titleMaxLength; /// 左右边距 double? _leftAndRightPadding; double get leftAndRightPadding => _leftAndRightPadding ?? - BrnDefaultConfigUtils.defaultAppBarConfig.leftAndRightPadding; + BrnDefaultConfigUtils.defaultAppBarConfig.leftAndRightPadding; /// 元素间间距 double? _itemSpacing; @@ -211,20 +188,19 @@ class BrnAppBarConfig extends BrnBaseConfig { double get iconSize => _iconSize ?? BrnDefaultConfigUtils.defaultAppBarConfig.iconSize; - /// statusBar 样式 /// 默认为 [SystemUiOverlayStyle.dark] SystemUiOverlayStyle? _systemUiOverlayStyle; SystemUiOverlayStyle get systemUiOverlayStyle => _systemUiOverlayStyle ?? - BrnDefaultConfigUtils.defaultAppBarConfig.systemUiOverlayStyle; + BrnDefaultConfigUtils.defaultAppBarConfig.systemUiOverlayStyle; @override void initThemeConfig( - String configId, { - BrnCommonConfig? currentLevelCommonConfig, - }) { + String configId, { + BrnCommonConfig? currentLevelCommonConfig, + }) { super.initThemeConfig( configId, currentLevelCommonConfig: currentLevelCommonConfig, @@ -259,7 +235,6 @@ class BrnAppBarConfig extends BrnBaseConfig { double? itemSpacing, EdgeInsets? titlePadding, double? iconSize, - Widget? flexibleSpace, SystemUiOverlayStyle? systemUiOverlayStyle, }) { return BrnAppBarConfig( diff --git a/lib/src/theme/configs/brn_gallery_detail_config.dart b/lib/src/theme/configs/brn_gallery_detail_config.dart index 0030e8e4..b7155350 100644 --- a/lib/src/theme/configs/brn_gallery_detail_config.dart +++ b/lib/src/theme/configs/brn_gallery_detail_config.dart @@ -42,19 +42,6 @@ class BrnGalleryDetailConfig extends BrnBaseConfig { /// 黑色主题 BrnGalleryDetailConfig.dark({ - appbarTitleStyle, - appbarActionStyle, - appbarBackgroundColor, - appbarBrightness, - tabBarUnSelectedLabelStyle, - tabBarLabelStyle, - tabBarBackgroundColor, - pageBackgroundColor, - bottomBackgroundColor, - titleStyle, - contentStyle, - actionStyle, - iconColor, String configId = GLOBAL_CONFIG_ID, }) : super(configId: configId) { _appbarTitleStyle = BrnTextStyle(color: commonConfig.colorTextBaseInverse); @@ -74,19 +61,6 @@ class BrnGalleryDetailConfig extends BrnBaseConfig { /// 白色主题 BrnGalleryDetailConfig.light({ - appbarTitleStyle, - appbarActionStyle, - appbarBackgroundColor, - appbarBrightness, - tabBarUnSelectedLabelStyle, - tabBarLabelStyle, - tabBarBackgroundColor, - pageBackgroundColor, - bottomBackgroundColor, - titleStyle, - contentStyle, - actionStyle, - iconColor, String configId = GLOBAL_CONFIG_ID, }) : super(configId: configId) { _appbarTitleStyle = BrnTextStyle(color: commonConfig.colorTextBase); @@ -270,8 +244,7 @@ class BrnGalleryDetailConfig extends BrnBaseConfig { ); _appbarBrightness ??= galleryDetailConfig.appbarBrightness; _appbarBackgroundColor ??= galleryDetailConfig.appbarBackgroundColor; - _tabBarUnSelectedLabelStyle = galleryDetailConfig - .tabBarUnSelectedLabelStyle + _tabBarUnSelectedLabelStyle = galleryDetailConfig.tabBarUnSelectedLabelStyle .merge(BrnTextStyle(fontSize: commonConfig.fontSizeSubHead)) .merge(_tabBarUnSelectedLabelStyle); _tabBarLabelStyle = galleryDetailConfig.tabBarLabelStyle @@ -357,8 +330,7 @@ class BrnGalleryDetailConfig extends BrnBaseConfig { pageBackgroundColor: other._pageBackgroundColor, bottomBackgroundColor: other._bottomBackgroundColor, titleStyle: titleStyle.merge(other._titleStyle), - contentStyle: - contentStyle.merge(other._contentStyle), + contentStyle: contentStyle.merge(other._contentStyle), actionStyle: actionStyle.merge(other._actionStyle), iconColor: other._iconColor, ); From 44ba17a527b4a3f443c50b21127957bfeb2a7442 Mon Sep 17 00:00:00 2001 From: zhoujuanjuan <15143015732@163.com> Date: Tue, 28 Dec 2021 22:48:09 +0800 Subject: [PATCH 04/14] =?UTF-8?q?theme:=E5=A2=9E=E5=8A=A0=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/src/theme/configs/brn_dialog_config.dart | 47 ++++++++++---------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/lib/src/theme/configs/brn_dialog_config.dart b/lib/src/theme/configs/brn_dialog_config.dart index 7bd99306..cab28d71 100644 --- a/lib/src/theme/configs/brn_dialog_config.dart +++ b/lib/src/theme/configs/brn_dialog_config.dart @@ -8,28 +8,28 @@ import 'package:flutter/material.dart'; /// 描述: Dialog 弹框主配置类 class BrnDialogConfig extends BrnBaseConfig { BrnDialogConfig({ - dialogWidth, - radius, - iconPadding, - titlePaddingSm, - titlePaddingLg, - titleTextStyle, - titleTextAlign, - contentPaddingSm, - contentPaddingLg, - contentTextStyle, - contentTextAlign, - warningPaddingSm, - warningPaddingLg, - warningTextStyle, - warningTextAlign, - dividerPadding, - mainActionTextStyle, - assistActionsTextStyle, - mainActionBackgroundColor, - assistActionsBackgroundColor, - bottomHeight, - backgroundColor, + double? dialogWidth, + double? radius, + EdgeInsets? iconPadding, + EdgeInsets? titlePaddingSm, + EdgeInsets? titlePaddingLg, + BrnTextStyle? titleTextStyle, + TextAlign? titleTextAlign, + EdgeInsets? contentPaddingSm, + EdgeInsets? contentPaddingLg, + BrnTextStyle? contentTextStyle, + TextAlign? contentTextAlign, + EdgeInsets? warningPaddingSm, + EdgeInsets? warningPaddingLg, + BrnTextStyle? warningTextStyle, + TextAlign? warningTextAlign, + EdgeInsets? dividerPadding, + BrnTextStyle? mainActionTextStyle, + BrnTextStyle? assistActionsTextStyle, + Color? mainActionBackgroundColor, + Color? assistActionsBackgroundColor, + double? bottomHeight, + Color? backgroundColor, String configId = GLOBAL_CONFIG_ID, }) : _dialogWidth = dialogWidth, _radius = radius, @@ -458,7 +458,8 @@ class BrnDialogConfig extends BrnBaseConfig { warningTextStyle: warningTextStyle.merge(other._warningTextStyle), warningTextAlign: other._warningTextAlign, dividerPadding: other._dividerPadding, - mainActionTextStyle: mainActionTextStyle.merge(other._mainActionTextStyle), + mainActionTextStyle: + mainActionTextStyle.merge(other._mainActionTextStyle), assistActionsTextStyle: assistActionsTextStyle.merge(other._assistActionsTextStyle), mainActionBackgroundColor: other._mainActionBackgroundColor, From c19203f63423eb62541e2d40b30f38a64eedb818 Mon Sep 17 00:00:00 2001 From: zhoujuanjuan <15143015732@163.com> Date: Fri, 31 Dec 2021 16:05:05 +0800 Subject: [PATCH 05/14] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BF=AE=E5=A4=8D=20Ev?= =?UTF-8?q?entBus?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/src/utils/brn_event_bus.dart | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/lib/src/utils/brn_event_bus.dart b/lib/src/utils/brn_event_bus.dart index f9c96247..9d3832a6 100644 --- a/lib/src/utils/brn_event_bus.dart +++ b/lib/src/utils/brn_event_bus.dart @@ -32,16 +32,15 @@ class EventBus { static EventBus? _instance; - factory EventBus.init() { - _instance = EventBus(); + factory EventBus._() { + if(_instance == null) { + _instance = EventBus(); + } return _instance!; } static EventBus get instance { - if (_instance == null) { - EventBus.init(); - } - return _instance!; + return EventBus._(); } StreamController _streamController; @@ -64,7 +63,7 @@ class EventBus { /// resumed or cancelled. So it's usually better to just cancel and later /// subscribe again (avoids memory leak). /// - Stream on() { + Stream on() { if (T == dynamic) { return streamController.stream as Stream; } @@ -80,19 +79,5 @@ class EventBus { void destroy() { _streamController.close(); } - static EventBus? _instance; - - factory EventBus.init() { - if (_instance == null) { - _instance = EventBus(); - } - return _instance!; - } - static EventBus get instance { - if (_instance == null) { - EventBus.init(); - } - return _instance!; - } } From 6e0834b62cb91087faec99454283820a154cc403 Mon Sep 17 00:00:00 2001 From: zhoujuanjuan <15143015732@163.com> Date: Tue, 4 Jan 2022 17:38:07 +0800 Subject: [PATCH 06/14] =?UTF-8?q?=E8=BF=81=E7=A7=BBexample=20=EF=BC=8C?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=B8=B8=E9=87=8F=E5=91=BD=E5=90=8D=EF=BC=8C?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0export?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/icons/icon_uparrow.png | Bin 452 -> 0 bytes example/lib/main.dart | 2 + .../actionsheet/actionsheet_entry_page.dart | 42 ++-- ...ionsheet_selected_list_custom_example.dart | 2 + .../actionsheet_selected_list_example.dart | 2 + .../components/appraise/appraise_example.dart | 2 + .../bottom_tabbar/bottom_tabbar_example.dart | 2 + .../components/button/big_fu_example.dart | 2 + .../components/button/big_ghost_example.dart | 2 + .../components/button/big_main_example.dart | 2 + .../button/big_outline_example.dart | 2 + .../button/bottom_button_entry_page.dart | 2 + .../button/brn_small_outline_example.dart | 2 + .../button/brn_text_button_panel_example.dart | 2 + .../components/button/button_entry_page.dart | 2 + .../button/button_panel_entry_page.dart | 2 + .../button/button_panel_example.dart | 2 + .../button/common_collection_example.dart | 2 + .../button/icon_button_example.dart | 2 + .../button/selection_collection_example.dart | 2 + .../components/button/small_main_example.dart | 2 + .../calendar/calendarview_example.dart | 2 + .../components/card/brn_shadow_example.dart | 2 + .../bubble/brn_expanded_bubble_example.dart | 2 + .../card/bubble/bubble_entry_page.dart | 2 + .../card/bubble/common_bubble_example.dart | 2 + .../content/brn_two_rich_content_example.dart | 2 + .../content/brn_two_text_content_example.dart | 2 + .../keyvalue_align_content_example.dart | 4 +- .../keyvalue_close_content_example.dart | 2 + .../card/content/number_item_example.dart | 2 + .../card/content/text_content_entry_page.dart | 2 + .../content/text_value_arrow_example.dart | 2 + .../card_title/brn_action_title_example.dart | 2 + .../card_title/brn_common_title_example.dart | 2 + .../components/card_title/title_example.dart | 2 + .../charts/chart_entry_example.dart | 2 + .../charts/doughnut_chart_example.dart | 2 + .../charts/line/brn_broken_line_example.dart | 2 + .../charts/line/db_data_node_model.dart | 2 + .../charts/progress_bar_chart_example.dart | 2 + .../charts/progress_chart_entry_page.dart | 2 + .../components/dialog/dialog_entry_page.dart | 18 +- .../components/empty/abnormal_entry_page.dart | 2 + .../empty/abnormal_state_example.dart | 2 + .../form/all_item_style_example.dart | 2 + .../form/form_item_entry_example.dart | 2 + .../components/form/form_page_example.dart | 2 + .../expansion_group_example.dart | 2 + .../form/group_example/group_add_example.dart | 2 + .../group_example/normal_group_example.dart | 2 + .../items_example/base_title_example.dart | 2 + .../items_example/multi_choice_example.dart | 2 + .../multi_choice_protrait_example.dart | 2 + .../items_example/radio_input_example.dart | 2 + .../items_example/radio_protrait_example.dart | 2 + .../items_example/range_input_example.dart | 2 + .../items_example/ratio_input_example.dart | 2 + .../select_all_title_example.dart | 2 + .../form/items_example/star_example.dart | 2 + .../items_example/step_input_example.dart | 2 + .../text_block_input_example.dart | 2 + .../items_example/text_input_example.dart | 2 + .../text_quick_select_input_example.dart | 2 + .../items_example/text_select_example.dart | 2 + .../form/items_example/title_example.dart | 2 + .../items_example/title_select_example.dart | 2 + .../gallery/gallery_detail_example.dart | 2 + .../gallery_detail_page_theme_example.dart | 2 + .../components/gallery/gallery_example.dart | 2 + .../components/guide/force_guide_example.dart | 2 + .../components/guide/guide_entry_page.dart | 2 + .../components/guide/soft_intro_example.dart | 2 + .../components/input/input_example.dart | 2 + .../components/line/dashed_line_example.dart | 2 + .../loading/loading_widget_example.dart | 2 + .../components/navbar/appbar_entry_page.dart | 2 + .../navbar/nav_bar_example_page.dart | 2 + .../noticebar/brn_notice_bar_example.dart | 2 + .../noticebar/notice_bar_example.dart | 2 + .../notice_bar_with_button_example.dart | 2 + .../picker/cutomer_bottom_picker_example.dart | 2 + .../picker/date_picker_example.dart | 2 + .../picker/multi_picker_example.dart | 2 + .../components/picker/picker_entry_page.dart | 2 + .../popup/overlay_window_example.dart | 2 + .../components/popup/popwindow_example.dart | 2 + .../components/rating/rating_example.dart | 8 +- .../scroll_actor_tab_example.dart | 2 + .../selectcity/selected_city_example.dart | 2 + .../components/selection/filter_entity.dart | 2 + .../flat_selection_five_tags_example.dart | 2 + .../flat_selection_four_tags_example.dart | 2 + .../flat_selection_three_tags_example.dart | 2 + .../selection/selection_entry_page.dart | 2 + .../selection/selection_flat_entry_page.dart | 2 + ...ionview_custom_floating_layer_example.dart | 2 + ...view_customhandle_filter_example_page.dart | 2 + ...selectionview_customview_example_page.dart | 2 + ...electionview_date_filter_example_page.dart | 2 + ...selectionview_date_range_example_page.dart | 2 + .../selectionview_interceptor_example.dart | 2 + ...view_limit_max_selected_count_example.dart | 2 + ...electionview_more_filter_example_page.dart | 2 + ...selectionview_multi_list_example_page.dart | 2 + ...electionview_multi_range_example_page.dart | 2 + ...nview_simple_multi_check_example_page.dart | 2 + ...nview_simple_single_list_example_page.dart | 2 + .../step/brn_horizontal_step_example.dart | 2 + .../sample/components/step/step_example.dart | 2 + .../components/step/step_line_example.dart | 2 + .../sugsearch/search_text_example.dart | 1 + .../components/switch/checkbox_example.dart | 2 + .../components/switch/radio_example.dart | 2 + .../tabbar/brn_switch_title_example.dart | 2 + .../components/tabbar/brn_tab_example.dart | 2 + .../tabbar/brn_tabbar_sticky_example.dart | 2 + .../tabbar/sub_switch_title_example.dart | 2 + .../components/tag/border_tag_example.dart | 2 + .../components/tag/custom_tag_example.dart | 2 + .../components/tag/delete_tag_example.dart | 2 + .../components/tag/select_tag_example.dart | 2 + .../components/tag/state_tag_example.dart | 2 + .../sample/components/tag/tag_example.dart | 2 + .../components/tag/tag_row_example.dart | 2 + .../components/toast/toast_example.dart | 2 + example/lib/sample/home/card_data_config.dart | 2 + .../home/expandable_container_widget.dart | 2 + example/lib/sample/home/group_card.dart | 2 + example/lib/sample/home/home.dart | 2 + example/lib/sample/home/list_item.dart | 2 + .../lib/sample/theme/config_test_utils.dart | 2 + example/pubspec.yaml | 4 +- .../brn_selected_list_action_sheet.dart | 2 +- .../actionsheet/brn_share_action_sheet.dart | 4 +- .../brn_appraise_emoji_list_view.dart | 30 +-- .../appraise/brn_appraise_header.dart | 2 +- .../brn_multiple_bottom_button.dart | 6 +- .../collection/brn_text_button_panel.dart | 4 +- .../calendar/brn_calendar_view.dart | 8 +- .../content_card/brn_enhance_number_card.dart | 4 +- .../content_card/brn_pair_info_rich_grid.dart | 2 +- .../content_card/brn_pair_info_table.dart | 16 +- .../card_title/brn_action_card_title.dart | 2 +- .../dialog/brn_content_export_dialog.dart | 2 +- .../components/dialog/brn_share_dialog.dart | 4 +- .../components/dialog/brn_single_select.dart | 2 +- .../general/brn_quick_select_input_item.dart | 2 +- .../items/general/brn_range_input_item.dart | 6 +- .../items/general/brn_star_input_item.dart | 6 +- .../items/general/brn_step_input_item.dart | 14 +- .../items/general/brn_text_input_item.dart | 2 +- .../items/general/brn_text_select_item.dart | 4 +- .../general/brn_title_select_input_item.dart | 6 +- .../form/items/group/brn_normal_group.dart | 2 +- .../items/group/element_expand_widget.dart | 2 +- .../form/items/misc/brn_add_label_item.dart | 2 +- .../form/items/misc/brn_title_item.dart | 2 +- .../undetermined/brn_expandable_group.dart | 4 +- .../components/form/utils/brn_form_util.dart | 10 +- .../gallery/config/brn_bottom_card.dart | 4 +- lib/src/components/guide/brn_tip_widget.dart | 2 +- lib/src/components/navbar/brn_search_bar.dart | 4 +- .../components/noticebar/brn_notice_bar.dart | 40 ++-- .../brn_select_tags_with_input_picker.dart | 2 +- .../bean/brn_multi_column_picker_entity.dart | 4 +- .../components/popup/brn_popup_window.dart | 4 +- lib/src/components/radio/brn_checkbox.dart | 8 +- .../components/radio/brn_radio_button.dart | 8 +- .../components/rating/brn_rating_star.dart | 6 +- .../brn_single_select_city_page.dart | 2 +- .../bean/brn_selection_common_entity.dart | 10 +- .../selection/brn_simple_selection.dart | 2 +- .../widget/brn_flat_selection_item.dart | 4 +- .../widget/brn_layer_more_selection_page.dart | 2 +- .../brn_selection_menu_item_widget.dart | 8 +- .../brn_selection_more_item_widget.dart | 4 +- .../components/step/brn_horizontal_steps.dart | 14 +- .../components/sugsearch/brn_search_text.dart | 4 +- .../components/tabbar/normal/brn_tab_bar.dart | 4 +- .../tag/tagview/brn_delete_tag.dart | 4 +- lib/src/constants/brn_asset_constants.dart | 197 +++++++++--------- lib/src/constants/brn_constants.dart | 24 +-- lib/src/constants/brn_fonts_constants.dart | 12 +- .../theme/base/brn_default_config_utils.dart | 2 +- lib/src/theme/brn_theme.dart | 3 + lib/src/theme/configs/brn_appbar_config.dart | 4 +- .../theme/img/brn_theme_default_utils.dart | 4 +- 188 files changed, 564 insertions(+), 301 deletions(-) delete mode 100644 assets/icons/icon_uparrow.png diff --git a/assets/icons/icon_uparrow.png b/assets/icons/icon_uparrow.png deleted file mode 100644 index b1d4cbf3a9918c37fdba49da7c2e47f07a02a8a1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 452 zcmeAS@N?(olHy`uVBq!ia0vp^x**KK1|+Sd9?b$$jKx9jP7LeL$-D$|Tv8)E(|mmy zw18|52FCVG1{RPKAeI7R1_tH@j10^`nh_+nfC(=G?|Dm){R;N%5N({9_}y24<@x!?>=%|jbY*|R zAiIFMq=D}Oqm={uCYc$_Ubap8y6M5vZUr@|O**GbWsV=WIiD}G<)S#R0G~zTo%kDU ze`45o-A%Z^?d@I5?>E18%lj_yZ?K)AxkJi|`G!mkYb-+!mtLD6!*}VYb+wD5_lCGw zTeJ4`vhVu(#bGP^`wRQCI?U4zOZYa}Ychl}@5!i~!f-e#X3~uKlt1%$*Ltq&v~@b) zw9O-H;Y0NaE!%w3mX>nmPCa7Xa?8n>D_2qOP+RWWZBO+5{}vvYxMS|qf65}~G;j7< z^`2mMzj8n^(6p9=|L_MVM{A#~i|dy0Ka@I9cWLX_TDfa5KLR~G!Qum}fVx { void _showShareSevenStyle(BuildContext context) { List firstRowList = List(); firstRowList.add(BrnShareItem( - BrnShareItemConstants.SHARE_WEIXIN, + BrnShareItemConstants.shareWeiXin, canClick: true, )); firstRowList.add(BrnShareItem( - BrnShareItemConstants.SHARE_BROWSER, + BrnShareItemConstants.shareBrowser, canClick: true, )); firstRowList.add(BrnShareItem( - BrnShareItemConstants.SHARE_COPY_LINK, + BrnShareItemConstants.shareCopyLink, canClick: true, )); firstRowList.add(BrnShareItem( - BrnShareItemConstants.SHARE_FRIEND, + BrnShareItemConstants.shareFriend, canClick: true, )); firstRowList.add(BrnShareItem( - BrnShareItemConstants.SHARE_LINK, + BrnShareItemConstants.shareLink, canClick: true, )); firstRowList.add(BrnShareItem( - BrnShareItemConstants.SHARE_QQ, + BrnShareItemConstants.shareQQ, canClick: true, )); firstRowList.add(BrnShareItem( - BrnShareItemConstants.SHARE_CUSTOM, + BrnShareItemConstants.shareCustom, customImage: BrunoTools.getAssetImage("images/icon_custom_share.png"), customTitle: "自定义", canClick: true, @@ -437,35 +439,35 @@ class _ActionSheetEntryPageState extends State { List firstRowList = List(); List secondRowList = List(); firstRowList.add(BrnShareItem( - BrnShareItemConstants.SHARE_QZONE, + BrnShareItemConstants.shareQZone, canClick: true, )); firstRowList.add(BrnShareItem( - BrnShareItemConstants.SHARE_SAVE_IMAGE, + BrnShareItemConstants.shareSaveImage, canClick: true, )); firstRowList.add(BrnShareItem( - BrnShareItemConstants.SHARE_SMS, + BrnShareItemConstants.shareSms, canClick: true, )); firstRowList.add(BrnShareItem( - BrnShareItemConstants.SHARE_WEIBO, + BrnShareItemConstants.shareWeiBo, canClick: true, )); secondRowList.add(BrnShareItem( - BrnShareItemConstants.SHARE_QZONE, + BrnShareItemConstants.shareQZone, canClick: false, )); secondRowList.add(BrnShareItem( - BrnShareItemConstants.SHARE_SAVE_IMAGE, + BrnShareItemConstants.shareSaveImage, canClick: false, )); secondRowList.add(BrnShareItem( - BrnShareItemConstants.SHARE_SMS, + BrnShareItemConstants.shareSms, canClick: false, )); secondRowList.add(BrnShareItem( - BrnShareItemConstants.SHARE_WEIBO, + BrnShareItemConstants.shareWeiBo, canClick: false, )); BrnShareActionSheet actionSheet = new BrnShareActionSheet( @@ -491,15 +493,15 @@ class _ActionSheetEntryPageState extends State { List firstRowList = List(); List secondRowList = List(); firstRowList.add(BrnShareItem( - BrnShareItemConstants.SHARE_WEIXIN, + BrnShareItemConstants.shareWeiXin, canClick: true, )); firstRowList.add(BrnShareItem( - BrnShareItemConstants.SHARE_FRIEND, + BrnShareItemConstants.shareFriend, canClick: true, )); secondRowList.add(BrnShareItem( - BrnShareItemConstants.SHARE_CUSTOM, + BrnShareItemConstants.shareCustom, customImage: BrunoTools.getAssetImage("images/icon_custom_share.png"), customTitle: "自定义", canClick: true, @@ -518,11 +520,11 @@ class _ActionSheetEntryPageState extends State { void _showShareTwoStyle(BuildContext context) { List firstRowList = List(); firstRowList.add(BrnShareItem( - BrnShareItemConstants.SHARE_WEIXIN, + BrnShareItemConstants.shareWeiXin, canClick: true, )); firstRowList.add(BrnShareItem( - BrnShareItemConstants.SHARE_FRIEND, + BrnShareItemConstants.shareFriend, canClick: true, )); BrnShareActionSheet actionSheet = new BrnShareActionSheet( diff --git a/example/lib/sample/components/actionsheet/actionsheet_selected_list_custom_example.dart b/example/lib/sample/components/actionsheet/actionsheet_selected_list_custom_example.dart index d018de8a..b7a0bf47 100644 --- a/example/lib/sample/components/actionsheet/actionsheet_selected_list_custom_example.dart +++ b/example/lib/sample/components/actionsheet/actionsheet_selected_list_custom_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/actionsheet/actionsheet_selected_list_example.dart b/example/lib/sample/components/actionsheet/actionsheet_selected_list_example.dart index e4d14f88..efbad49b 100644 --- a/example/lib/sample/components/actionsheet/actionsheet_selected_list_example.dart +++ b/example/lib/sample/components/actionsheet/actionsheet_selected_list_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/appraise/appraise_example.dart b/example/lib/sample/components/appraise/appraise_example.dart index c092d228..aca18fb4 100644 --- a/example/lib/sample/components/appraise/appraise_example.dart +++ b/example/lib/sample/components/appraise/appraise_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/bottom_tabbar/bottom_tabbar_example.dart b/example/lib/sample/components/bottom_tabbar/bottom_tabbar_example.dart index c63100a0..dc593e66 100644 --- a/example/lib/sample/components/bottom_tabbar/bottom_tabbar_example.dart +++ b/example/lib/sample/components/bottom_tabbar/bottom_tabbar_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/button/big_fu_example.dart b/example/lib/sample/components/button/big_fu_example.dart index cb560015..95b8d02f 100644 --- a/example/lib/sample/components/button/big_fu_example.dart +++ b/example/lib/sample/components/button/big_fu_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/button/big_ghost_example.dart b/example/lib/sample/components/button/big_ghost_example.dart index e9089d19..3b3d0e43 100644 --- a/example/lib/sample/components/button/big_ghost_example.dart +++ b/example/lib/sample/components/button/big_ghost_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/button/big_main_example.dart b/example/lib/sample/components/button/big_main_example.dart index 827b528c..250f4ce9 100644 --- a/example/lib/sample/components/button/big_main_example.dart +++ b/example/lib/sample/components/button/big_main_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/button/big_outline_example.dart b/example/lib/sample/components/button/big_outline_example.dart index 74835b5a..7adb4d96 100644 --- a/example/lib/sample/components/button/big_outline_example.dart +++ b/example/lib/sample/components/button/big_outline_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/button/bottom_button_entry_page.dart b/example/lib/sample/components/button/bottom_button_entry_page.dart index 314ceeb8..ce2ef9cf 100644 --- a/example/lib/sample/components/button/bottom_button_entry_page.dart +++ b/example/lib/sample/components/button/bottom_button_entry_page.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:example/sample/components/button/common_collection_example.dart'; import 'package:example/sample/components/button/selection_collection_example.dart'; diff --git a/example/lib/sample/components/button/brn_small_outline_example.dart b/example/lib/sample/components/button/brn_small_outline_example.dart index f5ad0957..25d5fae5 100644 --- a/example/lib/sample/components/button/brn_small_outline_example.dart +++ b/example/lib/sample/components/button/brn_small_outline_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/button/brn_text_button_panel_example.dart b/example/lib/sample/components/button/brn_text_button_panel_example.dart index 0ebc055e..27d0ec77 100644 --- a/example/lib/sample/components/button/brn_text_button_panel_example.dart +++ b/example/lib/sample/components/button/brn_text_button_panel_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/button/button_entry_page.dart b/example/lib/sample/components/button/button_entry_page.dart index c851ed43..427d8fb4 100644 --- a/example/lib/sample/components/button/button_entry_page.dart +++ b/example/lib/sample/components/button/button_entry_page.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:example/sample/components/button/big_main_example.dart'; import 'package:example/sample/components/button/big_outline_example.dart'; diff --git a/example/lib/sample/components/button/button_panel_entry_page.dart b/example/lib/sample/components/button/button_panel_entry_page.dart index 3d6ef593..ad0a903d 100644 --- a/example/lib/sample/components/button/button_panel_entry_page.dart +++ b/example/lib/sample/components/button/button_panel_entry_page.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:example/sample/components/button/brn_text_button_panel_example.dart'; import 'package:example/sample/components/button/button_panel_example.dart'; diff --git a/example/lib/sample/components/button/button_panel_example.dart b/example/lib/sample/components/button/button_panel_example.dart index 716e7687..e5b139bc 100644 --- a/example/lib/sample/components/button/button_panel_example.dart +++ b/example/lib/sample/components/button/button_panel_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/button/common_collection_example.dart b/example/lib/sample/components/button/common_collection_example.dart index 249d6bd0..7591e4ea 100644 --- a/example/lib/sample/components/button/common_collection_example.dart +++ b/example/lib/sample/components/button/common_collection_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/button/icon_button_example.dart b/example/lib/sample/components/button/icon_button_example.dart index b67f415e..bda32e1b 100644 --- a/example/lib/sample/components/button/icon_button_example.dart +++ b/example/lib/sample/components/button/icon_button_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/button/selection_collection_example.dart b/example/lib/sample/components/button/selection_collection_example.dart index 40bcbe64..f882204b 100644 --- a/example/lib/sample/components/button/selection_collection_example.dart +++ b/example/lib/sample/components/button/selection_collection_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/button/small_main_example.dart b/example/lib/sample/components/button/small_main_example.dart index 62296eee..e7fb3e5a 100644 --- a/example/lib/sample/components/button/small_main_example.dart +++ b/example/lib/sample/components/button/small_main_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/calendar/calendarview_example.dart b/example/lib/sample/components/calendar/calendarview_example.dart index 26e4178e..a713b3d7 100644 --- a/example/lib/sample/components/calendar/calendarview_example.dart +++ b/example/lib/sample/components/calendar/calendarview_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/card/brn_shadow_example.dart b/example/lib/sample/components/card/brn_shadow_example.dart index 679166c7..f06001b8 100644 --- a/example/lib/sample/components/card/brn_shadow_example.dart +++ b/example/lib/sample/components/card/brn_shadow_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'dart:math'; import 'package:bruno/bruno.dart'; diff --git a/example/lib/sample/components/card/bubble/brn_expanded_bubble_example.dart b/example/lib/sample/components/card/bubble/brn_expanded_bubble_example.dart index 1c8754c0..5df330ba 100644 --- a/example/lib/sample/components/card/bubble/brn_expanded_bubble_example.dart +++ b/example/lib/sample/components/card/bubble/brn_expanded_bubble_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/card/bubble/bubble_entry_page.dart b/example/lib/sample/components/card/bubble/bubble_entry_page.dart index 550304cc..ff6fd2d2 100644 --- a/example/lib/sample/components/card/bubble/bubble_entry_page.dart +++ b/example/lib/sample/components/card/bubble/bubble_entry_page.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:example/sample/components/card/bubble/common_bubble_example.dart'; import 'package:example/sample/components/card/bubble/brn_expanded_bubble_example.dart'; diff --git a/example/lib/sample/components/card/bubble/common_bubble_example.dart b/example/lib/sample/components/card/bubble/common_bubble_example.dart index 86532787..5c4486b7 100644 --- a/example/lib/sample/components/card/bubble/common_bubble_example.dart +++ b/example/lib/sample/components/card/bubble/common_bubble_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/card/content/brn_two_rich_content_example.dart b/example/lib/sample/components/card/content/brn_two_rich_content_example.dart index fc9c112d..40b06a40 100644 --- a/example/lib/sample/components/card/content/brn_two_rich_content_example.dart +++ b/example/lib/sample/components/card/content/brn_two_rich_content_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/card/content/brn_two_text_content_example.dart b/example/lib/sample/components/card/content/brn_two_text_content_example.dart index 3f011d6e..8f1352ab 100644 --- a/example/lib/sample/components/card/content/brn_two_text_content_example.dart +++ b/example/lib/sample/components/card/content/brn_two_text_content_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/card/content/keyvalue_align_content_example.dart b/example/lib/sample/components/card/content/keyvalue_align_content_example.dart index 57527374..7d8afa98 100644 --- a/example/lib/sample/components/card/content/keyvalue_align_content_example.dart +++ b/example/lib/sample/components/card/content/keyvalue_align_content_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'dart:math'; import 'package:bruno/bruno.dart'; @@ -301,7 +303,7 @@ class _TextContentExampleState extends State { ), Transform.rotate( angle: pi, - child: BrunoTools.getAssetImage('icons/icon_uparrow.png')), + child: BrunoTools.getAssetImage('icons/icon_up_arrow.png')), ], ), decoration: BoxDecoration( diff --git a/example/lib/sample/components/card/content/keyvalue_close_content_example.dart b/example/lib/sample/components/card/content/keyvalue_close_content_example.dart index acf2022c..aa4606c9 100644 --- a/example/lib/sample/components/card/content/keyvalue_close_content_example.dart +++ b/example/lib/sample/components/card/content/keyvalue_close_content_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/card/content/number_item_example.dart b/example/lib/sample/components/card/content/number_item_example.dart index 07bbba84..c7e4709b 100644 --- a/example/lib/sample/components/card/content/number_item_example.dart +++ b/example/lib/sample/components/card/content/number_item_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/card/content/text_content_entry_page.dart b/example/lib/sample/components/card/content/text_content_entry_page.dart index 2a3dfe12..da1888b8 100644 --- a/example/lib/sample/components/card/content/text_content_entry_page.dart +++ b/example/lib/sample/components/card/content/text_content_entry_page.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:example/sample/components/card/content/keyvalue_align_content_example.dart'; import 'package:example/sample/components/card/content/keyvalue_close_content_example.dart'; diff --git a/example/lib/sample/components/card/content/text_value_arrow_example.dart b/example/lib/sample/components/card/content/text_value_arrow_example.dart index 56d52af9..0b3b329b 100644 --- a/example/lib/sample/components/card/content/text_value_arrow_example.dart +++ b/example/lib/sample/components/card/content/text_value_arrow_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/card_title/brn_action_title_example.dart b/example/lib/sample/components/card_title/brn_action_title_example.dart index ba92ad98..ef0926d1 100644 --- a/example/lib/sample/components/card_title/brn_action_title_example.dart +++ b/example/lib/sample/components/card_title/brn_action_title_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/card_title/brn_common_title_example.dart b/example/lib/sample/components/card_title/brn_common_title_example.dart index 9c5a0478..8337ee66 100644 --- a/example/lib/sample/components/card_title/brn_common_title_example.dart +++ b/example/lib/sample/components/card_title/brn_common_title_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/card_title/title_example.dart b/example/lib/sample/components/card_title/title_example.dart index 66b73224..ede686df 100644 --- a/example/lib/sample/components/card_title/title_example.dart +++ b/example/lib/sample/components/card_title/title_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:example/sample/components/card_title/brn_action_title_example.dart'; import 'package:example/sample/components/card_title/brn_common_title_example.dart'; diff --git a/example/lib/sample/components/charts/chart_entry_example.dart b/example/lib/sample/components/charts/chart_entry_example.dart index d66f5f19..0a74e5cc 100644 --- a/example/lib/sample/components/charts/chart_entry_example.dart +++ b/example/lib/sample/components/charts/chart_entry_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'dart:math'; import 'package:bruno/bruno.dart'; diff --git a/example/lib/sample/components/charts/doughnut_chart_example.dart b/example/lib/sample/components/charts/doughnut_chart_example.dart index 49d6c6dd..e97f2e3f 100644 --- a/example/lib/sample/components/charts/doughnut_chart_example.dart +++ b/example/lib/sample/components/charts/doughnut_chart_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'dart:math'; import 'package:bruno/bruno.dart'; diff --git a/example/lib/sample/components/charts/line/brn_broken_line_example.dart b/example/lib/sample/components/charts/line/brn_broken_line_example.dart index fe4b71b2..13b8d0f4 100644 --- a/example/lib/sample/components/charts/line/brn_broken_line_example.dart +++ b/example/lib/sample/components/charts/line/brn_broken_line_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'dart:math'; import 'package:bruno/bruno.dart'; diff --git a/example/lib/sample/components/charts/line/db_data_node_model.dart b/example/lib/sample/components/charts/line/db_data_node_model.dart index 7e0464e4..93625b79 100644 --- a/example/lib/sample/components/charts/line/db_data_node_model.dart +++ b/example/lib/sample/components/charts/line/db_data_node_model.dart @@ -1,5 +1,7 @@ /// @desc 看板卡片中用于描述数据指标的模型,也能用于数据块的定义,内部嵌套了一个itemList +// @dart=2.9 + class DBDataNodeModel { String key; String name; diff --git a/example/lib/sample/components/charts/progress_bar_chart_example.dart b/example/lib/sample/components/charts/progress_bar_chart_example.dart index 0b6c98c4..c30c8316 100644 --- a/example/lib/sample/components/charts/progress_bar_chart_example.dart +++ b/example/lib/sample/components/charts/progress_bar_chart_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'dart:math'; import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/charts/progress_chart_entry_page.dart b/example/lib/sample/components/charts/progress_chart_entry_page.dart index bb0b34c9..db8840de 100644 --- a/example/lib/sample/components/charts/progress_chart_entry_page.dart +++ b/example/lib/sample/components/charts/progress_chart_entry_page.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/dialog/dialog_entry_page.dart b/example/lib/sample/components/dialog/dialog_entry_page.dart index ff961be6..189311e0 100644 --- a/example/lib/sample/components/dialog/dialog_entry_page.dart +++ b/example/lib/sample/components/dialog/dialog_entry_page.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:example/sample/home/list_item.dart'; import 'package:flutter/material.dart'; @@ -762,9 +764,9 @@ class DialogEntryPage extends StatelessWidget { BrnShareDialog brnShareDialog = new BrnShareDialog( context: context, shareChannels: [ - BrnShareItemConstants.SHARE_WEIXIN, - BrnShareItemConstants.SHARE_LINK, - BrnShareItemConstants.SHARE_CUSTOM + BrnShareItemConstants.shareWeiXin, + BrnShareItemConstants.shareLink, + BrnShareItemConstants.shareCustom ], titleText: "测试标题", descText: "测试辅助信息测试辅助信息测试辅助信息测试辅助信息测试辅助信息", @@ -792,11 +794,11 @@ class DialogEntryPage extends StatelessWidget { BrnShareDialog brnShareDialog = new BrnShareDialog( context: context, shareChannels: [ - BrnShareItemConstants.SHARE_WEIXIN, - BrnShareItemConstants.SHARE_CUSTOM, - BrnShareItemConstants.SHARE_CUSTOM, - BrnShareItemConstants.SHARE_LINK, - BrnShareItemConstants.SHARE_CUSTOM + BrnShareItemConstants.shareWeiXin, + BrnShareItemConstants.shareCustom, + BrnShareItemConstants.shareCustom, + BrnShareItemConstants.shareLink, + BrnShareItemConstants.shareCustom ], titleText: "测试标题", descText: "测试辅助信息测试辅助信息测试辅助信息测试辅助信息测试辅助信息", diff --git a/example/lib/sample/components/empty/abnormal_entry_page.dart b/example/lib/sample/components/empty/abnormal_entry_page.dart index a0fa3ffa..2c39489b 100644 --- a/example/lib/sample/components/empty/abnormal_entry_page.dart +++ b/example/lib/sample/components/empty/abnormal_entry_page.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:example/sample/components/empty/abnormal_state_example.dart'; import 'package:example/sample/home/list_item.dart'; diff --git a/example/lib/sample/components/empty/abnormal_state_example.dart b/example/lib/sample/components/empty/abnormal_state_example.dart index 8fa335fc..e6308d80 100644 --- a/example/lib/sample/components/empty/abnormal_state_example.dart +++ b/example/lib/sample/components/empty/abnormal_state_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/form/all_item_style_example.dart b/example/lib/sample/components/form/all_item_style_example.dart index ab695efd..5e02a78a 100644 --- a/example/lib/sample/components/form/all_item_style_example.dart +++ b/example/lib/sample/components/form/all_item_style_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:example/sample/components/form/group_example/expansion_group_example.dart'; import 'package:example/sample/components/form/group_example/group_add_example.dart'; diff --git a/example/lib/sample/components/form/form_item_entry_example.dart b/example/lib/sample/components/form/form_item_entry_example.dart index 25b63537..f65383b2 100644 --- a/example/lib/sample/components/form/form_item_entry_example.dart +++ b/example/lib/sample/components/form/form_item_entry_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:example/sample/components/form/all_item_style_example.dart'; import 'package:example/sample/components/form/form_page_example.dart'; diff --git a/example/lib/sample/components/form/form_page_example.dart b/example/lib/sample/components/form/form_page_example.dart index aa46c4bb..e0820de9 100644 --- a/example/lib/sample/components/form/form_page_example.dart +++ b/example/lib/sample/components/form/form_page_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; /// 退回订单 页面展示 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 248937bb..d4591836 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 @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/form/group_example/group_add_example.dart b/example/lib/sample/components/form/group_example/group_add_example.dart index 7516c930..1507f0ff 100644 --- a/example/lib/sample/components/form/group_example/group_add_example.dart +++ b/example/lib/sample/components/form/group_example/group_add_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; 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 8edefddd..705c2283 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 @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/form/items_example/base_title_example.dart b/example/lib/sample/components/form/items_example/base_title_example.dart index f251cb35..03ef2f2c 100644 --- a/example/lib/sample/components/form/items_example/base_title_example.dart +++ b/example/lib/sample/components/form/items_example/base_title_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/form/items_example/multi_choice_example.dart b/example/lib/sample/components/form/items_example/multi_choice_example.dart index bae807bf..7930fa3e 100644 --- a/example/lib/sample/components/form/items_example/multi_choice_example.dart +++ b/example/lib/sample/components/form/items_example/multi_choice_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/form/items_example/multi_choice_protrait_example.dart b/example/lib/sample/components/form/items_example/multi_choice_protrait_example.dart index 9621128e..3d6667f3 100644 --- a/example/lib/sample/components/form/items_example/multi_choice_protrait_example.dart +++ b/example/lib/sample/components/form/items_example/multi_choice_protrait_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/form/items_example/radio_input_example.dart b/example/lib/sample/components/form/items_example/radio_input_example.dart index cf2045dd..660138e4 100644 --- a/example/lib/sample/components/form/items_example/radio_input_example.dart +++ b/example/lib/sample/components/form/items_example/radio_input_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/form/items_example/radio_protrait_example.dart b/example/lib/sample/components/form/items_example/radio_protrait_example.dart index 27b60220..11a29c9d 100644 --- a/example/lib/sample/components/form/items_example/radio_protrait_example.dart +++ b/example/lib/sample/components/form/items_example/radio_protrait_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/form/items_example/range_input_example.dart b/example/lib/sample/components/form/items_example/range_input_example.dart index b04a42d9..e48eaa25 100644 --- a/example/lib/sample/components/form/items_example/range_input_example.dart +++ b/example/lib/sample/components/form/items_example/range_input_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/form/items_example/ratio_input_example.dart b/example/lib/sample/components/form/items_example/ratio_input_example.dart index 72f19a93..74027c82 100644 --- a/example/lib/sample/components/form/items_example/ratio_input_example.dart +++ b/example/lib/sample/components/form/items_example/ratio_input_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/form/items_example/select_all_title_example.dart b/example/lib/sample/components/form/items_example/select_all_title_example.dart index 2b2d991d..882c4259 100644 --- a/example/lib/sample/components/form/items_example/select_all_title_example.dart +++ b/example/lib/sample/components/form/items_example/select_all_title_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/form/items_example/star_example.dart b/example/lib/sample/components/form/items_example/star_example.dart index 484bc0a4..2215f140 100644 --- a/example/lib/sample/components/form/items_example/star_example.dart +++ b/example/lib/sample/components/form/items_example/star_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/form/items_example/step_input_example.dart b/example/lib/sample/components/form/items_example/step_input_example.dart index ca1ea523..950a70bc 100644 --- a/example/lib/sample/components/form/items_example/step_input_example.dart +++ b/example/lib/sample/components/form/items_example/step_input_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/form/items_example/text_block_input_example.dart b/example/lib/sample/components/form/items_example/text_block_input_example.dart index bd15cc0a..f15273f3 100644 --- a/example/lib/sample/components/form/items_example/text_block_input_example.dart +++ b/example/lib/sample/components/form/items_example/text_block_input_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/form/items_example/text_input_example.dart b/example/lib/sample/components/form/items_example/text_input_example.dart index 401b42dc..f55b432e 100644 --- a/example/lib/sample/components/form/items_example/text_input_example.dart +++ b/example/lib/sample/components/form/items_example/text_input_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/form/items_example/text_quick_select_input_example.dart b/example/lib/sample/components/form/items_example/text_quick_select_input_example.dart index 8703111f..2e1a9358 100644 --- a/example/lib/sample/components/form/items_example/text_quick_select_input_example.dart +++ b/example/lib/sample/components/form/items_example/text_quick_select_input_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; diff --git a/example/lib/sample/components/form/items_example/text_select_example.dart b/example/lib/sample/components/form/items_example/text_select_example.dart index 3e8de41a..7ddf1f66 100644 --- a/example/lib/sample/components/form/items_example/text_select_example.dart +++ b/example/lib/sample/components/form/items_example/text_select_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; diff --git a/example/lib/sample/components/form/items_example/title_example.dart b/example/lib/sample/components/form/items_example/title_example.dart index 227cd61a..970f43ad 100644 --- a/example/lib/sample/components/form/items_example/title_example.dart +++ b/example/lib/sample/components/form/items_example/title_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/form/items_example/title_select_example.dart b/example/lib/sample/components/form/items_example/title_select_example.dart index 9fe73327..a1512996 100644 --- a/example/lib/sample/components/form/items_example/title_select_example.dart +++ b/example/lib/sample/components/form/items_example/title_select_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; diff --git a/example/lib/sample/components/gallery/gallery_detail_example.dart b/example/lib/sample/components/gallery/gallery_detail_example.dart index 9680766f..597679d5 100644 --- a/example/lib/sample/components/gallery/gallery_detail_example.dart +++ b/example/lib/sample/components/gallery/gallery_detail_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/gallery/gallery_detail_page_theme_example.dart b/example/lib/sample/components/gallery/gallery_detail_page_theme_example.dart index b47d65c6..9c908fd7 100644 --- a/example/lib/sample/components/gallery/gallery_detail_page_theme_example.dart +++ b/example/lib/sample/components/gallery/gallery_detail_page_theme_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:example/sample/components/gallery/gallery_detail_example.dart'; import 'package:example/sample/home/list_item.dart'; diff --git a/example/lib/sample/components/gallery/gallery_example.dart b/example/lib/sample/components/gallery/gallery_example.dart index 1df173bf..cd69afb5 100644 --- a/example/lib/sample/components/gallery/gallery_example.dart +++ b/example/lib/sample/components/gallery/gallery_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:example/sample/components/gallery/gallery_detail_page_theme_example.dart'; import 'package:example/sample/home/list_item.dart'; diff --git a/example/lib/sample/components/guide/force_guide_example.dart b/example/lib/sample/components/guide/force_guide_example.dart index 0803c653..cac44b5b 100644 --- a/example/lib/sample/components/guide/force_guide_example.dart +++ b/example/lib/sample/components/guide/force_guide_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'dart:async'; import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/guide/guide_entry_page.dart b/example/lib/sample/components/guide/guide_entry_page.dart index a48c0515..1e616ab3 100644 --- a/example/lib/sample/components/guide/guide_entry_page.dart +++ b/example/lib/sample/components/guide/guide_entry_page.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:example/sample/components/guide/force_guide_example.dart'; import 'package:example/sample/components/guide/soft_intro_example.dart'; diff --git a/example/lib/sample/components/guide/soft_intro_example.dart b/example/lib/sample/components/guide/soft_intro_example.dart index 2fed63f6..1853fb2a 100644 --- a/example/lib/sample/components/guide/soft_intro_example.dart +++ b/example/lib/sample/components/guide/soft_intro_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'dart:async'; import 'package:bruno/bruno.dart'; diff --git a/example/lib/sample/components/input/input_example.dart b/example/lib/sample/components/input/input_example.dart index a6e654b9..04ef557a 100644 --- a/example/lib/sample/components/input/input_example.dart +++ b/example/lib/sample/components/input/input_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; diff --git a/example/lib/sample/components/line/dashed_line_example.dart b/example/lib/sample/components/line/dashed_line_example.dart index 8ffd30a6..f3d738c7 100644 --- a/example/lib/sample/components/line/dashed_line_example.dart +++ b/example/lib/sample/components/line/dashed_line_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/loading/loading_widget_example.dart b/example/lib/sample/components/loading/loading_widget_example.dart index f1f64c84..f1d43967 100644 --- a/example/lib/sample/components/loading/loading_widget_example.dart +++ b/example/lib/sample/components/loading/loading_widget_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/navbar/appbar_entry_page.dart b/example/lib/sample/components/navbar/appbar_entry_page.dart index 31f4f747..7a0cb152 100644 --- a/example/lib/sample/components/navbar/appbar_entry_page.dart +++ b/example/lib/sample/components/navbar/appbar_entry_page.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:example/sample/home/list_item.dart'; import 'package:example/sample/components/navbar/nav_bar_example_page.dart'; 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 fa51a1ef..717c46be 100644 --- a/example/lib/sample/components/navbar/nav_bar_example_page.dart +++ b/example/lib/sample/components/navbar/nav_bar_example_page.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; diff --git a/example/lib/sample/components/noticebar/brn_notice_bar_example.dart b/example/lib/sample/components/noticebar/brn_notice_bar_example.dart index fa7c06b2..76e44153 100644 --- a/example/lib/sample/components/noticebar/brn_notice_bar_example.dart +++ b/example/lib/sample/components/noticebar/brn_notice_bar_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:example/sample/home/list_item.dart'; import 'package:example/sample/components/noticebar/notice_bar_example.dart'; diff --git a/example/lib/sample/components/noticebar/notice_bar_example.dart b/example/lib/sample/components/noticebar/notice_bar_example.dart index 438dc52a..f75bf591 100644 --- a/example/lib/sample/components/noticebar/notice_bar_example.dart +++ b/example/lib/sample/components/noticebar/notice_bar_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/noticebar/notice_bar_with_button_example.dart b/example/lib/sample/components/noticebar/notice_bar_with_button_example.dart index 4f710353..91618eef 100644 --- a/example/lib/sample/components/noticebar/notice_bar_with_button_example.dart +++ b/example/lib/sample/components/noticebar/notice_bar_with_button_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/picker/cutomer_bottom_picker_example.dart b/example/lib/sample/components/picker/cutomer_bottom_picker_example.dart index 144f9981..70c94902 100644 --- a/example/lib/sample/components/picker/cutomer_bottom_picker_example.dart +++ b/example/lib/sample/components/picker/cutomer_bottom_picker_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:example/sample/home/list_item.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/picker/date_picker_example.dart b/example/lib/sample/components/picker/date_picker_example.dart index 46408e2b..d2c9b332 100644 --- a/example/lib/sample/components/picker/date_picker_example.dart +++ b/example/lib/sample/components/picker/date_picker_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:example/sample/home/list_item.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/picker/multi_picker_example.dart b/example/lib/sample/components/picker/multi_picker_example.dart index 00ff73c3..33f33bd7 100644 --- a/example/lib/sample/components/picker/multi_picker_example.dart +++ b/example/lib/sample/components/picker/multi_picker_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:example/sample/home/list_item.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/picker/picker_entry_page.dart b/example/lib/sample/components/picker/picker_entry_page.dart index 508db7ca..c5484461 100644 --- a/example/lib/sample/components/picker/picker_entry_page.dart +++ b/example/lib/sample/components/picker/picker_entry_page.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'dart:convert'; import 'package:bruno/bruno.dart'; diff --git a/example/lib/sample/components/popup/overlay_window_example.dart b/example/lib/sample/components/popup/overlay_window_example.dart index cad07a2c..b58e0c81 100644 --- a/example/lib/sample/components/popup/overlay_window_example.dart +++ b/example/lib/sample/components/popup/overlay_window_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/popup/popwindow_example.dart b/example/lib/sample/components/popup/popwindow_example.dart index cb01d1d6..e5d5c1c9 100644 --- a/example/lib/sample/components/popup/popwindow_example.dart +++ b/example/lib/sample/components/popup/popwindow_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/rating/rating_example.dart b/example/lib/sample/components/rating/rating_example.dart index 4c1addfc..32a6de06 100644 --- a/example/lib/sample/components/rating/rating_example.dart +++ b/example/lib/sample/components/rating/rating_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; @@ -72,12 +74,12 @@ class _RatingExampleState extends State { Widget _buildRating(RatingState state) { switch (state) { case RatingState.select: - return BrunoTools.getAssetSizeImage(BrnAsset.ICON_STAR, 16, 16, color: Color(0xFF3571DC)); + return BrunoTools.getAssetSizeImage(BrnAsset.iconStar, 16, 16, color: Color(0xFF3571DC)); case RatingState.half: - return BrunoTools.getAssetSizeImage(BrnAsset.ICON_STAR_HALF, 16, 16); + return BrunoTools.getAssetSizeImage(BrnAsset.iconStarHalf, 16, 16); case RatingState.unselect: default: - return BrunoTools.getAssetSizeImage(BrnAsset.ICON_STAR, 16, 16, color: Color(0xFFF0F0F0)); + return BrunoTools.getAssetSizeImage(BrnAsset.iconStar, 16, 16, color: Color(0xFFF0F0F0)); } } } diff --git a/example/lib/sample/components/scroll_anchor/scroll_actor_tab_example.dart b/example/lib/sample/components/scroll_anchor/scroll_actor_tab_example.dart index 9060636a..d40acf31 100644 --- a/example/lib/sample/components/scroll_anchor/scroll_actor_tab_example.dart +++ b/example/lib/sample/components/scroll_anchor/scroll_actor_tab_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'dart:math'; import 'package:bruno/bruno.dart'; diff --git a/example/lib/sample/components/selectcity/selected_city_example.dart b/example/lib/sample/components/selectcity/selected_city_example.dart index 9082bd77..fc6d8a7b 100644 --- a/example/lib/sample/components/selectcity/selected_city_example.dart +++ b/example/lib/sample/components/selectcity/selected_city_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'dart:convert'; import 'package:bruno/bruno.dart'; diff --git a/example/lib/sample/components/selection/filter_entity.dart b/example/lib/sample/components/selection/filter_entity.dart index 23f2d8e5..f350d117 100644 --- a/example/lib/sample/components/selection/filter_entity.dart +++ b/example/lib/sample/components/selection/filter_entity.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; class BrnFilterEntity { diff --git a/example/lib/sample/components/selection/flat_selection_five_tags_example.dart b/example/lib/sample/components/selection/flat_selection_five_tags_example.dart index e4e7f2e6..ff03d625 100644 --- a/example/lib/sample/components/selection/flat_selection_five_tags_example.dart +++ b/example/lib/sample/components/selection/flat_selection_five_tags_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/selection/flat_selection_four_tags_example.dart b/example/lib/sample/components/selection/flat_selection_four_tags_example.dart index 9edd42e3..0db9c2f3 100644 --- a/example/lib/sample/components/selection/flat_selection_four_tags_example.dart +++ b/example/lib/sample/components/selection/flat_selection_four_tags_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/selection/flat_selection_three_tags_example.dart b/example/lib/sample/components/selection/flat_selection_three_tags_example.dart index 16de0f0a..463095dc 100644 --- a/example/lib/sample/components/selection/flat_selection_three_tags_example.dart +++ b/example/lib/sample/components/selection/flat_selection_three_tags_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/selection/selection_entry_page.dart b/example/lib/sample/components/selection/selection_entry_page.dart index d9b54394..bf325871 100644 --- a/example/lib/sample/components/selection/selection_entry_page.dart +++ b/example/lib/sample/components/selection/selection_entry_page.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'dart:convert'; import 'package:bruno/bruno.dart'; diff --git a/example/lib/sample/components/selection/selection_flat_entry_page.dart b/example/lib/sample/components/selection/selection_flat_entry_page.dart index 4dfda15b..e8a8efb6 100644 --- a/example/lib/sample/components/selection/selection_flat_entry_page.dart +++ b/example/lib/sample/components/selection/selection_flat_entry_page.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'dart:convert'; import 'package:bruno/bruno.dart'; diff --git a/example/lib/sample/components/selection/selectionview_custom_floating_layer_example.dart b/example/lib/sample/components/selection/selectionview_custom_floating_layer_example.dart index 016d6571..c7d6bdee 100644 --- a/example/lib/sample/components/selection/selectionview_custom_floating_layer_example.dart +++ b/example/lib/sample/components/selection/selectionview_custom_floating_layer_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:example/sample/components/card/bubble/common_bubble_example.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/selection/selectionview_customhandle_filter_example_page.dart b/example/lib/sample/components/selection/selectionview_customhandle_filter_example_page.dart index ae7f7681..d8df37b3 100644 --- a/example/lib/sample/components/selection/selectionview_customhandle_filter_example_page.dart +++ b/example/lib/sample/components/selection/selectionview_customhandle_filter_example_page.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/selection/selectionview_customview_example_page.dart b/example/lib/sample/components/selection/selectionview_customview_example_page.dart index d2e9475a..216b8567 100644 --- a/example/lib/sample/components/selection/selectionview_customview_example_page.dart +++ b/example/lib/sample/components/selection/selectionview_customview_example_page.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/selection/selectionview_date_filter_example_page.dart b/example/lib/sample/components/selection/selectionview_date_filter_example_page.dart index ac39b12e..6b9ecbb7 100644 --- a/example/lib/sample/components/selection/selectionview_date_filter_example_page.dart +++ b/example/lib/sample/components/selection/selectionview_date_filter_example_page.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/selection/selectionview_date_range_example_page.dart b/example/lib/sample/components/selection/selectionview_date_range_example_page.dart index dbec59e6..ec41dd0e 100644 --- a/example/lib/sample/components/selection/selectionview_date_range_example_page.dart +++ b/example/lib/sample/components/selection/selectionview_date_range_example_page.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/selection/selectionview_interceptor_example.dart b/example/lib/sample/components/selection/selectionview_interceptor_example.dart index 2c3cbf96..2b2053cc 100644 --- a/example/lib/sample/components/selection/selectionview_interceptor_example.dart +++ b/example/lib/sample/components/selection/selectionview_interceptor_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/selection/selectionview_limit_max_selected_count_example.dart b/example/lib/sample/components/selection/selectionview_limit_max_selected_count_example.dart index d70a16b2..ee5cc674 100644 --- a/example/lib/sample/components/selection/selectionview_limit_max_selected_count_example.dart +++ b/example/lib/sample/components/selection/selectionview_limit_max_selected_count_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/selection/selectionview_more_filter_example_page.dart b/example/lib/sample/components/selection/selectionview_more_filter_example_page.dart index 4d334be6..71737ef5 100644 --- a/example/lib/sample/components/selection/selectionview_more_filter_example_page.dart +++ b/example/lib/sample/components/selection/selectionview_more_filter_example_page.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:example/sample/components/button/big_fu_example.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/selection/selectionview_multi_list_example_page.dart b/example/lib/sample/components/selection/selectionview_multi_list_example_page.dart index 3d3c6172..fcc8b8a8 100644 --- a/example/lib/sample/components/selection/selectionview_multi_list_example_page.dart +++ b/example/lib/sample/components/selection/selectionview_multi_list_example_page.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/selection/selectionview_multi_range_example_page.dart b/example/lib/sample/components/selection/selectionview_multi_range_example_page.dart index bd5555de..f5acd339 100644 --- a/example/lib/sample/components/selection/selectionview_multi_range_example_page.dart +++ b/example/lib/sample/components/selection/selectionview_multi_range_example_page.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/selection/selectionview_simple_multi_check_example_page.dart b/example/lib/sample/components/selection/selectionview_simple_multi_check_example_page.dart index 4b680414..5f406d81 100755 --- a/example/lib/sample/components/selection/selectionview_simple_multi_check_example_page.dart +++ b/example/lib/sample/components/selection/selectionview_simple_multi_check_example_page.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:example/sample/components/selection/filter_entity.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/selection/selectionview_simple_single_list_example_page.dart b/example/lib/sample/components/selection/selectionview_simple_single_list_example_page.dart index b05f00ef..1f56fd65 100755 --- a/example/lib/sample/components/selection/selectionview_simple_single_list_example_page.dart +++ b/example/lib/sample/components/selection/selectionview_simple_single_list_example_page.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:example/sample/components/selection/filter_entity.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/step/brn_horizontal_step_example.dart b/example/lib/sample/components/step/brn_horizontal_step_example.dart index 5f92beb6..938e2c90 100644 --- a/example/lib/sample/components/step/brn_horizontal_step_example.dart +++ b/example/lib/sample/components/step/brn_horizontal_step_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/step/step_example.dart b/example/lib/sample/components/step/step_example.dart index b07eee16..13b1ae74 100644 --- a/example/lib/sample/components/step/step_example.dart +++ b/example/lib/sample/components/step/step_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:example/sample/components/step/brn_horizontal_step_example.dart'; import 'package:example/sample/components/step/step_line_example.dart'; diff --git a/example/lib/sample/components/step/step_line_example.dart b/example/lib/sample/components/step/step_line_example.dart index 7e2ad87f..61f70c6f 100644 --- a/example/lib/sample/components/step/step_line_example.dart +++ b/example/lib/sample/components/step/step_line_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'dart:math'; import 'package:bruno/bruno.dart'; diff --git a/example/lib/sample/components/sugsearch/search_text_example.dart b/example/lib/sample/components/sugsearch/search_text_example.dart index d29ebe20..1347faff 100644 --- a/example/lib/sample/components/sugsearch/search_text_example.dart +++ b/example/lib/sample/components/sugsearch/search_text_example.dart @@ -1,3 +1,4 @@ + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/switch/checkbox_example.dart b/example/lib/sample/components/switch/checkbox_example.dart index 33894921..ed0f0dd6 100644 --- a/example/lib/sample/components/switch/checkbox_example.dart +++ b/example/lib/sample/components/switch/checkbox_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/switch/radio_example.dart b/example/lib/sample/components/switch/radio_example.dart index a07db2f1..eee90493 100644 --- a/example/lib/sample/components/switch/radio_example.dart +++ b/example/lib/sample/components/switch/radio_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/tabbar/brn_switch_title_example.dart b/example/lib/sample/components/tabbar/brn_switch_title_example.dart index 55b826c9..d2879f89 100644 --- a/example/lib/sample/components/tabbar/brn_switch_title_example.dart +++ b/example/lib/sample/components/tabbar/brn_switch_title_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/tabbar/brn_tab_example.dart b/example/lib/sample/components/tabbar/brn_tab_example.dart index dd05f85f..1f527dcd 100644 --- a/example/lib/sample/components/tabbar/brn_tab_example.dart +++ b/example/lib/sample/components/tabbar/brn_tab_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:example/sample/home/list_item.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/tabbar/brn_tabbar_sticky_example.dart b/example/lib/sample/components/tabbar/brn_tabbar_sticky_example.dart index 886dd88b..be0d3cf6 100644 --- a/example/lib/sample/components/tabbar/brn_tabbar_sticky_example.dart +++ b/example/lib/sample/components/tabbar/brn_tabbar_sticky_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/tabbar/sub_switch_title_example.dart b/example/lib/sample/components/tabbar/sub_switch_title_example.dart index 4c870862..667b48fd 100644 --- a/example/lib/sample/components/tabbar/sub_switch_title_example.dart +++ b/example/lib/sample/components/tabbar/sub_switch_title_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/tag/border_tag_example.dart b/example/lib/sample/components/tag/border_tag_example.dart index aff03ec1..0ca214f4 100644 --- a/example/lib/sample/components/tag/border_tag_example.dart +++ b/example/lib/sample/components/tag/border_tag_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/tag/custom_tag_example.dart b/example/lib/sample/components/tag/custom_tag_example.dart index db9f8083..990a6992 100644 --- a/example/lib/sample/components/tag/custom_tag_example.dart +++ b/example/lib/sample/components/tag/custom_tag_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/tag/delete_tag_example.dart b/example/lib/sample/components/tag/delete_tag_example.dart index 8a4a657e..d58f7a42 100644 --- a/example/lib/sample/components/tag/delete_tag_example.dart +++ b/example/lib/sample/components/tag/delete_tag_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/tag/select_tag_example.dart b/example/lib/sample/components/tag/select_tag_example.dart index 56f56e24..d1e43090 100644 --- a/example/lib/sample/components/tag/select_tag_example.dart +++ b/example/lib/sample/components/tag/select_tag_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/tag/state_tag_example.dart b/example/lib/sample/components/tag/state_tag_example.dart index 3363d57a..2650e082 100644 --- a/example/lib/sample/components/tag/state_tag_example.dart +++ b/example/lib/sample/components/tag/state_tag_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/tag/tag_example.dart b/example/lib/sample/components/tag/tag_example.dart index 60aca84c..f47dba72 100644 --- a/example/lib/sample/components/tag/tag_example.dart +++ b/example/lib/sample/components/tag/tag_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:example/sample/components/tag/border_tag_example.dart'; import 'package:example/sample/components/tag/custom_tag_example.dart'; diff --git a/example/lib/sample/components/tag/tag_row_example.dart b/example/lib/sample/components/tag/tag_row_example.dart index ed035494..0148a89a 100644 --- a/example/lib/sample/components/tag/tag_row_example.dart +++ b/example/lib/sample/components/tag/tag_row_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/components/toast/toast_example.dart b/example/lib/sample/components/toast/toast_example.dart index a2c94304..39c7a348 100644 --- a/example/lib/sample/components/toast/toast_example.dart +++ b/example/lib/sample/components/toast/toast_example.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/home/card_data_config.dart b/example/lib/sample/home/card_data_config.dart index 99e7684f..79ce55e6 100644 --- a/example/lib/sample/home/card_data_config.dart +++ b/example/lib/sample/home/card_data_config.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'dart:convert'; import 'package:bruno/bruno.dart'; diff --git a/example/lib/sample/home/expandable_container_widget.dart b/example/lib/sample/home/expandable_container_widget.dart index 517d15c6..468b4af5 100644 --- a/example/lib/sample/home/expandable_container_widget.dart +++ b/example/lib/sample/home/expandable_container_widget.dart @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// @dart=2.9 + import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; diff --git a/example/lib/sample/home/group_card.dart b/example/lib/sample/home/group_card.dart index 10d5dbf4..ea4bc592 100644 --- a/example/lib/sample/home/group_card.dart +++ b/example/lib/sample/home/group_card.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:example/sample/home/list_item.dart'; import 'package:example/sample/home/card_data_config.dart'; diff --git a/example/lib/sample/home/home.dart b/example/lib/sample/home/home.dart index 9b3abc45..179aa98d 100644 --- a/example/lib/sample/home/home.dart +++ b/example/lib/sample/home/home.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:example/sample/home/card_data_config.dart'; import 'package:example/sample/home/group_card.dart'; diff --git a/example/lib/sample/home/list_item.dart b/example/lib/sample/home/list_item.dart index 616f1729..70ad5974 100644 --- a/example/lib/sample/home/list_item.dart +++ b/example/lib/sample/home/list_item.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'package:bruno/bruno.dart'; import 'package:flutter/material.dart'; diff --git a/example/lib/sample/theme/config_test_utils.dart b/example/lib/sample/theme/config_test_utils.dart index 0d741da6..8a0d7feb 100644 --- a/example/lib/sample/theme/config_test_utils.dart +++ b/example/lib/sample/theme/config_test_utils.dart @@ -1,3 +1,5 @@ +// @dart=2.9 + import 'dart:ui'; import 'package:bruno/bruno.dart'; diff --git a/example/pubspec.yaml b/example/pubspec.yaml index ac490489..ffb77c08 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.1.0 <3.0.0" + sdk: '>=2.12.0 <3.0.0' dependencies: flutter: @@ -35,7 +35,7 @@ dev_dependencies: sdk: flutter dependency_overrides: - intl: 0.16.0 + intl: ^0.17.0 # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec diff --git a/lib/src/components/actionsheet/brn_selected_list_action_sheet.dart b/lib/src/components/actionsheet/brn_selected_list_action_sheet.dart index 73bc76d1..d2c7bf0e 100644 --- a/lib/src/components/actionsheet/brn_selected_list_action_sheet.dart +++ b/lib/src/components/actionsheet/brn_selected_list_action_sheet.dart @@ -513,7 +513,7 @@ class _BrnActionSheetSelectedItemListState padding: const EdgeInsets.only( left: 5, right: 20), child: BrunoTools.getAssetImage( - BrnAsset.ICON_TRASH_BIN)), + BrnAsset.iconTrashBin)), ), ), ], diff --git a/lib/src/components/actionsheet/brn_share_action_sheet.dart b/lib/src/components/actionsheet/brn_share_action_sheet.dart index 6795d509..bf18f5f9 100644 --- a/lib/src/components/actionsheet/brn_share_action_sheet.dart +++ b/lib/src/components/actionsheet/brn_share_action_sheet.dart @@ -119,11 +119,11 @@ class BrnShareActionSheet extends StatelessWidget { channel = secondShareChannels[index]; } // 判断是否为自定义标题 - title = (channel.shareType == BrnShareItemConstants.SHARE_CUSTOM) + title = (channel.shareType == BrnShareItemConstants.shareCustom) ? (channel.customTitle ?? "") : BrnShareItemConstants.shareItemTitleList[channel.shareType]; // 判断是否为自定义,如果不是自定义图标,则判断是否可点击(决定是否使用置灰图标) - image = (channel.shareType == BrnShareItemConstants.SHARE_CUSTOM) + image = (channel.shareType == BrnShareItemConstants.shareCustom) ? channel.customImage : (channel.canClick ? BrunoTools.getAssetImage( diff --git a/lib/src/components/appraise/brn_appraise_emoji_list_view.dart b/lib/src/components/appraise/brn_appraise_emoji_list_view.dart index 7881a723..5ac4e945 100644 --- a/lib/src/components/appraise/brn_appraise_emoji_list_view.dart +++ b/lib/src/components/appraise/brn_appraise_emoji_list_view.dart @@ -36,29 +36,29 @@ class BrnAppraiseEmojiListView extends StatefulWidget { class _BrnAppraiseEmojiListViewState extends State { /// 未选中表情,灰色 List _unselectedIcons = [ - BrnAsset.ICON_APPRAISE_BAD_UNSELECTED, - BrnAsset.ICON_APPRAISE_NOT_GOOD_UNSELECTED, - BrnAsset.ICON_APPRAISE_OK_UNSELECTED, - BrnAsset.ICON_APPRAISE_GOOD_UNSELECTED, - BrnAsset.ICON_APPRAISE_SURPRISE_UNSELECTED, + BrnAsset.iconAppraiseBadUnselected, + BrnAsset.iconAppraiseNotGoodUnselected, + BrnAsset.iconAppraiseOkUnselected, + BrnAsset.iconAppraiseGoodUnselected, + BrnAsset.iconAppraiseSurpriseUnselected, ]; /// 默认表情,黄色 List _defaultIcons = [ - BrnAsset.ICON_APPRAISE_BAD_DEFAULT, - BrnAsset.ICON_APPRAISE_NOT_GOOD_DEFAULT, - BrnAsset.ICON_APPRAISE_OK_DEFAULT, - BrnAsset.ICON_APPRAISE_GOOD_DEFAULT, - BrnAsset.ICON_APPRAISE_SURPRISE_DEFAULT, + BrnAsset.iconAppraiseBadDefault, + BrnAsset.iconAppraiseNotGoodDefault, + BrnAsset.iconAppraiseOkDefault, + BrnAsset.iconAppraiseGoodDefault, + BrnAsset.iconAppraiseSurpriseDefault, ]; /// 选中表情,gif List _selectedIcons = [ - BrnAsset.ICON_APPRAISE_BAD_SELECTED, - BrnAsset.ICON_APPRAISE_NOT_GOOD_SELECTED, - BrnAsset.ICON_APPRAISE_OK_SELECTED, - BrnAsset.ICON_APPRAISE_GOOD_SELECTED, - BrnAsset.ICON_APPRAISE_SURPRISE_SELECTED, + BrnAsset.iconAppraiseBadSelected, + BrnAsset.iconAppraiseNotGoodSelected, + BrnAsset.iconAppraiseOkSelected, + BrnAsset.iconAppraiseGoodSelected, + BrnAsset.iconAppraiseSurpriseSelected, ]; int _selectedIndex = -1; diff --git a/lib/src/components/appraise/brn_appraise_header.dart b/lib/src/components/appraise/brn_appraise_header.dart index c0263f32..972a2f8b 100644 --- a/lib/src/components/appraise/brn_appraise_header.dart +++ b/lib/src/components/appraise/brn_appraise_header.dart @@ -102,7 +102,7 @@ class BrnAppraiseHeader extends StatelessWidget { } Navigator.of(context).pop(); }, - child: BrunoTools.getAssetImage(BrnAsset.ICON_PICKER_CLOSE), + child: BrunoTools.getAssetImage(BrnAsset.iconPickerClose), ), ], ), diff --git a/lib/src/components/button/collection/brn_multiple_bottom_button.dart b/lib/src/components/button/collection/brn_multiple_bottom_button.dart index 2a71ba67..fd5164d4 100644 --- a/lib/src/components/button/collection/brn_multiple_bottom_button.dart +++ b/lib/src/components/button/collection/brn_multiple_bottom_button.dart @@ -142,14 +142,14 @@ class _BrnMultipleBottomButtonState extends State { Widget _selectedCountWidget() { Image unfoldWidget = BrunoTools.getAssetImageWithColor( - BrnAsset.ICON_SELECTED_UP_TRIANGLE, + BrnAsset.iconSelectedUpTriangle, BrnThemeConfigurator.instance.getConfig().commonConfig.brandPrimary); Image foldWidget = - BrunoTools.getAssetImage(BrnAsset.ICON_UNSELECT_DOWN_TRIANGLE); + BrunoTools.getAssetImage(BrnAsset.iconUnSelectDownTriangle); Image cantFoldWidget = BrunoTools.getAssetImageWithColor( - BrnAsset.ICON_UNSELECT_DOWN_TRIANGLE, Color(0XCCCCCCCC)); + BrnAsset.iconUnSelectDownTriangle, Color(0XCCCCCCCC)); return GestureDetector( onTap: () { diff --git a/lib/src/components/button/collection/brn_text_button_panel.dart b/lib/src/components/button/collection/brn_text_button_panel.dart index 5110dd21..5b7c96d5 100644 --- a/lib/src/components/button/collection/brn_text_button_panel.dart +++ b/lib/src/components/button/collection/brn_text_button_panel.dart @@ -155,8 +155,8 @@ class _BrnTextButtonPanelState extends State { ); Widget imageWidget = _isExpanded - ? BrunoTools.getAssetImage(BrnAsset.ICON_UP_ARROW) - : BrunoTools.getAssetImage(BrnAsset.ICON_DOWN_ARROW); + ? BrunoTools.getAssetImage(BrnAsset.iconUpArrow) + : BrunoTools.getAssetImage(BrnAsset.iconDownArrow); return GestureDetector( child: Row( diff --git a/lib/src/components/calendar/brn_calendar_view.dart b/lib/src/components/calendar/brn_calendar_view.dart index 20229323..8f8427a4 100644 --- a/lib/src/components/calendar/brn_calendar_view.dart +++ b/lib/src/components/calendar/brn_calendar_view.dart @@ -177,9 +177,9 @@ class _CustomCalendarViewState extends State { color: Colors.transparent, padding: EdgeInsets.only(left: 15), child: isPreIconEnable - ? BrunoTools.getAssetImage(BrnAsset.ICON_CALENDAR_PRE_MONTH) + ? BrunoTools.getAssetImage(BrnAsset.iconCalendarPreMonth) : BrunoTools.getAssetImageWithColor( - BrnAsset.ICON_CALENDAR_PRE_MONTH, Color(0xFFCCCCCC)), + BrnAsset.iconCalendarPreMonth, Color(0xFFCCCCCC)), alignment: Alignment.center, ), ), @@ -218,9 +218,9 @@ class _CustomCalendarViewState extends State { padding: EdgeInsets.only(right: 15), child: isNextIconEnable ? BrunoTools.getAssetImage( - BrnAsset.ICON_CALENDAR_NEXT_MONTH) + BrnAsset.iconCalendarNextMonth) : BrunoTools.getAssetImageWithColor( - BrnAsset.ICON_CALENDAR_NEXT_MONTH, Color(0xFFCCCCCC)), + BrnAsset.iconCalendarNextMonth, Color(0xFFCCCCCC)), alignment: Alignment.center, ), ) 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 6fa74843..34259e21 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 @@ -248,10 +248,10 @@ class BrnEnhanceNumberCard extends StatelessWidget { ); if (model.iconTapCallBack != null) { Widget icon = - BrunoTools.getAssetSizeImage(BrnAsset.ICON_QUESTION, 14, 14); + BrunoTools.getAssetSizeImage(BrnAsset.iconQuestion, 14, 14); if (model.numberInfoIcon == BrnNumberInfoIcon.ARROW) { - icon = BrunoTools.getAssetSizeImage(BrnAsset.ICON_RIGHT_ARROW, 14, 14); + icon = BrunoTools.getAssetSizeImage(BrnAsset.iconRightArrow, 14, 14); } debugPrint('${tp.height}'); debugPrint(model.title); 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 11a7dc11..1704695f 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 @@ -239,7 +239,7 @@ class BrnRichGridInfo { child: Padding( padding: EdgeInsets.only(left: isKey ? 0 : 4), child: BrunoTools.getAssetSizeImage( - BrnAsset.ICON_PAIR_INFO_QUESTION, 14, 14), + BrnAsset.iconPairInfoQuestion, 14, 14), )); } 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 e5000e9a..16c74d7f 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 @@ -236,7 +236,7 @@ class _BrnPairInfoTableState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Expanded(child: valueWidget), - BrunoTools.getAssetImage(BrnAsset.ICON_RIGHT_ARROW), + BrunoTools.getAssetImage(BrnAsset.iconRightArrow), ], ); } @@ -271,7 +271,7 @@ class _BrnPairInfoTableState extends State { } BrnInfoModal _foldButtonWidget() { - Image img = BrunoTools.getAssetImage('icons/icon_uparrow.png'); + Image img = BrunoTools.getAssetImage(BrnAsset.iconUpArrow); Transform trsm = Transform.rotate(angle: pi, child: img); Row row = Row( children: [ @@ -330,7 +330,7 @@ class _BrnPairInfoTableState extends State { } BrnInfoModal _expandedButtonWidget() { - Image img = BrunoTools.getAssetImage('icons/icon_uparrow.png'); + Image img = BrunoTools.getAssetImage(BrnAsset.iconUpArrow); Row row = Row( children: [ Padding( @@ -473,7 +473,7 @@ mixin PairInfoPart { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Expanded(child: valueWidget), - BrunoTools.getAssetImage(BrnAsset.ICON_RIGHT_ARROW), + BrunoTools.getAssetImage(BrnAsset.iconRightArrow), ], ); } @@ -874,7 +874,7 @@ class BrnInfoModal { keyCallback(); } }, - child: BrunoTools.getAssetImage(BrnAsset.ICON_QUESTION), + child: BrunoTools.getAssetImage(BrnAsset.iconQuestion), ), Text( ':', @@ -907,7 +907,7 @@ class BrnInfoModal { valueCallback(); } }, - child: BrunoTools.getAssetImage(BrnAsset.ICON_QUESTION), + child: BrunoTools.getAssetImage(BrnAsset.iconQuestion), ) ], ); @@ -925,7 +925,7 @@ class BrnInfoModal { keyCallback(); } }, - child: BrunoTools.getAssetImage(BrnAsset.ICON_QUESTION), + child: BrunoTools.getAssetImage(BrnAsset.iconQuestion), )); keyGen.addText(':', textStyle: themeData.keyTextStyle?.generateTextStyle()); @@ -942,7 +942,7 @@ class BrnInfoModal { valueCallback(); } }, - child: BrunoTools.getAssetImage(BrnAsset.ICON_QUESTION), + child: BrunoTools.getAssetImage(BrnAsset.iconQuestion), )); } valueWidget = valueGen.build(); diff --git a/lib/src/components/card_title/brn_action_card_title.dart b/lib/src/components/card_title/brn_action_card_title.dart index 49c54dcd..5ab94b37 100644 --- a/lib/src/components/card_title/brn_action_card_title.dart +++ b/lib/src/components/card_title/brn_action_card_title.dart @@ -142,7 +142,7 @@ class BrnActionCardTitle extends StatelessWidget { } Widget _arrowWidget() { - return BrunoTools.getAssetSizeImage(BrnAsset.ICON_RIGHT_ARROW, 16, 16); + return BrunoTools.getAssetSizeImage(BrnAsset.iconRightArrow, 16, 16); } Widget _accessoryTextWidget(BrnCardTitleConfig defaultConfig) { diff --git a/lib/src/components/dialog/brn_content_export_dialog.dart b/lib/src/components/dialog/brn_content_export_dialog.dart index 2c8b96b5..87fd5598 100644 --- a/lib/src/components/dialog/brn_content_export_dialog.dart +++ b/lib/src/components/dialog/brn_content_export_dialog.dart @@ -102,7 +102,7 @@ class BrnContentExportWidget extends StatelessWidget { behavior: HitTestBehavior.opaque, child: Padding( padding: EdgeInsets.all(15), - child: BrunoTools.getAssetImage(BrnAsset.ICON_PICKER_CLOSE), + child: BrunoTools.getAssetImage(BrnAsset.iconPickerClose), ))); } return Container(); diff --git a/lib/src/components/dialog/brn_share_dialog.dart b/lib/src/components/dialog/brn_share_dialog.dart index 05bf2196..954aa737 100644 --- a/lib/src/components/dialog/brn_share_dialog.dart +++ b/lib/src/components/dialog/brn_share_dialog.dart @@ -159,7 +159,7 @@ class BrnShareDialog extends StatelessWidget { child: Container( width: 30, height: 30, - child: BrunoTools.getAssetImage(BrnAsset.ICON_PICKER_CLOSE), + child: BrunoTools.getAssetImage(BrnAsset.iconPickerClose), ), onTap: () { Navigator.of(context).pop(); @@ -203,7 +203,7 @@ class BrnShareDialog extends StatelessWidget { for (int index = 0; index < shareChannels.length; index++) { title = null; image = null; - if (shareChannels[index] == BrnShareItemConstants.SHARE_CUSTOM) { + if (shareChannels[index] == BrnShareItemConstants.shareCustom) { // 获取自定义channel信息 title = getCustomChannelTitle(index); image = getCustomChannelWidget(index); diff --git a/lib/src/components/dialog/brn_single_select.dart b/lib/src/components/dialog/brn_single_select.dart index 959fb696..6a2bafe2 100644 --- a/lib/src/components/dialog/brn_single_select.dart +++ b/lib/src/components/dialog/brn_single_select.dart @@ -244,7 +244,7 @@ class BrnSingleSelectDialogWidgetState child: Padding( padding: EdgeInsets.all(15), child: BrunoTools.getAssetImage( - BrnAsset.ICON_PICKER_CLOSE), + BrnAsset.iconPickerClose), ))) : Container() ], diff --git a/lib/src/components/form/items/general/brn_quick_select_input_item.dart b/lib/src/components/form/items/general/brn_quick_select_input_item.dart index e200ba5b..8bf54770 100644 --- a/lib/src/components/form/items/general/brn_quick_select_input_item.dart +++ b/lib/src/components/form/items/general/brn_quick_select_input_item.dart @@ -346,7 +346,7 @@ class QuickButtonsState extends State { child: Text( str, style: TextStyle( - fontSize: BrnFonts.FONT_12, + fontSize: BrnFonts.f12, ), ), onPressed: () { diff --git a/lib/src/components/form/items/general/brn_range_input_item.dart b/lib/src/components/form/items/general/brn_range_input_item.dart index eb7fda17..cf7f98eb 100644 --- a/lib/src/components/form/items/general/brn_range_input_item.dart +++ b/lib/src/components/form/items/general/brn_range_input_item.dart @@ -233,7 +233,7 @@ class BrnRangeInputFormItemState extends State { widget.minUnit ?? "", style: TextStyle( color: Color(0xFF101010), - fontSize: BrnFonts.FONT_16, + fontSize: BrnFonts.f16, ), )), Container( @@ -242,7 +242,7 @@ class BrnRangeInputFormItemState extends State { "—", style: TextStyle( color: Color(0xFF101010), - fontSize: BrnFonts.FONT_16, + fontSize: BrnFonts.f16, ), )), Container( @@ -288,7 +288,7 @@ class BrnRangeInputFormItemState extends State { widget.maxUnit ?? "", style: TextStyle( color: Color(0xFF101010), - fontSize: BrnFonts.FONT_16, + fontSize: BrnFonts.f16, ), )), ], diff --git a/lib/src/components/form/items/general/brn_star_input_item.dart b/lib/src/components/form/items/general/brn_star_input_item.dart index 32223668..e8ade984 100644 --- a/lib/src/components/form/items/general/brn_star_input_item.dart +++ b/lib/src/components/form/items/general/brn_star_input_item.dart @@ -193,13 +193,13 @@ class BrnStarsFormItemState extends State { Image getStar(int index, int selectCount, int sum) { if (selectCount <= 0) { - return BrunoTools.getAssetImage(BrnAsset.ICON_STAR_UNSELECT); + return BrunoTools.getAssetImage(BrnAsset.iconStarUnSelect); } if (index < selectCount) { - return BrunoTools.getAssetImage(BrnAsset.ICON_STAR_SELECT); + return BrunoTools.getAssetImage(BrnAsset.iconStarSelect); } - return BrunoTools.getAssetImage(BrnAsset.ICON_STAR_UNSELECT); + return BrunoTools.getAssetImage(BrnAsset.iconStarUnSelect); } } diff --git a/lib/src/components/form/items/general/brn_step_input_item.dart b/lib/src/components/form/items/general/brn_step_input_item.dart index 248a6385..ac081f2a 100644 --- a/lib/src/components/form/items/general/brn_step_input_item.dart +++ b/lib/src/components/form/items/general/brn_step_input_item.dart @@ -179,7 +179,7 @@ class BrnStepInputFormItemState extends State { "${widget.value}", style: TextStyle( color: Color(0xFF222222), - fontSize: BrnFonts.FONT_16, + fontSize: BrnFonts.f16, ), ), ), @@ -237,14 +237,14 @@ class BrnStepInputFormItemState extends State { Image getAddIcon() { if (widget.isEdit != null && !widget.isEdit) { - return BrunoTools.getAssetImage(BrnAsset.ICON_ADD_DISABLE); + return BrunoTools.getAssetImage(BrnAsset.iconAddDisable); } if (isReachMaxLevel()) { - return BrunoTools.getAssetImage(BrnAsset.ICON_ADD_DISABLE); + return BrunoTools.getAssetImage(BrnAsset.iconAddDisable); } - return BrunoTools.getAssetImage(BrnAsset.ICON_ADD_ENABLE); + return BrunoTools.getAssetImage(BrnAsset.iconAddEnable); } bool isReachMaxLevel() { @@ -263,14 +263,14 @@ class BrnStepInputFormItemState extends State { Image getMinusIcon() { if (widget.isEdit != null && !widget.isEdit) { - return BrunoTools.getAssetImage(BrnAsset.ICON_MINUS_DISABLE); + return BrunoTools.getAssetImage(BrnAsset.iconMinusDisable); } if (isReachMinLevel()) { - return BrunoTools.getAssetImage(BrnAsset.ICON_MINUS_DISABLE); + return BrunoTools.getAssetImage(BrnAsset.iconMinusDisable); } - return BrunoTools.getAssetImage(BrnAsset.ICON_MINUS_ENABLE); + return BrunoTools.getAssetImage(BrnAsset.iconMinusEnable); } bool isReachMinLevel() { diff --git a/lib/src/components/form/items/general/brn_text_input_item.dart b/lib/src/components/form/items/general/brn_text_input_item.dart index fa52c00c..79559c7b 100644 --- a/lib/src/components/form/items/general/brn_text_input_item.dart +++ b/lib/src/components/form/items/general/brn_text_input_item.dart @@ -211,7 +211,7 @@ class BrnTextInputFormItemState extends State { widget.unit ?? "", style: TextStyle( color: Color(0xFF101010), - fontSize: BrnFonts.FONT_16, + fontSize: BrnFonts.f16, ), )), ), diff --git a/lib/src/components/form/items/general/brn_text_select_item.dart b/lib/src/components/form/items/general/brn_text_select_item.dart index 22e7490e..ed520208 100644 --- a/lib/src/components/form/items/general/brn_text_select_item.dart +++ b/lib/src/components/form/items/general/brn_text_select_item.dart @@ -149,7 +149,7 @@ class BrnTextSelectFormItem extends StatefulWidget { } } -double _fontSize = BrnFonts.FONT_16; +double _fontSize = BrnFonts.f16; StrutStyle _contentStructStyle = StrutStyle( forceStrutHeight: true, height: 1, leading: 0.5, fontSize: _fontSize); @@ -291,7 +291,7 @@ class BrnTextSelectFormItemState extends State { forceStrutHeight: true, height: 1, leading: 0.5, - fontSize: BrnFonts.FONT_14), + fontSize: BrnFonts.f14), style: BrnFormUtil.getTipsTextStyle(widget.themeData), ), ), diff --git a/lib/src/components/form/items/general/brn_title_select_input_item.dart b/lib/src/components/form/items/general/brn_title_select_input_item.dart index 03479b54..90193d38 100644 --- a/lib/src/components/form/items/general/brn_title_select_input_item.dart +++ b/lib/src/components/form/items/general/brn_title_select_input_item.dart @@ -275,8 +275,8 @@ class BrnTitleSelectInputFormItemState builder: (BuildContext context, AsyncSnapshot snapshot) { return snapshot.data ? BrunoTools.getAssetImageWithBandColor( - BrnAsset.ICON_SELECTED_UP_TRIANGLE) - : BrunoTools.getAssetImage(BrnAsset.ICON_UNSELECT_DOWN_TRIANGLE); + BrnAsset.iconSelectedUpTriangle) + : BrunoTools.getAssetImage(BrnAsset.iconUnSelectDownTriangle); }, ), ); @@ -298,7 +298,7 @@ class BrnTitleSelectInputFormItemState border: InputBorder.none, hintStyle: TextStyle( color: Color(0xFFCCCCCC), - fontSize: BrnFonts.FONT_16, + fontSize: BrnFonts.f16, textBaseline: TextBaseline.alphabetic), hintText: widget.hint ?? '请输入', counterText: "", 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 f7cee515..73c7584f 100644 --- a/lib/src/components/form/items/group/brn_normal_group.dart +++ b/lib/src/components/form/items/group/brn_normal_group.dart @@ -136,7 +136,7 @@ class BrnNormalFormGroupState extends State { widget.deleteLabel ?? "", style: TextStyle( color: Color(0xFFFA3F3F), - fontSize: BrnFonts.FONT_16, + fontSize: BrnFonts.f16, ), ), ), diff --git a/lib/src/components/form/items/group/element_expand_widget.dart b/lib/src/components/form/items/group/element_expand_widget.dart index 0f1fb5e7..887f6c33 100644 --- a/lib/src/components/form/items/group/element_expand_widget.dart +++ b/lib/src/components/form/items/group/element_expand_widget.dart @@ -227,7 +227,7 @@ class _ExpansionElementState extends State widget.deleteText ?? "", style: TextStyle( color: Color(0xFFFA3F3F), - fontSize: BrnFonts.FONT_16, + fontSize: BrnFonts.f16, ), ), ), diff --git a/lib/src/components/form/items/misc/brn_add_label_item.dart b/lib/src/components/form/items/misc/brn_add_label_item.dart index 500c8cb0..645fbb66 100644 --- a/lib/src/components/form/items/misc/brn_add_label_item.dart +++ b/lib/src/components/form/items/misc/brn_add_label_item.dart @@ -59,7 +59,7 @@ class BrnAddLabelState extends State { .getConfig() .commonConfig .brandPrimary, - fontSize: BrnFonts.FONT_18, + fontSize: BrnFonts.f18, ), ), ), diff --git a/lib/src/components/form/items/misc/brn_title_item.dart b/lib/src/components/form/items/misc/brn_title_item.dart index 2ae42450..a9451a14 100644 --- a/lib/src/components/form/items/misc/brn_title_item.dart +++ b/lib/src/components/form/items/misc/brn_title_item.dart @@ -135,7 +135,7 @@ class BrnTitleFormItemState extends State { widget.operationLabel ?? "", style: TextStyle( color: widget.themeData.commonConfig.brandPrimary, - fontSize: BrnFonts.FONT_16, + fontSize: BrnFonts.f16, ), )), ), diff --git a/lib/src/components/form/undetermined/brn_expandable_group.dart b/lib/src/components/form/undetermined/brn_expandable_group.dart index eb05a0fa..1db00a64 100644 --- a/lib/src/components/form/undetermined/brn_expandable_group.dart +++ b/lib/src/components/form/undetermined/brn_expandable_group.dart @@ -129,9 +129,9 @@ class _BrnExpansionElementState extends State if (_isExpanded) { arrowIcon = - BrunoTools.getAssetSizeImage(BrnAsset.ICON_DOWN_ARROW, 12, 12); + BrunoTools.getAssetSizeImage(BrnAsset.iconDownArrow, 12, 12); } else { - arrowIcon = BrunoTools.getAssetSizeImage(BrnAsset.ICON_UP_ARROW, 12, 12); + arrowIcon = BrunoTools.getAssetSizeImage(BrnAsset.iconUpArrow, 12, 12); } } diff --git a/lib/src/components/form/utils/brn_form_util.dart b/lib/src/components/form/utils/brn_form_util.dart index 1dd28e05..78ddb05a 100644 --- a/lib/src/components/form/utils/brn_form_util.dart +++ b/lib/src/components/form/utils/brn_form_util.dart @@ -117,9 +117,9 @@ class BrnFormUtil { static Widget getPrefixIcon(String type) { if (type == BrnPrefixIconType.TYPE_ADD) { - return BrunoTools.getAssetImageWithBandColor(BrnAsset.ICON_ADD_FORM_ITEM); + return BrunoTools.getAssetImageWithBandColor(BrnAsset.iconAddFormItem); } else if (type == BrnPrefixIconType.TYPE_REMOVE) { - return BrunoTools.getAssetImage(BrnAsset.ICON_REMOVE_FORM_ITEM); + return BrunoTools.getAssetImage(BrnAsset.iconRemoveFormItem); } else { return Container(); } @@ -146,7 +146,7 @@ class BrnFormUtil { padding: isRequire ? EdgeInsets.only(right: 2) : EdgeInsets.only(right: 0), child: isRequire - ? BrunoTools.getAssetSizeImage(BrnAsset.ICON_REQUIRE_RED, 8, 8, + ? BrunoTools.getAssetSizeImage(BrnAsset.iconRequireRed, 8, 8, color: Color(0xFFFA3F3F)) : null, ); @@ -155,11 +155,11 @@ class BrnFormUtil { /// 视觉同学要求修改右箭头图标 static Image getRightArrowIcon() { return BrunoTools.getAssetSizeImage( - BrnAsset.ICON_RIGHT_ARROW, rightArrowSize, rightArrowSize); + BrnAsset.iconRightArrow, rightArrowSize, rightArrowSize); } static Image getQuestionMarkIcon() { - return BrunoTools.getAssetImage(BrnAsset.ICON_QUESTION); + return BrunoTools.getAssetImage(BrnAsset.iconQuestion); } /// 设置录入项总的padding, 不包括顶部和底部padding diff --git a/lib/src/components/gallery/config/brn_bottom_card.dart b/lib/src/components/gallery/config/brn_bottom_card.dart index 3e2dc624..8d6f0ebd 100644 --- a/lib/src/components/gallery/config/brn_bottom_card.dart +++ b/lib/src/components/gallery/config/brn_bottom_card.dart @@ -83,7 +83,7 @@ class _BrnPhotoBottomCardState extends State Transform.rotate( angle: pi, child: BrunoTools.getAssetImageWithColor( - BrnAsset.ICON_UPARROW, widget.themeData.iconColor), + BrnAsset.iconUpArrow, widget.themeData.iconColor), ) ], ), @@ -119,7 +119,7 @@ class _BrnPhotoBottomCardState extends State ?.generateTextStyle()), ), BrunoTools.getAssetImageWithColor( - BrnAsset.ICON_UPARROW, widget.themeData.iconColor) + BrnAsset.iconUpArrow, widget.themeData.iconColor) ], ), ) diff --git a/lib/src/components/guide/brn_tip_widget.dart b/lib/src/components/guide/brn_tip_widget.dart index b5b66a7b..94c42557 100644 --- a/lib/src/components/guide/brn_tip_widget.dart +++ b/lib/src/components/guide/brn_tip_widget.dart @@ -200,7 +200,7 @@ class BrnTipInfoWidget extends StatelessWidget { onClose(); }, child: BrunoTools.getAssetImageWithColor( - BrnAsset.ICON_CLOSE, Colors.black), + BrnAsset.iconClose, Colors.black), ), ), ], diff --git a/lib/src/components/navbar/brn_search_bar.dart b/lib/src/components/navbar/brn_search_bar.dart index 974cd9b8..4efe58a9 100644 --- a/lib/src/components/navbar/brn_search_bar.dart +++ b/lib/src/components/navbar/brn_search_bar.dart @@ -270,7 +270,7 @@ class __SearchInputWidgetState extends State<_SearchInputWidget> { Padding( padding: EdgeInsets.only(right: 8.0), child: - BrunoTools.getAssetSizeImage(BrnAsset.ICON_SEARCH, 16, 16), + BrunoTools.getAssetSizeImage(BrnAsset.iconSearch, 16, 16), ), Expanded( child: TextField( @@ -343,7 +343,7 @@ class __SearchInputWidgetState extends State<_SearchInputWidget> { right: valueNotifier.value ? 24 : 20, left: valueNotifier.value ? 24 : 20), child: Image.asset( - 'assets/${BrnAsset.ICON_DELETE_TEXT}', + 'assets/${BrnAsset.iconDeleteText}', color: _defaultClearIconColor, scale: 3.0, height: 16, diff --git a/lib/src/components/noticebar/brn_notice_bar.dart b/lib/src/components/noticebar/brn_notice_bar.dart index c8ad8fbe..1ba2dc20 100644 --- a/lib/src/components/noticebar/brn_notice_bar.dart +++ b/lib/src/components/noticebar/brn_notice_bar.dart @@ -154,73 +154,73 @@ class BrnNoticeBar extends StatelessWidget { class NoticeStyles { ///红色+失败+箭头 static NoticeStyle failWithArrow = NoticeStyle( - BrunoTools.getAssetImage(BrnAsset.ICON_NOTICE_FAIL), + BrunoTools.getAssetImage(BrnAsset.iconNoticeFail), Color(0xFFFA3F3F), Color(0xFFFEEDED), - BrunoTools.getAssetImage(BrnAsset.ICON_NOTICE_ARROW_RED)); + BrunoTools.getAssetImage(BrnAsset.iconNoticeArrowRed)); ///红色+失败+关闭 static NoticeStyle failWithClose = NoticeStyle( - BrunoTools.getAssetImage(BrnAsset.ICON_NOTICE_FAIL), + BrunoTools.getAssetImage(BrnAsset.iconNoticeFail), Color(0xFFFA3F3F), Color(0xFFFEEDED), - BrunoTools.getAssetImage(BrnAsset.ICON_NOTICE_CLOSE_RED)); + BrunoTools.getAssetImage(BrnAsset.iconNoticeCloseRed)); ///蓝色+进行中+箭头 static NoticeStyle runningWithArrow = NoticeStyle( - BrunoTools.getAssetImage(BrnAsset.ICON_NOTICE_RUNNING), + BrunoTools.getAssetImage(BrnAsset.iconNoticeRunning), Color(0xFF0984F9), Color(0xFFE0EDFF), - BrunoTools.getAssetImage(BrnAsset.ICON_NOTICE_ARROW_BLUE)); + BrunoTools.getAssetImage(BrnAsset.iconNoticeArrowBlue)); ///蓝色+进行中+关闭 static NoticeStyle runningWithClose = NoticeStyle( - BrunoTools.getAssetImage(BrnAsset.ICON_NOTICE_RUNNING), + BrunoTools.getAssetImage(BrnAsset.iconNoticeRunning), Color(0xFF0984F9), Color(0xFFE0EDFF), - BrunoTools.getAssetImage(BrnAsset.ICON_NOTICE_CLOSE_BLUE)); + BrunoTools.getAssetImage(BrnAsset.iconNoticeCloseBlue)); ///绿色+完成+箭头 static NoticeStyle succeedWithArrow = NoticeStyle( - BrunoTools.getAssetImage(BrnAsset.ICON_NOTICE_SUCCEED), + BrunoTools.getAssetImage(BrnAsset.iconNoticeSucceed), Color(0xFF00AE66), Color(0xFFEBFFF7), - BrunoTools.getAssetImage(BrnAsset.ICON_NOTICE_ARROW_GREEN)); + BrunoTools.getAssetImage(BrnAsset.iconNoticeArrowGreen)); ///绿色+完成+关闭 static NoticeStyle succeedWithClose = NoticeStyle( - BrunoTools.getAssetImage(BrnAsset.ICON_NOTICE_SUCCEED), + BrunoTools.getAssetImage(BrnAsset.iconNoticeSucceed), Color(0xFF00AE66), Color(0xFFEBFFF7), - BrunoTools.getAssetImage(BrnAsset.ICON_NOTICE_CLOSE_GREEN)); + BrunoTools.getAssetImage(BrnAsset.iconNoticeCloseGreen)); ///橘色+警告+箭头 static NoticeStyle warningWithArrow = NoticeStyle( - BrunoTools.getAssetImage(BrnAsset.ICON_NOTICE_WARNING), + BrunoTools.getAssetImage(BrnAsset.iconNoticeWarning), Color(0xFFFAAD14), Color(0xFFFDFCEC), - BrunoTools.getAssetImage(BrnAsset.ICON_NOTICE_ARROW_ORANGE)); + BrunoTools.getAssetImage(BrnAsset.iconNoticeArrowOrange)); ///橘色+警告+关闭 static NoticeStyle warningWithClose = NoticeStyle( - BrunoTools.getAssetImage(BrnAsset.ICON_NOTICE_WARNING), + BrunoTools.getAssetImage(BrnAsset.iconNoticeWarning), Color(0xFFFAAD14), Color(0xFFFDFCEC), - BrunoTools.getAssetImage(BrnAsset.ICON_NOTICE_CLOSE_ORANGE)); + BrunoTools.getAssetImage(BrnAsset.iconNoticeCloseOrange)); ///橘色+通知+箭头 static NoticeStyle normalNoticeWithArrow = NoticeStyle( - BrunoTools.getAssetImage(BrnAsset.ICON_NOTICE), + BrunoTools.getAssetImage(BrnAsset.iconNotice), Color(0xFFFAAD14), Color(0xFFFDFCEC), - BrunoTools.getAssetImage(BrnAsset.ICON_NOTICE_ARROW_ORANGE)); + BrunoTools.getAssetImage(BrnAsset.iconNoticeArrowOrange)); ///橘色+通知+关闭 static NoticeStyle normalNoticeWithClose = NoticeStyle( - BrunoTools.getAssetImage(BrnAsset.ICON_NOTICE), + BrunoTools.getAssetImage(BrnAsset.iconNotice), Color(0xFFFAAD14), Color(0xFFFDFCEC), - BrunoTools.getAssetImage(BrnAsset.ICON_NOTICE_CLOSE_ORANGE)); + BrunoTools.getAssetImage(BrnAsset.iconNoticeCloseOrange)); } /// 通知样式 diff --git a/lib/src/components/picker/brn_select_tags_with_input_picker.dart b/lib/src/components/picker/brn_select_tags_with_input_picker.dart index 3fe88715..7c21e2f0 100644 --- a/lib/src/components/picker/brn_select_tags_with_input_picker.dart +++ b/lib/src/components/picker/brn_select_tags_with_input_picker.dart @@ -265,7 +265,7 @@ class _BrnSelectTagsWithInputPickerWidgetState }, child: Padding( padding: EdgeInsets.all(4), - child: BrunoTools.getAssetImage(BrnAsset.ICON_PICKER_CLOSE), + child: BrunoTools.getAssetImage(BrnAsset.iconPickerClose), )) ], ), diff --git a/lib/src/components/picker/multi_range_picker/bean/brn_multi_column_picker_entity.dart b/lib/src/components/picker/multi_range_picker/bean/brn_multi_column_picker_entity.dart index 89c42137..81b95621 100644 --- a/lib/src/components/picker/multi_range_picker/bean/brn_multi_column_picker_entity.dart +++ b/lib/src/components/picker/multi_range_picker/bean/brn_multi_column_picker_entity.dart @@ -47,7 +47,7 @@ class BrnPickerEntity { /// 默认支持最大选中个数为 65535 this.maxSelectedCount = - maxSelectedCount ?? BrnSelectionConstant.MAX_SELECT_COUNT; + maxSelectedCount ?? BrnSelectionConstant.maxSelectCount; } static BrnPickerEntity fromMap(Map map) { @@ -65,7 +65,7 @@ class BrnPickerEntity { int.tryParse(map['maxSelectedCount']) != null) { entity.maxSelectedCount = int.tryParse(map['maxSelectedCount']); } else { - entity.maxSelectedCount = BrnSelectionConstant.MAX_SELECT_COUNT; + entity.maxSelectedCount = BrnSelectionConstant.maxSelectCount; } entity.extMap = map['ext'] ?? {}; // entity.children = map['children'] ?? []; diff --git a/lib/src/components/popup/brn_popup_window.dart b/lib/src/components/popup/brn_popup_window.dart index 67691420..95e41d38 100644 --- a/lib/src/components/popup/brn_popup_window.dart +++ b/lib/src/components/popup/brn_popup_window.dart @@ -326,7 +326,7 @@ class _BrnPopupWindowState extends State { child: Padding( padding: EdgeInsets.only(left: 6), child: BrunoTools.getAssetImage( - BrnAsset.ICON_POPUP_CLOSE), + BrnAsset.iconPopupClose), )) : TextSpan(text: "") ])) @@ -346,7 +346,7 @@ class _BrnPopupWindowState extends State { ? Padding( padding: EdgeInsets.only(left: 6), child: BrunoTools.getAssetImage( - BrnAsset.ICON_POPUP_CLOSE), + BrnAsset.iconPopupClose), ) : Text("") ], diff --git a/lib/src/components/radio/brn_checkbox.dart b/lib/src/components/radio/brn_checkbox.dart index 00762859..5efaf772 100644 --- a/lib/src/components/radio/brn_checkbox.dart +++ b/lib/src/components/radio/brn_checkbox.dart @@ -81,12 +81,12 @@ class BrnCheckboxState extends State { mainAxisAlignment: widget.mainAxisAlignment, mainAxisSize: widget.mainAxisSize, selectedImage: BrunoTools.getAssetImageWithBandColor( - BrnAsset.ICON_RADIO_MULTI_SELECTED), - unselectedImage: BrunoTools.getAssetImage(BrnAsset.ICON_RADIO_UNSELECTED), + BrnAsset.iconRadioMultiSelected), + unselectedImage: BrunoTools.getAssetImage(BrnAsset.iconRadioUnSelected), disSelectedImage: - BrunoTools.getAssetImage(BrnAsset.ICON_RADIO_DISABLE_SINGLE_SELECTED), + BrunoTools.getAssetImage(BrnAsset.iconRadioDisableSingleSelected), disUnselectedImage: - BrunoTools.getAssetImage(BrnAsset.ICON_RADIO_DISABLE_UNSELECTED), + BrunoTools.getAssetImage(BrnAsset.iconRadioDisableUnselected), child: widget.child, onRadioItemClick: () { setState(() { diff --git a/lib/src/components/radio/brn_radio_button.dart b/lib/src/components/radio/brn_radio_button.dart index bfcb9e28..93c3217b 100644 --- a/lib/src/components/radio/brn_radio_button.dart +++ b/lib/src/components/radio/brn_radio_button.dart @@ -66,12 +66,12 @@ class BrnRadioButton extends StatelessWidget { mainAxisAlignment: mainAxisAlignment, mainAxisSize: mainAxisSize, selectedImage: BrunoTools.getAssetImageWithBandColor( - BrnAsset.ICON_RADIO_SINGLE_SELECTED), - unselectedImage: BrunoTools.getAssetImage(BrnAsset.ICON_RADIO_UNSELECTED), + BrnAsset.iconRadioSingleSelected), + unselectedImage: BrunoTools.getAssetImage(BrnAsset.iconRadioUnSelected), disSelectedImage: - BrunoTools.getAssetImage(BrnAsset.ICON_RADIO_DISABLE_MULTI_SELECTED), + BrunoTools.getAssetImage(BrnAsset.iconRadioDisableMultiSelected), disUnselectedImage: - BrunoTools.getAssetImage(BrnAsset.ICON_RADIO_DISABLE_UNSELECTED), + BrunoTools.getAssetImage(BrnAsset.iconRadioDisableUnselected), child: child, onRadioItemClick: () { onValueChangedAtIndex(radioIndex, true); diff --git a/lib/src/components/rating/brn_rating_star.dart b/lib/src/components/rating/brn_rating_star.dart index fb48e128..dbb0bec1 100644 --- a/lib/src/components/rating/brn_rating_star.dart +++ b/lib/src/components/rating/brn_rating_star.dart @@ -132,12 +132,12 @@ class _BrnRatingStarState extends State { Widget _buildRating(RatingState state) { switch (state) { case RatingState.select: - return BrunoTools.getAssetSizeImage(BrnAsset.ICON_STAR, 16, 16); + return BrunoTools.getAssetSizeImage(BrnAsset.iconStar, 16, 16); case RatingState.half: - return BrunoTools.getAssetSizeImage(BrnAsset.ICON_STAR_HALF, 16, 16); + return BrunoTools.getAssetSizeImage(BrnAsset.iconStarHalf, 16, 16); case RatingState.unselect: default: - return BrunoTools.getAssetSizeImage(BrnAsset.ICON_STAR, 16, 16, + return BrunoTools.getAssetSizeImage(BrnAsset.iconStar, 16, 16, color: Color(0xFFF0F0F0)); } } diff --git a/lib/src/components/selectcity/brn_single_select_city_page.dart b/lib/src/components/selectcity/brn_single_select_city_page.dart index a7a13fe6..ba17a40d 100644 --- a/lib/src/components/selectcity/brn_single_select_city_page.dart +++ b/lib/src/components/selectcity/brn_single_select_city_page.dart @@ -168,7 +168,7 @@ class _BrnSingleSelectCityPageState extends State { textAlign: TextAlign.center, style: TextStyle( color: Color(0xFF222222), - fontSize: BrnFonts.FONT_12, + fontSize: BrnFonts.f12, fontWeight: FontWeight.w400, ), ), diff --git a/lib/src/components/selection/bean/brn_selection_common_entity.dart b/lib/src/components/selection/bean/brn_selection_common_entity.dart index 37d4d053..fc56f700 100644 --- a/lib/src/components/selection/bean/brn_selection_common_entity.dart +++ b/lib/src/components/selection/bean/brn_selection_common_entity.dart @@ -136,7 +136,7 @@ class BrnSelectionEntity { /// 默认支持最大选中个数为 65535 this.maxSelectedCount = - maxSelectedCount ?? BrnSelectionConstant.MAX_SELECT_COUNT; + maxSelectedCount ?? BrnSelectionConstant.maxSelectCount; } /// 构造简单筛选数据 @@ -153,7 +153,7 @@ class BrnSelectionEntity { /// 默认支持最大选中个数为 65535 this.maxSelectedCount = - maxSelectedCount ?? BrnSelectionConstant.MAX_SELECT_COUNT; + maxSelectedCount ?? BrnSelectionConstant.maxSelectCount; } BrnSelectionEntity.fromJson(Map map) { @@ -168,7 +168,7 @@ class BrnSelectionEntity { int.tryParse(map['maxSelectedCount']) != null) { maxSelectedCount = int.tryParse(map['maxSelectedCount']); } else { - maxSelectedCount = BrnSelectionConstant.MAX_SELECT_COUNT; + maxSelectedCount = BrnSelectionConstant.maxSelectCount; } extMap = map['ext'] ?? {}; children = List() @@ -192,7 +192,7 @@ class BrnSelectionEntity { int.tryParse(map['maxSelectedCount']) != null) { entity.maxSelectedCount = int.tryParse(map['maxSelectedCount']); } else { - entity.maxSelectedCount = BrnSelectionConstant.MAX_SELECT_COUNT; + entity.maxSelectedCount = BrnSelectionConstant.maxSelectCount; } entity.extMap = map['ext'] ?? {}; entity.children = List() @@ -432,7 +432,7 @@ class BrnSelectionEntity { BrnSelectionEntity getRootEntity(BrnSelectionEntity rootEntity) { if (rootEntity.parent == null || rootEntity.parent.maxSelectedCount == - BrnSelectionConstant.MAX_SELECT_COUNT) { + BrnSelectionConstant.maxSelectCount) { return rootEntity; } else { return getRootEntity(rootEntity.parent); diff --git a/lib/src/components/selection/brn_simple_selection.dart b/lib/src/components/selection/brn_simple_selection.dart index 9268dc6a..627c56c3 100644 --- a/lib/src/components/selection/brn_simple_selection.dart +++ b/lib/src/components/selection/brn_simple_selection.dart @@ -47,7 +47,7 @@ class BrnSimpleSelection extends StatefulWidget { @required this.onSimpleSelectionChanged, this.onMenuItemClick, }) : this.isRadio = true, - this.maxSelectedCount = BrnSelectionConstant.MAX_SELECT_COUNT, + this.maxSelectedCount = BrnSelectionConstant.maxSelectCount, super(key: key); /// 多选构造函数 diff --git a/lib/src/components/selection/widget/brn_flat_selection_item.dart b/lib/src/components/selection/widget/brn_flat_selection_item.dart index 5e5448d3..483c86fb 100644 --- a/lib/src/components/selection/widget/brn_flat_selection_item.dart +++ b/lib/src/components/selection/widget/brn_flat_selection_item.dart @@ -383,7 +383,7 @@ class __MoreArrowState extends State<_MoreArrow> { @override Widget build(BuildContext context) { String asset = - isExpanded ? BrnAsset.ICON_UP_ARROW : BrnAsset.ICON_DOWN_ARROW; + isExpanded ? BrnAsset.iconUpArrow : BrnAsset.iconDownArrow; return GestureDetector( behavior: HitTestBehavior.opaque, @@ -707,7 +707,7 @@ class _FilterLayerTypeWidgetState extends State { Container( height: 16, width: 16, - child: BrunoTools.getAssetImage(BrnAsset.ICON_RIGHT_ARROW), + child: BrunoTools.getAssetImage(BrnAsset.iconRightArrow), ) ], ), diff --git a/lib/src/components/selection/widget/brn_layer_more_selection_page.dart b/lib/src/components/selection/widget/brn_layer_more_selection_page.dart index 3ff717c1..8350209f 100644 --- a/lib/src/components/selection/widget/brn_layer_more_selection_page.dart +++ b/lib/src/components/selection/widget/brn_layer_more_selection_page.dart @@ -441,7 +441,7 @@ class _BrnLayerMoreSelectionPageState extends State height: 16, width: 16, child: tmp.isSelected - ? BrnThemeImg.instance.checkedStatus + ? BrunoTools.getAssetImage(BrnAsset.selectCheckedStatus) : BrunoTools.getAssetImage(BrnAsset.iconUnSelect), ) ], diff --git a/lib/src/components/selection/widget/brn_selection_menu_item_widget.dart b/lib/src/components/selection/widget/brn_selection_menu_item_widget.dart index 22cf01f8..5fdcd784 100644 --- a/lib/src/components/selection/widget/brn_selection_menu_item_widget.dart +++ b/lib/src/components/selection/widget/brn_selection_menu_item_widget.dart @@ -56,16 +56,16 @@ class BrnSelectionMenuItemWidget extends StatelessWidget { child: isHighLight ? (active ? BrunoTools.getAssetImageWithBandColor( - BrnAsset.ICON_ARROWUP_SELECT, + BrnAsset.iconArrowUpSelect, configId: themeData.configId) : BrunoTools.getAssetImageWithBandColor( - BrnAsset.ICON_ARROWDOWN_SELECT)) + BrnAsset.iconArrowDownSelect)) : (active ? BrunoTools.getAssetImageWithBandColor( - BrnAsset.ICON_ARROWUP_SELECT, + BrnAsset.iconArrowUpSelect, configId: themeData.configId) : BrunoTools.getAssetImage( - BrnAsset.ICON_ARROWDOWN_UNSELECT))) + BrnAsset.iconArrowDownUnSelect))) ], ), ), diff --git a/lib/src/components/selection/widget/brn_selection_more_item_widget.dart b/lib/src/components/selection/widget/brn_selection_more_item_widget.dart index 024299e5..7ac7f89c 100644 --- a/lib/src/components/selection/widget/brn_selection_more_item_widget.dart +++ b/lib/src/components/selection/widget/brn_selection_more_item_widget.dart @@ -335,7 +335,7 @@ class __MoreArrowState extends State<_MoreArrow> { @override Widget build(BuildContext context) { String asset = - isExpanded ? BrnAsset.ICON_UP_ARROW : BrnAsset.ICON_DOWN_ARROW; + isExpanded ? BrnAsset.iconUpArrow : BrnAsset.iconDownArrow; return GestureDetector( behavior: HitTestBehavior.opaque, @@ -670,7 +670,7 @@ class _FilterLayerTypeWidgetState extends State { Container( height: 16, width: 16, - child: BrunoTools.getAssetImage(BrnAsset.ICON_RIGHT_ARROW), + child: BrunoTools.getAssetImage(BrnAsset.iconRightArrow), ) ], ), diff --git a/lib/src/components/step/brn_horizontal_steps.dart b/lib/src/components/step/brn_horizontal_steps.dart index 500134bf..46c59670 100644 --- a/lib/src/components/step/brn_horizontal_steps.dart +++ b/lib/src/components/step/brn_horizontal_steps.dart @@ -207,19 +207,19 @@ class BrnHorizontalStepsState extends State { Widget icon; switch (index) { case 1: - icon = BrunoTools.getAssetSizeImage(BrnAsset.ICON_STEP_2, 20, 20); + icon = BrunoTools.getAssetSizeImage(BrnAsset.iconStep2, 20, 20); break; case 2: - icon = BrunoTools.getAssetSizeImage(BrnAsset.ICON_STEP_3, 20, 20); + icon = BrunoTools.getAssetSizeImage(BrnAsset.iconStep3, 20, 20); break; case 3: - icon = BrunoTools.getAssetSizeImage(BrnAsset.ICON_STEP_4, 20, 20); + icon = BrunoTools.getAssetSizeImage(BrnAsset.iconStep4, 20, 20); break; case 4: - icon = BrunoTools.getAssetSizeImage(BrnAsset.ICON_STEP_5, 20, 20); + icon = BrunoTools.getAssetSizeImage(BrnAsset.iconStep5, 20, 20); break; default: - icon = BrunoTools.getAssetSizeImage(BrnAsset.ICON_STEP_DOING, 20, 20); + icon = BrunoTools.getAssetSizeImage(BrnAsset.iconStepDoing, 20, 20); break; } return icon; @@ -252,7 +252,7 @@ class BrnHorizontalStepsState extends State { return widget.completedIcon; } // 使用组件默认的icon - return BrunoTools.getAssetSizeImage(BrnAsset.ICON_STEP_COMPLETED, 20, 20, + return BrunoTools.getAssetSizeImage(BrnAsset.iconStepCompleted, 20, 20, color: BrnThemeConfigurator.instance .getConfig() .commonConfig @@ -269,7 +269,7 @@ class BrnHorizontalStepsState extends State { return widget.doingIcon; } // 使用组件默认的icon - return BrunoTools.getAssetSizeImage(BrnAsset.ICON_STEP_DOING, 20, 20, + return BrunoTools.getAssetSizeImage(BrnAsset.iconStepDoing, 20, 20, color: BrnThemeConfigurator.instance .getConfig() .commonConfig diff --git a/lib/src/components/sugsearch/brn_search_text.dart b/lib/src/components/sugsearch/brn_search_text.dart index 421cb5a2..266e8d90 100644 --- a/lib/src/components/sugsearch/brn_search_text.dart +++ b/lib/src/components/sugsearch/brn_search_text.dart @@ -198,7 +198,7 @@ class _SearchTextState extends State { child: Center( child: Container( child: Image.asset( - 'assets/${BrnAsset.ICON_SEARCH}', + 'assets/${BrnAsset.iconSearch}', package: BrnStrings.flutterPackageName, height: 16, width: 16, @@ -288,7 +288,7 @@ class _SearchTextState extends State { padding: const EdgeInsets.symmetric(horizontal: 12.0), child: BrunoTools.getAssetImage( - BrnAsset.ICON_DELETE_TEXT, + BrnAsset.iconDeleteText, ), ), ), diff --git a/lib/src/components/tabbar/normal/brn_tab_bar.dart b/lib/src/components/tabbar/normal/brn_tab_bar.dart index e3d5cf2e..06a6aa12 100644 --- a/lib/src/components/tabbar/normal/brn_tab_bar.dart +++ b/lib/src/components/tabbar/normal/brn_tab_bar.dart @@ -329,9 +329,9 @@ class BrnTabBarState extends State { ], ), child: !_brnTabbarController.isShow - ? BrunoTools.getAssetImage(BrnAsset.ICON_TRIANGLE_DOWN) + ? BrunoTools.getAssetImage(BrnAsset.iconTriangleDown) : BrunoTools.getAssetImageWithBandColor( - BrnAsset.ICON_TRIANGLE_UP)), + BrnAsset.iconTriangleUp)), ), ); } diff --git a/lib/src/components/tag/tagview/brn_delete_tag.dart b/lib/src/components/tag/tagview/brn_delete_tag.dart index 609a3fa0..2a5bb4c9 100644 --- a/lib/src/components/tag/tagview/brn_delete_tag.dart +++ b/lib/src/components/tag/tagview/brn_delete_tag.dart @@ -211,10 +211,10 @@ class DeleteTagItemWidget extends StatelessWidget { //删除图标 deleteIcon: deleteIconSize != null ? BrunoTools.getAssetSizeImage( - BrnAsset.ICON_CLOSE, deleteIconSize.width, deleteIconSize.height, + BrnAsset.iconClose, deleteIconSize.width, deleteIconSize.height, color: deleteIconColor) : BrunoTools.getAssetImageWithColor( - BrnAsset.ICON_CLOSE, deleteIconColor), + BrnAsset.iconClose, deleteIconColor), onDeleted: () { debugPrint('$index'); didDeleted(index); diff --git a/lib/src/constants/brn_asset_constants.dart b/lib/src/constants/brn_asset_constants.dart index b8ec1fcd..abb01801 100644 --- a/lib/src/constants/brn_asset_constants.dart +++ b/lib/src/constants/brn_asset_constants.dart @@ -21,165 +21,164 @@ class BrnAsset { static const String iconBottomPickerRightTopBg = "images/icon_bottom_picker_right_top_bg.png"; - static const String ICON_ARROWUP_SELECT = "images/icon_arrow_up_selected.png"; - static const String ICON_REFRESH = "assets/images/icon_refresh.png"; - static const String ICON_ARROWDOWN_SELECT = + static const String iconArrowUpSelect = "images/icon_arrow_up_selected.png"; + static const String iconRefresh = "assets/images/icon_refresh.png"; + static const String iconArrowDownSelect = "images/icon_arrow_down_selected.png"; - static const String ICON_ARROWDOWN_UNSELECT = + static const String iconArrowDownUnSelect = "images/icon_arrow_down_unselected.png"; - static const String ICON_ARROW_RIGHT_1 = "icons/icon_right_arrow_1.png"; - static const String SELECT_CHECKED_STATUS = + static const String iconArrowRight = "icons/icon_right_arrow_1.png"; + static const String selectCheckedStatus = "images/select_checked_status.png"; - static const String SELECT_NORMAL_STATUS = "icons/normol_border.png"; - static const String ICON_SELECTED_UP_TRIANGLE = + static const String selectNormalStatus = "icons/normol_border.png"; + static const String iconSelectedUpTriangle = "icons/icon_selcted_triangle.png"; - static const String ICON_UNSELECT_DOWN_TRIANGLE = + static const String iconUnSelectDownTriangle = "icons/icon_unselected_triangle.png"; - static const String ICON_REQUIRE_RED = 'icons/icon_require_red.png'; - static const String ICON_RIGHT_ARROW = 'icons/icon_right_arrow.png'; - static const String ICON_BACK_WHITE = 'assets/icons/icon_back_white.png'; - static const String ICON_BACK_BLACK = 'assets/icons/icon_back_black.png'; - static const String ICON_STEP_2 = 'icons/icon_step_2.png'; - static const String ICON_STEP_3 = 'icons/icon_step_3.png'; - static const String ICON_STEP_4 = 'icons/icon_step_4.png'; - static const String ICON_STEP_5 = 'icons/icon_step_5.png'; - static const String ICON_STEP_DOING = 'icons/icon_step_doing.png'; - static const String ICON_STEP_COMPLETED = 'icons/icon_step_completed.png'; - - static const String ICON_DELETE_TEXT = 'icons/ic_delete_grey.png'; - static const String ICON_SEARCH = 'icons/ic_search.png'; - - static const String ICON_POPUP_CLOSE = 'icons/icon_popup_close.png'; - static const String ICON_CLOSE = 'icons/icon_close.png'; - static const String ICON_CALENDAR_PRE_MONTH = + static const String iconRequireRed = 'icons/icon_require_red.png'; + static const String iconRightArrow = 'icons/icon_right_arrow.png'; + static const String iconBackWhite = 'assets/icons/icon_back_white.png'; + static const String iconBackBlack = 'assets/icons/icon_back_black.png'; + static const String iconStep2 = 'icons/icon_step_2.png'; + static const String iconStep3 = 'icons/icon_step_3.png'; + static const String iconStep4 = 'icons/icon_step_4.png'; + static const String iconStep5 = 'icons/icon_step_5.png'; + static const String iconStepDoing = 'icons/icon_step_doing.png'; + static const String iconStepCompleted = 'icons/icon_step_completed.png'; + + static const String iconDeleteText = 'icons/ic_delete_grey.png'; + static const String iconSearch = 'icons/ic_search.png'; + + static const String iconPopupClose = 'icons/icon_popup_close.png'; + static const String iconClose = 'icons/icon_close.png'; + static const String iconCalendarPreMonth = 'icons/icon_calendar_pre_month.png'; - static const String ICON_CALENDAR_NEXT_MONTH = + static const String iconCalendarNextMonth = 'icons/icon_calendar_next_month.png'; - static const String ICON_UP_ARROW = 'icons/icon_up_arrow.png'; - static const String ICON_DOWN_ARROW = 'icons/icon_down_arrow.png'; - static const String ICON_TRASH_BIN = 'icons/icon_trash.png'; - static const String ICON_STAR_UNSELECT = 'icons/icon_star_unselect.png'; - static const String ICON_STAR_SELECT = 'icons/icon_star_select.png'; - static const String ICON_ADD_FORM_ITEM = 'icons/icon_add_form_item.png'; - static const String ICON_REMOVE_FORM_ITEM = 'icons/icon_remove_form_item.png'; + static const String iconUpArrow = 'icons/icon_up_arrow.png'; + static const String iconDownArrow = 'icons/icon_down_arrow.png'; + static const String iconTrashBin = 'icons/icon_trash.png'; + static const String iconStarUnSelect = 'icons/icon_star_unselect.png'; + static const String iconStarSelect = 'icons/icon_star_select.png'; + static const String iconAddFormItem = 'icons/icon_add_form_item.png'; + static const String iconRemoveFormItem = 'icons/icon_remove_form_item.png'; - static const String ICON_TRIANGLE_DOWN = 'icons/icon_triangle_down.png'; - static const String ICON_TRIANGLE_UP = 'icons/icon_triangle_up.png'; + static const String iconTriangleDown = 'icons/icon_triangle_down.png'; + static const String iconTriangleUp = 'icons/icon_triangle_up.png'; - static const String ICON_PAIR_INFO_QUESTION = + static const String iconPairInfoQuestion = 'icons/icon_pait_info_question.png'; - static const String ICON_PICKER_CLOSE = 'images/icon_guanbi.png'; + static const String iconPickerClose = 'images/icon_guanbi.png'; - static const String ICON_NOTICE = 'icons/icon_notice.png'; - static const String ICON_NOTICE_ARROW_BLUE = + static const String iconNotice = 'icons/icon_notice.png'; + static const String iconNoticeArrowBlue = 'icons/icon_notice_arrow_blue.png'; - static const String ICON_NOTICE_ARROW_GREEN = + static const String iconNoticeArrowGreen = 'icons/icon_notice_arrow_green.png'; - static const String ICON_NOTICE_ARROW_ORANGE = + static const String iconNoticeArrowOrange = 'icons/icon_notice_arrow_orange.png'; - static const String ICON_NOTICE_ARROW_RED = 'icons/icon_notice_arrow_red.png'; - static const String ICON_NOTICE_CLOSE_BLUE = + static const String iconNoticeArrowRed = 'icons/icon_notice_arrow_red.png'; + static const String iconNoticeCloseBlue = 'icons/icon_notice_close_blue.png'; - static const String ICON_NOTICE_CLOSE_GREEN = + static const String iconNoticeCloseGreen = 'icons/icon_notice_close_green.png'; - static const String ICON_NOTICE_CLOSE_ORANGE = + static const String iconNoticeCloseOrange = 'icons/icon_notice_close_orange.png'; - static const String ICON_NOTICE_CLOSE_RED = 'icons/icon_notice_close_red.png'; - static const String ICON_NOTICE_FAIL = 'icons/icon_notice_fail.png'; - static const String ICON_NOTICE_RUNNING = 'icons/icon_notice_running.png'; - static const String ICON_NOTICE_SUCCEED = 'icons/icon_notice_succeed.png'; - static const String ICON_NOTICE_WARNING = 'icons/icon_notice_warning.png'; + static const String iconNoticeCloseRed = 'icons/icon_notice_close_red.png'; + static const String iconNoticeFail = 'icons/icon_notice_fail.png'; + static const String iconNoticeRunning = 'icons/icon_notice_running.png'; + static const String iconNoticeSucceed = 'icons/icon_notice_succeed.png'; + static const String iconNoticeWarning = 'icons/icon_notice_warning.png'; - static const String ICON_OPERATION_OTHER_RIGHT = + static const String iconOperationOtherRight = 'icons/icon_operation_line_right.png'; - static const String ICON_OPERATION_OTHER_LEFT = + static const String iconOperationOtherLeft = 'icons/icon_operation_line_left.png'; - static const String ICON_RESULT_SUCCESS = 'icons/icon_result_success.png'; - static const String ICON_RESULT_ERROR = 'icons/icon_result_error.png'; - static const String ICON_STAR = 'icons/icon_star.png'; - static const String ICON_STAR_HALF = 'icons/icon_star_half.png'; - static const String ICON_UPARROW = 'icons/icon_uparrow.png'; - static const String ICOS_QRCODE_BG = 'assets/images/icon_qrcode_bg.png'; - static const String ICONS_QRCODE_FAILED = + static const String iconResultSuccess = 'icons/icon_result_success.png'; + static const String iconResultError = 'icons/icon_result_error.png'; + static const String iconStar = 'icons/icon_star.png'; + static const String iconStarHalf = 'icons/icon_star_half.png'; + static const String iconQrCodeBg = 'assets/images/icon_qrcode_bg.png'; + static const String iconsQrCodeFailed = '/assets/images/icon_qrcode_failed.png'; - static const String ICONS_REFRESH_WHITE = + static const String iconsRefreshWhite = 'assets/images/icon_refresh_white.png'; - static const String ICONS_AVATAR_NEW = '/assets/icons/img_avatar_new.png'; + static const String iconsAvatarNew = '/assets/icons/img_avatar_new.png'; - static const String ICON_AUDIOPALYER_PLAY = 'icons/icon_audioplayer_play.png'; - static const String ICON_AUDIOPALYER_PAUSE = + static const String iconAudioPlayer = 'icons/icon_audioplayer_play.png'; + static const String iconAudioPlayerPause = 'icons/icon_audioplayer_pause.png'; - static const String ICON_GREY_PLACE_HOLDER = 'icons/grey_place_holder.png'; + static const String iconGreyPlaceHolder = 'icons/grey_place_holder.png'; - static const String ICON_QUOTATION_MARK = 'icons/ic_quotation_mark.png'; + static const String iconQuotationMark = 'icons/ic_quotation_mark.png'; - static const String IMG_BACKGROUND_CARD = 'images/img_bg_card.png'; + static const String imgBackgroundCard = 'images/img_bg_card.png'; - static const String IMG_BG_BLUR = 'images/img_bg_blur.png'; + static const String imgBgBlur = 'images/img_bg_blur.png'; /// 用于图片右上角删除icon 的展示 - static const String ICON_DELETE = 'icons/icon_delete.png'; + static const String iconDelete = 'icons/icon_delete.png'; - static const String ICON_IM = 'images/icon_im_blue.png'; - static const String ICON_CALL = 'images/icon_call.png'; - static const String ICON_CALL_DISABLE = 'images/icon_call_disable.png'; - static const String PERSON_PLACE_HOLDER = + static const String iconIm = 'images/icon_im_blue.png'; + static const String iconCall = 'images/icon_call.png'; + static const String iconCallDisable = 'images/icon_call_disable.png'; + static const String personPlaceHolder = 'packages/bruno/assets/icons/img_avatar_new.png'; /// radio组件,用于单选和多选 - static const String ICON_RADIO_MULTI_SELECTED = + static const String iconRadioMultiSelected = 'icons/radio/multiple_selected.png'; - static const String ICON_RADIO_UNSELECTED = 'icons/radio/unselected.png'; - static const String ICON_RADIO_DISABLE_MULTI_SELECTED = + static const String iconRadioUnSelected = 'icons/radio/unselected.png'; + static const String iconRadioDisableMultiSelected = 'icons/radio/disable_multi_selected.png'; - static const String ICON_RADIO_DISABLE_UNSELECTED = + static const String iconRadioDisableUnselected = 'icons/radio/disable_unselected.png'; - static const String ICON_RADIO_SINGLE_SELECTED = + static const String iconRadioSingleSelected = 'icons/radio/single_selected.png'; - static const String ICON_RADIO_DISABLE_SINGLE_SELECTED = + static const String iconRadioDisableSingleSelected = 'icons/radio/disable_single_selected.png'; /// 评价组件--表情 - static const String ICON_APPRAISE_BAD_UNSELECTED = + static const String iconAppraiseBadUnselected = 'assets/images/icon_appraise_bad_unselected.png'; - static const String ICON_APPRAISE_NOT_GOOD_UNSELECTED = + static const String iconAppraiseNotGoodUnselected = 'assets/images/icon_appraise_not_good_unselected.png'; - static const String ICON_APPRAISE_OK_UNSELECTED = + static const String iconAppraiseOkUnselected = 'assets/images/icon_appraise_ok_unselected.png'; - static const String ICON_APPRAISE_GOOD_UNSELECTED = + static const String iconAppraiseGoodUnselected = 'assets/images/icon_appraise_good_unselected.png'; - static const String ICON_APPRAISE_SURPRISE_UNSELECTED = + static const String iconAppraiseSurpriseUnselected = 'assets/images/icon_appraise_surprise_unselected.png'; - static const String ICON_APPRAISE_BAD_DEFAULT = + static const String iconAppraiseBadDefault = 'assets/images/icon_appraise_bad_default.png'; - static const String ICON_APPRAISE_NOT_GOOD_DEFAULT = + static const String iconAppraiseNotGoodDefault = 'assets/images/icon_appraise_not_good_default.png'; - static const String ICON_APPRAISE_OK_DEFAULT = + static const String iconAppraiseOkDefault = 'assets/images/icon_appraise_ok_default.png'; - static const String ICON_APPRAISE_GOOD_DEFAULT = + static const String iconAppraiseGoodDefault = 'assets/images/icon_appraise_good_default.png'; - static const String ICON_APPRAISE_SURPRISE_DEFAULT = + static const String iconAppraiseSurpriseDefault = 'assets/images/icon_appraise_surprise_default.png'; - static const String ICON_APPRAISE_BAD_SELECTED = + static const String iconAppraiseBadSelected = 'assets/images/icon_appraise_bad_selected.png'; - static const String ICON_APPRAISE_NOT_GOOD_SELECTED = + static const String iconAppraiseNotGoodSelected = 'assets/images/icon_appraise_not_good_selected.png'; - static const String ICON_APPRAISE_OK_SELECTED = + static const String iconAppraiseOkSelected = 'assets/images/icon_appraise_ok_selected.png'; - static const String ICON_APPRAISE_GOOD_SELECTED = + static const String iconAppraiseGoodSelected = 'assets/images/icon_appraise_good_selected.png'; - static const String ICON_APPRAISE_SURPRISE_SELECTED = + static const String iconAppraiseSurpriseSelected = 'assets/images/icon_appraise_surprise_selected.png'; - static const String ICON_QUESTION = "icons/icon_question.png"; + static const String iconQuestion = "icons/icon_question.png"; /// 录入项icon - static const String ICON_ADD_DISABLE = "icons/icon_add_disable.png"; - static const String ICON_ADD_ENABLE = "icons/icon_add_enable.png"; + static const String iconAddDisable = "icons/icon_add_disable.png"; + static const String iconAddEnable = "icons/icon_add_enable.png"; - static const String ICON_MINUS_DISABLE = "icons/icon_minus_disable.png"; - static const String ICON_MINUS_ENABLE = "icons/icon_minus_enable.png"; + static const String iconMinusDisable = "icons/icon_minus_disable.png"; + static const String iconMinusEnable = "icons/icon_minus_enable.png"; } diff --git a/lib/src/constants/brn_constants.dart b/lib/src/constants/brn_constants.dart index 3c90445d..72dbc7e5 100644 --- a/lib/src/constants/brn_constants.dart +++ b/lib/src/constants/brn_constants.dart @@ -42,39 +42,39 @@ class BrnShareItemConstants { ]; /// 微信 - static const int SHARE_WEIXIN = 0; + static const int shareWeiXin = 0; /// 朋友圈 - static const int SHARE_FRIEND = 1; + static const int shareFriend = 1; /// qq - static const int SHARE_QQ = 2; + static const int shareQQ = 2; /// qq空间 - static const int SHARE_QZONE = 3; + static const int shareQZone = 3; /// 微博 - static const int SHARE_WEIBO = 4; + static const int shareWeiBo = 4; /// 链接 - static const int SHARE_LINK = 5; + static const int shareLink = 5; /// 短信 - static const int SHARE_SMS = 6; + static const int shareSms = 6; /// 剪贴板 - static const int SHARE_COPY_LINK = 7; + static const int shareCopyLink = 7; /// 浏览器 - static const int SHARE_BROWSER = 8; + static const int shareBrowser = 8; /// 相册 - static const int SHARE_SAVE_IMAGE = 9; + static const int shareSaveImage = 9; /// 自定义 - static const int SHARE_CUSTOM = 100; + static const int shareCustom = 100; } class BrnSelectionConstant { - static const int MAX_SELECT_COUNT = 65535; + static const int maxSelectCount = 65535; } diff --git a/lib/src/constants/brn_fonts_constants.dart b/lib/src/constants/brn_fonts_constants.dart index c9a30757..a6ecea8c 100644 --- a/lib/src/constants/brn_fonts_constants.dart +++ b/lib/src/constants/brn_fonts_constants.dart @@ -1,10 +1,10 @@ class BrnFonts { const BrnFonts._(); - static const double FONT_12 = 12; - static const double FONT_14 = 14; - static const double FONT_16 = 16; - static const double FONT_18 = 18; - static const double FONT_20 = 20; - static const double FONT_22 = 22; + static const double f12 = 12; + static const double f14 = 14; + static const double f16 = 16; + static const double f18 = 18; + static const double f20 = 20; + static const double f22 = 22; } diff --git a/lib/src/theme/base/brn_default_config_utils.dart b/lib/src/theme/base/brn_default_config_utils.dart index 66861fb3..03c565fc 100644 --- a/lib/src/theme/base/brn_default_config_utils.dart +++ b/lib/src/theme/base/brn_default_config_utils.dart @@ -405,7 +405,7 @@ class BrnDefaultConfigUtils { backgroundColor: Colors.white, appBarHeight: BrnAppBarTheme.appBarHeight, leadIconBuilder: () => Image.asset( - BrnAsset.ICON_BACK_BLACK, + BrnAsset.iconBackBlack, package: BrnStrings.flutterPackageName, width: BrnAppBarTheme.iconSize, height: BrnAppBarTheme.iconSize, diff --git a/lib/src/theme/brn_theme.dart b/lib/src/theme/brn_theme.dart index 6699bbff..243bea0c 100644 --- a/lib/src/theme/brn_theme.dart +++ b/lib/src/theme/brn_theme.dart @@ -25,3 +25,6 @@ export 'configs/brn_tabbar_config.dart'; export 'configs/brn_tag_config.dart'; export 'img/brn_theme_default_utils.dart'; export 'brn_initializer.dart'; +export 'brn_theme_configurator.dart'; +export 'img/brn_theme_default_utils.dart'; + diff --git a/lib/src/theme/configs/brn_appbar_config.dart b/lib/src/theme/configs/brn_appbar_config.dart index a220c951..bc2323b4 100644 --- a/lib/src/theme/configs/brn_appbar_config.dart +++ b/lib/src/theme/configs/brn_appbar_config.dart @@ -58,7 +58,7 @@ class BrnAppBarConfig extends BrnBaseConfig { super(configId: configId) { _backgroundColor = Color(0xff2E313B); _leadIconBuilder = () => Image.asset( - BrnAsset.ICON_BACK_WHITE, + BrnAsset.iconBackWhite, package: BrnStrings.flutterPackageName, width: BrnAppBarTheme.iconSize, height: BrnAppBarTheme.iconSize, @@ -94,7 +94,7 @@ class BrnAppBarConfig extends BrnBaseConfig { super(configId: configId) { _backgroundColor = Colors.white; _leadIconBuilder = () => Image.asset( - BrnAsset.ICON_BACK_BLACK, + BrnAsset.iconBackBlack, package: BrnStrings.flutterPackageName, width: BrnAppBarTheme.iconSize, height: BrnAppBarTheme.iconSize, diff --git a/lib/src/theme/img/brn_theme_default_utils.dart b/lib/src/theme/img/brn_theme_default_utils.dart index df2ebcc0..33d7be55 100644 --- a/lib/src/theme/img/brn_theme_default_utils.dart +++ b/lib/src/theme/img/brn_theme_default_utils.dart @@ -34,7 +34,7 @@ class BrnThemeImg { Image get checkedStatus => _defaultBrunoImg.checkedStatus ?? - BrunoTools.getAssetImage(BrnAsset.SELECT_CHECKED_STATUS); + BrunoTools.getAssetImage(BrnAsset.selectCheckedStatus); Image get stepIcon { return _defaultBrunoImg.stepIcon ?? @@ -56,7 +56,7 @@ class BrnDefaultThemeImgUtil extends BrnThemeImgUtils { @override Image get checkedStatus { return BrunoTools.getAssetImageWithBandColor( - BrnAsset.SELECT_CHECKED_STATUS); + BrnAsset.selectCheckedStatus); } @override From 5db665dad56217fdae62cd48d4b92c40668d1222 Mon Sep 17 00:00:00 2001 From: zhoujuanjuan <15143015732@163.com> Date: Wed, 5 Jan 2022 17:51:27 +0800 Subject: [PATCH 07/14] migrate brn_empty_status.dart --- .../components/empty/brn_empty_status.dart | 84 +++++++++---------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/lib/src/components/empty/brn_empty_status.dart b/lib/src/components/empty/brn_empty_status.dart index bd244d91..7c4ba7d2 100644 --- a/lib/src/components/empty/brn_empty_status.dart +++ b/lib/src/components/empty/brn_empty_status.dart @@ -1,4 +1,4 @@ -// @dart=2.9 + import 'package:bruno/src/constants/brn_asset_constants.dart'; import 'package:bruno/src/constants/brn_strings_constants.dart'; @@ -28,7 +28,7 @@ class BrnAbnormalStateUtils { /// status: 页面状态类型为[EmptyState] static Widget getEmptyWidgetByState(BuildContext context, AbnormalState status, BrnEmptyStatusIndexedActionClickCallback action, - {Image img}) { + {Image? img}) { if (AbnormalState.getDataFailed == status) { return BrnAbnormalStateWidget( img: img ?? BrunoTools.getAssetImage(BrnAsset.emptyState), @@ -74,22 +74,22 @@ typedef BrnEmptyStatusIndexedActionClickCallback = void Function(int index); // ignore: must_be_immutable class BrnAbnormalStateWidget extends StatelessWidget { /// 图片 - final Image img; + final Image? img; /// 标题 - final String title; + final String? title; /// 内容 - final String content; + final String? content; /// 操作区类型 final OperateAreaType operateAreaType; /// 操作区文案 - final List operateTexts; + final List? operateTexts; /// 点击事件回调 - final BrnEmptyStatusIndexedActionClickCallback action; + final BrnEmptyStatusIndexedActionClickCallback? action; /// 是否可点击页面回调配合[action]使用 /// 当为true时调用[action]回调,当为false时不做处理 @@ -98,7 +98,7 @@ class BrnAbnormalStateWidget extends StatelessWidget { /// 顶部距离走自动计算逻辑:父视图高度的8%,可自己指定高度 /// 默认为null - final double topOffset; + final double? topOffset; /// 背景色设置 /// 默认Colors.white @@ -111,7 +111,7 @@ class BrnAbnormalStateWidget extends StatelessWidget { /// 默认 false final bool isCenterVertical; - BrnAbnormalStateConfig themeData; + BrnAbnormalStateConfig? themeData; BrnAbnormalStateWidget({ this.img, @@ -129,7 +129,7 @@ class BrnAbnormalStateWidget extends StatelessWidget { }) { this.themeData ??= BrnAbnormalStateConfig(); this.themeData = BrnThemeConfigurator.instance - .getConfig(configId: this.themeData.configId) + .getConfig(configId: this.themeData!.configId) .abnormalStateConfig .merge(this.themeData); } @@ -138,12 +138,12 @@ class BrnAbnormalStateWidget extends StatelessWidget { Widget build(BuildContext context) { return GestureDetector( onTap: () { - if (this.enablePageTap) { - action(0); + if (this.enablePageTap && action!=null) { + action!(0); } }, child: Container( - color: bgColor ?? Colors.white, + color: bgColor, child: Column( mainAxisSize: MainAxisSize.max, mainAxisAlignment: isCenterVertical @@ -171,7 +171,7 @@ class BrnAbnormalStateWidget extends StatelessWidget { : EdgeInsets.only(top: topOffset ?? height * topPercent), child: img, ) - : Container(); + : SizedBox.shrink(); } ///文案区域:标题 @@ -180,11 +180,11 @@ class BrnAbnormalStateWidget extends StatelessWidget { ? Container( alignment: Alignment.center, padding: EdgeInsets.fromLTRB(60, 24, 60, 0), - child: Text(title, + child: Text(title!, textAlign: TextAlign.center, - style: themeData?.titleTextStyle?.generateTextStyle()), + style: themeData!.titleTextStyle.generateTextStyle()), ) - : Container(); + : SizedBox.shrink(); } ///文案区域:内容 @@ -193,11 +193,11 @@ class BrnAbnormalStateWidget extends StatelessWidget { ? Container( alignment: Alignment.center, padding: EdgeInsets.fromLTRB(60, 12, 60, 0), - child: Text(content, + child: Text(content!, textAlign: TextAlign.center, - style: themeData?.contentTextStyle?.generateTextStyle()), + style: themeData!.contentTextStyle.generateTextStyle()), ) - : Container(); + : SizedBox.shrink(); } ///操作区域 @@ -207,24 +207,24 @@ class BrnAbnormalStateWidget extends StatelessWidget { padding: EdgeInsets.only(top: 36), child: _buildOperateContentWidget(), ) - : Container(); + : SizedBox.shrink(); } ///操作区按钮 _buildOperateContentWidget() { if (OperateAreaType.SingleButton == operateAreaType) { return GestureDetector( - onTap: () => action(0), + onTap: () => action!(0), child: Container( - constraints: BoxConstraints(minWidth: themeData.singleMinWidth), + constraints: BoxConstraints(minWidth: themeData!.singleMinWidth), padding: EdgeInsets.fromLTRB(48, 16, 48, 16), decoration: BoxDecoration( - color: themeData.commonConfig.brandPrimary, + color: themeData!.commonConfig.brandPrimary, borderRadius: - BorderRadius.all(Radius.circular(themeData?.btnRadius))), - child: Text(operateTexts[0] ?? "", + BorderRadius.all(Radius.circular(themeData!.btnRadius))), + child: Text(operateTexts?[0] ?? '', textAlign: TextAlign.center, - style: themeData?.singleTextStyle?.generateTextStyle()), + style: themeData!.singleTextStyle.generateTextStyle()), ), ); } else if (OperateAreaType.DoubleButton == operateAreaType) { @@ -232,17 +232,17 @@ class BrnAbnormalStateWidget extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.center, children: [ GestureDetector( - onTap: () => action(0), + onTap: () => action!(0), child: Container( - constraints: BoxConstraints(minWidth: themeData.doubleMinWidth), + constraints: BoxConstraints(minWidth: themeData!.doubleMinWidth), padding: EdgeInsets.fromLTRB(36, 16, 36, 16), decoration: BoxDecoration( - color: themeData.commonConfig.brandPrimary.withAlpha(0x14), + color: themeData!.commonConfig.brandPrimary.withAlpha(0x14), borderRadius: - BorderRadius.all(Radius.circular(themeData?.btnRadius))), - child: Text(operateTexts[0] ?? "", + BorderRadius.all(Radius.circular(themeData!.btnRadius))), + child: Text(operateTexts?[0] ?? '', textAlign: TextAlign.center, - style: themeData?.doubleTextStyle?.generateTextStyle()), + style: themeData!.doubleTextStyle.generateTextStyle()), ), ), Container( @@ -250,26 +250,26 @@ class BrnAbnormalStateWidget extends StatelessWidget { color: Colors.transparent, ), GestureDetector( - onTap: () => action(1), + onTap: () => action!(1), child: Container( - constraints: BoxConstraints(minWidth: themeData.doubleMinWidth), + constraints: BoxConstraints(minWidth: themeData!.doubleMinWidth), padding: EdgeInsets.fromLTRB(36, 16, 36, 16), decoration: BoxDecoration( - color: themeData.commonConfig.brandPrimary.withAlpha(0x14), + color: themeData!.commonConfig.brandPrimary.withAlpha(0x14), borderRadius: - BorderRadius.all(Radius.circular(themeData?.btnRadius))), - child: Text(operateTexts[1] ?? "", + BorderRadius.all(Radius.circular(themeData!.btnRadius))), + child: Text(operateTexts?[1] ?? '', textAlign: TextAlign.center, - style: themeData?.doubleTextStyle?.generateTextStyle()), + style: themeData!.doubleTextStyle.generateTextStyle()), ), ), ], ); } else if (OperateAreaType.TextButton == operateAreaType) { return GestureDetector( - onTap: () => action(0), - child: Text(operateTexts[0] ?? "", - style: themeData?.operateTextStyle?.generateTextStyle())); + onTap: () => action!(0), + child: Text(operateTexts?[0] ??'', + style: themeData!.operateTextStyle.generateTextStyle())); } return Container(); } From 7c12fc8eec4703da6ca52c455c5834cb326731b0 Mon Sep 17 00:00:00 2001 From: zhoujuanjuan <15143015732@163.com> Date: Thu, 6 Jan 2022 16:29:45 +0800 Subject: [PATCH 08/14] =?UTF-8?q?=E5=88=A0=E9=99=A4=20BrnThemeImg?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../widget/brn_layer_more_selection_page.dart | 1 - lib/src/theme/brn_initializer.dart | 7 -- lib/src/theme/brn_theme.dart | 3 - .../theme/img/brn_theme_default_utils.dart | 66 ------------------- lib/src/theme/img/brn_theme_img_utils.dart | 15 ----- 5 files changed, 92 deletions(-) delete mode 100644 lib/src/theme/img/brn_theme_default_utils.dart delete mode 100644 lib/src/theme/img/brn_theme_img_utils.dart diff --git a/lib/src/components/selection/widget/brn_layer_more_selection_page.dart b/lib/src/components/selection/widget/brn_layer_more_selection_page.dart index 8350209f..ae4bb552 100644 --- a/lib/src/components/selection/widget/brn_layer_more_selection_page.dart +++ b/lib/src/components/selection/widget/brn_layer_more_selection_page.dart @@ -8,7 +8,6 @@ import 'package:bruno/src/components/toast/brn_toast.dart'; import 'package:bruno/src/constants/brn_asset_constants.dart'; import 'package:bruno/src/theme/brn_theme_configurator.dart'; import 'package:bruno/src/theme/configs/brn_selection_config.dart'; -import 'package:bruno/src/theme/img/brn_theme_default_utils.dart'; import 'package:bruno/src/utils/brn_tools.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; diff --git a/lib/src/theme/brn_initializer.dart b/lib/src/theme/brn_initializer.dart index 2cc30df0..b90c0b5b 100644 --- a/lib/src/theme/brn_initializer.dart +++ b/lib/src/theme/brn_initializer.dart @@ -1,7 +1,5 @@ import 'package:bruno/src/theme/brn_theme_configurator.dart'; import 'package:bruno/src/theme/configs/brn_all_config.dart'; -import 'package:bruno/src/theme/img/brn_theme_default_utils.dart'; -import 'package:bruno/src/theme/img/brn_theme_img_utils.dart'; /// Bruno 初始化 class BrnInitializer { @@ -9,12 +7,7 @@ class BrnInitializer { static register({ BrnAllThemeConfig? allThemeConfig, String configId = GLOBAL_CONFIG_ID, - BrnThemeImgUtils? brunoImgUtils, }) { - /// 配置图片 - if (brunoImgUtils != null) { - BrnThemeImg.register(brunoImgUtils: brunoImgUtils); - } /// 配置主题定制 BrnThemeConfigurator.instance.register(allThemeConfig, configId: configId); diff --git a/lib/src/theme/brn_theme.dart b/lib/src/theme/brn_theme.dart index 243bea0c..6300080e 100644 --- a/lib/src/theme/brn_theme.dart +++ b/lib/src/theme/brn_theme.dart @@ -23,8 +23,5 @@ export 'configs/brn_picker_config.dart'; export 'configs/brn_selection_config.dart'; export 'configs/brn_tabbar_config.dart'; export 'configs/brn_tag_config.dart'; -export 'img/brn_theme_default_utils.dart'; export 'brn_initializer.dart'; export 'brn_theme_configurator.dart'; -export 'img/brn_theme_default_utils.dart'; - diff --git a/lib/src/theme/img/brn_theme_default_utils.dart b/lib/src/theme/img/brn_theme_default_utils.dart deleted file mode 100644 index 33d7be55..00000000 --- a/lib/src/theme/img/brn_theme_default_utils.dart +++ /dev/null @@ -1,66 +0,0 @@ -import 'package:bruno/src/constants/brn_asset_constants.dart'; -import 'package:bruno/src/theme/img/brn_theme_img_utils.dart'; -import 'package:bruno/src/utils/brn_tools.dart'; -import 'package:flutter/material.dart'; - -class BrnThemeImg { - BrnThemeImg._( - BrnThemeImgUtils? brunoImgUtils, - ) : _defaultBrunoImg = brunoImgUtils ?? BrnDefaultThemeImgUtil(); - - factory BrnThemeImg.register({BrnThemeImgUtils? brunoImgUtils}) { - _instance = BrnThemeImg._(brunoImgUtils); - return _instance!; - } - - static BrnThemeImg get instance { - if (_instance == null) { - BrnThemeImg.register(); - } - return _instance!; - } - - static BrnThemeImg? _instance; - - BrnThemeImgUtils _defaultBrunoImg; - - Image get arrowRefreshUp => - _defaultBrunoImg.arrowRefreshUp ?? - BrunoTools.getAssetImage(BrnAsset.refreshArrowUp); - - Image get arrowRefreshDown => - _defaultBrunoImg.arrowRefreshDown ?? - BrunoTools.getAssetImage(BrnAsset.refreshArrowDown); - - Image get checkedStatus => - _defaultBrunoImg.checkedStatus ?? - BrunoTools.getAssetImage(BrnAsset.selectCheckedStatus); - - Image get stepIcon { - return _defaultBrunoImg.stepIcon ?? - BrunoTools.getAssetImage(BrnAsset.stepTitle); - } -} - -class BrnDefaultThemeImgUtil extends BrnThemeImgUtils { - @override - Image get arrowRefreshUp { - return BrunoTools.getAssetImageWithBandColor(BrnAsset.refreshArrowUp); - } - - @override - Image get arrowRefreshDown { - return BrunoTools.getAssetImageWithBandColor(BrnAsset.refreshArrowDown); - } - - @override - Image get checkedStatus { - return BrunoTools.getAssetImageWithBandColor( - BrnAsset.selectCheckedStatus); - } - - @override - Image get stepIcon { - return BrunoTools.getAssetImageWithBandColor(BrnAsset.stepTitle); - } -} diff --git a/lib/src/theme/img/brn_theme_img_utils.dart b/lib/src/theme/img/brn_theme_img_utils.dart deleted file mode 100644 index 83de205d..00000000 --- a/lib/src/theme/img/brn_theme_img_utils.dart +++ /dev/null @@ -1,15 +0,0 @@ -import 'package:flutter/material.dart'; - -abstract class BrnThemeImgUtils { - /// 下拉刷新的向上icon - Image? get arrowRefreshUp; - - /// 下拉刷新的向下icon - Image? get arrowRefreshDown; - - /// 选中与否的Icon - Image? get checkedStatus; - - /// 步骤的title - Image? get stepIcon; -} From c00cfd5318901c00e4211028e57fe4fa51038aed Mon Sep 17 00:00:00 2001 From: zhoujuanjuan <15143015732@163.com> Date: Thu, 6 Jan 2022 16:47:12 +0800 Subject: [PATCH 09/14] =?UTF-8?q?fix:tagConfig=20merge=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=88=A4=E7=A9=BA=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/src/theme/configs/brn_tag_config.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/src/theme/configs/brn_tag_config.dart b/lib/src/theme/configs/brn_tag_config.dart index 39b03a26..6af4dae1 100644 --- a/lib/src/theme/configs/brn_tag_config.dart +++ b/lib/src/theme/configs/brn_tag_config.dart @@ -152,7 +152,8 @@ class BrnTagConfig extends BrnBaseConfig { ); } - BrnTagConfig merge(BrnTagConfig other) { + BrnTagConfig merge(BrnTagConfig? other) { + if (other == null) return this; return copyWith( textStyle: tagTextStyle.merge(other._tagTextStyle), selectTextStyle: selectTagTextStyle.merge(other._selectTagTextStyle), From ada5216abb007fcd3909c5e3535e323cc644b35f Mon Sep 17 00:00:00 2001 From: zhoujuanjuan <15143015732@163.com> Date: Fri, 7 Jan 2022 10:39:40 +0800 Subject: [PATCH 10/14] fix:revert tagConfig --- lib/src/components/tag/tagview/brn_delete_tag.dart | 2 +- lib/src/components/tag/tagview/brn_select_tag.dart | 2 +- lib/src/theme/configs/brn_tag_config.dart | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/src/components/tag/tagview/brn_delete_tag.dart b/lib/src/components/tag/tagview/brn_delete_tag.dart index 5a7a12e6..3683211f 100644 --- a/lib/src/components/tag/tagview/brn_delete_tag.dart +++ b/lib/src/components/tag/tagview/brn_delete_tag.dart @@ -76,7 +76,7 @@ class BrnDeleteTag extends StatefulWidget { themeData = BrnThemeConfigurator.instance .getConfig(configId: themeData!.configId) .tagConfig - .merge(themeData); + .merge(this.themeData!); } @override diff --git a/lib/src/components/tag/tagview/brn_select_tag.dart b/lib/src/components/tag/tagview/brn_select_tag.dart index 62f01fe4..b3f6d16f 100644 --- a/lib/src/components/tag/tagview/brn_select_tag.dart +++ b/lib/src/components/tag/tagview/brn_select_tag.dart @@ -92,7 +92,7 @@ class BrnSelectTag extends StatefulWidget { this.themeData = BrnThemeConfigurator.instance .getConfig(configId: this.themeData!.configId) .tagConfig - .merge(this.themeData); + .merge(this.themeData!); } @override diff --git a/lib/src/theme/configs/brn_tag_config.dart b/lib/src/theme/configs/brn_tag_config.dart index 6af4dae1..39b03a26 100644 --- a/lib/src/theme/configs/brn_tag_config.dart +++ b/lib/src/theme/configs/brn_tag_config.dart @@ -152,8 +152,7 @@ class BrnTagConfig extends BrnBaseConfig { ); } - BrnTagConfig merge(BrnTagConfig? other) { - if (other == null) return this; + BrnTagConfig merge(BrnTagConfig other) { return copyWith( textStyle: tagTextStyle.merge(other._tagTextStyle), selectTextStyle: selectTagTextStyle.merge(other._selectTagTextStyle), From beec378fc95e1408be1f328c7830bce70048ff57 Mon Sep 17 00:00:00 2001 From: zhoujuanjuan <15143015732@163.com> Date: Fri, 7 Jan 2022 12:07:05 +0800 Subject: [PATCH 11/14] =?UTF-8?q?fix:BrnAbnormalStateWidget=E7=A9=BA?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/empty/brn_empty_status.dart | 30 +++++++++++-------- .../selectcity/brn_base_azlistview_page.dart | 4 +-- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/lib/src/components/empty/brn_empty_status.dart b/lib/src/components/empty/brn_empty_status.dart index 7c4ba7d2..6d832c02 100644 --- a/lib/src/components/empty/brn_empty_status.dart +++ b/lib/src/components/empty/brn_empty_status.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_configurator.dart'; @@ -27,8 +25,8 @@ class BrnAbnormalStateUtils { /// 通过状态获取对应空页面widget /// status: 页面状态类型为[EmptyState] static Widget getEmptyWidgetByState(BuildContext context, - AbnormalState status, BrnEmptyStatusIndexedActionClickCallback action, - {Image? img}) { + AbnormalState status, + {Image? img,BrnEmptyStatusIndexedActionClickCallback? action}) { if (AbnormalState.getDataFailed == status) { return BrnAbnormalStateWidget( img: img ?? BrunoTools.getAssetImage(BrnAsset.emptyState), @@ -214,7 +212,9 @@ class BrnAbnormalStateWidget extends StatelessWidget { _buildOperateContentWidget() { if (OperateAreaType.SingleButton == operateAreaType) { return GestureDetector( - onTap: () => action!(0), + onTap: () { + if (action != null) action!(0); + }, child: Container( constraints: BoxConstraints(minWidth: themeData!.singleMinWidth), padding: EdgeInsets.fromLTRB(48, 16, 48, 16), @@ -222,7 +222,7 @@ class BrnAbnormalStateWidget extends StatelessWidget { color: themeData!.commonConfig.brandPrimary, borderRadius: BorderRadius.all(Radius.circular(themeData!.btnRadius))), - child: Text(operateTexts?[0] ?? '', + child: Text(operateTexts![0] ?? '', textAlign: TextAlign.center, style: themeData!.singleTextStyle.generateTextStyle()), ), @@ -232,7 +232,9 @@ class BrnAbnormalStateWidget extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.center, children: [ GestureDetector( - onTap: () => action!(0), + onTap: () { + if (action != null) action!(0); + }, child: Container( constraints: BoxConstraints(minWidth: themeData!.doubleMinWidth), padding: EdgeInsets.fromLTRB(36, 16, 36, 16), @@ -240,7 +242,7 @@ class BrnAbnormalStateWidget extends StatelessWidget { color: themeData!.commonConfig.brandPrimary.withAlpha(0x14), borderRadius: BorderRadius.all(Radius.circular(themeData!.btnRadius))), - child: Text(operateTexts?[0] ?? '', + child: Text(operateTexts![0] ?? '', textAlign: TextAlign.center, style: themeData!.doubleTextStyle.generateTextStyle()), ), @@ -250,7 +252,9 @@ class BrnAbnormalStateWidget extends StatelessWidget { color: Colors.transparent, ), GestureDetector( - onTap: () => action!(1), + onTap: () { + if (action != null) action!(1); + }, child: Container( constraints: BoxConstraints(minWidth: themeData!.doubleMinWidth), padding: EdgeInsets.fromLTRB(36, 16, 36, 16), @@ -258,7 +262,7 @@ class BrnAbnormalStateWidget extends StatelessWidget { color: themeData!.commonConfig.brandPrimary.withAlpha(0x14), borderRadius: BorderRadius.all(Radius.circular(themeData!.btnRadius))), - child: Text(operateTexts?[1] ?? '', + child: Text(operateTexts![1] ?? '', textAlign: TextAlign.center, style: themeData!.doubleTextStyle.generateTextStyle()), ), @@ -267,8 +271,10 @@ class BrnAbnormalStateWidget extends StatelessWidget { ); } else if (OperateAreaType.TextButton == operateAreaType) { return GestureDetector( - onTap: () => action!(0), - child: Text(operateTexts?[0] ??'', + onTap: () { + if (action != null) action!(0); + }, + child: Text(operateTexts![0] ??'', style: themeData!.operateTextStyle.generateTextStyle())); } return Container(); diff --git a/lib/src/components/selectcity/brn_base_azlistview_page.dart b/lib/src/components/selectcity/brn_base_azlistview_page.dart index c05e9950..a73c1027 100644 --- a/lib/src/components/selectcity/brn_base_azlistview_page.dart +++ b/lib/src/components/selectcity/brn_base_azlistview_page.dart @@ -72,7 +72,7 @@ class _BaseAZListViewPageState extends State { if (snapShot.connectionState == ConnectionState.done) { if (snapShot.hasError) { return BrnAbnormalStateUtils.getEmptyWidgetByState( - context, AbnormalState.networkConnectError, (index) { + context, AbnormalState.networkConnectError,action: (index) { setState(() {}); }); } else { @@ -98,7 +98,7 @@ class _BaseAZListViewPageState extends State { if (_dataList.isEmpty && top.isEmpty) { return BrnAbnormalStateUtils.getEmptyWidgetByState( - context, AbnormalState.noData, (index) {}); + context, AbnormalState.noData,); } suspensionTag = top.isEmpty ? _dataList[0].tag : top[0].tag; From 162fcfe575c190e513f123cdf8d0cfd453a1996d Mon Sep 17 00:00:00 2001 From: zhoujuanjuan <15143015732@163.com> Date: Tue, 11 Jan 2022 17:06:25 +0800 Subject: [PATCH 12/14] Migrated tabbar to null-safety --- .../bottom/brn_bottom_tab_bar_item.dart | 17 +- .../bottom/brn_bottom_tab_bar_main.dart | 115 +++++---- .../indicator/brn_custom_width_indicator.dart | 20 +- .../brn_fixed_underline_decoration.dart | 18 +- .../indicator/brn_triangle_decoration.dart | 54 ++--- .../tabbar/normal/brn_sub_switch_title.dart | 24 +- .../tabbar/normal/brn_switch_title.dart | 36 +-- .../components/tabbar/normal/brn_tab_bar.dart | 222 +++++++++--------- .../tabbar/normal/brn_tabbar_controller.dart | 12 +- 9 files changed, 255 insertions(+), 263 deletions(-) diff --git a/lib/src/components/tabbar/bottom/brn_bottom_tab_bar_item.dart b/lib/src/components/tabbar/bottom/brn_bottom_tab_bar_item.dart index 70d63a90..0e8422a9 100644 --- a/lib/src/components/tabbar/bottom/brn_bottom_tab_bar_item.dart +++ b/lib/src/components/tabbar/bottom/brn_bottom_tab_bar_item.dart @@ -1,4 +1,4 @@ -// @dart=2.9 + import 'dart:ui' show Color; @@ -9,15 +9,14 @@ import 'package:flutter/material.dart'; /// 特别注意:Tab的右上角小红点可能不符合UI规范,可以使用BrnBadge小红点组件 class BrnBottomTabBarItem { const BrnBottomTabBarItem({ - @required this.icon, + required this.icon, this.title, - Widget activeIcon, + Widget? activeIcon, this.backgroundColor, this.badge, this.badgeNo, this.maxBadgeNo = 99, - }) : activeIcon = activeIcon ?? icon, - assert(icon != null); + }) : activeIcon = activeIcon ?? icon; /// 未选中时的icon final Widget icon; @@ -26,16 +25,16 @@ class BrnBottomTabBarItem { final Widget activeIcon; /// Tab标题名 - final Widget title; + final Widget? title; /// 背景色 - final Color backgroundColor; + final Color? backgroundColor; /// 未读信息 - final Widget badge; + final Widget? badge; /// 未读信息个数 - final String badgeNo; + final String? badgeNo; /// 未读消息最大个数 final int maxBadgeNo; diff --git a/lib/src/components/tabbar/bottom/brn_bottom_tab_bar_main.dart b/lib/src/components/tabbar/bottom/brn_bottom_tab_bar_main.dart index 2a16b303..1ff2b67d 100644 --- a/lib/src/components/tabbar/bottom/brn_bottom_tab_bar_main.dart +++ b/lib/src/components/tabbar/bottom/brn_bottom_tab_bar_main.dart @@ -1,4 +1,4 @@ -// @dart=2.9 + import 'dart:collection' show Queue; import 'dart:math' as math; @@ -12,9 +12,9 @@ const double _kActiveFontSize = 10.0; const double _kInactiveFontSize = 9.0; const double _kTopMargin = 6.0; const double _kBottomMargin = 0.0; -const double _kmiddleInterval = 4.0; +const double _kMiddleInterval = 4.0; -/// Tabbar显示状态 +/// tabBar显示状态 enum BrnBottomTabBarDisplayType { /// 固定显示状态 fixed, @@ -28,8 +28,8 @@ enum BrnBottomTabBarDisplayType { /// 特别注意:默认关闭点击动画,为固定显示状态 class BrnBottomTabBar extends StatefulWidget { BrnBottomTabBar({ - Key key, - @required this.items, + Key? key, + required this.items, this.onTap, this.currentIndex = 0, BrnBottomTabBarDisplayType type = BrnBottomTabBarDisplayType.fixed, @@ -38,25 +38,22 @@ class BrnBottomTabBar extends StatefulWidget { this.isAnimation = false, this.badgeColor, this.isInkResponse = false, - }) : assert(items != null), - assert(items.length >= 1), + }) : assert(items.length >= 1), assert( items.every((BrnBottomTabBarItem item) => item.title != null) == true, 'Every item must have a non-null title', ), assert(0 <= currentIndex && currentIndex < items.length), - assert(iconSize != null), - type = type ?? - (items.length <= 3 + type = items.length <= 3 ? BrnBottomTabBarDisplayType.fixed - : BrnBottomTabBarDisplayType.shifting), + : BrnBottomTabBarDisplayType.shifting, super(key: key); /// 动画是否可见,默认:true final bool isAnimation; /// 未读弹窗背景颜色,默认:fixedColor - final Color badgeColor; + final Color? badgeColor; /// InkResponse:是否可访问, 默认:true final bool isInkResponse; @@ -65,7 +62,7 @@ class BrnBottomTabBar extends StatefulWidget { final List items; /// Tab点击之后的回调函数 - final ValueChanged onTap; + final ValueChanged? onTap; /// 当前活动项的索引值 final int currentIndex; @@ -74,7 +71,7 @@ class BrnBottomTabBar extends StatefulWidget { final BrnBottomTabBarDisplayType type; /// 底部Tab所选中时的颜色 - final Color fixedColor; + final Color? fixedColor; /// Tab中图标的大小 final double iconSize; @@ -98,29 +95,29 @@ class _BottomNavigationTile extends StatelessWidget { this.isAnimation = true, this.isInkResponse = true, this.badgeColor, - }) : assert(selected != null); + }) ; final BrnBottomTabBarDisplayType type; final BrnBottomTabBarItem item; final Animation animation; final double iconSize; - final VoidCallback onTap; - final ColorTween colorTween; - final double flex; + final VoidCallback? onTap; + final ColorTween? colorTween; + final double? flex; final bool selected; - final String indexLabel; + final String? indexLabel; final bool isAnimation; final bool isInkResponse; - final Color badgeColor; + final Color? badgeColor; /// 构建icon Widget _buildIcon() { - double tweenStart; - Color iconColor; + double? tweenStart; + Color? iconColor; switch (type) { case BrnBottomTabBarDisplayType.fixed: tweenStart = 8.0; - iconColor = colorTween.evaluate(animation); + iconColor = colorTween?.evaluate(animation); break; case BrnBottomTabBarDisplayType.shifting: tweenStart = 16.0; @@ -150,7 +147,7 @@ class _BottomNavigationTile extends StatelessWidget { ); } - /// 构建固定Lable + /// 构建固定Label /// 修改icon与text间距在这里修改 Widget _buildFixedLabel() { double scale = isAnimation @@ -164,11 +161,11 @@ class _BottomNavigationTile extends StatelessWidget { heightFactor: 1.0, child: Container( margin: const EdgeInsets.only( - bottom: _kBottomMargin, top: _kmiddleInterval), + bottom: _kBottomMargin, top: _kMiddleInterval), child: DefaultTextStyle.merge( style: TextStyle( fontSize: _kActiveFontSize, - color: colorTween.evaluate(animation), + color: colorTween?.evaluate(animation), ), /// 使用矩阵变化控制字体大小 @@ -186,7 +183,7 @@ class _BottomNavigationTile extends StatelessWidget { ); } - /// 构建可变Lable + /// 构建可变Label Widget _buildShiftingLabel() { return Align( alignment: Alignment.bottomCenter, @@ -208,7 +205,7 @@ class _BottomNavigationTile extends StatelessWidget { fontSize: _kActiveFontSize, color: Colors.blue, ), - child: item.title, + child: item.title!, ), ), ), @@ -216,8 +213,8 @@ class _BottomNavigationTile extends StatelessWidget { } /// 构建未读消息弹窗 - Widget _buildBadge() { - if (item.badge == null && (item.badgeNo == null || item.badgeNo.isEmpty)) { + Widget? _buildBadge() { + if (item.badge == null && (item.badgeNo == null || item.badgeNo!.isEmpty)) { return Container(); } if (item.badge != null) { @@ -233,7 +230,7 @@ class _BottomNavigationTile extends StatelessWidget { borderRadius: BorderRadius.all(Radius.circular(10))), child: Text( /// 设置未读数 > item.maxBadgeNo 则报加+ 默认 99 - '${int.parse(item.badgeNo) > item.maxBadgeNo ? '${item.maxBadgeNo}+' : item.badgeNo}', + '${int.parse(item.badgeNo!) > item.maxBadgeNo ? '${item.maxBadgeNo}+' : item.badgeNo}', style: TextStyle(fontSize: 10, color: Colors.white), ), ); @@ -241,7 +238,7 @@ class _BottomNavigationTile extends StatelessWidget { /// 构建底字体缩放动画 /// label: 传入的文字组件 - Widget _buildInkWidget(Widget label) { + Widget _buildInkWidget(Widget? label) { if (isInkResponse) { return InkResponse( onTap: onTap, @@ -251,7 +248,7 @@ class _BottomNavigationTile extends StatelessWidget { mainAxisSize: MainAxisSize.min, children: [ _buildIcon(), - label, + label!, ], ), ); @@ -264,7 +261,7 @@ class _BottomNavigationTile extends StatelessWidget { mainAxisSize: MainAxisSize.min, children: [ _buildIcon(), - label, + label!, ], )); } @@ -275,15 +272,15 @@ class _BottomNavigationTile extends StatelessWidget { /// 需要将flex分配中的更改划分为更小的块 /// 制作流畅的动画。我们通过将flex值相乘来实现这一点 /// (这是一个整数)乘以一个大数。 - int size; - Widget label; + late int size; + Widget? label; switch (type) { case BrnBottomTabBarDisplayType.fixed: size = 1; label = _buildFixedLabel(); break; case BrnBottomTabBarDisplayType.shifting: - size = (flex * 1000.0).round(); + size = (flex! * 1000.0).round(); label = _buildShiftingLabel(); break; } @@ -296,7 +293,7 @@ class _BottomNavigationTile extends StatelessWidget { selected: selected, child: Stack( children: [ - Positioned(right: 4, top: 4, child: _buildBadge()), + Positioned(right: 4, top: 4, child: _buildBadge()!), _buildInkWidget(label), Semantics( label: indexLabel, @@ -312,13 +309,13 @@ class _BottomNavigationTile extends StatelessWidget { class _BottomTabBarState extends State with TickerProviderStateMixin { List _controllers = []; - List _animations; + late List _animations; /// 当前正在执行图标变色逻辑的队列 final Queue<_Circle> _circles = Queue<_Circle>(); /// 执行完动画之后的背景颜色 - Color _backgroundColor; + Color? _backgroundColor; static final Animatable _flexTween = Tween(begin: 1.0, end: 1.5); @@ -375,7 +372,7 @@ class _BottomTabBarState extends State _Circle( state: this, index: index, - color: widget.items[index].backgroundColor, + color: widget.items[index].backgroundColor!, vsync: this, )..controller.addStatusListener( (AnimationStatus status) { @@ -429,13 +426,12 @@ class _BottomTabBarState extends State List _createTiles() { final MaterialLocalizations localizations = MaterialLocalizations.of(context); - assert(localizations != null); final List children = []; switch (widget.type) { case BrnBottomTabBarDisplayType.fixed: final ThemeData themeData = Theme.of(context); final TextTheme textTheme = themeData.textTheme; - Color themeColor; + Color? themeColor; switch (themeData.brightness) { case Brightness.light: themeColor = themeData.primaryColor; @@ -445,7 +441,7 @@ class _BottomTabBarState extends State break; } final ColorTween colorTween = ColorTween( - begin: textTheme.caption.color, + begin: textTheme.caption!.color, end: widget.fixedColor ?? themeColor, ); for (int i = 0; i < widget.items.length; i += 1) { @@ -456,7 +452,7 @@ class _BottomTabBarState extends State _animations[i], widget.iconSize, onTap: () { - if (widget.onTap != null) widget.onTap(i); + if (widget.onTap != null) widget.onTap!(i); }, colorTween: colorTween, selected: i == widget.currentIndex, @@ -480,7 +476,7 @@ class _BottomTabBarState extends State _animations[i], widget.iconSize, onTap: () { - if (widget.onTap != null) widget.onTap(i); + if (widget.onTap != null) widget.onTap!(i); }, flex: _evaluateFlex(_animations[i]), selected: i == widget.currentIndex, @@ -520,7 +516,7 @@ class _BottomTabBarState extends State /// 下标题距底部距离 final double additionalBottomPadding = math.max(MediaQuery.of(context).padding.bottom - _kBottomMargin, 0.0); - Color backgroundColor; + Color? backgroundColor; switch (widget.type) { case BrnBottomTabBarDisplayType.fixed: break; @@ -579,13 +575,11 @@ class _BottomTabBarState extends State /// 功能:实现点击飞溅动画 class _Circle { _Circle({ - @required this.state, - @required this.index, - @required this.color, - @required TickerProvider vsync, - }) : assert(state != null), - assert(index != null), - assert(color != null) { + required this.state, + required this.index, + required this.color, + required TickerProvider vsync, + }) { controller = AnimationController( duration: kThemeAnimationDuration, vsync: vsync, @@ -600,8 +594,8 @@ class _Circle { final _BottomTabBarState state; final int index; final Color color; - AnimationController controller; - CurvedAnimation animation; + late AnimationController controller; + late CurvedAnimation animation; double get horizontalLeadingOffset { double weightSum(Iterable> animations) { @@ -631,10 +625,9 @@ class _Circle { /// 绘制动画色彩飞溅的圆圈 class _RadialPainter extends CustomPainter { _RadialPainter({ - @required this.circles, - @required this.textDirection, - }) : assert(circles != null), - assert(textDirection != null); + required this.circles, + required this.textDirection, + }); final List<_Circle> circles; final TextDirection textDirection; @@ -663,7 +656,7 @@ class _RadialPainter extends CustomPainter { final Paint paint = Paint()..color = circle.color; final Rect rect = Rect.fromLTWH(0.0, 0.0, size.width, size.height); canvas.clipRect(rect); - double leftFraction; + late double leftFraction; switch (textDirection) { case TextDirection.rtl: leftFraction = 1.0 - circle.horizontalLeadingOffset; diff --git a/lib/src/components/tabbar/indicator/brn_custom_width_indicator.dart b/lib/src/components/tabbar/indicator/brn_custom_width_indicator.dart index f305e256..a3d36225 100644 --- a/lib/src/components/tabbar/indicator/brn_custom_width_indicator.dart +++ b/lib/src/components/tabbar/indicator/brn_custom_width_indicator.dart @@ -1,4 +1,4 @@ -// @dart=2.9 + import 'package:flutter/material.dart'; @@ -27,35 +27,35 @@ class CustomWidthUnderlineTabIndicator extends Decoration { final double width; @override - Decoration lerpFrom(Decoration a, double t) { + Decoration? lerpFrom(Decoration? a, double t) { if (a is CustomWidthUnderlineTabIndicator) { return CustomWidthUnderlineTabIndicator( borderSide: BorderSide.lerp(a.borderSide, borderSide, t), - insets: EdgeInsetsGeometry.lerp(a.insets, insets, t), + insets: EdgeInsetsGeometry.lerp(a.insets, insets, t)!, ); } return super.lerpFrom(a, t); } @override - Decoration lerpTo(Decoration b, double t) { + Decoration? lerpTo(Decoration? b, double t) { if (b is CustomWidthUnderlineTabIndicator) { return CustomWidthUnderlineTabIndicator( borderSide: BorderSide.lerp(borderSide, b.borderSide, t), - insets: EdgeInsetsGeometry.lerp(insets, b.insets, t), + insets: EdgeInsetsGeometry.lerp(insets, b.insets, t)!, ); } return super.lerpTo(b, t); } @override - _UnderlinePainter createBoxPainter([VoidCallback onChanged]) { + _UnderlinePainter createBoxPainter([VoidCallback? onChanged]) { return _UnderlinePainter(this, width, onChanged); } } class _UnderlinePainter extends BoxPainter { - _UnderlinePainter(this.decoration, this.width, VoidCallback onChanged) + _UnderlinePainter(this.decoration, this.width, VoidCallback? onChanged) : assert(decoration != null), super(onChanged); @@ -72,7 +72,7 @@ class _UnderlinePainter extends BoxPainter { assert(textDirection != null); final Rect indicator = insets.resolve(textDirection).deflateRect(rect); //希望的宽度 - double wantWidth = width ?? 24; + double wantWidth = width; //取中间坐标 double cw = (indicator.left + indicator.right) / 2; return Rect.fromLTWH(cw - wantWidth / 2, @@ -83,8 +83,8 @@ class _UnderlinePainter extends BoxPainter { void paint(Canvas canvas, Offset offset, ImageConfiguration configuration) { assert(configuration != null); assert(configuration.size != null); - final Rect rect = offset & configuration.size; - final TextDirection textDirection = configuration.textDirection; + final Rect rect = offset & configuration.size!; + final TextDirection textDirection = configuration.textDirection!; final Rect indicator = _indicatorRectFor(rect, textDirection).deflate(borderSide.width / 2.0); final Paint paint = borderSide.toPaint()..strokeCap = StrokeCap.round; diff --git a/lib/src/components/tabbar/indicator/brn_fixed_underline_decoration.dart b/lib/src/components/tabbar/indicator/brn_fixed_underline_decoration.dart index 7641a3f1..f0a27e8a 100644 --- a/lib/src/components/tabbar/indicator/brn_fixed_underline_decoration.dart +++ b/lib/src/components/tabbar/indicator/brn_fixed_underline_decoration.dart @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// @dart=2.9 + import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; @@ -48,35 +48,35 @@ class BrnFixedUnderlineIndicator extends Decoration { final Color color; @override - Decoration lerpFrom(Decoration a, double t) { + Decoration? lerpFrom(Decoration? a, double t) { if (a is BrnFixedUnderlineIndicator) { return BrnFixedUnderlineIndicator( borderSide: BorderSide.lerp(a.borderSide, borderSide, t), - insets: EdgeInsetsGeometry.lerp(a.insets, insets, t), + insets: EdgeInsetsGeometry.lerp(a.insets, insets, t)!, ); } return super.lerpFrom(a, t); } @override - Decoration lerpTo(Decoration b, double t) { + Decoration? lerpTo(Decoration? b, double t) { if (b is BrnFixedUnderlineIndicator) { return BrnFixedUnderlineIndicator( borderSide: BorderSide.lerp(borderSide, b.borderSide, t), - insets: EdgeInsetsGeometry.lerp(insets, b.insets, t), + insets: EdgeInsetsGeometry.lerp(insets, b.insets, t)!, ); } return super.lerpTo(b, t); } @override - _FixedUnderlinePainter createBoxPainter([VoidCallback onChanged]) { + _FixedUnderlinePainter createBoxPainter([VoidCallback? onChanged]) { return _FixedUnderlinePainter(this, onChanged); } } class _FixedUnderlinePainter extends BoxPainter { - _FixedUnderlinePainter(this.decoration, VoidCallback onChanged) + _FixedUnderlinePainter(this.decoration, VoidCallback? onChanged) : assert(decoration != null), super(onChanged); @@ -102,8 +102,8 @@ class _FixedUnderlinePainter extends BoxPainter { void paint(Canvas canvas, Offset offset, ImageConfiguration configuration) { assert(configuration != null); assert(configuration.size != null); - final Rect rect = offset & configuration.size; - final TextDirection textDirection = configuration.textDirection; + final Rect rect = offset & configuration.size!; + final TextDirection textDirection = configuration.textDirection!; final Rect indicator = _indicatorRectFor(rect, textDirection).deflate(borderSide.width / 2.0); final Paint paint = borderSide.toPaint()..strokeCap = StrokeCap.square; diff --git a/lib/src/components/tabbar/indicator/brn_triangle_decoration.dart b/lib/src/components/tabbar/indicator/brn_triangle_decoration.dart index 8375f46e..82925132 100644 --- a/lib/src/components/tabbar/indicator/brn_triangle_decoration.dart +++ b/lib/src/components/tabbar/indicator/brn_triangle_decoration.dart @@ -2,21 +2,21 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// @dart=2.9 + import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; /// 三角形指示器 参考ShapeDecoration class BrnTriangleIndicator extends Decoration { - final Color color; // 指示器颜色 + final Color? color; // 指示器颜色 final double lineWidth; final double triWidth; // 三角形底边长 final double triHeight; // 三角形高 - final Gradient gradient; - final DecorationImage image; - final List shadows; - final ShapeBorder shape; + final Gradient? gradient; + final DecorationImage? image; + final List? shadows; + final ShapeBorder? shape; const BrnTriangleIndicator({ this.color = Colors.white, @@ -30,23 +30,23 @@ class BrnTriangleIndicator extends Decoration { }); factory BrnTriangleIndicator.fromBoxDecoration(BoxDecoration source) { - ShapeBorder shape; + ShapeBorder? shape; assert(source.shape != null); switch (source.shape) { case BoxShape.circle: if (source.border != null) { - assert(source.border.isUniform); - shape = CircleBorder(side: source.border.top); + assert(source.border!.isUniform); + shape = CircleBorder(side: source.border!.top); } else { shape = const CircleBorder(); } break; case BoxShape.rectangle: if (source.borderRadius != null) { - assert(source.border == null || source.border.isUniform); + assert(source.border == null || source.border!.isUniform); shape = RoundedRectangleBorder( side: source.border?.top ?? BorderSide.none, - borderRadius: source.borderRadius, + borderRadius: source.borderRadius!, ); } else { shape = source.border ?? const Border(); @@ -67,35 +67,35 @@ class BrnTriangleIndicator extends Decoration { /// /// This value may be misleading. See the discussion at [ShapeBorder.dimensions]. @override - EdgeInsets get padding => shape.dimensions; + EdgeInsets get padding => shape!.dimensions as EdgeInsets; @override bool get isComplex => shadows != null; @override - BrnTriangleIndicator lerpFrom(Decoration a, double t) { + BrnTriangleIndicator? lerpFrom(Decoration? a, double t) { if (a is BoxDecoration) { return BrnTriangleIndicator.lerp( BrnTriangleIndicator.fromBoxDecoration(a), this, t); } else if (a == null || a is BrnTriangleIndicator) { - return BrnTriangleIndicator.lerp(a, this, t); + return BrnTriangleIndicator.lerp(a as BrnTriangleIndicator?, this, t); } - return super.lerpFrom(a, t); + return super.lerpFrom(a, t) as BrnTriangleIndicator?; } @override - BrnTriangleIndicator lerpTo(Decoration b, double t) { + BrnTriangleIndicator? lerpTo(Decoration? b, double t) { if (b is BoxDecoration) { return BrnTriangleIndicator.lerp( this, BrnTriangleIndicator.fromBoxDecoration(b), t); } else if (b == null || b is BrnTriangleIndicator) { - return BrnTriangleIndicator.lerp(this, b, t); + return BrnTriangleIndicator.lerp(this, b as BrnTriangleIndicator?, t); } - return super.lerpTo(b, t); + return super.lerpTo(b, t) as BrnTriangleIndicator?; } - static BrnTriangleIndicator lerp( - BrnTriangleIndicator a, BrnTriangleIndicator b, double t) { + static BrnTriangleIndicator? lerp( + BrnTriangleIndicator? a, BrnTriangleIndicator? b, double t) { assert(t != null); if (a == null && b == null) return null; if (a != null && b != null) { @@ -105,7 +105,7 @@ class BrnTriangleIndicator extends Decoration { return BrnTriangleIndicator( color: Color.lerp(a?.color, b?.color, t), gradient: Gradient.lerp(a?.gradient, b?.gradient, t), - image: t < 0.5 ? a.image : b.image, + image: t < 0.5 ? a!.image : b!.image, shadows: BoxShadow.lerpList(a?.shadows, b?.shadows, t), shape: ShapeBorder.lerp(a?.shape, b?.shape, t), ); @@ -156,14 +156,14 @@ class BrnTriangleIndicator extends Decoration { } @override - bool hitTest(Size size, Offset position, {TextDirection textDirection}) { - return shape + bool hitTest(Size size, Offset position, {TextDirection? textDirection}) { + return shape! .getOuterPath(Offset.zero & size, textDirection: textDirection) .contains(position); } @override - _TriangleDecorationPainter createBoxPainter([VoidCallback onChanged]) { + _TriangleDecorationPainter createBoxPainter([VoidCallback? onChanged]) { assert(onChanged != null || image == null); Path path = Path(); Paint paint = Paint()..isAntiAlias = true; @@ -174,7 +174,7 @@ class BrnTriangleIndicator extends Decoration { /// An object that paints a [BrnTriangleIndicator] into a canvas. class _TriangleDecorationPainter extends BoxPainter { _TriangleDecorationPainter( - this._decoration, this._path, this._paint, VoidCallback onChanged) + this._decoration, this._path, this._paint, VoidCallback? onChanged) : assert(_decoration != null), super(onChanged); @@ -197,7 +197,7 @@ class _TriangleDecorationPainter extends BoxPainter { _path.lineTo(_vertexX + width / 2, _vertexY + height / 2); _path.close(); - _paint..color = _decoration.color; + _paint..color = _decoration.color!; _paint..strokeWidth = _decoration.lineWidth; canvas.drawPath(_path, _paint); @@ -213,7 +213,7 @@ class _TriangleDecorationPainter extends BoxPainter { void paint(Canvas canvas, Offset offset, ImageConfiguration configuration) { assert(configuration != null); assert(configuration.size != null); - final Rect rect = offset & configuration.size; + final Rect rect = offset & configuration.size!; _paintTriangle(canvas, offset, rect, configuration); } diff --git a/lib/src/components/tabbar/normal/brn_sub_switch_title.dart b/lib/src/components/tabbar/normal/brn_sub_switch_title.dart index edbc73ea..47d43f5c 100644 --- a/lib/src/components/tabbar/normal/brn_sub_switch_title.dart +++ b/lib/src/components/tabbar/normal/brn_sub_switch_title.dart @@ -1,4 +1,4 @@ -// @dart=2.9 + import 'package:bruno/src/theme/brn_theme_configurator.dart'; import 'package:flutter/material.dart'; @@ -14,18 +14,18 @@ class BrnSubSwitchTitle extends StatefulWidget { final int defaultSelectIndex; /// 选中回调 - final void Function(int index) onSelect; + final void Function(int index)? onSelect; /// 二级标题的padding /// 默认 EdgeInsets.only(right: 20) - final EdgeInsets padding; + final EdgeInsets? padding; /// tab切换控制器,默认不需要传递 - final TabController controller; + final TabController? controller; const BrnSubSwitchTitle({ - Key key, - @required this.nameList, + Key? key, + required this.nameList, this.defaultSelectIndex = 0, this.onSelect, this.padding, @@ -38,9 +38,9 @@ class BrnSubSwitchTitle extends StatefulWidget { class _BrnSubSwitchTitleState extends State with TickerProviderStateMixin { - List widgetList; + List? widgetList; - TabController _controller; + TabController? _controller; int _defaultSelectIndex = 0; @@ -51,7 +51,7 @@ class _BrnSubSwitchTitleState extends State _controller = widget.controller ?? TabController( initialIndex: _defaultSelectIndex, - length: widget.nameList?.length ?? 0, + length: widget.nameList.length, vsync: this, ); } @@ -61,7 +61,7 @@ class _BrnSubSwitchTitleState extends State super.didUpdateWidget(oldWidget); _defaultSelectIndex = widget.defaultSelectIndex; if (_controller != null) { - _controller.index = _defaultSelectIndex; + _controller!.index = _defaultSelectIndex; } } @@ -71,7 +71,7 @@ class _BrnSubSwitchTitleState extends State } Widget _toggleButtonsWidget(context) { - if (widget.nameList == null || widget.nameList.isEmpty) { + if (widget.nameList.isEmpty) { return Container( height: 0, width: 0, @@ -117,7 +117,7 @@ class _BrnSubSwitchTitleState extends State ), onTap: (index) { if (null != widget.onSelect) { - widget.onSelect(index); + widget.onSelect!(index); } }, ); diff --git a/lib/src/components/tabbar/normal/brn_switch_title.dart b/lib/src/components/tabbar/normal/brn_switch_title.dart index 10c2cf2f..2ddcdba4 100644 --- a/lib/src/components/tabbar/normal/brn_switch_title.dart +++ b/lib/src/components/tabbar/normal/brn_switch_title.dart @@ -1,4 +1,4 @@ -// @dart=2.9 + import 'package:bruno/src/components/line/brn_line.dart'; import 'package:bruno/src/components/tabbar/indicator/brn_custom_width_indicator.dart'; @@ -17,7 +17,7 @@ class BrnSwitchTitle extends StatefulWidget { /// 选中时的回调 /// index 选中的title的索引 - final void Function(int index) onSelect; + final void Function(int index)? onSelect; /// 标题的 padding,默认 `EdgeInsets.fromLTRB(0, 14, 20, 14)` final EdgeInsets padding; @@ -30,17 +30,17 @@ class BrnSwitchTitle extends StatefulWidget { /// 控制tab切换,默认不需要传递 /// 只在需要外部控制tab切换时传递 - final TabController controller; + final TabController? controller; /// 选中时的标题样式,默认 `TextStyle(fontWeight: FontWeight.w600,fontSize: 18)` - final TextStyle selectedTextStyle; + final TextStyle? selectedTextStyle; /// 未选中时的标题样式,默认 `TextStyle(fontWeight: FontWeight.w600,fontSize: 18)` - final TextStyle unselectedTextStyle; + final TextStyle? unselectedTextStyle; const BrnSwitchTitle( - {Key key, - @required this.nameList, + {Key? key, + required this.nameList, this.defaultSelectIndex = 0, this.onSelect, this.indicatorWeight = 2.0, @@ -59,7 +59,7 @@ class _BrnSwitchTitleState extends State with TickerProviderStateMixin { static final Color _color = Color(0XFF243238); - TabController _controller; + TabController? _controller; int _defaultSelectIndex = 0; @@ -68,7 +68,7 @@ class _BrnSwitchTitleState extends State super.didUpdateWidget(oldWidget); _defaultSelectIndex = widget.defaultSelectIndex; if (_controller != null) { - _controller.index = _defaultSelectIndex; + _controller!.index = _defaultSelectIndex; } } @@ -86,7 +86,7 @@ class _BrnSwitchTitleState extends State @override Widget build(BuildContext context) { - if (widget.nameList != null && widget.nameList.length > 1) { + if (widget.nameList.length > 1) { return Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, @@ -112,7 +112,7 @@ class _BrnSwitchTitleState extends State Text tx = Text(name); /// 有下划线的时候,需要将下划线的高度3减去 - double tempBottomPadding = widget.padding?.bottom ?? 0; + double tempBottomPadding = widget.padding.bottom; double bottomPadding = widget.nameList.length == 1 ? tempBottomPadding : tempBottomPadding - 3; @@ -122,20 +122,20 @@ class _BrnSwitchTitleState extends State return Container( padding: EdgeInsets.fromLTRB( - widget.padding?.left ?? 0, - widget.padding?.top ?? 0, - widget.padding?.right ?? 0, + widget.padding.left, + widget.padding.top, + widget.padding.right, bottomPadding), child: tx, ); }).toList(); Decoration _indicator = CustomWidthUnderlineTabIndicator( - width: widget.indicatorWidth ?? 24.0, + width: widget.indicatorWidth, insets: EdgeInsets.only( - left: widget.padding?.left ?? 0, right: widget.padding?.right ?? 0), + left: widget.padding.left, right: widget.padding.right), borderSide: BorderSide( - width: widget.indicatorWeight ?? 2.0, + width: widget.indicatorWeight, color: BrnThemeConfigurator.instance.getConfig().commonConfig.brandPrimary, ), @@ -175,7 +175,7 @@ class _BrnSwitchTitleState extends State indicatorWeight: 0, onTap: (index) { if (null != widget.onSelect && widget.nameList.length > 1) { - widget.onSelect(index); + widget.onSelect!(index); } }, ), diff --git a/lib/src/components/tabbar/normal/brn_tab_bar.dart b/lib/src/components/tabbar/normal/brn_tab_bar.dart index 06a6aa12..86f7a346 100644 --- a/lib/src/components/tabbar/normal/brn_tab_bar.dart +++ b/lib/src/components/tabbar/normal/brn_tab_bar.dart @@ -1,4 +1,4 @@ -// @dart=2.9 + import 'dart:ui'; @@ -22,7 +22,7 @@ typedef BrnTabBarOnTap = Function(BrnTabBarState state, int index); // ignore: must_be_immutable class BrnTabBar extends StatefulWidget { /// BrnTabBarBadge填充的数据,长度匹配控制器的TabController.length - final List tabs; + final List? tabs; /// [BrnTabBar] 的tab模式 /// 默认:[BrnTabBarBadgeMode.average](按照屏幕平均分配模式) @@ -32,51 +32,51 @@ class BrnTabBar extends StatefulWidget { final bool isScroll; /// Tabbar的整体高度 - final double tabHeight; + final double? tabHeight; /// TabBar的padding final EdgeInsetsGeometry padding; /// 控制Tab的切换 - final TabController controller; + final TabController? controller; /// TabBar背景颜色 final Color backgroundcolor; /// 指示器的颜色 - final Color indicatorColor; + final Color? indicatorColor; /// 指示器的高度 - final double indicatorWeight; + final double? indicatorWeight; /// 指示器的宽度 - final double indicatorWidth; + final double? indicatorWidth; final EdgeInsetsGeometry indicatorPadding; /// 选中Tab文本的颜色 - final Color labelColor; + final Color? labelColor; /// 选中Tab文本的样式 - final TextStyle labelStyle; + final TextStyle? labelStyle; /// Tab文本的Padding final EdgeInsetsGeometry labelPadding; /// 未选中Tab文本的颜色 - final Color unselectedLabelColor; + final Color? unselectedLabelColor; /// 未中Tab文本的样式 - final TextStyle unselectedLabelStyle; + final TextStyle? unselectedLabelStyle; /// 处理拖拽开始行为方式,默认DragStartBehavior.start final DragStartBehavior dragStartBehavior; /// Tab的选中点击事件 - final BrnTabBarOnTap onTap; + final BrnTabBarOnTap? onTap; /// 添加的Tab的宽度(指定tabWidth就不会均分屏幕宽度) - final double tabWidth; + final double? tabWidth; /// 是否显示分隔线 final bool hasDivider; @@ -88,27 +88,27 @@ class BrnTabBar extends StatefulWidget { final bool showMore; /// 展开更多弹框标题 - final String moreWindowText; + final String? moreWindowText; /// 更多弹框弹出的时候 - final VoidCallback onMorePop; + final VoidCallback? onMorePop; /// 更多弹框关闭控制器 - final BrnCloseWindowController closeController; + final BrnCloseWindowController? closeController; /// tag间距 - final double tagSpacing; + final double? tagSpacing; /// 每行tag数 - final int preLineTagCount; + final int? preLineTagCount; /// tag高度 - final double tagHeight; + final double? tagHeight; - BrnTabBarConfig themeData; + BrnTabBarConfig? themeData; BrnTabBar({ - @required this.tabs, + required this.tabs, this.mode = BrnTabBarBadgeMode.average, this.isScroll = false, this.tabHeight, @@ -139,7 +139,7 @@ class BrnTabBar extends StatefulWidget { this.tagHeight, }) : assert(tabs == null || tabs is List) { this.themeData ??= BrnTabBarConfig(); - this.themeData = this.themeData.merge(BrnTabBarConfig( + this.themeData = this.themeData!.merge(BrnTabBarConfig( tabHeight: tabHeight, indicatorHeight: indicatorWeight, indicatorWidth: indicatorWidth, @@ -150,7 +150,7 @@ class BrnTabBar extends StatefulWidget { tagHeight: tagHeight, )); this.themeData = BrnThemeConfigurator.instance - .getConfig(configId: this.themeData.configId) + .getConfig(configId: this.themeData!.configId) .tabBarConfig .merge(this.themeData); } @@ -170,33 +170,33 @@ enum BrnTabBarBadgeMode { class BrnTabBarState extends State { /// 小红点容器的样式 - BadgeShape _badgeShape; + late BadgeShape _badgeShape; /// 小红点文案 - String _badgeText; + late String _badgeText; /// 小红点容器内边距 - EdgeInsets _badgePadding; + late EdgeInsets _badgePadding; /// 小红点上偏移量 - double _paddingTop; + late double _paddingTop = 0; /// 小红点右偏移量 - double _paddingRight; + late double _paddingRight = 0; /// 小红点圆角 - BorderRadiusGeometry _borderRadius; + late BorderRadiusGeometry _borderRadius; /// 展开更多的按钮宽度 final double _moreSpacing = 50; /// BrnTabBarBadge展开更多数据处理控制器 - BrnTabbarController _brnTabbarController; + late BrnTabbarController _brnTabbarController; /// BrnTabBarBadge展开更多关闭处理控制器 - BrnCloseWindowController _closeWindowController; + BrnCloseWindowController? _closeWindowController; - BrnTabBarState(BrnCloseWindowController closeController) { + BrnTabBarState(BrnCloseWindowController? closeController) { this._closeWindowController = closeController; } @@ -205,11 +205,11 @@ class BrnTabBarState extends State { super.initState(); _brnTabbarController = BrnTabbarController(); // 监听更多弹框tab选中变化的时候 - _brnTabbarController?.addListener(() { + _brnTabbarController.addListener(() { _closeWindowController?.syncWindowState(_brnTabbarController.isShow); // 更新TabBar选中位置 if (widget.controller != null) { - widget.controller.animateTo(_brnTabbarController.selectIndex); + widget.controller!.animateTo(_brnTabbarController.selectIndex); } // 刷新选中TabBar小红点 refreshBadgeState(_brnTabbarController.selectIndex); @@ -217,10 +217,10 @@ class BrnTabBarState extends State { setState(() {}); }); - _closeWindowController?.getCloseController()?.stream?.listen((event) { - _brnTabbarController?.hide(); - _brnTabbarController?.entry?.remove(); - _brnTabbarController?.entry = null; + _closeWindowController?.getCloseController().stream.listen((event) { + _brnTabbarController.hide(); + _brnTabbarController.entry?.remove(); + _brnTabbarController.entry = null; }); widget.controller?.addListener(_handleTabIndexChangeTick); @@ -233,10 +233,10 @@ class BrnTabBarState extends State { } void _handleTabIndexChangeTick() { - if (widget.controller.index.toDouble() == - widget.controller.animation.value) { - _brnTabbarController?.selectIndex = widget.controller?.index ?? 0; - _brnTabbarController?.isShow = false; + if (widget.controller!.index.toDouble() == + widget.controller!.animation!.value) { + _brnTabbarController.selectIndex = widget.controller?.index ?? 0; + _brnTabbarController.isShow = false; } } @@ -244,8 +244,8 @@ class BrnTabBarState extends State { Widget build(BuildContext context) { return Container( padding: widget.padding, - constraints: BoxConstraints(minHeight: widget.themeData.tabHeight), - color: widget.themeData.backgroundColor, + constraints: BoxConstraints(minHeight: widget.themeData!.tabHeight), + color: widget.themeData!.backgroundColor, child: widget.showMore ? Row( children: [ @@ -265,34 +265,34 @@ class BrnTabBarState extends State { return TabBar( tabs: fillWidgetByDataList(), controller: widget.controller, - isScrollable: widget.tabs.length > 4 || + isScrollable: widget.tabs!.length > 4 || widget.tabWidth != null || widget.isScroll, - labelColor: widget.labelColor ?? widget.themeData.labelStyle.color, + labelColor: widget.labelColor ?? widget.themeData!.labelStyle.color, labelStyle: widget.labelStyle ?? - widget.themeData.labelStyle.generateTextStyle(), + widget.themeData!.labelStyle.generateTextStyle(), labelPadding: widget.labelPadding, unselectedLabelColor: widget.unselectedLabelColor ?? - widget.themeData.unselectedLabelStyle.color, + widget.themeData!.unselectedLabelStyle.color, unselectedLabelStyle: widget.unselectedLabelStyle ?? - widget.themeData.unselectedLabelStyle.generateTextStyle(), + widget.themeData!.unselectedLabelStyle.generateTextStyle(), dragStartBehavior: widget.dragStartBehavior, onTap: (index) { if (widget.onTap != null) { - widget.onTap(this, index); - _brnTabbarController?.setSelectIndex(index); - _brnTabbarController?.isShow = false; - _brnTabbarController?.entry?.remove(); - _brnTabbarController?.entry = null; + widget.onTap!(this, index); + _brnTabbarController.setSelectIndex(index); + _brnTabbarController.isShow = false; + _brnTabbarController.entry?.remove(); + _brnTabbarController.entry = null; } }, indicator: CustomWidthUnderlineTabIndicator( insets: widget.indicatorPadding, borderSide: BorderSide( - width: widget.themeData.indicatorHeight, - color: widget.indicatorColor ?? widget.themeData.labelStyle.color, + width: widget.themeData!.indicatorHeight, + color: widget.indicatorColor ?? widget.themeData!.labelStyle.color!, ), - width: widget.themeData.indicatorWidth, + width: widget.themeData!.indicatorWidth, )); } @@ -303,11 +303,11 @@ class BrnTabBarState extends State { child: GestureDetector( onTap: () { if (!_brnTabbarController.isShow && - widget.controller.index.toDouble() == - widget.controller.animation.value) { - _brnTabbarController?.show(); + widget.controller!.index.toDouble() == + widget.controller!.animation!.value) { + _brnTabbarController.show(); if (widget.onMorePop != null) { - widget.onMorePop(); + widget.onMorePop!(); } showMoreWindow(context); setState(() {}); @@ -318,7 +318,7 @@ class BrnTabBarState extends State { }, child: Container( width: _moreSpacing, - height: widget.themeData.tabHeight, + height: widget.themeData!.tabHeight, decoration: BoxDecoration( color: Colors.white, boxShadow: [ @@ -339,7 +339,7 @@ class BrnTabBarState extends State { // 更新选中tab的小红点状态 void refreshBadgeState(int index) { setState(() { - BadgeTab badgeTab = widget.tabs[index]; + BadgeTab badgeTab = widget.tabs![index]; if (badgeTab != null && badgeTab.isAutoDismiss) { badgeTab.badgeNum = null; badgeTab.badgeText = null; @@ -349,10 +349,10 @@ class BrnTabBarState extends State { } List fillWidgetByDataList() { - List widgets = List(); - List tabList = widget.tabs; + List widgets = []; + List? tabList = widget.tabs; if (tabList != null && tabList.isNotEmpty) { - double minWidth; + double? minWidth; if (widget.tabWidth != null) { minWidth = widget.tabWidth; } else { @@ -399,11 +399,11 @@ class BrnTabBarState extends State { )), Badge( showBadge: (badgeTab.badgeNum != null - ? badgeTab.badgeNum > 0 + ? badgeTab.badgeNum! > 0 : false) || badgeTab.showRedBadge || (badgeTab.badgeText != null - ? badgeTab.badgeText.isNotEmpty + ? badgeTab.badgeText!.isNotEmpty : false), badgeContent: Text( _badgeText, @@ -418,7 +418,7 @@ class BrnTabBarState extends State { padding: _badgePadding, position: BadgePosition.topEnd(top: _paddingTop, end: _paddingRight), - child: Text(badgeTab.text, + child: Text(badgeTab.text!, maxLines: 1, softWrap: true, overflow: TextOverflow.ellipsis), @@ -440,7 +440,7 @@ class BrnTabBarState extends State { // 定制的等分tab样式 Widget _wrapAverageWidget( - BadgeTab badgeTab, double minWidth, bool lastElement) { + BadgeTab badgeTab, double? minWidth, bool lastElement) { caculateBadgeParams(badgeTab); return Container( width: minWidth, @@ -464,11 +464,11 @@ class BrnTabBarState extends State { )), Badge( showBadge: (badgeTab.badgeNum != null - ? badgeTab.badgeNum > 0 + ? badgeTab.badgeNum! > 0 : false) || badgeTab.showRedBadge || (badgeTab.badgeText != null - ? badgeTab.badgeText.isNotEmpty + ? badgeTab.badgeText!.isNotEmpty : false), badgeContent: Text( _badgeText, @@ -483,7 +483,7 @@ class BrnTabBarState extends State { padding: _badgePadding, position: BadgePosition.topEnd( top: _paddingTop, end: _paddingRight), - child: Text(badgeTab.text, + child: Text(badgeTab.text!, maxLines: 1, softWrap: true, overflow: TextOverflow.ellipsis), @@ -507,14 +507,14 @@ class BrnTabBarState extends State { // 计算小红点尺寸相关参数 void caculateBadgeParams(BadgeTab badgeTab) { if (badgeTab.badgeNum != null) { - if (badgeTab.badgeNum < 10) { + if (badgeTab.badgeNum! < 10) { _badgePadding = EdgeInsets.all(5); _badgeShape = BadgeShape.circle; _badgeText = badgeTab.badgeNum?.toString() ?? ""; _paddingTop = -8; _paddingRight = -18; _borderRadius = BorderRadius.all(Radius.circular(8.5)); - } else if (badgeTab.badgeNum > 99) { + } else if (badgeTab.badgeNum! > 99) { _badgePadding = EdgeInsets.fromLTRB(4, 3, 4, 2); _badgeShape = BadgeShape.square; _badgeText = "99+"; @@ -530,7 +530,7 @@ class BrnTabBarState extends State { _borderRadius = BorderRadius.all(Radius.circular(8.5)); } } else { - if (badgeTab.badgeText != null && badgeTab.badgeText.isNotEmpty) { + if (badgeTab.badgeText != null && badgeTab.badgeText!.isNotEmpty) { _badgePadding = EdgeInsets.fromLTRB(5, 3, 5, 2); _badgeShape = BadgeShape.square; _badgeText = badgeTab.badgeText?.toString() ?? ""; @@ -553,7 +553,7 @@ class BrnTabBarState extends State { // 展开更多 void showMoreWindow(BuildContext context) { - final RenderBox dropDownItemRenderBox = context.findRenderObject(); + final RenderBox dropDownItemRenderBox = context.findRenderObject() as RenderBox; var position = dropDownItemRenderBox.localToGlobal(Offset.zero, ancestor: null); var size = dropDownItemRenderBox.size; @@ -591,10 +591,10 @@ class BrnTabBarState extends State { tabs: widget.tabs, moreWindowText: widget.moreWindowText, brnTabbarController: _brnTabbarController, - themeData: widget.themeData, - spacing: widget.themeData.tagSpacing, - preLineTagCount: widget.themeData.preLineTagCount, - tagHeight: widget.themeData.tagHeight, + themeData: widget.themeData!, + spacing: widget.themeData!.tagSpacing, + preLineTagCount: widget.themeData!.preLineTagCount, + tagHeight: widget.themeData!.tagHeight, ), ), ), @@ -610,17 +610,17 @@ class BrnTabBarState extends State { resetEntry(); } _brnTabbarController.entry = overlayEntry; - Overlay.of(context).insert(_brnTabbarController.entry); + Overlay.of(context)!.insert(_brnTabbarController.entry!); } void resetEntry() { - _brnTabbarController.entry.remove(); + _brnTabbarController.entry!.remove(); _brnTabbarController.entry = null; } void hideMoreWindow() { - if (_brnTabbarController?.isShow ?? false) { - _brnTabbarController?.hide(); + if (_brnTabbarController.isShow) { + _brnTabbarController.hide(); resetEntry(); } } @@ -629,28 +629,28 @@ class BrnTabBarState extends State { // 更多弹框样式 // ignore: must_be_immutable class _TabBarOverlayWidget extends StatefulWidget { - List tabs; + List? tabs; - String moreWindowText; + String? moreWindowText; - BrnTabbarController brnTabbarController; + BrnTabbarController? brnTabbarController; BrnTabBarConfig themeData; /// tag间距 - double spacing; + double? spacing; /// 每行tag数 - int preLineTagCount; + int? preLineTagCount; /// tag高度 - double tagHeight; + double? tagHeight; _TabBarOverlayWidget( {this.tabs, this.moreWindowText, this.brnTabbarController, - this.themeData, + required this.themeData, this.spacing, this.preLineTagCount, this.tagHeight}); @@ -661,7 +661,7 @@ class _TabBarOverlayWidget extends StatefulWidget { class _TabBarOverlayWidgetState extends State<_TabBarOverlayWidget> { /// tag宽度 - double _tagWidth; + double? _tagWidth; double _padding = 20; @@ -698,7 +698,7 @@ class _TabBarOverlayWidgetState extends State<_TabBarOverlayWidget> { children: [ Visibility( visible: widget.moreWindowText != null && - widget.moreWindowText.isNotEmpty, + widget.moreWindowText!.isNotEmpty, child: Padding( padding: EdgeInsets.only(bottom: 16), child: Text( @@ -726,12 +726,12 @@ class _TabBarOverlayWidgetState extends State<_TabBarOverlayWidget> { Widget _createMoreItems() { // 计算tag的宽度 _tagWidth = (_parentWidth - - widget.spacing * (widget.preLineTagCount - 1) - + widget.spacing! * (widget.preLineTagCount! - 1) - _padding * 2) / - widget.preLineTagCount; + widget.preLineTagCount!; - List widgets = List(); - List tabList = widget.tabs; + List widgets = []; + List? tabList = widget.tabs; if (tabList != null && tabList.isNotEmpty) { for (int i = 0; i < tabList.length; i++) { BadgeTab badgeTab = tabList[i]; @@ -739,7 +739,7 @@ class _TabBarOverlayWidgetState extends State<_TabBarOverlayWidget> { } } return Wrap( - spacing: widget.spacing, + spacing: widget.spacing!, runSpacing: 12, children: widgets, ); @@ -748,14 +748,14 @@ class _TabBarOverlayWidgetState extends State<_TabBarOverlayWidget> { Widget _createMoreItemWidget(BadgeTab badgeTab, int index) { return GestureDetector( onTap: () { - if (widget.brnTabbarController.selectIndex == index) { + if (widget.brnTabbarController!.selectIndex == index) { widget.brnTabbarController?.setSelectIndex(index); widget.brnTabbarController?.isShow = false; widget.brnTabbarController?.entry?.remove(); widget.brnTabbarController?.entry = null; setState(() {}); } else { - widget.brnTabbarController.setSelectIndex(index); + widget.brnTabbarController!.setSelectIndex(index); widget.brnTabbarController?.isShow = false; widget.brnTabbarController?.entry?.remove(); widget.brnTabbarController?.entry = null; @@ -765,21 +765,21 @@ class _TabBarOverlayWidgetState extends State<_TabBarOverlayWidget> { child: Container( alignment: Alignment.center, decoration: BoxDecoration( - color: widget.brnTabbarController.selectIndex == index + color: widget.brnTabbarController!.selectIndex == index ? widget.themeData.tagSelectedBgColor : widget.themeData.tagNormalBgColor, borderRadius: BorderRadius.circular(widget.themeData.tagRadius)), height: widget.tagHeight, width: _tagWidth, child: Text( - badgeTab.text, + badgeTab.text!, textAlign: TextAlign.center, maxLines: 1, softWrap: true, overflow: TextOverflow.ellipsis, - style: widget.brnTabbarController.selectIndex == index - ? widget.themeData.tagSelectedTextStyle?.generateTextStyle() - : widget.themeData.tagNormalTextStyle?.generateTextStyle(), + style: widget.brnTabbarController!.selectIndex == index + ? widget.themeData.tagSelectedTextStyle.generateTextStyle() + : widget.themeData.tagNormalTextStyle.generateTextStyle(), ), ), ); @@ -796,19 +796,19 @@ class BadgeTab { this.showRedBadge = false, this.isAutoDismiss = true}); - final Key key; + final Key? key; /// Tab文本 - final String text; + final String? text; /// 红点数字 - int badgeNum; + int? badgeNum; /// tab顶部文本信息 - String topText; + String? topText; /// 红点显示的文本 - String badgeText; + String? badgeText; /// 是否显示小红点,默认badgeNum没设置,不显示 bool showRedBadge; diff --git a/lib/src/components/tabbar/normal/brn_tabbar_controller.dart b/lib/src/components/tabbar/normal/brn_tabbar_controller.dart index 3ed1c24c..f68b2a6b 100644 --- a/lib/src/components/tabbar/normal/brn_tabbar_controller.dart +++ b/lib/src/components/tabbar/normal/brn_tabbar_controller.dart @@ -1,4 +1,4 @@ -// @dart=2.9 + import 'dart:async'; @@ -8,7 +8,7 @@ class BrnTabbarController extends ChangeNotifier { /// /// 更多选项距离顶部距离 /// - double top; + late double top; /// /// 是否显示更多选项弹框 @@ -18,12 +18,12 @@ class BrnTabbarController extends ChangeNotifier { /// /// 屏幕高度 /// - double screenHeight; + double? screenHeight; /// /// 展开更多图层 /// - OverlayEntry entry; + OverlayEntry? entry; /// /// 选中的角标 @@ -47,7 +47,7 @@ class BrnTabbarController extends ChangeNotifier { } class CloseWindowEvent { - bool isShow = false; + bool? isShow = false; CloseWindowEvent({this.isShow}); } @@ -76,6 +76,6 @@ class BrnCloseWindowController { } void closeMoreWindow() { - _closeController?.add(CloseWindowEvent()); + _closeController.add(CloseWindowEvent()); } } From 103ab13472ffdbebe5b20f87cdb71b06aa7df1a5 Mon Sep 17 00:00:00 2001 From: zhoujuanjuan <15143015732@163.com> Date: Tue, 11 Jan 2022 18:27:29 +0800 Subject: [PATCH 13/14] Migrated scroll_anchor to null-safety --- .../scroll_anchor/brn_scroll_anchor_tab.dart | 73 +++++++++---------- 1 file changed, 34 insertions(+), 39 deletions(-) diff --git a/lib/src/components/scroll_anchor/brn_scroll_anchor_tab.dart b/lib/src/components/scroll_anchor/brn_scroll_anchor_tab.dart index b9bcb32a..8e6f841d 100644 --- a/lib/src/components/scroll_anchor/brn_scroll_anchor_tab.dart +++ b/lib/src/components/scroll_anchor/brn_scroll_anchor_tab.dart @@ -1,4 +1,4 @@ -// @dart=2.9 + import 'dart:async'; import 'dart:ui'; @@ -20,15 +20,15 @@ class BrnAnchorTab extends StatefulWidget { final BrnAnchorTabBarStyle tabBarStyle; final AnchorTabWidgetIndexedBuilder widgetIndexedBuilder; final AnchorTabIndexedBuilder tabIndexedBuilder; - final Widget tabDivider; + final Widget? tabDivider; //设置tab与widget的个数 final int itemCount; BrnAnchorTab( - {@required this.widgetIndexedBuilder, - @required this.tabIndexedBuilder, - @required this.itemCount, + {required this.widgetIndexedBuilder, + required this.tabIndexedBuilder, + required this.itemCount, this.tabDivider, this.tabBarStyle = const BrnAnchorTabBarStyle()}); @@ -40,31 +40,31 @@ class BrnAnchorTab extends StatefulWidget { class _BrnScrollAnchorTabWidgetState extends State with SingleTickerProviderStateMixin { //用于控制 滑动 - ScrollController scrollController; + late ScrollController scrollController; //用于 滑动 和 tab 之间的通信 - StreamController streamController; + late StreamController streamController; //用于控制tab - TabController tabController; + late TabController tabController; //滑动组件的 key - GlobalKey key; + late GlobalKey key; //当前选中的索引 - int currentIndex; + int currentIndex = 0; //滑动组件的元素、 - List bodyWidgetList; + late List bodyWidgetList; //滑动组件的元素的key - List bodyKeyList; + late List bodyKeyList; //每个元素在滑动组件中的位置 - List cardOffsetList; + late List cardOffsetList; //tab - List tabList; + late List tabList; //是否点击滑动 bool tab = false; @@ -79,18 +79,17 @@ class _BrnScrollAnchorTabWidgetState extends State key = GlobalKey(); cardOffsetList = List.filled(widget.itemCount, -1.0); - bodyWidgetList = List(); - bodyKeyList = List(); - tabList = List(); + bodyWidgetList = []; + bodyKeyList = []; + tabList = []; - currentIndex = 0; tabController = TabController(length: widget.itemCount, vsync: this); fillKeyList(); fillList(); fillTab(); - WidgetsBinding.instance.addPostFrameCallback((da) { + WidgetsBinding.instance!.addPostFrameCallback((da) { fillOffset(); scrollController.addListener(() { updateOffset(); @@ -108,7 +107,7 @@ class _BrnScrollAnchorTabWidgetState extends State return Column( mainAxisSize: MainAxisSize.min, children: [ - StreamBuilder( + StreamBuilder( initialData: currentIndex, stream: streamController.stream, builder: (context, snap) { @@ -160,14 +159,12 @@ class _BrnScrollAnchorTabWidgetState extends State } void fillList() { - if (widget.widgetIndexedBuilder != null) { - for (int i = 0, n = widget.itemCount; i < n; i++) { - bodyWidgetList.add( - Container( - key: bodyKeyList[i], - child: widget.widgetIndexedBuilder(context, i)), - ); - } + for (int i = 0, n = widget.itemCount; i < n; i++) { + bodyWidgetList.add( + Container( + key: bodyKeyList[i], + child: widget.widgetIndexedBuilder(context, i)), + ); } } @@ -178,7 +175,7 @@ class _BrnScrollAnchorTabWidgetState extends State } void fillOffset() { - Offset globalToLocal = (key.currentContext.findRenderObject() as RenderBox) + Offset globalToLocal = (key.currentContext!.findRenderObject() as RenderBox) .localToGlobal(Offset.zero); listDy = globalToLocal.dy; @@ -186,7 +183,7 @@ class _BrnScrollAnchorTabWidgetState extends State if (cardOffsetList[i] == -1.0) if (bodyKeyList[i].currentContext != null) { double cardOffset = - (bodyKeyList[i].currentContext.findRenderObject() as RenderBox) + (bodyKeyList[i].currentContext!.findRenderObject() as RenderBox) .localToGlobal(Offset.zero) //相对于原点 控件的位置 .dy; //y点坐标 @@ -196,11 +193,9 @@ class _BrnScrollAnchorTabWidgetState extends State } void fillTab() { - if (widget.tabIndexedBuilder != null) { for (int i = 0, n = widget.itemCount; i < n; i++) { tabList.add(widget.tabIndexedBuilder(context, i)); } - } } void updateOffset() { @@ -208,7 +203,7 @@ class _BrnScrollAnchorTabWidgetState extends State if (cardOffsetList[i] == -1.0) if (bodyKeyList[i].currentContext != null) { double cardOffset = - (bodyKeyList[i].currentContext.findRenderObject() as RenderBox) + (bodyKeyList[i].currentContext!.findRenderObject() as RenderBox) .localToGlobal(Offset.zero) //相对于原点 控件的位置 .dy; //y点坐标 @@ -238,21 +233,21 @@ class _BrnScrollAnchorTabWidgetState extends State } class BrnAnchorTabBarStyle { - final Color indicatorColor; + final Color? indicatorColor; final double indicatorWeight; final EdgeInsetsGeometry indicatorPadding; - final Color labelColor; + final Color? labelColor; - final Color unselectedLabelColor; + final Color? unselectedLabelColor; - final TextStyle labelStyle; + final TextStyle? labelStyle; - final EdgeInsetsGeometry labelPadding; + final EdgeInsetsGeometry? labelPadding; - final TextStyle unselectedLabelStyle; + final TextStyle? unselectedLabelStyle; final DragStartBehavior dragStartBehavior; From 5748da7ba1093a8dd00e82db5a89ca80e205f0af Mon Sep 17 00:00:00 2001 From: zhoujuanjuan <15143015732@163.com> Date: Mon, 17 Jan 2022 15:43:04 +0800 Subject: [PATCH 14/14] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E8=BF=81=E7=A7=BBt?= =?UTF-8?q?abar=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scroll_anchor/brn_scroll_anchor_tab.dart | 86 +++++++++---------- .../bottom/brn_bottom_tab_bar_main.dart | 14 ++- .../indicator/brn_triangle_decoration.dart | 2 +- .../components/tabbar/normal/brn_tab_bar.dart | 21 +++-- .../tabbar/normal/brn_tabbar_controller.dart | 2 +- 5 files changed, 68 insertions(+), 57 deletions(-) diff --git a/lib/src/components/scroll_anchor/brn_scroll_anchor_tab.dart b/lib/src/components/scroll_anchor/brn_scroll_anchor_tab.dart index 8e6f841d..29b3fea2 100644 --- a/lib/src/components/scroll_anchor/brn_scroll_anchor_tab.dart +++ b/lib/src/components/scroll_anchor/brn_scroll_anchor_tab.dart @@ -40,31 +40,31 @@ class BrnAnchorTab extends StatefulWidget { class _BrnScrollAnchorTabWidgetState extends State with SingleTickerProviderStateMixin { //用于控制 滑动 - late ScrollController scrollController; + late ScrollController _scrollController; //用于 滑动 和 tab 之间的通信 - late StreamController streamController; + late StreamController _streamController; //用于控制tab - late TabController tabController; + late TabController _tabController; //滑动组件的 key - late GlobalKey key; + late GlobalKey _key; //当前选中的索引 int currentIndex = 0; //滑动组件的元素、 - late List bodyWidgetList; + late List _bodyWidgetList; //滑动组件的元素的key - late List bodyKeyList; + late List _bodyKeyList; //每个元素在滑动组件中的位置 - late List cardOffsetList; + late List _cardOffsetList; //tab - late List tabList; + late List _tabList; //是否点击滑动 bool tab = false; @@ -74,16 +74,16 @@ class _BrnScrollAnchorTabWidgetState extends State @override void initState() { - streamController = StreamController(); - scrollController = ScrollController(); + _streamController = StreamController(); + _scrollController = ScrollController(); - key = GlobalKey(); - cardOffsetList = List.filled(widget.itemCount, -1.0); - bodyWidgetList = []; - bodyKeyList = []; - tabList = []; + _key = GlobalKey(); + _cardOffsetList = List.filled(widget.itemCount, -1.0); + _bodyWidgetList = []; + _bodyKeyList = []; + _tabList = []; - tabController = TabController(length: widget.itemCount, vsync: this); + _tabController = TabController(length: widget.itemCount, vsync: this); fillKeyList(); fillList(); @@ -91,11 +91,11 @@ class _BrnScrollAnchorTabWidgetState extends State WidgetsBinding.instance!.addPostFrameCallback((da) { fillOffset(); - scrollController.addListener(() { + _scrollController.addListener(() { updateOffset(); - currentIndex = createIndex(scrollController.offset); + currentIndex = createIndex(_scrollController.offset); //防止再次 发送消息 - if (!tab) streamController.add(currentIndex); + if (!tab) _streamController.add(currentIndex); }); }); @@ -109,9 +109,9 @@ class _BrnScrollAnchorTabWidgetState extends State children: [ StreamBuilder( initialData: currentIndex, - stream: streamController.stream, + stream: _streamController.stream, builder: (context, snap) { - tabController.index = currentIndex; + _tabController.index = currentIndex; return BrnTabBar( indicatorColor: widget.tabBarStyle.indicatorColor, indicatorWeight: widget.tabBarStyle.indicatorWeight, @@ -122,14 +122,14 @@ class _BrnScrollAnchorTabWidgetState extends State unselectedLabelColor: widget.tabBarStyle.unselectedLabelColor, unselectedLabelStyle: widget.tabBarStyle.unselectedLabelStyle, dragStartBehavior: widget.tabBarStyle.dragStartBehavior, - controller: tabController, - tabs: tabList, + controller: _tabController, + tabs: _tabList, onTap: (state, index) { state.refreshBadgeState(index); currentIndex = index; tab = true; - scrollController - .animateTo(cardOffsetList[index], + _scrollController + .animateTo(_cardOffsetList[index], duration: Duration(milliseconds: 100), curve: Curves.linear) .whenComplete(() { @@ -148,10 +148,10 @@ class _BrnScrollAnchorTabWidgetState extends State child: SingleChildScrollView( child: Column( mainAxisSize: MainAxisSize.min, - children: bodyWidgetList, + children: _bodyWidgetList, ), - key: key, - controller: scrollController, + key: _key, + controller: _scrollController, ), ) ], @@ -160,9 +160,9 @@ class _BrnScrollAnchorTabWidgetState extends State void fillList() { for (int i = 0, n = widget.itemCount; i < n; i++) { - bodyWidgetList.add( + _bodyWidgetList.add( Container( - key: bodyKeyList[i], + key: _bodyKeyList[i], child: widget.widgetIndexedBuilder(context, i)), ); } @@ -170,44 +170,44 @@ class _BrnScrollAnchorTabWidgetState extends State void fillKeyList() { for (int i = 0, n = widget.itemCount; i < n; i++) { - bodyKeyList.add(GlobalKey()); + _bodyKeyList.add(GlobalKey()); } } void fillOffset() { - Offset globalToLocal = (key.currentContext!.findRenderObject() as RenderBox) + Offset globalToLocal = (_key.currentContext!.findRenderObject() as RenderBox) .localToGlobal(Offset.zero); listDy = globalToLocal.dy; for (int i = 0, n = widget.itemCount; i < n; i++) { - if (cardOffsetList[i] == -1.0) if (bodyKeyList[i].currentContext != + if (_cardOffsetList[i] == -1.0) if (_bodyKeyList[i].currentContext != null) { double cardOffset = - (bodyKeyList[i].currentContext!.findRenderObject() as RenderBox) + (_bodyKeyList[i].currentContext!.findRenderObject() as RenderBox) .localToGlobal(Offset.zero) //相对于原点 控件的位置 .dy; //y点坐标 - cardOffsetList[i] = cardOffset + scrollController.offset - listDy; + _cardOffsetList[i] = cardOffset + _scrollController.offset - listDy; } } } void fillTab() { for (int i = 0, n = widget.itemCount; i < n; i++) { - tabList.add(widget.tabIndexedBuilder(context, i)); + _tabList.add(widget.tabIndexedBuilder(context, i)); } } void updateOffset() { for (int i = 0, n = widget.itemCount; i < n; i++) { - if (cardOffsetList[i] == -1.0) if (bodyKeyList[i].currentContext != + if (_cardOffsetList[i] == -1.0) if (_bodyKeyList[i].currentContext != null) { double cardOffset = - (bodyKeyList[i].currentContext!.findRenderObject() as RenderBox) + (_bodyKeyList[i].currentContext!.findRenderObject() as RenderBox) .localToGlobal(Offset.zero) //相对于原点 控件的位置 .dy; //y点坐标 - cardOffsetList[i] = cardOffset + scrollController.offset - listDy; + _cardOffsetList[i] = cardOffset + _scrollController.offset - listDy; } } } @@ -216,7 +216,7 @@ class _BrnScrollAnchorTabWidgetState extends State int createIndex(double offset) { int index = 0; for (int i = 0, n = widget.itemCount; i < n; i++) { - if (offset >= cardOffsetList[i] && (offset <= cardOffsetList[i + 1])) { + if (offset >= _cardOffsetList[i] && (offset <= _cardOffsetList[i + 1])) { return i; } } @@ -226,9 +226,9 @@ class _BrnScrollAnchorTabWidgetState extends State @override void dispose() { super.dispose(); - tabController.dispose(); - streamController.close(); - scrollController.dispose(); + _tabController.dispose(); + _streamController.close(); + _scrollController.dispose(); } } diff --git a/lib/src/components/tabbar/bottom/brn_bottom_tab_bar_main.dart b/lib/src/components/tabbar/bottom/brn_bottom_tab_bar_main.dart index 1ff2b67d..40cb9016 100644 --- a/lib/src/components/tabbar/bottom/brn_bottom_tab_bar_main.dart +++ b/lib/src/components/tabbar/bottom/brn_bottom_tab_bar_main.dart @@ -230,12 +230,24 @@ class _BottomNavigationTile extends StatelessWidget { borderRadius: BorderRadius.all(Radius.circular(10))), child: Text( /// 设置未读数 > item.maxBadgeNo 则报加+ 默认 99 - '${int.parse(item.badgeNo!) > item.maxBadgeNo ? '${item.maxBadgeNo}+' : item.badgeNo}', + _getUnReadText(), style: TextStyle(fontSize: 10, color: Colors.white), ), ); } + String _getUnReadText(){ + int _badgeNo = 0; + try { + if (item.badgeNo != null) { + _badgeNo = int.parse(item.badgeNo!); + } + } catch (e) { + debugPrint('badgeNo has FormatException'); + } + return '${_badgeNo > item.maxBadgeNo ? '${item.maxBadgeNo}+' : _badgeNo}'; + } + /// 构建底字体缩放动画 /// label: 传入的文字组件 Widget _buildInkWidget(Widget? label) { diff --git a/lib/src/components/tabbar/indicator/brn_triangle_decoration.dart b/lib/src/components/tabbar/indicator/brn_triangle_decoration.dart index 82925132..60bccfb6 100644 --- a/lib/src/components/tabbar/indicator/brn_triangle_decoration.dart +++ b/lib/src/components/tabbar/indicator/brn_triangle_decoration.dart @@ -105,7 +105,7 @@ class BrnTriangleIndicator extends Decoration { return BrnTriangleIndicator( color: Color.lerp(a?.color, b?.color, t), gradient: Gradient.lerp(a?.gradient, b?.gradient, t), - image: t < 0.5 ? a!.image : b!.image, + image: t < 0.5 ? a?.image : b?.image, shadows: BoxShadow.lerpList(a?.shadows, b?.shadows, t), shape: ShapeBorder.lerp(a?.shape, b?.shape, t), ); diff --git a/lib/src/components/tabbar/normal/brn_tab_bar.dart b/lib/src/components/tabbar/normal/brn_tab_bar.dart index 86f7a346..b1c16e4a 100644 --- a/lib/src/components/tabbar/normal/brn_tab_bar.dart +++ b/lib/src/components/tabbar/normal/brn_tab_bar.dart @@ -1,5 +1,3 @@ - - import 'dart:ui'; import 'package:badges/badges.dart'; @@ -179,10 +177,10 @@ class BrnTabBarState extends State { late EdgeInsets _badgePadding; /// 小红点上偏移量 - late double _paddingTop = 0; + double _paddingTop = 0; /// 小红点右偏移量 - late double _paddingRight = 0; + double _paddingRight = 0; /// 小红点圆角 late BorderRadiusGeometry _borderRadius; @@ -233,8 +231,8 @@ class BrnTabBarState extends State { } void _handleTabIndexChangeTick() { - if (widget.controller!.index.toDouble() == - widget.controller!.animation!.value) { + if (widget.controller?.index.toDouble() == + widget.controller?.animation?.value) { _brnTabbarController.selectIndex = widget.controller?.index ?? 0; _brnTabbarController.isShow = false; } @@ -553,7 +551,8 @@ class BrnTabBarState extends State { // 展开更多 void showMoreWindow(BuildContext context) { - final RenderBox dropDownItemRenderBox = context.findRenderObject() as RenderBox; + final RenderBox dropDownItemRenderBox = + context.findRenderObject() as RenderBox; var position = dropDownItemRenderBox.localToGlobal(Offset.zero, ancestor: null); var size = dropDownItemRenderBox.size; @@ -572,7 +571,7 @@ class BrnTabBarState extends State { }, child: Container( padding: EdgeInsets.only( - top: _brnTabbarController.top, + top: _brnTabbarController.top!, ), child: Stack( children: [ @@ -584,7 +583,7 @@ class BrnTabBarState extends State { child: Container( width: MediaQuery.of(context).size.width, height: MediaQuery.of(context).size.height - - _brnTabbarController.top, + _brnTabbarController.top!, child: Padding( padding: EdgeInsets.all(0), child: _TabBarOverlayWidget( @@ -614,7 +613,7 @@ class BrnTabBarState extends State { } void resetEntry() { - _brnTabbarController.entry!.remove(); + _brnTabbarController.entry?.remove(); _brnTabbarController.entry = null; } @@ -772,7 +771,7 @@ class _TabBarOverlayWidgetState extends State<_TabBarOverlayWidget> { height: widget.tagHeight, width: _tagWidth, child: Text( - badgeTab.text!, + badgeTab.text ?? '', textAlign: TextAlign.center, maxLines: 1, softWrap: true, diff --git a/lib/src/components/tabbar/normal/brn_tabbar_controller.dart b/lib/src/components/tabbar/normal/brn_tabbar_controller.dart index f68b2a6b..b0337c54 100644 --- a/lib/src/components/tabbar/normal/brn_tabbar_controller.dart +++ b/lib/src/components/tabbar/normal/brn_tabbar_controller.dart @@ -8,7 +8,7 @@ class BrnTabbarController extends ChangeNotifier { /// /// 更多选项距离顶部距离 /// - late double top; + double? top; /// /// 是否显示更多选项弹框