opt android ab ui (#8374)
* multiline error banner * mobile remove ab permission icons due to hard to press * center ab dropdown button text Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
parent
db108d964b
commit
8d6de9ca59
@ -2747,12 +2747,10 @@ Widget buildErrorBanner(BuildContext context,
|
|||||||
required RxString err,
|
required RxString err,
|
||||||
required Function? retry,
|
required Function? retry,
|
||||||
required Function close}) {
|
required Function close}) {
|
||||||
const double height = 25;
|
|
||||||
return Obx(() => Offstage(
|
return Obx(() => Offstage(
|
||||||
offstage: !(!loading.value && err.value.isNotEmpty),
|
offstage: !(!loading.value && err.value.isNotEmpty),
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Container(
|
child: Container(
|
||||||
height: height,
|
|
||||||
color: MyTheme.color(context).errorBannerBg,
|
color: MyTheme.color(context).errorBannerBg,
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
@ -2771,7 +2769,6 @@ Widget buildErrorBanner(BuildContext context,
|
|||||||
message: translate(err.value),
|
message: translate(err.value),
|
||||||
child: Text(
|
child: Text(
|
||||||
translate(err.value),
|
translate(err.value),
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
),
|
),
|
||||||
)).marginSymmetric(vertical: 2),
|
)).marginSymmetric(vertical: 2),
|
||||||
),
|
),
|
||||||
|
@ -130,7 +130,6 @@ class _AddressBookState extends State<AddressBook> {
|
|||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
child: _buildTags(),
|
child: _buildTags(),
|
||||||
),
|
),
|
||||||
_buildAbPermission(),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -198,24 +197,28 @@ class _AddressBookState extends State<AddressBook> {
|
|||||||
if (contains) {
|
if (contains) {
|
||||||
names.insert(0, personalAddressBookName);
|
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
|
final items = names
|
||||||
.map((e) => DropdownMenuItem(
|
.map((e) => DropdownMenuItem(value: e, child: buildItem(e)))
|
||||||
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,
|
|
||||||
)),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)))
|
|
||||||
.toList();
|
.toList();
|
||||||
var menuItemStyleData = MenuItemStyleData(height: 36);
|
var menuItemStyleData = MenuItemStyleData(height: 36);
|
||||||
if (contains && items.length > 1) {
|
if (contains && items.length > 1) {
|
||||||
@ -237,14 +240,22 @@ class _AddressBookState extends State<AddressBook> {
|
|||||||
bind.setLocalFlutterOption(k: kOptionCurrentAbName, v: value);
|
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(
|
underline: Container(
|
||||||
height: 0.7,
|
height: 0.7,
|
||||||
color: Theme.of(context).dividerColor.withOpacity(0.1),
|
color: Theme.of(context).dividerColor.withOpacity(0.1),
|
||||||
),
|
),
|
||||||
buttonStyleData: ButtonStyleData(height: 48),
|
|
||||||
menuItemStyleData: menuItemStyleData,
|
menuItemStyleData: menuItemStyleData,
|
||||||
items: items,
|
items: items,
|
||||||
isExpanded: true,
|
isExpanded: true,
|
||||||
|
isDense: true,
|
||||||
dropdownSearchData: DropdownSearchData(
|
dropdownSearchData: DropdownSearchData(
|
||||||
searchController: textEditingController,
|
searchController: textEditingController,
|
||||||
searchInnerWidgetHeight: 50,
|
searchInnerWidgetHeight: 50,
|
||||||
|
Loading…
Reference in New Issue
Block a user