diff --git a/flutter/lib/common.dart b/flutter/lib/common.dart index 4536a806d..407e2ed03 100644 --- a/flutter/lib/common.dart +++ b/flutter/lib/common.dart @@ -2747,12 +2747,10 @@ Widget buildErrorBanner(BuildContext context, required RxString err, required Function? retry, required Function close}) { - const double height = 25; return Obx(() => Offstage( offstage: !(!loading.value && err.value.isNotEmpty), child: Center( child: Container( - height: height, color: MyTheme.color(context).errorBannerBg, child: Row( mainAxisAlignment: MainAxisAlignment.center, @@ -2771,7 +2769,6 @@ Widget buildErrorBanner(BuildContext context, message: translate(err.value), child: Text( translate(err.value), - overflow: TextOverflow.ellipsis, ), )).marginSymmetric(vertical: 2), ), diff --git a/flutter/lib/common/widgets/address_book.dart b/flutter/lib/common/widgets/address_book.dart index 1128f1aa5..d316d4fa2 100644 --- a/flutter/lib/common/widgets/address_book.dart +++ b/flutter/lib/common/widgets/address_book.dart @@ -130,7 +130,6 @@ class _AddressBookState extends State { width: double.infinity, child: _buildTags(), ), - _buildAbPermission(), ], ), ), @@ -198,24 +197,28 @@ class _AddressBookState extends State { if (contains) { names.insert(0, personalAddressBookName); } + + Row buildItem(String e, {bool button = false}) { + return Row( + children: [ + Expanded( + child: Tooltip( + waitDuration: Duration(milliseconds: 500), + message: gFFI.abModel.translatedName(e), + child: Text( + gFFI.abModel.translatedName(e), + style: button ? null : TextStyle(fontSize: 14.0), + maxLines: 1, + overflow: TextOverflow.ellipsis, + textAlign: button ? TextAlign.center : null, + )), + ), + ], + ); + } + final items = names - .map((e) => DropdownMenuItem( - value: e, - child: Row( - children: [ - Expanded( - child: Tooltip( - waitDuration: Duration(milliseconds: 500), - message: gFFI.abModel.translatedName(e), - child: Text( - gFFI.abModel.translatedName(e), - style: TextStyle(fontSize: 14.0), - maxLines: 1, - overflow: TextOverflow.ellipsis, - )), - ), - ], - ))) + .map((e) => DropdownMenuItem(value: e, child: buildItem(e))) .toList(); var menuItemStyleData = MenuItemStyleData(height: 36); if (contains && items.length > 1) { @@ -237,14 +240,22 @@ class _AddressBookState extends State { bind.setLocalFlutterOption(k: kOptionCurrentAbName, v: value); } }, + customButton: Container( + height: isDesktop ? 48 : 40, + child: Row(children: [ + Expanded( + child: buildItem(gFFI.abModel.currentName.value, button: true)), + Icon(Icons.arrow_drop_down), + ]), + ), underline: Container( height: 0.7, color: Theme.of(context).dividerColor.withOpacity(0.1), ), - buttonStyleData: ButtonStyleData(height: 48), menuItemStyleData: menuItemStyleData, items: items, isExpanded: true, + isDense: true, dropdownSearchData: DropdownSearchData( searchController: textEditingController, searchInnerWidgetHeight: 50,