refacto: new UdUnitDisplay Widget
This commit is contained in:
parent
150f6892f8
commit
c81662de83
|
@ -390,34 +390,5 @@ class WalletOptionsProvider with ChangeNotifier {
|
|||
|
||||
return addressGet;
|
||||
}
|
||||
|
||||
Widget udUnitDisplay(double size, [Color color = Colors.black]) {
|
||||
final bool isUdUnit = configBox.get('isUdUnit') ?? false;
|
||||
return isUdUnit
|
||||
? Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Text(
|
||||
'ud'.tr(args: ['']),
|
||||
style: TextStyle(
|
||||
fontSize: isTall ? size : size * 0.9, color: color),
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
Text(
|
||||
currencyName,
|
||||
style: TextStyle(
|
||||
fontSize: (isTall ? size : size * 0.9) * 0.7,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: color),
|
||||
),
|
||||
const SizedBox(height: 15)
|
||||
],
|
||||
)
|
||||
],
|
||||
)
|
||||
: Text(currencyName,
|
||||
style:
|
||||
TextStyle(fontSize: isTall ? size : size * 0.9, color: color));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|||
import 'package:gecko/globals.dart';
|
||||
import 'package:gecko/providers/substrate_sdk.dart';
|
||||
import 'package:gecko/providers/wallet_options.dart';
|
||||
import 'package:gecko/widgets/ud_unit_display.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class Balance extends StatelessWidget {
|
||||
|
@ -37,7 +38,7 @@ class Balance extends StatelessWidget {
|
|||
fontSize: isTall ? size : size * 0.9,
|
||||
color: color)),
|
||||
const SizedBox(width: 5),
|
||||
walletOptions.udUnitDisplay(size, color),
|
||||
UdUnitDisplay(size: size, color: color),
|
||||
]);
|
||||
} else {
|
||||
return SizedBox(
|
||||
|
@ -62,7 +63,7 @@ class Balance extends StatelessWidget {
|
|||
),
|
||||
),
|
||||
const SizedBox(width: 5),
|
||||
walletOptions.udUnitDisplay(size, color),
|
||||
UdUnitDisplay(size: size, color: color),
|
||||
]);
|
||||
} else {
|
||||
return const Text('');
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:gecko/globals.dart';
|
||||
|
||||
class UdUnitDisplay extends StatelessWidget {
|
||||
const UdUnitDisplay({
|
||||
Key? key,
|
||||
required this.size,
|
||||
required this.color,
|
||||
}) : super(key: key);
|
||||
|
||||
final double size;
|
||||
final Color color;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final bool isUdUnit = configBox.get('isUdUnit') ?? false;
|
||||
return isUdUnit
|
||||
? Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Text(
|
||||
'ud'.tr(args: ['']),
|
||||
style: TextStyle(
|
||||
fontSize: isTall ? size : size * 0.9, color: color),
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
Text(
|
||||
currencyName,
|
||||
style: TextStyle(
|
||||
fontSize: (isTall ? size : size * 0.9) * 0.7,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: color),
|
||||
),
|
||||
const SizedBox(height: 15)
|
||||
],
|
||||
)
|
||||
],
|
||||
)
|
||||
: Text(currencyName,
|
||||
style:
|
||||
TextStyle(fontSize: isTall ? size : size * 0.9, color: color));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue