Skip to content

Commit add5b89

Browse files
authored
Merge pull request #159 from MostroP2P/fix/buysell-buttons-cutoff
Fixed the BUY/SELL button text cutoff
2 parents 699eecc + 2ae67d8 commit add5b89

File tree

1 file changed

+67
-62
lines changed

1 file changed

+67
-62
lines changed

lib/shared/widgets/add_order_button.dart

Lines changed: 67 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ class _AddOrderButtonState extends State<AddOrderButton>
5858
Widget build(BuildContext context) {
5959
return SizedBox(
6060
height: 130,
61-
width: 200,
6261
child: Column(
6362
mainAxisAlignment: MainAxisAlignment.end,
6463
crossAxisAlignment: CrossAxisAlignment.end,
@@ -69,71 +68,77 @@ class _AddOrderButtonState extends State<AddOrderButton>
6968
margin: const EdgeInsets.only(bottom: 10),
7069
child: Opacity(
7170
opacity: _isMenuOpen ? 1.0 : 0.0,
72-
child: Row(
73-
mainAxisSize: MainAxisSize.min,
74-
children: [
75-
Stack(
76-
alignment: Alignment.centerLeft,
77-
children: [
78-
ElevatedButton.icon(
79-
key: const Key('buyButton'),
80-
onPressed: _isMenuOpen
81-
? () => _navigateToCreateOrder(context, 'buy')
82-
: null,
83-
style: ElevatedButton.styleFrom(
84-
backgroundColor: AppTheme.buyColor,
85-
foregroundColor: Colors.black,
86-
shape: RoundedRectangleBorder(
87-
borderRadius: BorderRadius.circular(50),
71+
child: IntrinsicWidth(
72+
child: Row(
73+
mainAxisSize: MainAxisSize.min,
74+
children: [
75+
Flexible(
76+
child: Stack(
77+
alignment: Alignment.centerLeft,
78+
children: [
79+
ElevatedButton.icon(
80+
key: const Key('buyButton'),
81+
onPressed: _isMenuOpen
82+
? () => _navigateToCreateOrder(context, 'buy')
83+
: null,
84+
style: ElevatedButton.styleFrom(
85+
backgroundColor: AppTheme.buyColor,
86+
foregroundColor: Colors.black,
87+
shape: RoundedRectangleBorder(
88+
borderRadius: BorderRadius.circular(50),
89+
),
90+
padding: const EdgeInsets.symmetric(
91+
horizontal: 12, vertical: 10),
92+
),
93+
icon: const SizedBox(width: 16, height: 16),
94+
label: Text(S.of(context)!.buy,
95+
style:
96+
const TextStyle(fontWeight: FontWeight.bold)),
8897
),
89-
padding: const EdgeInsets.symmetric(
90-
horizontal: 16, vertical: 10),
91-
),
92-
icon: const SizedBox(width: 16, height: 16),
93-
label: Text(S.of(context)!.buy,
94-
style:
95-
const TextStyle(fontWeight: FontWeight.bold)),
98+
if (_isMenuOpen)
99+
const Positioned(
100+
left: 12,
101+
child: Icon(Icons.arrow_downward,
102+
size: 16, color: Colors.black),
103+
),
104+
],
96105
),
97-
if (_isMenuOpen)
98-
const Positioned(
99-
left: 16,
100-
child: Icon(Icons.arrow_downward,
101-
size: 16, color: Colors.black),
102-
),
103-
],
104-
),
105-
const SizedBox(width: 8),
106-
Stack(
107-
alignment: Alignment.centerLeft,
108-
children: [
109-
ElevatedButton.icon(
110-
key: const Key('sellButton'),
111-
onPressed: _isMenuOpen
112-
? () => _navigateToCreateOrder(context, 'sell')
113-
: null,
114-
style: ElevatedButton.styleFrom(
115-
backgroundColor: AppTheme.sellColor,
116-
foregroundColor: Colors.black,
117-
shape: RoundedRectangleBorder(
118-
borderRadius: BorderRadius.circular(50),
106+
),
107+
const SizedBox(width: 6),
108+
Flexible(
109+
child: Stack(
110+
alignment: Alignment.centerLeft,
111+
children: [
112+
ElevatedButton.icon(
113+
key: const Key('sellButton'),
114+
onPressed: _isMenuOpen
115+
? () => _navigateToCreateOrder(context, 'sell')
116+
: null,
117+
style: ElevatedButton.styleFrom(
118+
backgroundColor: AppTheme.sellColor,
119+
foregroundColor: Colors.black,
120+
shape: RoundedRectangleBorder(
121+
borderRadius: BorderRadius.circular(50),
122+
),
123+
padding: const EdgeInsets.symmetric(
124+
horizontal: 12, vertical: 10),
125+
),
126+
icon: const SizedBox(width: 16, height: 16),
127+
label: Text(S.of(context)!.sell,
128+
style:
129+
const TextStyle(fontWeight: FontWeight.bold)),
119130
),
120-
padding: const EdgeInsets.symmetric(
121-
horizontal: 16, vertical: 10),
122-
),
123-
icon: const SizedBox(width: 16, height: 16),
124-
label: Text(S.of(context)!.sell,
125-
style:
126-
const TextStyle(fontWeight: FontWeight.bold)),
131+
if (_isMenuOpen)
132+
const Positioned(
133+
left: 12,
134+
child: Icon(Icons.arrow_upward,
135+
size: 16, color: Colors.black),
136+
),
137+
],
127138
),
128-
if (_isMenuOpen)
129-
const Positioned(
130-
left: 16,
131-
child: Icon(Icons.arrow_upward,
132-
size: 16, color: Colors.black),
133-
),
134-
],
135-
),
136-
],
139+
),
140+
],
141+
),
137142
),
138143
),
139144
),

0 commit comments

Comments
 (0)