New history screen
This commit is contained in:
parent
bd87ea5ab8
commit
8f0018e326
|
@ -69,7 +69,8 @@ Future<void> main() async {
|
||||||
// await HiveStore.open(path: '${appPath.path}/gqlCache');
|
// await HiveStore.open(path: '${appPath.path}/gqlCache');
|
||||||
|
|
||||||
// Get a valid GVA endpoint
|
// Get a valid GVA endpoint
|
||||||
endPointGVA = 'https://g1.librelois.fr/gva';
|
// endPointGVA = 'https://g1.librelois.fr/gva';
|
||||||
|
endPointGVA = 'https://duniter-g1.p2p.legal/gva';
|
||||||
// await _homeProvider.getValidEndpoint();
|
// await _homeProvider.getValidEndpoint();
|
||||||
|
|
||||||
// if (endPointGVA == 'HS') {
|
// if (endPointGVA == 'HS') {
|
||||||
|
|
|
@ -79,6 +79,10 @@ class CesiumPlusProvider with ChangeNotifier {
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Image> getAvatar(String _pubkey, double size) async {
|
Future<Image> getAvatar(String _pubkey, double size) async {
|
||||||
|
if (g1WalletsBox.get(_pubkey).avatar != null) {
|
||||||
|
return g1WalletsBox.get(_pubkey).avatar;
|
||||||
|
}
|
||||||
|
|
||||||
List queryOptions = await _buildQuery(_pubkey);
|
List queryOptions = await _buildQuery(_pubkey);
|
||||||
|
|
||||||
http.Response response;
|
http.Response response;
|
||||||
|
|
|
@ -21,7 +21,7 @@ class HomeProvider with ChangeNotifier {
|
||||||
Widget appBarExplorer =
|
Widget appBarExplorer =
|
||||||
Text('Explorateur', style: TextStyle(color: Colors.grey[850]));
|
Text('Explorateur', style: TextStyle(color: Colors.grey[850]));
|
||||||
|
|
||||||
List currentTab = [HistoryScreen(), WalletsHome()];
|
List currentTab = [OldHistoryScreen(), WalletsHome()];
|
||||||
bool isFirstBuild = true;
|
bool isFirstBuild = true;
|
||||||
// AudioCache player = AudioCache(prefix: 'sounds/');
|
// AudioCache player = AudioCache(prefix: 'sounds/');
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ class SearchProvider with ChangeNotifier {
|
||||||
searchResult.clear();
|
searchResult.clear();
|
||||||
int searchTime = DateTime.now().millisecondsSinceEpoch;
|
int searchTime = DateTime.now().millisecondsSinceEpoch;
|
||||||
|
|
||||||
if (cacheTime + 0 <= searchTime) {
|
if (cacheTime + cacheDuring <= searchTime) {
|
||||||
g1WalletsBox.clear();
|
g1WalletsBox.clear();
|
||||||
final url = Uri.parse('https://g1-stats.axiom-team.fr/data/forbes.json');
|
final url = Uri.parse('https://g1-stats.axiom-team.fr/data/forbes.json');
|
||||||
final response = await http.get(url);
|
final response = await http.get(url);
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:dubp/dubp.dart';
|
import 'package:dubp/dubp.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
@ -14,6 +16,7 @@ import 'package:intl/intl.dart';
|
||||||
import 'package:truncate/truncate.dart';
|
import 'package:truncate/truncate.dart';
|
||||||
import 'package:crypto/crypto.dart';
|
import 'package:crypto/crypto.dart';
|
||||||
import 'package:fast_base58/fast_base58.dart';
|
import 'package:fast_base58/fast_base58.dart';
|
||||||
|
import 'package:http/http.dart' as http;
|
||||||
|
|
||||||
class WalletsProfilesProvider with ChangeNotifier {
|
class WalletsProfilesProvider with ChangeNotifier {
|
||||||
WalletsProfilesProvider(this.pubkey);
|
WalletsProfilesProvider(this.pubkey);
|
||||||
|
@ -254,4 +257,20 @@ class WalletsProfilesProvider with ChangeNotifier {
|
||||||
String generateIdenticon(String _pubkey) {
|
String generateIdenticon(String _pubkey) {
|
||||||
return Jdenticon.toSvg(_pubkey);
|
return Jdenticon.toSvg(_pubkey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<num> getBalance(String _pubkey) async {
|
||||||
|
num balance;
|
||||||
|
final url = Uri.parse(
|
||||||
|
'$endPointGVA?query={%20balance(script:%20%22$_pubkey%22)%20{%20amount%20base%20}%20}');
|
||||||
|
final response = await http.get(url);
|
||||||
|
final result = json.decode(response.body);
|
||||||
|
|
||||||
|
if (result['data']['balance'] == null) {
|
||||||
|
balance = 0.0;
|
||||||
|
} else {
|
||||||
|
balance = removeDecimalZero(result['data']['balance']['amount'] / 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
return balance;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,569 @@
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:gecko/globals.dart';
|
||||||
|
import 'package:gecko/models/cesium_plus.dart';
|
||||||
|
import 'package:gecko/models/home.dart';
|
||||||
|
import 'package:gecko/models/queries.dart';
|
||||||
|
import 'package:gecko/models/wallets_profiles.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
|
import 'package:gecko/screens/avatar_fullscreen.dart';
|
||||||
|
import 'package:gecko/screens/wallet_view.dart';
|
||||||
|
import 'dart:ui';
|
||||||
|
import 'package:graphql_flutter/graphql_flutter.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:pull_to_refresh/pull_to_refresh.dart';
|
||||||
|
|
||||||
|
// ignore: must_be_immutable
|
||||||
|
class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
||||||
|
HistoryScreen({@required this.pubkey, this.avatar, this.username, Key key})
|
||||||
|
: super(key: key);
|
||||||
|
final ScrollController scrollController = ScrollController();
|
||||||
|
final nRepositories = 20;
|
||||||
|
final double avatarsSize = 80;
|
||||||
|
final String pubkey;
|
||||||
|
final String username;
|
||||||
|
final Image avatar;
|
||||||
|
|
||||||
|
FetchMore fetchMore;
|
||||||
|
FetchMoreOptions opts;
|
||||||
|
|
||||||
|
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||||
|
WalletsProfilesProvider _historyProvider =
|
||||||
|
Provider.of<WalletsProfilesProvider>(context, listen: false);
|
||||||
|
CesiumPlusProvider _cesiumPlusProvider =
|
||||||
|
Provider.of<CesiumPlusProvider>(context, listen: false);
|
||||||
|
log.i('Build pubkey : ' + _historyProvider.pubkey);
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((_) {});
|
||||||
|
|
||||||
|
return Scaffold(
|
||||||
|
key: _scaffoldKey,
|
||||||
|
appBar: AppBar(
|
||||||
|
elevation: 0,
|
||||||
|
toolbarHeight: 60 * ratio,
|
||||||
|
title: const SizedBox(
|
||||||
|
height: 22,
|
||||||
|
child: Text('Historique des transactions'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: Column(children: <Widget>[
|
||||||
|
headerProfileView(context, _historyProvider, _cesiumPlusProvider),
|
||||||
|
if (_historyProvider.pubkey != '')
|
||||||
|
historyQuery(context, _historyProvider, _cesiumPlusProvider),
|
||||||
|
]));
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget historyQuery(context, WalletsProfilesProvider _historyProvider2,
|
||||||
|
CesiumPlusProvider _cesiumPlusProvider) {
|
||||||
|
WalletsProfilesProvider _historyProvider =
|
||||||
|
Provider.of<WalletsProfilesProvider>(context, listen: true);
|
||||||
|
RefreshController _refreshController =
|
||||||
|
RefreshController(initialRefresh: false);
|
||||||
|
return Expanded(
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
mainAxisSize: MainAxisSize.max,
|
||||||
|
children: <Widget>[
|
||||||
|
Query(
|
||||||
|
options: QueryOptions(
|
||||||
|
document: gql(getHistory),
|
||||||
|
variables: <String, dynamic>{
|
||||||
|
'pubkey': _historyProvider.pubkey,
|
||||||
|
'number': nRepositories,
|
||||||
|
'cursor': null
|
||||||
|
},
|
||||||
|
),
|
||||||
|
builder: (QueryResult result, {fetchMore, refetch}) {
|
||||||
|
if (result.isLoading && result.data == null) {
|
||||||
|
return const Center(
|
||||||
|
child: CircularProgressIndicator(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result.hasException) {
|
||||||
|
log.e('Error GVA: ' + result.exception.toString());
|
||||||
|
return Column(children: const <Widget>[
|
||||||
|
SizedBox(height: 50),
|
||||||
|
Text(
|
||||||
|
"Aucun noeud GVA valide n'a pu être trouvé.\nVeuillez réessayer ultérieurement.",
|
||||||
|
style: TextStyle(fontSize: 17.0),
|
||||||
|
)
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result.data == null && result.exception.toString() == null) {
|
||||||
|
return const Text('Aucune donnée à afficher.');
|
||||||
|
}
|
||||||
|
|
||||||
|
opts = _historyProvider.checkQueryResult(result, opts, pubkey);
|
||||||
|
|
||||||
|
// Build history list
|
||||||
|
return NotificationListener(
|
||||||
|
child: Builder(
|
||||||
|
builder: (context) => Expanded(
|
||||||
|
child: SmartRefresher(
|
||||||
|
enablePullUp: false,
|
||||||
|
controller: _refreshController,
|
||||||
|
onRefresh: () {
|
||||||
|
_historyProvider.resetdHistory();
|
||||||
|
_refreshController.refreshCompleted();
|
||||||
|
},
|
||||||
|
child: ListView(
|
||||||
|
key: const Key('listTransactions'),
|
||||||
|
controller: scrollController,
|
||||||
|
children: <Widget>[historyView(context, result)],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onNotification: (t) {
|
||||||
|
if (t is ScrollEndNotification &&
|
||||||
|
scrollController.position.pixels >=
|
||||||
|
scrollController.position.maxScrollExtent * 0.7) {
|
||||||
|
fetchMore(opts);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget historyView(context, result) {
|
||||||
|
WalletsProfilesProvider _historyProvider =
|
||||||
|
Provider.of<WalletsProfilesProvider>(context, listen: false);
|
||||||
|
|
||||||
|
return _historyProvider.transBC == null
|
||||||
|
? const Text('Aucune transaction à afficher.')
|
||||||
|
: Column(children: <Widget>[
|
||||||
|
getTransactionTile(context, _historyProvider),
|
||||||
|
// for (var repository in _historyProvider.transBC)
|
||||||
|
// if (repository[1].toString().split(' ')[0] == '22-11-21')
|
||||||
|
// const Text("Aujourd'hui"),
|
||||||
|
// Padding(
|
||||||
|
// padding: const EdgeInsets.symmetric(horizontal: 5.0),
|
||||||
|
// child: ListTile(
|
||||||
|
// key: Key('transaction${keyID++}'),
|
||||||
|
// contentPadding: const EdgeInsets.all(5.0),
|
||||||
|
// leading: Text(repository[1],
|
||||||
|
// 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: () {
|
||||||
|
// if (_historyProvider.isPubkey(context, repository[2])) {
|
||||||
|
// _homeProvider.currentIndex = 0;
|
||||||
|
// Navigator.push(
|
||||||
|
// context,
|
||||||
|
// MaterialPageRoute(builder: (context) {
|
||||||
|
// return const WalletViewScreen();
|
||||||
|
// }),
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// Navigator.pop(context);
|
||||||
|
// }),
|
||||||
|
// ),
|
||||||
|
if (result.isLoading &&
|
||||||
|
_historyProvider.pageInfo['hasPreviousPage'])
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: const <Widget>[
|
||||||
|
CircularProgressIndicator(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
// if (_historyProvider.isTheEnd) // What I did before ...
|
||||||
|
if (!_historyProvider.pageInfo['hasPreviousPage'])
|
||||||
|
Column(
|
||||||
|
children: const <Widget>[
|
||||||
|
SizedBox(height: 15),
|
||||||
|
Text("Début de l'historique.",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(fontSize: 20)),
|
||||||
|
SizedBox(height: 15)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget getTransactionTile(
|
||||||
|
BuildContext context, WalletsProfilesProvider _historyProvider) {
|
||||||
|
HomeProvider _homeProvider =
|
||||||
|
Provider.of<HomeProvider>(context, listen: false);
|
||||||
|
CesiumPlusProvider _cesiumPlusProvider =
|
||||||
|
Provider.of<CesiumPlusProvider>(context, listen: false);
|
||||||
|
int keyID = 0;
|
||||||
|
String dateDelimiter;
|
||||||
|
String lastDateDelimiter;
|
||||||
|
const double _avatarSize = 200;
|
||||||
|
|
||||||
|
const Map<int, String> monthsInYear = {
|
||||||
|
1: "Janvier",
|
||||||
|
2: "Février",
|
||||||
|
3: "Mars",
|
||||||
|
4: "Avril",
|
||||||
|
5: "Mai",
|
||||||
|
6: "Juin",
|
||||||
|
7: "Juillet",
|
||||||
|
8: "Aout",
|
||||||
|
9: "Septembre",
|
||||||
|
10: "Octobre",
|
||||||
|
11: "Novembre",
|
||||||
|
12: "Décembre"
|
||||||
|
};
|
||||||
|
|
||||||
|
return Column(
|
||||||
|
children: _historyProvider.transBC.map((repository) {
|
||||||
|
DateTime now = DateTime.now();
|
||||||
|
DateTime date = DateTime.fromMillisecondsSinceEpoch(repository[0] * 1000);
|
||||||
|
|
||||||
|
String dateForm;
|
||||||
|
if ({4, 10, 11, 12}.contains(date.month)) {
|
||||||
|
dateForm = "${date.day} ${monthsInYear[date.month].substring(0, 3)}.";
|
||||||
|
} else if ({1, 2, 7, 9}.contains(date.month)) {
|
||||||
|
dateForm = "${date.day} ${monthsInYear[date.month].substring(0, 4)}.";
|
||||||
|
} else {
|
||||||
|
dateForm = "${date.day} ${monthsInYear[date.month]}";
|
||||||
|
}
|
||||||
|
log.d(dateForm);
|
||||||
|
|
||||||
|
int weekNumber(DateTime date) {
|
||||||
|
int dayOfYear = int.parse(DateFormat("D").format(date));
|
||||||
|
return ((dayOfYear - date.weekday + 10) / 7).floor();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (DateTime(date.year, date.month, date.day) ==
|
||||||
|
DateTime(now.year, now.month, now.day)) {
|
||||||
|
dateDelimiter = lastDateDelimiter = "Aujourd'hui";
|
||||||
|
} else if (DateTime(date.year, date.month, date.day) ==
|
||||||
|
DateTime(now.year, now.month, now.day - 1)) {
|
||||||
|
dateDelimiter = lastDateDelimiter = "Hier";
|
||||||
|
} else if (weekNumber(date) == weekNumber(now) &&
|
||||||
|
date.year == now.year &&
|
||||||
|
lastDateDelimiter != "Cette semaine") {
|
||||||
|
dateDelimiter = lastDateDelimiter = "Cette semaine";
|
||||||
|
} else if (lastDateDelimiter != monthsInYear[date.month] &&
|
||||||
|
lastDateDelimiter != "${monthsInYear[date.month]} ${date.year}") {
|
||||||
|
if (date.year == now.year) {
|
||||||
|
dateDelimiter = lastDateDelimiter = monthsInYear[date.month];
|
||||||
|
} else {
|
||||||
|
dateDelimiter =
|
||||||
|
lastDateDelimiter = "${monthsInYear[date.month]} ${date.year}";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
dateDelimiter = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Column(children: <Widget>[
|
||||||
|
if (dateDelimiter != null)
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 30),
|
||||||
|
child: Text(
|
||||||
|
dateDelimiter,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 23, color: orangeC, fontWeight: FontWeight.w300),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(right: 0),
|
||||||
|
child:
|
||||||
|
// Row(children: [Column(children: [],)],)
|
||||||
|
ListTile(
|
||||||
|
key: Key('transaction${keyID++}'),
|
||||||
|
contentPadding: const EdgeInsets.only(
|
||||||
|
left: 20, right: 30, top: 15, bottom: 15),
|
||||||
|
leading: g1WalletsBox.get(repository[2])?.avatar == null
|
||||||
|
? FutureBuilder(
|
||||||
|
future: _cesiumPlusProvider.getAvatar(
|
||||||
|
repository[2], _avatarSize),
|
||||||
|
builder: (BuildContext context,
|
||||||
|
AsyncSnapshot<Image> _avatar) {
|
||||||
|
if (_avatar.connectionState !=
|
||||||
|
ConnectionState.done ||
|
||||||
|
_avatar.hasError) {
|
||||||
|
return Stack(children: [
|
||||||
|
_cesiumPlusProvider.defaultAvatar(_avatarSize),
|
||||||
|
Positioned(
|
||||||
|
top: 8,
|
||||||
|
right: 0,
|
||||||
|
width: 12,
|
||||||
|
height: 12,
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
strokeWidth: 1,
|
||||||
|
color: orangeC,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
if (_avatar.hasData) {
|
||||||
|
g1WalletsBox.get(repository[2]).avatar =
|
||||||
|
_avatar.data;
|
||||||
|
return ClipOval(child: _avatar.data);
|
||||||
|
} else {
|
||||||
|
g1WalletsBox.get(repository[2]).avatar =
|
||||||
|
_cesiumPlusProvider
|
||||||
|
.defaultAvatar(repository[2]);
|
||||||
|
return _cesiumPlusProvider
|
||||||
|
.defaultAvatar(_avatarSize);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
: ClipOval(
|
||||||
|
child: Image(
|
||||||
|
image: g1WalletsBox.get(repository[2]).avatar.image,
|
||||||
|
height: _avatarSize,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
title: Padding(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
bottom: 5, top: repository[6] != '' ? 0 : 0),
|
||||||
|
child: Text(repository[3],
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 18, fontFamily: 'Monospace')),
|
||||||
|
),
|
||||||
|
subtitle: RichText(
|
||||||
|
text: TextSpan(
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
color: Colors.grey[700],
|
||||||
|
),
|
||||||
|
children: <TextSpan>[
|
||||||
|
TextSpan(
|
||||||
|
text: dateForm,
|
||||||
|
),
|
||||||
|
if (repository[6] != '')
|
||||||
|
TextSpan(
|
||||||
|
text: ' · ',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20,
|
||||||
|
color: Colors.grey[550],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
TextSpan(
|
||||||
|
text: repository[6],
|
||||||
|
style: TextStyle(
|
||||||
|
fontStyle: FontStyle.italic,
|
||||||
|
color: Colors.grey[600],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
trailing: Text("${repository[4]} Ğ1",
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 18, fontWeight: FontWeight.w500),
|
||||||
|
textAlign: TextAlign.justify),
|
||||||
|
dense: false,
|
||||||
|
isThreeLine: false,
|
||||||
|
onTap: () {
|
||||||
|
if (_historyProvider.isPubkey(context, repository[2])) {
|
||||||
|
_homeProvider.currentIndex = 0;
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(builder: (context) {
|
||||||
|
return const WalletViewScreen();
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
Navigator.pop(context);
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
]);
|
||||||
|
}).toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget headerProfileView(
|
||||||
|
BuildContext context,
|
||||||
|
WalletsProfilesProvider _historyProvider,
|
||||||
|
CesiumPlusProvider _cesiumPlusProvider) {
|
||||||
|
const double _avatarSize = 140;
|
||||||
|
|
||||||
|
return Column(children: <Widget>[
|
||||||
|
Container(
|
||||||
|
height: 10,
|
||||||
|
color: yellowC,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
gradient: LinearGradient(
|
||||||
|
begin: Alignment.topCenter,
|
||||||
|
end: Alignment.bottomCenter,
|
||||||
|
colors: [
|
||||||
|
yellowC,
|
||||||
|
const Color(0xFFE7811A),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 30, right: 40),
|
||||||
|
child: Row(children: <Widget>[
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: <Widget>[
|
||||||
|
Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
Row(children: [
|
||||||
|
GestureDetector(
|
||||||
|
key: const Key('copyPubkey'),
|
||||||
|
onTap: () {
|
||||||
|
Clipboard.setData(ClipboardData(
|
||||||
|
text: pubkey ?? _historyProvider.pubkey));
|
||||||
|
_historyProvider.snackCopyKey(context);
|
||||||
|
},
|
||||||
|
child: Text(
|
||||||
|
_historyProvider.getShortPubkey(
|
||||||
|
pubkey ?? _historyProvider.pubkey),
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 30,
|
||||||
|
fontWeight: FontWeight.w800,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
if (username == null)
|
||||||
|
Query(
|
||||||
|
options: QueryOptions(
|
||||||
|
document: gql(getId),
|
||||||
|
variables: {
|
||||||
|
'pubkey': _historyProvider.pubkey,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
builder: (QueryResult result,
|
||||||
|
{VoidCallback refetch, FetchMore fetchMore}) {
|
||||||
|
if (result.isLoading || result.hasException) {
|
||||||
|
return const Text('...');
|
||||||
|
} else if (result.data['idty'] == null ||
|
||||||
|
result.data['idty']['username'] == null) {
|
||||||
|
return const Text('');
|
||||||
|
} else {
|
||||||
|
return SizedBox(
|
||||||
|
width: 230,
|
||||||
|
child: Text(
|
||||||
|
result?.data['idty']['username'] ?? '',
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 27,
|
||||||
|
color: Color(0xff814C00),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
if (username != null)
|
||||||
|
Text(
|
||||||
|
username,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 27,
|
||||||
|
color: Color(0xff814C00),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 25),
|
||||||
|
]),
|
||||||
|
FutureBuilder(
|
||||||
|
future: _historyProvider.getBalance(pubkey),
|
||||||
|
builder:
|
||||||
|
(BuildContext context, AsyncSnapshot<num> _balance) {
|
||||||
|
if (_balance.connectionState != ConnectionState.done ||
|
||||||
|
_balance.hasError) {
|
||||||
|
return const Text('...');
|
||||||
|
}
|
||||||
|
return Text(
|
||||||
|
"${_balance.data.toString()} Ğ1",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 22, fontWeight: FontWeight.w500),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
const SizedBox(height: 30),
|
||||||
|
]),
|
||||||
|
const Spacer(),
|
||||||
|
Column(children: <Widget>[
|
||||||
|
if (avatar == null)
|
||||||
|
FutureBuilder(
|
||||||
|
future: _cesiumPlusProvider.getAvatar(
|
||||||
|
_historyProvider.pubkey, _avatarSize),
|
||||||
|
builder:
|
||||||
|
(BuildContext context, AsyncSnapshot<Image> _avatar) {
|
||||||
|
if (_avatar.connectionState != ConnectionState.done ||
|
||||||
|
_avatar.hasError) {
|
||||||
|
return Stack(children: [
|
||||||
|
ClipOval(
|
||||||
|
child:
|
||||||
|
_cesiumPlusProvider.defaultAvatar(_avatarSize),
|
||||||
|
),
|
||||||
|
Positioned(
|
||||||
|
top: 16.5,
|
||||||
|
right: 47.5,
|
||||||
|
width: 55,
|
||||||
|
height: 55,
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
strokeWidth: 6,
|
||||||
|
color: orangeC,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
if (_avatar.hasData) {
|
||||||
|
return GestureDetector(
|
||||||
|
key: const Key('openAvatar'),
|
||||||
|
onTap: () {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(builder: (context) {
|
||||||
|
return AvatarFullscreen(_avatar.data);
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: ClipOval(
|
||||||
|
child: _avatar.data,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return ClipOval(
|
||||||
|
child: _cesiumPlusProvider.defaultAvatar(_avatarSize),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
if (avatar != null)
|
||||||
|
GestureDetector(
|
||||||
|
key: const Key('openAvatar'),
|
||||||
|
onTap: () {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(builder: (context) {
|
||||||
|
return AvatarFullscreen(avatar);
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: ClipOval(
|
||||||
|
child: Image(
|
||||||
|
image: avatar.image,
|
||||||
|
height: _avatarSize,
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 25),
|
||||||
|
]),
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
|
@ -16,7 +16,7 @@ import 'package:provider/provider.dart';
|
||||||
import 'package:flutter_svg/flutter_svg.dart';
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
|
|
||||||
// ignore: must_be_immutable
|
// ignore: must_be_immutable
|
||||||
class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
class OldHistoryScreen extends StatelessWidget with ChangeNotifier {
|
||||||
final TextEditingController _outputPubkey = TextEditingController();
|
final TextEditingController _outputPubkey = TextEditingController();
|
||||||
ScrollController scrollController = ScrollController();
|
ScrollController scrollController = ScrollController();
|
||||||
final nRepositories = 20;
|
final nRepositories = 20;
|
||||||
|
@ -29,7 +29,7 @@ class HistoryScreen extends StatelessWidget with ChangeNotifier {
|
||||||
FetchMoreOptions opts;
|
FetchMoreOptions opts;
|
||||||
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
||||||
|
|
||||||
HistoryScreen({Key key}) : super(key: key);
|
OldHistoryScreen({Key key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
|
@ -14,9 +14,10 @@ class SearchResultScreen extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||||
SearchProvider _searchProvider = Provider.of<SearchProvider>(context);
|
SearchProvider _searchProvider =
|
||||||
|
Provider.of<SearchProvider>(context, listen: false);
|
||||||
CesiumPlusProvider _cesiumPlusProvider =
|
CesiumPlusProvider _cesiumPlusProvider =
|
||||||
Provider.of<CesiumPlusProvider>(context);
|
Provider.of<CesiumPlusProvider>(context, listen: false);
|
||||||
WalletsProfilesProvider _walletsProfilesClass =
|
WalletsProfilesProvider _walletsProfilesClass =
|
||||||
Provider.of<WalletsProfilesProvider>(context, listen: false);
|
Provider.of<WalletsProfilesProvider>(context, listen: false);
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,9 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:gecko/models/cesium_plus.dart';
|
import 'package:gecko/models/cesium_plus.dart';
|
||||||
import 'package:gecko/models/wallets_profiles.dart';
|
import 'package:gecko/models/wallets_profiles.dart';
|
||||||
import 'package:gecko/models/queries.dart';
|
import 'package:gecko/models/queries.dart';
|
||||||
// import 'package:gecko/models/wallet_options.dart';
|
|
||||||
import 'package:gecko/screens/avatar_fullscreen.dart';
|
import 'package:gecko/screens/avatar_fullscreen.dart';
|
||||||
|
import 'package:gecko/screens/common_elements.dart';
|
||||||
|
import 'package:gecko/screens/history.dart';
|
||||||
import 'package:graphql_flutter/graphql_flutter.dart';
|
import 'package:graphql_flutter/graphql_flutter.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
@ -21,11 +22,9 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
|
||||||
WalletsProfilesProvider _historyProvider =
|
WalletsProfilesProvider _historyProvider =
|
||||||
Provider.of<WalletsProfilesProvider>(context);
|
Provider.of<WalletsProfilesProvider>(context, listen: false);
|
||||||
CesiumPlusProvider _cesiumPlusProvider =
|
CesiumPlusProvider _cesiumPlusProvider =
|
||||||
Provider.of<CesiumPlusProvider>(context);
|
Provider.of<CesiumPlusProvider>(context, listen: false);
|
||||||
// WalletOptionsProvider _walletOptions = WalletOptionsProvider();
|
|
||||||
double _avatarSize = 150;
|
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
|
@ -65,172 +64,7 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
),
|
),
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
child: Column(children: <Widget>[
|
child: Column(children: <Widget>[
|
||||||
Container(
|
headerProfileView(context, _historyProvider, _cesiumPlusProvider),
|
||||||
height: 10,
|
|
||||||
color: yellowC,
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
gradient: LinearGradient(
|
|
||||||
begin: Alignment.topCenter,
|
|
||||||
end: Alignment.bottomCenter,
|
|
||||||
colors: [
|
|
||||||
yellowC,
|
|
||||||
const Color(0xFFE7811A),
|
|
||||||
],
|
|
||||||
)),
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 30),
|
|
||||||
child: Row(children: <Widget>[
|
|
||||||
Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: <Widget>[
|
|
||||||
Row(children: [
|
|
||||||
GestureDetector(
|
|
||||||
key: const Key('copyPubkey'),
|
|
||||||
onTap: () {
|
|
||||||
Clipboard.setData(ClipboardData(
|
|
||||||
text: pubkey ?? _historyProvider.pubkey));
|
|
||||||
_historyProvider.snackCopyKey(context);
|
|
||||||
},
|
|
||||||
child: Text(
|
|
||||||
_historyProvider.getShortPubkey(
|
|
||||||
pubkey ?? _historyProvider.pubkey),
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 30,
|
|
||||||
fontWeight: FontWeight.w800,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
]),
|
|
||||||
const SizedBox(height: 10),
|
|
||||||
if (username == null)
|
|
||||||
Query(
|
|
||||||
options: QueryOptions(
|
|
||||||
document: gql(getId),
|
|
||||||
variables: {
|
|
||||||
'pubkey': _historyProvider.pubkey,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
builder: (QueryResult result,
|
|
||||||
{VoidCallback refetch, FetchMore fetchMore}) {
|
|
||||||
if (result.isLoading || result.hasException) {
|
|
||||||
return const Text('...');
|
|
||||||
} else if (result.data['idty'] == null ||
|
|
||||||
result.data['idty']['username'] == null) {
|
|
||||||
return const Text('');
|
|
||||||
} else {
|
|
||||||
return SizedBox(
|
|
||||||
width: 230,
|
|
||||||
child: Text(
|
|
||||||
result?.data['idty']['username'] ?? '',
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 27,
|
|
||||||
color: Color(0xff814C00),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
|
||||||
if (username != null)
|
|
||||||
Text(
|
|
||||||
username,
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 27,
|
|
||||||
color: Color(0xff814C00),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 25),
|
|
||||||
FutureBuilder(
|
|
||||||
future: _cesiumPlusProvider
|
|
||||||
.getName(_historyProvider.pubkey),
|
|
||||||
initialData: '...',
|
|
||||||
builder: (context, snapshot) {
|
|
||||||
return SizedBox(
|
|
||||||
width: 230,
|
|
||||||
child: Text(
|
|
||||||
snapshot.data ?? '-',
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 18, color: Colors.black),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
const SizedBox(height: 30),
|
|
||||||
]),
|
|
||||||
const Spacer(),
|
|
||||||
Column(children: <Widget>[
|
|
||||||
if (avatar == null)
|
|
||||||
FutureBuilder(
|
|
||||||
future: _cesiumPlusProvider.getAvatar(
|
|
||||||
_historyProvider.pubkey, _avatarSize),
|
|
||||||
builder: (BuildContext context,
|
|
||||||
AsyncSnapshot<Image> _avatar) {
|
|
||||||
if (_avatar.connectionState !=
|
|
||||||
ConnectionState.done ||
|
|
||||||
_avatar.hasError) {
|
|
||||||
return Stack(children: [
|
|
||||||
ClipOval(
|
|
||||||
child: _cesiumPlusProvider
|
|
||||||
.defaultAvatar(_avatarSize),
|
|
||||||
),
|
|
||||||
Positioned(
|
|
||||||
top: 16.5,
|
|
||||||
right: 47.5,
|
|
||||||
width: 55,
|
|
||||||
height: 55,
|
|
||||||
child: CircularProgressIndicator(
|
|
||||||
strokeWidth: 6,
|
|
||||||
color: orangeC,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
if (_avatar.hasData) {
|
|
||||||
return GestureDetector(
|
|
||||||
key: const Key('openAvatar'),
|
|
||||||
onTap: () {
|
|
||||||
Navigator.push(
|
|
||||||
context,
|
|
||||||
MaterialPageRoute(builder: (context) {
|
|
||||||
return AvatarFullscreen(_avatar.data);
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
child: ClipOval(
|
|
||||||
child: _avatar.data,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return ClipOval(
|
|
||||||
child: _cesiumPlusProvider
|
|
||||||
.defaultAvatar(_avatarSize),
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
if (avatar != null)
|
|
||||||
GestureDetector(
|
|
||||||
key: const Key('openAvatar'),
|
|
||||||
onTap: () {
|
|
||||||
Navigator.push(
|
|
||||||
context,
|
|
||||||
MaterialPageRoute(builder: (context) {
|
|
||||||
return AvatarFullscreen(avatar);
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
child: ClipOval(
|
|
||||||
child: Image(
|
|
||||||
image: avatar.image,
|
|
||||||
height: _avatarSize,
|
|
||||||
fit: BoxFit.cover,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 25),
|
|
||||||
]),
|
|
||||||
]),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(height: isTall ? 60 : 30),
|
SizedBox(height: isTall ? 60 : 30),
|
||||||
Row(mainAxisAlignment: MainAxisAlignment.spaceAround, children: [
|
Row(mainAxisAlignment: MainAxisAlignment.spaceAround, children: [
|
||||||
Column(children: <Widget>[
|
Column(children: <Widget>[
|
||||||
|
@ -249,7 +83,16 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
'assets/walletOptions/clock.png'),
|
'assets/walletOptions/clock.png'),
|
||||||
height: 90)),
|
height: 90)),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
null;
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
FaderTransition(
|
||||||
|
page: HistoryScreen(
|
||||||
|
pubkey: pubkey ?? _historyProvider.pubkey,
|
||||||
|
username: username,
|
||||||
|
avatar: avatar,
|
||||||
|
),
|
||||||
|
isFast: false),
|
||||||
|
);
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -352,4 +195,176 @@ class WalletViewScreen extends StatelessWidget {
|
||||||
]),
|
]),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget headerProfileView(
|
||||||
|
BuildContext context,
|
||||||
|
WalletsProfilesProvider _historyProvider,
|
||||||
|
CesiumPlusProvider _cesiumPlusProvider) {
|
||||||
|
const double _avatarSize = 140;
|
||||||
|
|
||||||
|
return Column(children: <Widget>[
|
||||||
|
Container(
|
||||||
|
height: 10,
|
||||||
|
color: yellowC,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
gradient: LinearGradient(
|
||||||
|
begin: Alignment.topCenter,
|
||||||
|
end: Alignment.bottomCenter,
|
||||||
|
colors: [
|
||||||
|
yellowC,
|
||||||
|
const Color(0xFFE7811A),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 30, right: 40),
|
||||||
|
child: Row(children: <Widget>[
|
||||||
|
Column(crossAxisAlignment: CrossAxisAlignment.start, children: <
|
||||||
|
Widget>[
|
||||||
|
Row(children: [
|
||||||
|
GestureDetector(
|
||||||
|
key: const Key('copyPubkey'),
|
||||||
|
onTap: () {
|
||||||
|
Clipboard.setData(
|
||||||
|
ClipboardData(text: pubkey ?? _historyProvider.pubkey));
|
||||||
|
_historyProvider.snackCopyKey(context);
|
||||||
|
},
|
||||||
|
child: Text(
|
||||||
|
_historyProvider
|
||||||
|
.getShortPubkey(pubkey ?? _historyProvider.pubkey),
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 30,
|
||||||
|
fontWeight: FontWeight.w800,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
if (username == null)
|
||||||
|
Query(
|
||||||
|
options: QueryOptions(
|
||||||
|
document: gql(getId),
|
||||||
|
variables: {
|
||||||
|
'pubkey': _historyProvider.pubkey,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
builder: (QueryResult result,
|
||||||
|
{VoidCallback refetch, FetchMore fetchMore}) {
|
||||||
|
if (result.isLoading || result.hasException) {
|
||||||
|
return const Text('...');
|
||||||
|
} else if (result.data['idty'] == null ||
|
||||||
|
result.data['idty']['username'] == null) {
|
||||||
|
return const Text('');
|
||||||
|
} else {
|
||||||
|
return SizedBox(
|
||||||
|
width: 230,
|
||||||
|
child: Text(
|
||||||
|
result?.data['idty']['username'] ?? '',
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 27,
|
||||||
|
color: Color(0xff814C00),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
if (username != null)
|
||||||
|
Text(
|
||||||
|
username,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 27,
|
||||||
|
color: Color(0xff814C00),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 25),
|
||||||
|
FutureBuilder(
|
||||||
|
future: _cesiumPlusProvider.getName(_historyProvider.pubkey),
|
||||||
|
initialData: '...',
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
return SizedBox(
|
||||||
|
width: 230,
|
||||||
|
child: Text(
|
||||||
|
snapshot.data ?? '-',
|
||||||
|
style:
|
||||||
|
const TextStyle(fontSize: 18, color: Colors.black),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
const SizedBox(height: 30),
|
||||||
|
]),
|
||||||
|
const Spacer(),
|
||||||
|
Column(children: <Widget>[
|
||||||
|
if (avatar == null)
|
||||||
|
FutureBuilder(
|
||||||
|
future: _cesiumPlusProvider.getAvatar(
|
||||||
|
_historyProvider.pubkey, _avatarSize),
|
||||||
|
builder:
|
||||||
|
(BuildContext context, AsyncSnapshot<Image> _avatar) {
|
||||||
|
if (_avatar.connectionState != ConnectionState.done ||
|
||||||
|
_avatar.hasError) {
|
||||||
|
return Stack(children: [
|
||||||
|
ClipOval(
|
||||||
|
child:
|
||||||
|
_cesiumPlusProvider.defaultAvatar(_avatarSize),
|
||||||
|
),
|
||||||
|
Positioned(
|
||||||
|
top: 16.5,
|
||||||
|
right: 47.5,
|
||||||
|
width: 55,
|
||||||
|
height: 55,
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
strokeWidth: 6,
|
||||||
|
color: orangeC,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
if (_avatar.hasData) {
|
||||||
|
return GestureDetector(
|
||||||
|
key: const Key('openAvatar'),
|
||||||
|
onTap: () {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(builder: (context) {
|
||||||
|
return AvatarFullscreen(_avatar.data);
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: ClipOval(
|
||||||
|
child: _avatar.data,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return ClipOval(
|
||||||
|
child: _cesiumPlusProvider.defaultAvatar(_avatarSize),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
if (avatar != null)
|
||||||
|
GestureDetector(
|
||||||
|
key: const Key('openAvatar'),
|
||||||
|
onTap: () {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(builder: (context) {
|
||||||
|
return AvatarFullscreen(avatar);
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: ClipOval(
|
||||||
|
child: Image(
|
||||||
|
image: avatar.image,
|
||||||
|
height: _avatarSize,
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 25),
|
||||||
|
]),
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -885,6 +885,13 @@ packages:
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.1.0"
|
version: "1.1.0"
|
||||||
|
pull_to_refresh:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: pull_to_refresh
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "2.0.0"
|
||||||
qr:
|
qr:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|
|
@ -5,7 +5,7 @@ description: Pay with G1.
|
||||||
# pub.dev using `pub publish`. This is preferred for private packages.
|
# pub.dev using `pub publish`. This is preferred for private packages.
|
||||||
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||||
|
|
||||||
version: 0.0.3+9
|
version: 0.0.3+10
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.7.0 <3.0.0"
|
sdk: ">=2.7.0 <3.0.0"
|
||||||
|
@ -56,6 +56,7 @@ dependencies:
|
||||||
truncate: ^3.0.1
|
truncate: ^3.0.1
|
||||||
unorm_dart: ^0.2.0
|
unorm_dart: ^0.2.0
|
||||||
xml: ^5.3.0
|
xml: ^5.3.0
|
||||||
|
pull_to_refresh: ^2.0.0
|
||||||
|
|
||||||
flutter_icons:
|
flutter_icons:
|
||||||
android: "ic_launcher"
|
android: "ic_launcher"
|
||||||
|
|
Loading…
Reference in New Issue