align currency options

This commit is contained in:
julian 2023-03-10 18:44:25 -06:00
parent 02e984f479
commit 7a958696d0

View file

@ -76,7 +76,7 @@ class _FiatSelectionViewState extends State<FiatSelectionView> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
Locale locale = Localizations.localeOf(context); Locale locale = Localizations.localeOf(context);
var format = NumberFormat.simpleCurrency(locale: locale.toString()); final format = NumberFormat.simpleCurrency(locale: locale.toString());
// See https://stackoverflow.com/a/67055685 // See https://stackoverflow.com/a/67055685
final isDesktop = Util.isDesktop; final isDesktop = Util.isDesktop;
@ -186,80 +186,178 @@ class _FiatSelectionViewState extends State<FiatSelectionView> {
height: 12, height: 12,
), ),
Flexible( Flexible(
child: RoundedWhiteContainer( child: SingleChildScrollView(
padding: const EdgeInsets.all(0), child: RoundedWhiteContainer(
child: ListView.builder( padding: const EdgeInsets.all(0),
shrinkWrap: true, child: Table(
primary: isDesktop ? false : null, columnWidths: const {
itemCount: _fiats.length, 0: IntrinsicColumnWidth(),
itemBuilder: (builderContext, index) { 1: FlexColumnWidth(),
return Padding( },
padding: const EdgeInsets.symmetric(vertical: 4), defaultVerticalAlignment: TableCellVerticalAlignment.middle,
child: GestureDetector( children: [
onTap: () { ..._fiats.map(
Navigator.of(context).pop(_fiats[index]); (e) {
}, return TableRow(
child: RoundedWhiteContainer(
child: Row(
children: [ children: [
Container( TableCell(
padding: const EdgeInsets.all(7.5), verticalAlignment:
decoration: BoxDecoration( TableCellVerticalAlignment.fill,
color: Theme.of(context) child: GestureDetector(
.extension<StackColors>()! onTap: () => Navigator.of(context).pop(e),
.currencyListItemBG, child: Container(
borderRadius: BorderRadius.circular(4), color: Colors.transparent,
), padding: const EdgeInsets.only(left: 12),
child: Text( child: Column(
format.simpleCurrencySymbol( mainAxisSize: MainAxisSize.min,
_fiats[index].ticker.toUpperCase()), mainAxisAlignment: MainAxisAlignment.center,
style: STextStyles.subtitle(context).apply( crossAxisAlignment:
fontSizeFactor: (1 / CrossAxisAlignment.stretch,
format children: [
.simpleCurrencySymbol(_fiats[index] Container(
.ticker padding: const EdgeInsets.all(7.5),
.toUpperCase()) decoration: BoxDecoration(
.length * // Couldn't get pow() working here color: Theme.of(context)
format .extension<StackColors>()!
.simpleCurrencySymbol(_fiats[index] .currencyListItemBG,
.ticker borderRadius:
.toUpperCase()) BorderRadius.circular(4),
.length)), ),
textAlign: TextAlign.center, child: Text(
format.simpleCurrencySymbol(
e.ticker.toUpperCase()),
style: STextStyles.subtitle(context)
.apply(
fontSizeFactor: (1 /
format
.simpleCurrencySymbol(
e.ticker.toUpperCase())
.length * // Couldn't get pow() working here
format
.simpleCurrencySymbol(
e.ticker.toUpperCase())
.length),
),
textAlign: TextAlign.center,
),
),
],
),
),
), ),
), ),
const SizedBox( GestureDetector(
width: 10, onTap: () => Navigator.of(context).pop(e),
), child: Container(
Expanded( color: Colors.transparent,
child: Column( child: Padding(
crossAxisAlignment: CrossAxisAlignment.start, padding: const EdgeInsets.all(12),
children: [ child: Column(
Text( crossAxisAlignment:
_fiats[index].name, CrossAxisAlignment.start,
style: STextStyles.largeMedium14(context), children: [
Text(
e.name,
style:
STextStyles.largeMedium14(context),
),
const SizedBox(
height: 2,
),
Text(
e.ticker.toUpperCase(),
style: STextStyles.smallMed12(context)
.copyWith(
color: Theme.of(context)
.extension<StackColors>()!
.textSubtitle1,
),
),
],
), ),
const SizedBox( ),
height: 2,
),
Text(
_fiats[index].ticker.toUpperCase(),
style: STextStyles.smallMed12(context)
.copyWith(
color: Theme.of(context)
.extension<StackColors>()!
.textSubtitle1,
),
),
],
), ),
), ),
], ],
), );
), },
), ),
); ],
}, ),
// child: ListView.builder(
// shrinkWrap: true,
// primary: isDesktop ? false : null,
// itemCount: _fiats.length,
// itemBuilder: (builderContext, index) {
// return Padding(
// padding: const EdgeInsets.symmetric(vertical: 4),
// child: GestureDetector(
// onTap: () {
// Navigator.of(context).pop(_fiats[index]);
// },
// child: RoundedWhiteContainer(
// child: Row(
// children: [
// Container(
// padding: const EdgeInsets.all(7.5),
// decoration: BoxDecoration(
// color: Theme.of(context)
// .extension<StackColors>()!
// .currencyListItemBG,
// borderRadius: BorderRadius.circular(4),
// ),
// child: Text(
// format.simpleCurrencySymbol(
// _fiats[index].ticker.toUpperCase()),
// style: STextStyles.subtitle(context).apply(
// fontSizeFactor: (1 /
// format
// .simpleCurrencySymbol(_fiats[index]
// .ticker
// .toUpperCase())
// .length * // Couldn't get pow() working here
// format
// .simpleCurrencySymbol(_fiats[index]
// .ticker
// .toUpperCase())
// .length)),
// textAlign: TextAlign.center,
// ),
// ),
// const SizedBox(
// width: 10,
// ),
// Expanded(
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Text(
// _fiats[index].name,
// style: STextStyles.largeMedium14(context),
// ),
// const SizedBox(
// height: 2,
// ),
// Text(
// _fiats[index].ticker.toUpperCase(),
// style: STextStyles.smallMed12(context)
// .copyWith(
// color: Theme.of(context)
// .extension<StackColors>()!
// .textSubtitle1,
// ),
// ),
// ],
// ),
// ),
// ],
// ),
// ),
// ),
// );
// },
// ),
), ),
), ),
), ),