Skip to content

Commit

Permalink
Merge pull request #1388 from ardriveapp/PE-4397
Browse files Browse the repository at this point in the history
PE-4397: Country Dropdown - Fixes
  • Loading branch information
matibat authored Sep 28, 2023
2 parents aa8e678 + 8034723 commit cd2424c
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,6 @@ class EntityActionsMenu extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ArDriveDropdown(
width: item is DriveDataItem ? 240 : 160,
height: isMobile(context) ? 44 : 60,
anchor: alignment,
items: _getItems(item, context, withInfo),
Expand Down
2 changes: 0 additions & 2 deletions lib/pages/drive_detail/drive_detail_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,6 @@ class _DriveDetailPageState extends State<DriveDetailPage> {
tooltip:
appLocalizationsOf(context).showMenu,
child: ArDriveDropdown(
width: 260,
anchor: const Aligned(
follower: Alignment.topRight,
target: Alignment.bottomRight,
Expand Down Expand Up @@ -775,7 +774,6 @@ class MobileFolderNavigation extends StatelessWidget {
state.currentDrive.ownerAddress);

return ArDriveDropdown(
width: 240,
anchor: const Aligned(
follower: Alignment.topRight,
target: Alignment.bottomRight,
Expand Down
36 changes: 27 additions & 9 deletions lib/turbo/topup/views/topup_payment_form.dart
Original file line number Diff line number Diff line change
Expand Up @@ -430,13 +430,6 @@ class TurboPaymentFormViewState extends State<TurboPaymentFormView> {
nameOnCardTextField(),
],
),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
countryTextField(theme),
],
),
const SizedBox(height: 16),
Padding(
padding: const EdgeInsets.only(bottom: 4, right: 16),
child: Align(
Expand Down Expand Up @@ -493,6 +486,13 @@ class TurboPaymentFormViewState extends State<TurboPaymentFormView> {
),
),
const SizedBox(height: 16),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
countryTextField(theme),
],
),
const SizedBox(height: 16),
Row(children: [promoCodeLabel()]),
ScreenTypeLayout.builder(
mobile: (context) => Row(children: [
Expand Down Expand Up @@ -1018,11 +1018,29 @@ class InputDropdownMenu<T extends InputDropdownItem> extends StatefulWidget {
class _InputDropdownMenuState<T extends InputDropdownItem>
extends State<InputDropdownMenu<T>> {
T? _selectedItem;
final GlobalKey _childKey = GlobalKey();
double? _childWidth;
double get childWidth => _childWidth ?? 200;

void _refreshChildWidth() {
final currentContext = _childKey.currentContext;
if (currentContext == null) {
return;
}

final RenderBox renderBox =
_childKey.currentContext!.findRenderObject() as RenderBox;

setState(() {
_childWidth = renderBox.size.width;
});
}

@override
initState() {
super.initState();
_selectedItem = widget.selectedItem;
WidgetsBinding.instance.addPostFrameCallback((_) => _refreshChildWidth());
}

@override
Expand All @@ -1032,13 +1050,12 @@ class _InputDropdownMenuState<T extends InputDropdownItem>
showScrollbars: true,
onClick: widget.onClick,
maxHeight: 275,
width: 200,
anchor: widget.anchor,
items: widget.items
.map(
(e) => ArDriveDropdownItem(
content: Container(
width: 200,
width: _childWidth,
alignment: Alignment.center,
height: 44,
color: widget.backgroundColor ??
Expand Down Expand Up @@ -1072,6 +1089,7 @@ class _InputDropdownMenuState<T extends InputDropdownItem>
)
.toList(),
child: Column(
key: _childKey,
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
Expand Down
6 changes: 3 additions & 3 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ packages:
dependency: "direct main"
description:
path: "."
ref: "v1.10.0"
resolved-ref: "72cd21de7cbd52067924cefac579cdb9d7ef39b7"
ref: "v1.11.0"
resolved-ref: "357ce9113b6c90eb00d3ae4528112a8228d9d11f"
url: "https://github.com/ar-io/ardrive_ui.git"
source: git
version: "1.10.0"
version: "1.11.0"
args:
dependency: transitive
description:
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ dependencies:
ardrive_ui:
git:
url: https://github.com/ar-io/ardrive_ui.git
ref: v1.10.0
ref: v1.11.0
artemis: ^7.0.0-beta.13
arweave:
git:
Expand Down

0 comments on commit cd2424c

Please sign in to comment.