2021-01-30 15:24:08 +01:00
|
|
|
import 'package:flutter/services.dart';
|
2021-02-02 20:33:09 +01:00
|
|
|
import 'package:gecko/globals.dart';
|
2021-11-14 19:21:20 +01:00
|
|
|
import 'package:gecko/models/cesium_plus.dart';
|
2021-02-22 08:49:29 +01:00
|
|
|
import 'package:gecko/models/home.dart';
|
2021-11-14 19:21:20 +01:00
|
|
|
import 'package:gecko/models/my_wallets.dart';
|
2021-01-30 15:24:08 +01:00
|
|
|
import 'package:gecko/models/queries.dart';
|
2021-01-23 16:38:03 +01:00
|
|
|
import 'package:gecko/models/history.dart';
|
2020-12-21 01:05:00 +01:00
|
|
|
import 'package:flutter/material.dart';
|
2021-01-06 21:17:01 +01:00
|
|
|
import 'package:flutter/foundation.dart';
|
2021-11-14 19:21:20 +01:00
|
|
|
import 'package:gecko/models/wallet_data.dart';
|
|
|
|
import 'package:gecko/screens/myWallets/unlocking_wallet.dart';
|
2020-12-21 01:05:00 +01:00
|
|
|
import 'dart:ui';
|
2020-12-21 03:59:25 +01:00
|
|
|
import 'package:graphql_flutter/graphql_flutter.dart';
|
2021-01-24 08:53:03 +01:00
|
|
|
import 'package:provider/provider.dart';
|
2021-03-21 00:35:32 +01:00
|
|
|
import 'package:flutter_svg/flutter_svg.dart';
|
2021-01-06 05:04:54 +01:00
|
|
|
|
2021-01-26 21:00:26 +01:00
|
|
|
// ignore: must_be_immutable
|
2021-01-23 16:38:03 +01:00
|
|
|
class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
2021-01-26 21:00:26 +01:00
|
|
|
final TextEditingController _outputPubkey = TextEditingController();
|
|
|
|
ScrollController scrollController = ScrollController();
|
2021-01-06 05:04:54 +01:00
|
|
|
final nRepositories = 20;
|
2021-01-29 03:44:09 +01:00
|
|
|
// HistoryProvider _historyProvider;
|
2021-01-30 15:24:08 +01:00
|
|
|
final _formKey = GlobalKey<FormState>();
|
2021-11-14 19:21:20 +01:00
|
|
|
final FocusNode _pubkeyFocus = FocusNode();
|
2021-02-17 00:15:08 +01:00
|
|
|
final double avatarsSize = 80;
|
2021-01-24 08:53:03 +01:00
|
|
|
|
|
|
|
FetchMore fetchMore;
|
|
|
|
FetchMoreOptions opts;
|
2021-03-21 00:35:32 +01:00
|
|
|
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
2021-01-06 05:04:54 +01:00
|
|
|
|
2021-11-14 19:21:20 +01:00
|
|
|
HistoryScreen({Key key}) : super(key: key);
|
|
|
|
|
2020-12-21 01:05:00 +01:00
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2021-02-27 20:29:35 +01:00
|
|
|
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
2021-01-29 02:20:15 +01:00
|
|
|
HistoryProvider _historyProvider = Provider.of<HistoryProvider>(context);
|
2021-02-22 08:49:29 +01:00
|
|
|
HomeProvider _homeProvider = Provider.of<HomeProvider>(context);
|
2021-11-14 19:21:20 +01:00
|
|
|
_outputPubkey.text = _historyProvider.pubkey;
|
2021-04-02 12:05:37 +02:00
|
|
|
log.i('Build pubkey : ' + _historyProvider.pubkey);
|
2021-02-22 08:49:29 +01:00
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) {});
|
2021-02-06 08:31:14 +01:00
|
|
|
|
2021-01-10 07:49:29 +01:00
|
|
|
return Scaffold(
|
2021-03-21 00:35:32 +01:00
|
|
|
key: _scaffoldKey,
|
2021-02-22 08:49:29 +01:00
|
|
|
appBar: AppBar(
|
2021-11-15 04:16:25 +01:00
|
|
|
toolbarHeight: 60 * ratio,
|
2021-02-22 08:49:29 +01:00
|
|
|
title: _homeProvider.appBarExplorer,
|
|
|
|
actions: [
|
|
|
|
Padding(
|
2021-11-14 19:21:20 +01:00
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 16),
|
2021-02-22 08:49:29 +01:00
|
|
|
child: IconButton(
|
|
|
|
icon: _homeProvider.searchIcon,
|
|
|
|
color: Colors.grey[850],
|
|
|
|
onPressed: () {
|
|
|
|
if (_homeProvider.searchIcon.icon == Icons.search) {
|
|
|
|
_homeProvider.searchIcon = Icon(
|
|
|
|
Icons.close,
|
|
|
|
color: Colors.grey[850],
|
|
|
|
);
|
|
|
|
_homeProvider.appBarExplorer = TextField(
|
|
|
|
autofocus: true,
|
|
|
|
controller: _homeProvider.searchQuery,
|
|
|
|
onChanged: (text) {
|
2021-04-02 12:05:37 +02:00
|
|
|
log.d("Clé tappé: $text");
|
2021-02-22 08:49:29 +01:00
|
|
|
final String searchResult =
|
|
|
|
_historyProvider.isPubkey(context, text);
|
|
|
|
if (searchResult != '') {
|
|
|
|
_homeProvider.currentIndex = 0;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
style: TextStyle(
|
|
|
|
color: Colors.grey[850],
|
|
|
|
),
|
|
|
|
decoration: InputDecoration(
|
|
|
|
prefixIcon:
|
|
|
|
Icon(Icons.search, color: Colors.grey[850]),
|
|
|
|
hintText: "Rechercher ...",
|
|
|
|
hintStyle: TextStyle(color: Colors.grey[850])),
|
|
|
|
);
|
|
|
|
_homeProvider.handleSearchStart();
|
|
|
|
} else {
|
|
|
|
_homeProvider.handleSearchEnd();
|
|
|
|
}
|
|
|
|
}))
|
|
|
|
],
|
2021-11-14 19:21:20 +01:00
|
|
|
backgroundColor: const Color(0xffFFD58D),
|
2021-02-22 08:49:29 +01:00
|
|
|
),
|
2021-11-14 19:21:20 +01:00
|
|
|
floatingActionButton: SizedBox(
|
2021-01-10 07:49:29 +01:00
|
|
|
height: 80.0,
|
|
|
|
width: 80.0,
|
|
|
|
child: FittedBox(
|
|
|
|
child: FloatingActionButton(
|
|
|
|
heroTag: "buttonScan",
|
|
|
|
onPressed: () async {
|
2021-02-18 07:54:35 +01:00
|
|
|
await _historyProvider.scan(context);
|
2021-01-10 07:49:29 +01:00
|
|
|
},
|
2021-11-14 19:21:20 +01:00
|
|
|
child: SizedBox(
|
2021-01-10 07:49:29 +01:00
|
|
|
height: 40.0,
|
|
|
|
width: 40.0,
|
2021-02-18 04:42:57 +01:00
|
|
|
child: Padding(
|
2021-11-14 19:21:20 +01:00
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 3),
|
2021-02-18 04:42:57 +01:00
|
|
|
child: Image.asset('assets/qrcode-scan.png'))),
|
2021-11-08 23:12:25 +01:00
|
|
|
backgroundColor:
|
|
|
|
floattingYellow, //smoothYellow, //Color.fromARGB(500, 204, 255, 255),
|
2021-01-10 07:49:29 +01:00
|
|
|
),
|
2021-01-01 21:47:43 +01:00
|
|
|
),
|
2021-01-10 07:49:29 +01:00
|
|
|
),
|
|
|
|
body: Column(children: <Widget>[
|
2021-11-14 19:21:20 +01:00
|
|
|
const SizedBox(height: 0),
|
2021-02-06 08:31:14 +01:00
|
|
|
if (_historyProvider.pubkey != '')
|
|
|
|
historyQuery(context, _historyProvider),
|
2021-01-10 07:49:29 +01:00
|
|
|
]));
|
2021-01-01 21:47:43 +01:00
|
|
|
}
|
|
|
|
|
2021-02-17 00:15:08 +01:00
|
|
|
Widget historyQuery(context, HistoryProvider _historyProvider) {
|
2021-01-30 15:24:08 +01:00
|
|
|
_pubkeyFocus.unfocus();
|
2021-02-06 08:31:14 +01:00
|
|
|
// HistoryProvider _historyProvider = Provider.of<HistoryProvider>(context);
|
2021-02-02 20:33:09 +01:00
|
|
|
CesiumPlusProvider _cesiumPlusProvider =
|
|
|
|
Provider.of<CesiumPlusProvider>(context);
|
2021-02-07 02:59:48 +01:00
|
|
|
bool _isFirstExec = true;
|
2021-01-01 21:47:43 +01:00
|
|
|
return Expanded(
|
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
mainAxisSize: MainAxisSize.max,
|
|
|
|
children: <Widget>[
|
|
|
|
Query(
|
|
|
|
options: QueryOptions(
|
|
|
|
document: gql(getHistory),
|
|
|
|
variables: <String, dynamic>{
|
2021-01-24 08:53:03 +01:00
|
|
|
'pubkey': _historyProvider.pubkey,
|
2021-01-01 21:47:43 +01:00
|
|
|
'number': nRepositories,
|
|
|
|
'cursor': null
|
|
|
|
},
|
|
|
|
),
|
2021-02-04 21:00:37 +01:00
|
|
|
builder: (QueryResult result, {fetchMore, refetch}) {
|
2021-01-01 21:47:43 +01:00
|
|
|
if (result.isLoading && result.data == null) {
|
|
|
|
return const Center(
|
|
|
|
child: CircularProgressIndicator(),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (result.hasException) {
|
2021-04-02 12:05:37 +02:00
|
|
|
log.e('Error GVA: ' + result.exception.toString());
|
2021-11-14 19:21:20 +01:00
|
|
|
return Column(children: const <Widget>[
|
2021-01-11 19:46:20 +01:00
|
|
|
SizedBox(height: 50),
|
|
|
|
Text(
|
|
|
|
"Aucun noeud GVA valide n'a pu être trouvé.\nVeuillez réessayer ultérieurement.",
|
|
|
|
style: TextStyle(fontSize: 17.0),
|
|
|
|
)
|
|
|
|
]);
|
2021-01-01 21:47:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (result.data == null && result.exception.toString() == null) {
|
2021-01-11 19:46:20 +01:00
|
|
|
return const Text('Aucune donnée à afficher.');
|
2021-01-01 21:47:43 +01:00
|
|
|
}
|
|
|
|
|
2021-03-21 00:35:32 +01:00
|
|
|
num balance;
|
|
|
|
|
|
|
|
if (result.data['balance'] == null) {
|
|
|
|
balance = 0.0;
|
|
|
|
} else {
|
|
|
|
balance = _historyProvider
|
|
|
|
.removeDecimalZero(result.data['balance']['amount'] / 100);
|
|
|
|
}
|
2021-01-08 02:10:23 +01:00
|
|
|
|
2021-02-03 18:45:08 +01:00
|
|
|
opts = _historyProvider.checkQueryResult(
|
|
|
|
result, opts, _outputPubkey.text);
|
2021-01-30 15:24:08 +01:00
|
|
|
|
2021-02-07 02:59:48 +01:00
|
|
|
// _historyProvider.transBC = null;
|
|
|
|
|
2021-01-08 02:10:23 +01:00
|
|
|
// Build history list
|
2021-01-24 08:53:03 +01:00
|
|
|
return NotificationListener(
|
2021-02-22 19:44:58 +01:00
|
|
|
child: Builder(
|
|
|
|
builder: (context) => Expanded(
|
|
|
|
child: ListView(
|
2021-11-14 19:21:20 +01:00
|
|
|
key: const Key('listTransactions'),
|
2021-02-22 19:44:58 +01:00
|
|
|
controller: scrollController,
|
|
|
|
children: <Widget>[
|
2021-11-14 19:21:20 +01:00
|
|
|
const SizedBox(height: 20),
|
2021-02-22 19:44:58 +01:00
|
|
|
if (_historyProvider.pubkey != '')
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment:
|
|
|
|
MainAxisAlignment.spaceBetween,
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
if (_isFirstExec)
|
|
|
|
Container(
|
2021-11-26 08:56:20 +01:00
|
|
|
padding: const EdgeInsets.fromLTRB(
|
|
|
|
20, 0, 30, 0),
|
|
|
|
child: FutureBuilder(
|
|
|
|
future:
|
|
|
|
_cesiumPlusProvider.getAvatar(
|
2021-11-29 04:05:08 +01:00
|
|
|
_historyProvider.pubkey,
|
|
|
|
55),
|
2021-11-26 08:56:20 +01:00
|
|
|
builder: (BuildContext context,
|
2021-11-29 04:05:08 +01:00
|
|
|
AsyncSnapshot<Image> _avatar) {
|
2021-11-26 08:56:20 +01:00
|
|
|
if (_avatar.connectionState !=
|
2021-11-29 04:05:08 +01:00
|
|
|
ConnectionState.done ||
|
|
|
|
_avatar.hasError) {
|
|
|
|
return Stack(children: [
|
|
|
|
_cesiumPlusProvider
|
|
|
|
.defaultAvatar(55),
|
|
|
|
Positioned(
|
|
|
|
top: 8,
|
|
|
|
right: 0,
|
|
|
|
width: 12,
|
|
|
|
height: 12,
|
|
|
|
child:
|
|
|
|
CircularProgressIndicator(
|
|
|
|
strokeWidth: 1,
|
|
|
|
color: orangeC,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
]);
|
2021-11-26 08:56:20 +01:00
|
|
|
}
|
|
|
|
if (_avatar.hasData) {
|
2021-11-29 04:05:08 +01:00
|
|
|
return ClipOval(
|
|
|
|
child: _avatar.data,
|
|
|
|
);
|
2021-11-26 08:56:20 +01:00
|
|
|
}
|
2021-11-29 04:05:08 +01:00
|
|
|
return _cesiumPlusProvider
|
|
|
|
.defaultAvatar(55);
|
2021-11-26 08:56:20 +01:00
|
|
|
}),
|
|
|
|
),
|
2021-02-22 19:44:58 +01:00
|
|
|
GestureDetector(
|
2021-11-14 19:21:20 +01:00
|
|
|
key: const Key('copyPubkey'),
|
2021-02-22 19:44:58 +01:00
|
|
|
onTap: () {
|
|
|
|
Clipboard.setData(ClipboardData(
|
|
|
|
text: _historyProvider.pubkey));
|
|
|
|
_historyProvider.snackCopyKey(context);
|
|
|
|
},
|
|
|
|
child: Text(
|
|
|
|
_historyProvider.getShortPubkey(
|
|
|
|
_historyProvider.pubkey),
|
2021-11-14 19:21:20 +01:00
|
|
|
style: const TextStyle(
|
2021-02-22 19:44:58 +01:00
|
|
|
fontSize: 22,
|
|
|
|
fontWeight: FontWeight.w800,
|
|
|
|
fontFamily: 'Monospace')),
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
padding: const EdgeInsets.fromLTRB(
|
|
|
|
30, 0, 5, 0), // .only(right: 15),
|
2021-03-21 00:35:32 +01:00
|
|
|
child: Card(
|
|
|
|
child: Column(
|
|
|
|
children: <Widget>[
|
|
|
|
SvgPicture.string(
|
|
|
|
_historyProvider
|
|
|
|
.generateIdenticon(
|
|
|
|
_historyProvider
|
|
|
|
.pubkey),
|
|
|
|
fit: BoxFit.contain,
|
|
|
|
height: 64,
|
|
|
|
width: 64,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
)),
|
2021-11-14 19:21:20 +01:00
|
|
|
const SizedBox(width: 0)
|
2021-02-22 19:44:58 +01:00
|
|
|
]),
|
|
|
|
if (_isFirstExec)
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment:
|
|
|
|
MainAxisAlignment.spaceAround,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Container(
|
2021-11-26 08:56:20 +01:00
|
|
|
padding:
|
|
|
|
const EdgeInsets.fromLTRB(0, 0, 0, 0),
|
|
|
|
// padding: const EdgeInsets.,
|
|
|
|
child: FutureBuilder(
|
|
|
|
future: _cesiumPlusProvider
|
|
|
|
.getName(_historyProvider.pubkey),
|
|
|
|
initialData: '...',
|
|
|
|
builder: (context, snapshot) {
|
|
|
|
return Text(snapshot.data ?? '-',
|
|
|
|
style: const TextStyle(
|
|
|
|
fontSize: 20));
|
|
|
|
}),
|
|
|
|
)
|
2021-02-22 19:44:58 +01:00
|
|
|
]),
|
2021-11-14 19:21:20 +01:00
|
|
|
const SizedBox(height: 18),
|
2021-02-07 02:59:48 +01:00
|
|
|
if (_isFirstExec)
|
|
|
|
Container(
|
2021-02-17 00:15:08 +01:00
|
|
|
padding:
|
2021-02-22 19:44:58 +01:00
|
|
|
const EdgeInsets.fromLTRB(0, 0, 0, 0),
|
|
|
|
child: Text(balance.toString() + ' Ğ1',
|
|
|
|
textAlign: TextAlign.center,
|
2021-11-14 19:21:20 +01:00
|
|
|
style: const TextStyle(fontSize: 18.0))),
|
|
|
|
const SizedBox(height: 20),
|
2021-02-22 19:44:58 +01:00
|
|
|
ElevatedButton(
|
2021-11-14 19:21:20 +01:00
|
|
|
key: const Key('switchPayHistory'),
|
2021-02-22 19:44:58 +01:00
|
|
|
style: ElevatedButton.styleFrom(
|
|
|
|
elevation: 1,
|
|
|
|
primary: Colors.grey[50], // background
|
|
|
|
onPrimary: Colors.black, // foreground
|
|
|
|
),
|
|
|
|
onPressed: () {
|
|
|
|
_historyProvider.switchProfileView();
|
|
|
|
},
|
|
|
|
child: Text(
|
|
|
|
_historyProvider.historySwitchButtun,
|
|
|
|
style: TextStyle(
|
2021-11-08 23:12:25 +01:00
|
|
|
fontSize: 15, color: orangeC))),
|
2021-02-22 19:44:58 +01:00
|
|
|
// const Divider(
|
|
|
|
// color: Colors.grey,
|
|
|
|
// height: 5,
|
|
|
|
// thickness: 0.5,
|
|
|
|
// indent: 0,
|
|
|
|
// endIndent: 0,
|
|
|
|
// ),
|
|
|
|
_historyProvider.isHistoryScreen
|
|
|
|
? historyView(context, result)
|
2021-03-29 22:12:38 +02:00
|
|
|
: payView(context, _historyProvider),
|
2021-02-22 19:44:58 +01:00
|
|
|
],
|
|
|
|
))),
|
2021-01-24 08:53:03 +01:00
|
|
|
onNotification: (t) {
|
|
|
|
if (t is ScrollEndNotification &&
|
|
|
|
scrollController.position.pixels >=
|
2021-01-29 14:21:57 +01:00
|
|
|
scrollController.position.maxScrollExtent * 0.7) {
|
2021-01-24 08:53:03 +01:00
|
|
|
fetchMore(opts);
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
});
|
2021-01-01 21:47:43 +01:00
|
|
|
},
|
|
|
|
),
|
|
|
|
],
|
|
|
|
));
|
|
|
|
}
|
2020-12-21 01:05:00 +01:00
|
|
|
|
2021-03-29 22:12:38 +02:00
|
|
|
Widget payView(context, HistoryProvider _historyProvider) {
|
2021-11-14 03:12:07 +01:00
|
|
|
MyWalletsProvider _myWalletProvider = MyWalletsProvider();
|
|
|
|
WalletData defaultWallet =
|
|
|
|
_myWalletProvider.getDefaultWallet(configBox.get('currentChest'));
|
|
|
|
|
2021-02-17 00:15:08 +01:00
|
|
|
return Stack(
|
2021-03-08 11:11:01 +01:00
|
|
|
clipBehavior: Clip.hardEdge,
|
2021-02-17 00:15:08 +01:00
|
|
|
children: <Widget>[
|
|
|
|
Form(
|
|
|
|
key: _formKey,
|
|
|
|
child: Column(
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
children: <Widget>[
|
2021-11-14 19:21:20 +01:00
|
|
|
const SizedBox(height: 20),
|
|
|
|
const Text('Commentaire:', style: TextStyle(fontSize: 20.0)),
|
2021-02-17 00:15:08 +01:00
|
|
|
Padding(
|
2021-11-14 19:21:20 +01:00
|
|
|
padding: const EdgeInsets.all(8.0),
|
2021-02-17 00:15:08 +01:00
|
|
|
child: TextField(
|
2021-04-03 00:07:03 +02:00
|
|
|
controller: _historyProvider.payComment,
|
2021-02-17 00:15:08 +01:00
|
|
|
maxLines: 2,
|
2021-01-30 15:24:08 +01:00
|
|
|
textAlign: TextAlign.center,
|
2021-11-14 19:21:20 +01:00
|
|
|
decoration: const InputDecoration(),
|
|
|
|
style: const TextStyle(
|
2021-04-03 02:39:09 +02:00
|
|
|
fontSize: 22,
|
2021-02-17 00:15:08 +01:00
|
|
|
color: Colors.black,
|
|
|
|
fontWeight: FontWeight.bold))),
|
2021-11-14 19:21:20 +01:00
|
|
|
const SizedBox(height: 20),
|
|
|
|
const Text('Montant (DU/Ğ1):', style: TextStyle(fontSize: 20.0)),
|
2021-02-17 00:15:08 +01:00
|
|
|
Padding(
|
2021-11-14 19:21:20 +01:00
|
|
|
padding: const EdgeInsets.all(8.0),
|
2021-02-17 00:15:08 +01:00
|
|
|
child: TextFormField(
|
2021-11-14 19:21:20 +01:00
|
|
|
style: const TextStyle(fontSize: 22),
|
2021-04-03 00:07:03 +02:00
|
|
|
controller: _historyProvider.payAmount,
|
2021-02-17 00:15:08 +01:00
|
|
|
textAlign: TextAlign.center,
|
|
|
|
maxLines: 1,
|
|
|
|
keyboardType: TextInputType.number,
|
2021-04-03 02:39:09 +02:00
|
|
|
decoration: InputDecoration(
|
2021-11-14 19:21:20 +01:00
|
|
|
contentPadding: const EdgeInsets.symmetric(
|
|
|
|
vertical: 25.0, horizontal: 10.0),
|
2021-04-03 02:39:09 +02:00
|
|
|
border: OutlineInputBorder(
|
|
|
|
borderRadius: BorderRadius.circular(10.0)),
|
|
|
|
),
|
2021-02-17 00:15:08 +01:00
|
|
|
inputFormatters: <TextInputFormatter>[
|
|
|
|
FilteringTextInputFormatter.allow(RegExp(r'(^\d*\.?\d*)'))
|
|
|
|
],
|
2021-01-30 15:24:08 +01:00
|
|
|
),
|
2021-02-17 00:15:08 +01:00
|
|
|
),
|
|
|
|
Padding(
|
2021-11-21 02:52:01 +01:00
|
|
|
padding: const EdgeInsets.only(top: 15),
|
|
|
|
child: OutlinedButton(
|
|
|
|
style: OutlinedButton.styleFrom(
|
|
|
|
side: BorderSide(width: 2, color: orangeC)),
|
|
|
|
onPressed: () {
|
|
|
|
// if (_formKey.currentState.validate()) {
|
|
|
|
// _formKey.currentState.save();
|
|
|
|
// }
|
|
|
|
// _historyProvider.pay(payAmount.text, payComment.text);
|
|
|
|
Navigator.push(context,
|
|
|
|
MaterialPageRoute(builder: (context) {
|
|
|
|
return UnlockingWallet(
|
|
|
|
wallet: defaultWallet, action: "pay");
|
|
|
|
}));
|
|
|
|
},
|
|
|
|
child: Padding(
|
|
|
|
padding: const EdgeInsets.all(12),
|
|
|
|
child: Text(
|
|
|
|
"PAYER",
|
|
|
|
style: TextStyle(fontSize: 25, color: Colors.grey[850]),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
2021-02-17 00:15:08 +01:00
|
|
|
],
|
2021-01-30 15:24:08 +01:00
|
|
|
),
|
2021-02-17 00:15:08 +01:00
|
|
|
),
|
|
|
|
],
|
2021-01-30 15:24:08 +01:00
|
|
|
);
|
2021-01-09 10:48:06 +01:00
|
|
|
}
|
2021-02-17 00:15:08 +01:00
|
|
|
|
|
|
|
Widget historyView(context, result) {
|
|
|
|
HistoryProvider _historyProvider = Provider.of<HistoryProvider>(context);
|
2021-04-28 23:44:07 +02:00
|
|
|
int keyID = 0;
|
2021-02-17 00:15:08 +01:00
|
|
|
|
|
|
|
return _historyProvider.transBC == null
|
2021-11-14 19:21:20 +01:00
|
|
|
? const Text('Aucune transaction à afficher.')
|
2021-02-17 00:15:08 +01:00
|
|
|
: Column(children: <Widget>[
|
|
|
|
for (var repository in _historyProvider.transBC)
|
|
|
|
Padding(
|
2021-11-26 08:56:20 +01:00
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 5.0),
|
|
|
|
child: ListTile(
|
|
|
|
key: Key('transaction${keyID++}'),
|
|
|
|
contentPadding: const EdgeInsets.all(5.0),
|
|
|
|
leading: Text(repository[1].toString(),
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 12,
|
|
|
|
color: Colors.grey[800],
|
|
|
|
fontWeight: FontWeight.w700),
|
|
|
|
textAlign: TextAlign.center),
|
|
|
|
title: Text(repository[3],
|
|
|
|
style: const TextStyle(
|
|
|
|
fontSize: 15.0, fontFamily: 'Monospace'),
|
|
|
|
textAlign: TextAlign.center),
|
|
|
|
subtitle: Text(repository[6] != '' ? repository[6] : '-',
|
|
|
|
style: const TextStyle(fontSize: 12.0),
|
|
|
|
textAlign: TextAlign.center),
|
|
|
|
trailing: Text("${repository[4]} Ğ1",
|
|
|
|
style: const TextStyle(fontSize: 14.0),
|
|
|
|
textAlign: TextAlign.justify),
|
|
|
|
dense: true,
|
|
|
|
isThreeLine: false,
|
|
|
|
onTap: () {
|
|
|
|
// this._outputPubkey.text = repository[2];
|
|
|
|
_historyProvider.isPubkey(context, repository[2]);
|
2021-11-27 05:35:02 +01:00
|
|
|
Navigator.pop(context);
|
2021-11-26 08:56:20 +01:00
|
|
|
}),
|
|
|
|
),
|
2021-11-29 04:05:08 +01:00
|
|
|
if (result.isLoading &&
|
|
|
|
_historyProvider.pageInfo['hasPreviousPage'])
|
2021-02-17 00:15:08 +01:00
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
2021-11-14 19:21:20 +01:00
|
|
|
children: const <Widget>[
|
2021-02-17 00:15:08 +01:00
|
|
|
CircularProgressIndicator(),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
// if (_historyProvider.isTheEnd) // What I did before ...
|
|
|
|
if (!_historyProvider.pageInfo['hasPreviousPage'])
|
2021-04-28 23:44:07 +02:00
|
|
|
Column(
|
2021-11-14 19:21:20 +01:00
|
|
|
children: const <Widget>[
|
2021-04-28 23:44:07 +02:00
|
|
|
SizedBox(height: 15),
|
|
|
|
Text("Début de l'historique.",
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
style: TextStyle(fontSize: 20)),
|
|
|
|
SizedBox(height: 15)
|
|
|
|
],
|
|
|
|
)
|
2021-02-17 00:15:08 +01:00
|
|
|
]);
|
|
|
|
}
|
2021-01-01 21:47:43 +01:00
|
|
|
}
|