diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 9774b1ac..9ee2224b 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -29,13 +29,13 @@ dependencies: flutter_easyrefresh: ^2.2.1 lpinyin: ^2.0.3 badges: ^2.0.2 + intl: ^0.17.0 dev_dependencies: flutter_test: sdk: flutter -dependency_overrides: - 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_common_action_sheet.dart b/lib/src/components/actionsheet/brn_common_action_sheet.dart index f3c4a41e..d0e297f8 100644 --- a/lib/src/components/actionsheet/brn_common_action_sheet.dart +++ b/lib/src/components/actionsheet/brn_common_action_sheet.dart @@ -23,7 +23,7 @@ enum BrnCommonActionSheetItemStyle { class BrnCommonActionSheetItem { /// 标题文字 - String? title; + String title; /// 辅助信息 String? desc; @@ -232,31 +232,24 @@ class BrnCommonActionSheet extends StatelessWidget { // action 每个item配置项 [BrnCommonActionSheetItem] Widget _configTile(BrnCommonActionSheetItem action) { List tileElements = []; - bool hasTitle = false; - // 如果有标题则添加标题 - if (action.title != null) { - tileElements.add(Center( - child: Text( - action.title!, - maxLines: 1, - style: action.titleStyle ?? - (action.actionStyle == BrnCommonActionSheetItemStyle.alert - ? this.themeData!.itemTitleStyleAlert.generateTextStyle() - : (action.actionStyle == BrnCommonActionSheetItemStyle.link - ? this.themeData!.itemTitleStyleLink.generateTextStyle() - : this.themeData!.itemTitleStyle.generateTextStyle())), - ), - )); - hasTitle = true; - } + // 添加标题 + tileElements.add(Center( + child: Text( + action.title, + maxLines: 1, + style: action.titleStyle ?? + (action.actionStyle == BrnCommonActionSheetItemStyle.alert + ? this.themeData!.itemTitleStyleAlert.generateTextStyle() + : (action.actionStyle == BrnCommonActionSheetItemStyle.link + ? this.themeData!.itemTitleStyleLink.generateTextStyle() + : this.themeData!.itemTitleStyle.generateTextStyle())), + ), + )); // 如果有辅助信息则添加辅助信息 if (action.desc != null) { - // 如果有标题添加间距 - if (hasTitle) { - tileElements.add(SizedBox( - height: 2, - )); - } + tileElements.add(SizedBox( + height: 2, + )); tileElements.add( Center( child: Text(