tmp commit
This commit is contained in:
parent
2bf5adf049
commit
d3582c1da3
|
@ -250,6 +250,58 @@ class DuniterIndexer with ChangeNotifier {
|
|||
);
|
||||
}
|
||||
|
||||
Widget balance(BuildContext context, String address, double size,
|
||||
[Color color = Colors.black,
|
||||
Color loadingColor = const Color(0xffd07316)]) {
|
||||
return Column(children: <Widget>[
|
||||
Consumer<SubstrateSdk>(builder: (context, sdk, _) {
|
||||
return FutureBuilder(
|
||||
future: sdk.getBalance(address),
|
||||
builder: (BuildContext context,
|
||||
AsyncSnapshot<Map<String, double>> globalBalance) {
|
||||
if (globalBalance.connectionState != ConnectionState.done ||
|
||||
globalBalance.hasError) {
|
||||
if (balanceCache[address] != null &&
|
||||
balanceCache[address] != -1) {
|
||||
return Row(children: [
|
||||
Text(balanceCache[address]!.toString(),
|
||||
style: TextStyle(
|
||||
fontSize: isTall ? size : size * 0.9, color: color)),
|
||||
const SizedBox(width: 5),
|
||||
udUnitDisplay(size, color),
|
||||
]);
|
||||
} else {
|
||||
return SizedBox(
|
||||
height: 15,
|
||||
width: 15,
|
||||
child: CircularProgressIndicator(
|
||||
color: loadingColor,
|
||||
strokeWidth: 2,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
balanceCache[address] = globalBalance.data!['transferableBalance']!;
|
||||
if (balanceCache[address] != -1) {
|
||||
return Row(children: [
|
||||
Text(
|
||||
balanceCache[address]!.toString(),
|
||||
style: TextStyle(
|
||||
fontSize: isTall ? size : size * 0.9,
|
||||
color: color,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 5),
|
||||
udUnitDisplay(size, color),
|
||||
]);
|
||||
} else {
|
||||
return const Text('');
|
||||
}
|
||||
});
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
||||
Widget searchIdentity(BuildContext context, String name) {
|
||||
// WalletOptionsProvider _walletOptions =
|
||||
// Provider.of<WalletOptionsProvider>(context, listen: false);
|
||||
|
|
|
@ -507,57 +507,7 @@ class WalletOptionsProvider with ChangeNotifier {
|
|||
|
||||
Map<String, double> balanceCache = {};
|
||||
|
||||
Widget balance(BuildContext context, String address, double size,
|
||||
[Color color = Colors.black,
|
||||
Color loadingColor = const Color(0xffd07316)]) {
|
||||
return Column(children: <Widget>[
|
||||
Consumer<SubstrateSdk>(builder: (context, sdk, _) {
|
||||
return FutureBuilder(
|
||||
future: sdk.getBalance(address),
|
||||
builder: (BuildContext context,
|
||||
AsyncSnapshot<Map<String, double>> globalBalance) {
|
||||
if (globalBalance.connectionState != ConnectionState.done ||
|
||||
globalBalance.hasError) {
|
||||
if (balanceCache[address] != null &&
|
||||
balanceCache[address] != -1) {
|
||||
return Row(children: [
|
||||
Text(balanceCache[address]!.toString(),
|
||||
style: TextStyle(
|
||||
fontSize: isTall ? size : size * 0.9, color: color)),
|
||||
const SizedBox(width: 5),
|
||||
udUnitDisplay(size, color),
|
||||
]);
|
||||
} else {
|
||||
return SizedBox(
|
||||
height: 15,
|
||||
width: 15,
|
||||
child: CircularProgressIndicator(
|
||||
color: loadingColor,
|
||||
strokeWidth: 2,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
balanceCache[address] = globalBalance.data!['transferableBalance']!;
|
||||
if (balanceCache[address] != -1) {
|
||||
return Row(children: [
|
||||
Text(
|
||||
balanceCache[address]!.toString(),
|
||||
style: TextStyle(
|
||||
fontSize: isTall ? size : size * 0.9,
|
||||
color: color,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 5),
|
||||
udUnitDisplay(size, color),
|
||||
]);
|
||||
} else {
|
||||
return const Text('');
|
||||
}
|
||||
});
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
Widget getCerts(BuildContext context, String address, double size,
|
||||
[Color color = Colors.black]) {
|
||||
|
|
|
@ -129,6 +129,58 @@ class WalletsProfilesProvider with ChangeNotifier {
|
|||
return _balance;
|
||||
}
|
||||
|
||||
Widget balance(BuildContext context, String address, double size,
|
||||
[Color color = Colors.black,
|
||||
Color loadingColor = const Color(0xffd07316)]) {
|
||||
return Column(children: <Widget>[
|
||||
Consumer<SubstrateSdk>(builder: (context, sdk, _) {
|
||||
return FutureBuilder(
|
||||
future: sdk.getBalance(address),
|
||||
builder: (BuildContext context,
|
||||
AsyncSnapshot<Map<String, double>> globalBalance) {
|
||||
if (globalBalance.connectionState != ConnectionState.done ||
|
||||
globalBalance.hasError) {
|
||||
if (balanceCache[address] != null &&
|
||||
balanceCache[address] != -1) {
|
||||
return Row(children: [
|
||||
Text(balanceCache[address]!.toString(),
|
||||
style: TextStyle(
|
||||
fontSize: isTall ? size : size * 0.9, color: color)),
|
||||
const SizedBox(width: 5),
|
||||
udUnitDisplay(size, color),
|
||||
]);
|
||||
} else {
|
||||
return SizedBox(
|
||||
height: 15,
|
||||
width: 15,
|
||||
child: CircularProgressIndicator(
|
||||
color: loadingColor,
|
||||
strokeWidth: 2,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
balanceCache[address] = globalBalance.data!['transferableBalance']!;
|
||||
if (balanceCache[address] != -1) {
|
||||
return Row(children: [
|
||||
Text(
|
||||
balanceCache[address]!.toString(),
|
||||
style: TextStyle(
|
||||
fontSize: isTall ? size : size * 0.9,
|
||||
color: color,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 5),
|
||||
udUnitDisplay(size, color),
|
||||
]);
|
||||
} else {
|
||||
return const Text('');
|
||||
}
|
||||
});
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
||||
Widget headerProfileView(
|
||||
BuildContext context, String address, String? username) {
|
||||
const double avatarSize = 140;
|
||||
|
|
|
@ -211,6 +211,58 @@ class ChooseWalletScreen extends StatelessWidget {
|
|||
]);
|
||||
}
|
||||
|
||||
Widget balance(BuildContext context, String address, double size,
|
||||
[Color color = Colors.black,
|
||||
Color loadingColor = const Color(0xffd07316)]) {
|
||||
return Column(children: <Widget>[
|
||||
Consumer<SubstrateSdk>(builder: (context, sdk, _) {
|
||||
return FutureBuilder(
|
||||
future: sdk.getBalance(address),
|
||||
builder: (BuildContext context,
|
||||
AsyncSnapshot<Map<String, double>> globalBalance) {
|
||||
if (globalBalance.connectionState != ConnectionState.done ||
|
||||
globalBalance.hasError) {
|
||||
if (balanceCache[address] != null &&
|
||||
balanceCache[address] != -1) {
|
||||
return Row(children: [
|
||||
Text(balanceCache[address]!.toString(),
|
||||
style: TextStyle(
|
||||
fontSize: isTall ? size : size * 0.9, color: color)),
|
||||
const SizedBox(width: 5),
|
||||
udUnitDisplay(size, color),
|
||||
]);
|
||||
} else {
|
||||
return SizedBox(
|
||||
height: 15,
|
||||
width: 15,
|
||||
child: CircularProgressIndicator(
|
||||
color: loadingColor,
|
||||
strokeWidth: 2,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
balanceCache[address] = globalBalance.data!['transferableBalance']!;
|
||||
if (balanceCache[address] != -1) {
|
||||
return Row(children: [
|
||||
Text(
|
||||
balanceCache[address]!.toString(),
|
||||
style: TextStyle(
|
||||
fontSize: isTall ? size : size * 0.9,
|
||||
color: color,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 5),
|
||||
udUnitDisplay(size, color),
|
||||
]);
|
||||
} else {
|
||||
return const Text('');
|
||||
}
|
||||
});
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
||||
Widget balanceBuilder(context, String address, bool isDefault) {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
|
|
|
@ -574,4 +574,58 @@ class WalletOptions extends StatelessWidget {
|
|||
);
|
||||
});
|
||||
}
|
||||
|
||||
Widget balance(BuildContext context, String address, double size,
|
||||
[Color color = Colors.black,
|
||||
Color loadingColor = const Color(0xffd07316)]) {
|
||||
return Column(children: <Widget>[
|
||||
Consumer<SubstrateSdk>(builder: (context, sdk, _) {
|
||||
return FutureBuilder(
|
||||
future: sdk.getBalance(address),
|
||||
builder: (BuildContext context,
|
||||
AsyncSnapshot<Map<String, double>> globalBalance) {
|
||||
if (globalBalance.connectionState != ConnectionState.done ||
|
||||
globalBalance.hasError) {
|
||||
if (balanceCache[address] != null &&
|
||||
balanceCache[address] != -1) {
|
||||
return Row(children: [
|
||||
Text(balanceCache[address]!.toString(),
|
||||
style: TextStyle(
|
||||
fontSize: isTall ? size : size * 0.9, color: color)),
|
||||
const SizedBox(width: 5),
|
||||
udUnitDisplay(size, color),
|
||||
]);
|
||||
} else {
|
||||
return SizedBox(
|
||||
height: 15,
|
||||
width: 15,
|
||||
child: CircularProgressIndicator(
|
||||
color: loadingColor,
|
||||
strokeWidth: 2,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
balanceCache[address] = globalBalance.data!['transferableBalance']!;
|
||||
if (balanceCache[address] != -1) {
|
||||
return Row(children: [
|
||||
Text(
|
||||
balanceCache[address]!.toString(),
|
||||
style: TextStyle(
|
||||
fontSize: isTall ? size : size * 0.9,
|
||||
color: color,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 5),
|
||||
udUnitDisplay(size, color),
|
||||
]);
|
||||
} else {
|
||||
return const Text('');
|
||||
}
|
||||
});
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -373,6 +373,58 @@ class WalletsHome extends StatelessWidget {
|
|||
]);
|
||||
}
|
||||
|
||||
Widget balance(BuildContext context, String address, double size,
|
||||
[Color color = Colors.black,
|
||||
Color loadingColor = const Color(0xffd07316)]) {
|
||||
return Column(children: <Widget>[
|
||||
Consumer<SubstrateSdk>(builder: (context, sdk, _) {
|
||||
return FutureBuilder(
|
||||
future: sdk.getBalance(address),
|
||||
builder: (BuildContext context,
|
||||
AsyncSnapshot<Map<String, double>> globalBalance) {
|
||||
if (globalBalance.connectionState != ConnectionState.done ||
|
||||
globalBalance.hasError) {
|
||||
if (balanceCache[address] != null &&
|
||||
balanceCache[address] != -1) {
|
||||
return Row(children: [
|
||||
Text(balanceCache[address]!.toString(),
|
||||
style: TextStyle(
|
||||
fontSize: isTall ? size : size * 0.9, color: color)),
|
||||
const SizedBox(width: 5),
|
||||
udUnitDisplay(size, color),
|
||||
]);
|
||||
} else {
|
||||
return SizedBox(
|
||||
height: 15,
|
||||
width: 15,
|
||||
child: CircularProgressIndicator(
|
||||
color: loadingColor,
|
||||
strokeWidth: 2,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
balanceCache[address] = globalBalance.data!['transferableBalance']!;
|
||||
if (balanceCache[address] != -1) {
|
||||
return Row(children: [
|
||||
Text(
|
||||
balanceCache[address]!.toString(),
|
||||
style: TextStyle(
|
||||
fontSize: isTall ? size : size * 0.9,
|
||||
color: color,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 5),
|
||||
udUnitDisplay(size, color),
|
||||
]);
|
||||
} else {
|
||||
return const Text('');
|
||||
}
|
||||
});
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
||||
Widget balanceBuilder(context, String address, bool isDefault) {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
|
|
|
@ -40,6 +40,58 @@ class ContactsScreen extends StatelessWidget {
|
|||
p2.username?.toLowerCase() ?? 'zz');
|
||||
});
|
||||
|
||||
Widget balance(BuildContext context, String address, double size,
|
||||
[Color color = Colors.black,
|
||||
Color loadingColor = const Color(0xffd07316)]) {
|
||||
return Column(children: <Widget>[
|
||||
Consumer<SubstrateSdk>(builder: (context, sdk, _) {
|
||||
return FutureBuilder(
|
||||
future: sdk.getBalance(address),
|
||||
builder: (BuildContext context,
|
||||
AsyncSnapshot<Map<String, double>> globalBalance) {
|
||||
if (globalBalance.connectionState != ConnectionState.done ||
|
||||
globalBalance.hasError) {
|
||||
if (balanceCache[address] != null &&
|
||||
balanceCache[address] != -1) {
|
||||
return Row(children: [
|
||||
Text(balanceCache[address]!.toString(),
|
||||
style: TextStyle(
|
||||
fontSize: isTall ? size : size * 0.9, color: color)),
|
||||
const SizedBox(width: 5),
|
||||
udUnitDisplay(size, color),
|
||||
]);
|
||||
} else {
|
||||
return SizedBox(
|
||||
height: 15,
|
||||
width: 15,
|
||||
child: CircularProgressIndicator(
|
||||
color: loadingColor,
|
||||
strokeWidth: 2,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
balanceCache[address] = globalBalance.data!['transferableBalance']!;
|
||||
if (balanceCache[address] != -1) {
|
||||
return Row(children: [
|
||||
Text(
|
||||
balanceCache[address]!.toString(),
|
||||
style: TextStyle(
|
||||
fontSize: isTall ? size : size * 0.9,
|
||||
color: color,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 5),
|
||||
udUnitDisplay(size, color),
|
||||
]);
|
||||
} else {
|
||||
return const Text('');
|
||||
}
|
||||
});
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: backgroundColor,
|
||||
appBar: AppBar(
|
||||
|
|
|
@ -18,6 +18,58 @@ import 'package:provider/provider.dart';
|
|||
class SearchResultScreen extends StatelessWidget {
|
||||
const SearchResultScreen({Key? key}) : super(key: key);
|
||||
|
||||
Widget balance(BuildContext context, String address, double size,
|
||||
[Color color = Colors.black,
|
||||
Color loadingColor = const Color(0xffd07316)]) {
|
||||
return Column(children: <Widget>[
|
||||
Consumer<SubstrateSdk>(builder: (context, sdk, _) {
|
||||
return FutureBuilder(
|
||||
future: sdk.getBalance(address),
|
||||
builder: (BuildContext context,
|
||||
AsyncSnapshot<Map<String, double>> globalBalance) {
|
||||
if (globalBalance.connectionState != ConnectionState.done ||
|
||||
globalBalance.hasError) {
|
||||
if (balanceCache[address] != null &&
|
||||
balanceCache[address] != -1) {
|
||||
return Row(children: [
|
||||
Text(balanceCache[address]!.toString(),
|
||||
style: TextStyle(
|
||||
fontSize: isTall ? size : size * 0.9, color: color)),
|
||||
const SizedBox(width: 5),
|
||||
udUnitDisplay(size, color),
|
||||
]);
|
||||
} else {
|
||||
return SizedBox(
|
||||
height: 15,
|
||||
width: 15,
|
||||
child: CircularProgressIndicator(
|
||||
color: loadingColor,
|
||||
strokeWidth: 2,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
balanceCache[address] = globalBalance.data!['transferableBalance']!;
|
||||
if (balanceCache[address] != -1) {
|
||||
return Row(children: [
|
||||
Text(
|
||||
balanceCache[address]!.toString(),
|
||||
style: TextStyle(
|
||||
fontSize: isTall ? size : size * 0.9,
|
||||
color: color,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 5),
|
||||
udUnitDisplay(size, color),
|
||||
]);
|
||||
} else {
|
||||
return const Text('');
|
||||
}
|
||||
});
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||
|
|
|
@ -360,6 +360,8 @@ class WalletViewScreen extends StatelessWidget {
|
|||
));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Widget waitToCert(String status, String duration) {
|
||||
return Column(children: <Widget>[
|
||||
SizedBox(
|
||||
|
@ -440,6 +442,58 @@ void paymentPopup(BuildContext context, String toAddress) {
|
|||
}
|
||||
}
|
||||
|
||||
Widget balance(BuildContext context, String address, double size,
|
||||
[Color color = Colors.black,
|
||||
Color loadingColor = const Color(0xffd07316)]) {
|
||||
return Column(children: <Widget>[
|
||||
Consumer<SubstrateSdk>(builder: (context, sdk, _) {
|
||||
return FutureBuilder(
|
||||
future: sdk.getBalance(address),
|
||||
builder: (BuildContext context,
|
||||
AsyncSnapshot<Map<String, double>> globalBalance) {
|
||||
if (globalBalance.connectionState != ConnectionState.done ||
|
||||
globalBalance.hasError) {
|
||||
if (balanceCache[address] != null &&
|
||||
balanceCache[address] != -1) {
|
||||
return Row(children: [
|
||||
Text(balanceCache[address]!.toString(),
|
||||
style: TextStyle(
|
||||
fontSize: isTall ? size : size * 0.9, color: color)),
|
||||
const SizedBox(width: 5),
|
||||
udUnitDisplay(size, color),
|
||||
]);
|
||||
} else {
|
||||
return SizedBox(
|
||||
height: 15,
|
||||
width: 15,
|
||||
child: CircularProgressIndicator(
|
||||
color: loadingColor,
|
||||
strokeWidth: 2,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
balanceCache[address] = globalBalance.data!['transferableBalance']!;
|
||||
if (balanceCache[address] != -1) {
|
||||
return Row(children: [
|
||||
Text(
|
||||
balanceCache[address]!.toString(),
|
||||
style: TextStyle(
|
||||
fontSize: isTall ? size : size * 0.9,
|
||||
color: color,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 5),
|
||||
udUnitDisplay(size, color),
|
||||
]);
|
||||
} else {
|
||||
return const Text('');
|
||||
}
|
||||
});
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
||||
showModalBottomSheet<void>(
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.only(
|
||||
|
@ -684,4 +738,6 @@ void paymentPopup(BuildContext context, String toAddress) {
|
|||
);
|
||||
});
|
||||
}).then((value) => walletViewProvider.payAmount.text = '');
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue