Skip to content

Commit

Permalink
Theme: 优化单例实现,初步优化 BrnAllThemeConfig 属性获取不为 null (LianjiaTech#40)
Browse files Browse the repository at this point in the history
* Theme: 优化单例实现,初步优化 BrnAllThemeConfig 属性获取不为 null

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

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

* theme:增加属性类型
  • Loading branch information
zhoujuanjuan authored and leftcoding committed Dec 31, 2021
1 parent c3d145b commit 09ca6d7
Show file tree
Hide file tree
Showing 24 changed files with 2,655 additions and 1,591 deletions.
2 changes: 1 addition & 1 deletion example/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ end
target 'Runner' do
use_frameworks!
use_modular_headers!

# Flutter Pod

copied_flutter_dir = File.join(__dir__, 'Flutter')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class TitleSelectInputState extends State<TitleSelectInputExamplePage> {
title: _list[0],
hint: "请输入",
controller: controller,
inputFormatters: [FilteringTextInputFormatter(RegExp('[0-9"]'))],
inputFormatters: [FilteringTextInputFormatter.digitsOnly],
selectedIndex: -1,
selectList: _list,
onTip: () {
Expand Down
10 changes: 0 additions & 10 deletions example/lib/sample/theme/config_test_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions lib/src/components/navbar/brn_appbar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/src/components/sugsearch/brn_search_text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ class _SearchTextState extends State<BrnSearchText> {
child: GestureDetector(
onTap: () {
if (widget.onTextClear != null) {
bool isIntercept = widget.onTextClear!() ?? false;
bool isIntercept = widget.onTextClear!();
if (isIntercept) return;
}
textEditingController!.clear();
Expand Down
3 changes: 1 addition & 2 deletions lib/src/theme/base/brn_base_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,5 @@ abstract class BrnBaseConfig {
_currentLevelCommonConfig ??
BrnThemeConfigurator.instance
.getConfig(configId: configId)
.commonConfig ??
BrnDefaultConfigUtils.defaultCommonConfig;
.commonConfig;
}
Loading

0 comments on commit 09ca6d7

Please sign in to comment.