|
| 1 | +import 'dart:io'; |
| 2 | + |
1 | 3 | import 'package:flutter/material.dart';
|
2 | 4 | import 'package:flutter/services.dart';
|
3 | 5 | import 'package:provider/provider.dart';
|
@@ -135,6 +137,71 @@ class _ReceiveTabState extends State<ReceiveTab> {
|
135 | 137 | );
|
136 | 138 | }
|
137 | 139 |
|
| 140 | + Widget renderPurchaseButtons() { |
| 141 | + if (widget.wallet.letterCode == 'tPPC') { |
| 142 | + return Align( |
| 143 | + child: PeerContainer( |
| 144 | + child: Column( |
| 145 | + crossAxisAlignment: CrossAxisAlignment.center, |
| 146 | + children: <Widget>[ |
| 147 | + PeerServiceTitle( |
| 148 | + title: AppLocalizations.instance.translate('receive_obtain'), |
| 149 | + ), |
| 150 | + const SizedBox(height: 20), |
| 151 | + Text( |
| 152 | + AppLocalizations.instance.translate('receive_website_faucet'), |
| 153 | + textAlign: TextAlign.center, |
| 154 | + ), |
| 155 | + const SizedBox(height: 20), |
| 156 | + PeerButton( |
| 157 | + text: AppLocalizations.instance.translate('receive_faucet'), |
| 158 | + action: () { |
| 159 | + launchURL('https://ppc.lol/faucet/'); |
| 160 | + }, |
| 161 | + ), |
| 162 | + ], |
| 163 | + ), |
| 164 | + ), |
| 165 | + ); |
| 166 | + } else if (widget.wallet.letterCode == 'PPC' && Platform.isIOS == false) { |
| 167 | + return Align( |
| 168 | + child: PeerContainer( |
| 169 | + child: Column( |
| 170 | + crossAxisAlignment: CrossAxisAlignment.center, |
| 171 | + children: <Widget>[ |
| 172 | + PeerServiceTitle( |
| 173 | + title: AppLocalizations.instance.translate('buy_peercoin'), |
| 174 | + ), |
| 175 | + const SizedBox(height: 20), |
| 176 | + Text( |
| 177 | + AppLocalizations.instance |
| 178 | + .translate('receive_website_description'), |
| 179 | + textAlign: TextAlign.center, |
| 180 | + ), |
| 181 | + const SizedBox(height: 20), |
| 182 | + PeerButton( |
| 183 | + text: AppLocalizations.instance |
| 184 | + .translate('receive_website_credit'), |
| 185 | + action: () { |
| 186 | + launchURL('https://ppc.lol/buy'); |
| 187 | + }, |
| 188 | + ), |
| 189 | + const SizedBox(height: 20), |
| 190 | + PeerButton( |
| 191 | + text: AppLocalizations.instance |
| 192 | + .translate('receive_website_exchandes'), |
| 193 | + action: () { |
| 194 | + launchURL('https://ppc.lol/exchanges'); |
| 195 | + }, |
| 196 | + ), |
| 197 | + ], |
| 198 | + ), |
| 199 | + ), |
| 200 | + ); |
| 201 | + } |
| 202 | + return const SizedBox(); |
| 203 | + } |
| 204 | + |
138 | 205 | @override
|
139 | 206 | Widget build(BuildContext context) {
|
140 | 207 | return Stack(
|
@@ -293,69 +360,7 @@ class _ReceiveTabState extends State<ReceiveTab> {
|
293 | 360 | ),
|
294 | 361 | ),
|
295 | 362 | ),
|
296 |
| - widget.wallet.letterCode == 'tPPC' |
297 |
| - ? Align( |
298 |
| - child: PeerContainer( |
299 |
| - child: Column( |
300 |
| - crossAxisAlignment: CrossAxisAlignment.center, |
301 |
| - children: <Widget>[ |
302 |
| - PeerServiceTitle( |
303 |
| - title: AppLocalizations.instance |
304 |
| - .translate('receive_obtain'), |
305 |
| - ), |
306 |
| - const SizedBox(height: 20), |
307 |
| - Text( |
308 |
| - AppLocalizations.instance |
309 |
| - .translate('receive_website_faucet'), |
310 |
| - textAlign: TextAlign.center, |
311 |
| - ), |
312 |
| - const SizedBox(height: 20), |
313 |
| - PeerButton( |
314 |
| - text: AppLocalizations.instance |
315 |
| - .translate('receive_faucet'), |
316 |
| - action: () { |
317 |
| - launchURL('https://ppc.lol/faucet/'); |
318 |
| - }, |
319 |
| - ), |
320 |
| - ], |
321 |
| - ), |
322 |
| - ), |
323 |
| - ) |
324 |
| - : Align( |
325 |
| - child: PeerContainer( |
326 |
| - child: Column( |
327 |
| - crossAxisAlignment: CrossAxisAlignment.center, |
328 |
| - children: <Widget>[ |
329 |
| - PeerServiceTitle( |
330 |
| - title: AppLocalizations.instance |
331 |
| - .translate('buy_peercoin'), |
332 |
| - ), |
333 |
| - const SizedBox(height: 20), |
334 |
| - Text( |
335 |
| - AppLocalizations.instance |
336 |
| - .translate('receive_website_description'), |
337 |
| - textAlign: TextAlign.center, |
338 |
| - ), |
339 |
| - const SizedBox(height: 20), |
340 |
| - PeerButton( |
341 |
| - text: AppLocalizations.instance |
342 |
| - .translate('receive_website_credit'), |
343 |
| - action: () { |
344 |
| - launchURL('https://ppc.lol/buy'); |
345 |
| - }, |
346 |
| - ), |
347 |
| - const SizedBox(height: 20), |
348 |
| - PeerButton( |
349 |
| - text: AppLocalizations.instance |
350 |
| - .translate('receive_website_exchandes'), |
351 |
| - action: () { |
352 |
| - launchURL('https://ppc.lol/exchanges'); |
353 |
| - }, |
354 |
| - ), |
355 |
| - ], |
356 |
| - ), |
357 |
| - ), |
358 |
| - ), |
| 363 | + renderPurchaseButtons(), |
359 | 364 | ],
|
360 | 365 | ),
|
361 | 366 | ],
|
|
0 commit comments