Add blockchain username in wallet view; Can open avatar fullscreen; Fix HD assets size in mywallets view

This commit is contained in:
poka 2021-11-29 05:53:21 +01:00
parent 300a6ce5cc
commit 39881ba136
8 changed files with 152 additions and 79 deletions

View File

@ -105,7 +105,7 @@ class CesiumPlusProvider with ChangeNotifier {
return Image.file( return Image.file(
avatarFile, avatarFile,
height: size, height: size,
fit: BoxFit.cover, fit: BoxFit.fitWidth,
); );
} }
} }

View File

@ -86,3 +86,12 @@ query ($number: Int!, $cursor: String) {
} }
} }
'''; ''';
const String getId = r'''
query ($pubkey: PubKeyGva!) {
idty(pubkey: $pubkey) {
isMember
username
}
}
''';

View File

@ -0,0 +1,48 @@
import 'package:flutter/services.dart';
import 'package:gecko/globals.dart';
import 'package:flutter/material.dart';
// import 'package:gecko/models/home.dart';
// import 'package:provider/provider.dart';
// ignore: must_be_immutable
class AvatarFullscreen extends StatelessWidget {
TextEditingController tplController = TextEditingController();
AvatarFullscreen(this.avatar, {Key key}) : super(key: key);
final Image avatar;
@override
Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
// HomeProvider _homeProvider = Provider.of<HomeProvider>(context);
return Scaffold(
appBar: AppBar(
elevation: 0,
backgroundColor: Colors.black,
toolbarHeight: 60 * ratio,
leading: IconButton(
icon: Icon(Icons.arrow_back, color: orangeC),
onPressed: () {
Navigator.pop(context);
}),
title: SizedBox(
height: 22,
child: Text(
'Photo de profil',
style: TextStyle(color: orangeC),
),
)),
body: SafeArea(
child: SizedBox.expand(
child: Container(
color: Colors.black,
// alignment: Alignment.center,
// height: MediaQuery.of(context).size.height,
// width: MediaQuery.of(context).size.width,
child: avatar,
),
),
),
);
}
}

View File

@ -89,8 +89,9 @@ Widget cesiumWalletOptions(BuildContext context, ChestData cesiumWallet,
child: Column(children: <Widget>[ child: Column(children: <Widget>[
Image.asset( Image.asset(
'assets/walletOptions/camera.png', 'assets/walletOptions/camera.png',
height: 40,
), ),
const SizedBox(height: 100) const SizedBox(height: 80)
])), ])),
Column(children: <Widget>[ Column(children: <Widget>[
Row(children: <Widget>[ Row(children: <Widget>[
@ -175,15 +176,17 @@ Widget cesiumWalletOptions(BuildContext context, ChestData cesiumWallet,
), ),
const SizedBox(height: 5), const SizedBox(height: 5),
InkWell( InkWell(
key: const Key('displayBalance'), key: const Key('displayBalance'),
onTap: () { onTap: () {
_walletOptions.bluringBalance(); _walletOptions.bluringBalance();
}, },
child: Image.asset( child: Image.asset(
_walletOptions.isBalanceBlur _walletOptions.isBalanceBlur
? 'assets/walletOptions/icon_oeuil.png' ? 'assets/walletOptions/icon_oeuil.png'
: 'assets/walletOptions/icon_oeuil_close.png', : 'assets/walletOptions/icon_oeuil_close.png',
)), height: 35,
),
),
]), ]),
const SizedBox(width: 0), const SizedBox(width: 0),
Column(children: <Widget>[ Column(children: <Widget>[
@ -234,6 +237,7 @@ Widget cesiumWalletOptions(BuildContext context, ChestData cesiumWallet,
const SizedBox(width: 30), const SizedBox(width: 30),
Image.asset( Image.asset(
'assets/walletOptions/key.png', 'assets/walletOptions/key.png',
height: 45,
), ),
const SizedBox(width: 20), const SizedBox(width: 20),
Text("${shortPubkey.split(':')[0]}:", Text("${shortPubkey.split(':')[0]}:",
@ -267,6 +271,7 @@ Widget cesiumWalletOptions(BuildContext context, ChestData cesiumWallet,
child: Row(children: <Widget>[ child: Row(children: <Widget>[
Image.asset( Image.asset(
'assets/walletOptions/copy-white.png', 'assets/walletOptions/copy-white.png',
height: 25,
), ),
const SizedBox(width: 7), const SizedBox(width: 7),
Text('Copier', Text('Copier',
@ -287,6 +292,7 @@ Widget cesiumWalletOptions(BuildContext context, ChestData cesiumWallet,
const SizedBox(width: 30), const SizedBox(width: 30),
Image.asset( Image.asset(
'assets/walletOptions/clock.png', 'assets/walletOptions/clock.png',
height: 45,
), ),
const SizedBox(width: 22), const SizedBox(width: 22),
const Text('Historique des transactions', const Text('Historique des transactions',
@ -312,11 +318,12 @@ Widget cesiumWalletOptions(BuildContext context, ChestData cesiumWallet,
child: SizedBox( child: SizedBox(
height: 50, height: 50,
child: Row(children: <Widget>[ child: Row(children: <Widget>[
const SizedBox(width: 28), const SizedBox(width: 31),
Image.asset( Image.asset(
'assets/chests/secret_code.png', 'assets/chests/secret_code.png',
height: 24,
), ),
const SizedBox(width: 18), const SizedBox(width: 20),
const Text('Changer mon code secret', const Text('Changer mon code secret',
style: TextStyle(fontSize: 20, color: Colors.black)), style: TextStyle(fontSize: 20, color: Colors.black)),
])), ])),
@ -333,8 +340,9 @@ Widget cesiumWalletOptions(BuildContext context, ChestData cesiumWallet,
const SizedBox(width: 33), const SizedBox(width: 33),
Image.asset( Image.asset(
'assets/walletOptions/trash.png', 'assets/walletOptions/trash.png',
height: 45,
), ),
const SizedBox(width: 25), const SizedBox(width: 21),
const Text( const Text(
'Supprimer ce coffre', 'Supprimer ce coffre',
style: TextStyle( style: TextStyle(

View File

@ -68,6 +68,7 @@ class ChestOptions extends StatelessWidget {
const SizedBox(width: 28), const SizedBox(width: 28),
Image.asset( Image.asset(
'assets/chests/secret_code.png', 'assets/chests/secret_code.png',
height: 25,
), ),
const SizedBox(width: 18), const SizedBox(width: 18),
const Text('Changer mon code secret', const Text('Changer mon code secret',
@ -83,11 +84,12 @@ class ChestOptions extends StatelessWidget {
child: SizedBox( child: SizedBox(
height: 50, height: 50,
child: Row(children: <Widget>[ child: Row(children: <Widget>[
const SizedBox(width: 33), const SizedBox(width: 30),
Image.asset( Image.asset(
'assets/walletOptions/trash.png', 'assets/walletOptions/trash.png',
height: 45,
), ),
const SizedBox(width: 24), const SizedBox(width: 20),
const Text( const Text(
'Supprimer ce coffre', 'Supprimer ce coffre',
style: TextStyle( style: TextStyle(

View File

@ -131,8 +131,9 @@ class WalletOptions extends StatelessWidget {
child: Column(children: <Widget>[ child: Column(children: <Widget>[
Image.asset( Image.asset(
'assets/walletOptions/camera.png', 'assets/walletOptions/camera.png',
height: 40,
), ),
const SizedBox(height: 100) const SizedBox(height: 80)
])), ])),
Column(children: <Widget>[ Column(children: <Widget>[
Row(children: <Widget>[ Row(children: <Widget>[
@ -221,15 +222,17 @@ class WalletOptions extends StatelessWidget {
), ),
const SizedBox(height: 5), const SizedBox(height: 5),
InkWell( InkWell(
key: const Key('displayBalance'), key: const Key('displayBalance'),
onTap: () { onTap: () {
_walletOptions.bluringBalance(); _walletOptions.bluringBalance();
}, },
child: Image.asset( child: Image.asset(
_walletOptions.isBalanceBlur _walletOptions.isBalanceBlur
? 'assets/walletOptions/icon_oeuil.png' ? 'assets/walletOptions/icon_oeuil.png'
: 'assets/walletOptions/icon_oeuil_close.png', : 'assets/walletOptions/icon_oeuil_close.png',
)), height: 35,
),
),
]), ]),
const SizedBox(width: 0), const SizedBox(width: 0),
Column(children: <Widget>[ Column(children: <Widget>[
@ -282,6 +285,7 @@ class WalletOptions extends StatelessWidget {
const SizedBox(width: 30), const SizedBox(width: 30),
Image.asset( Image.asset(
'assets/walletOptions/key.png', 'assets/walletOptions/key.png',
height: 45,
), ),
const SizedBox(width: 20), const SizedBox(width: 20),
Text("${shortPubkey.split(':')[0]}:", Text("${shortPubkey.split(':')[0]}:",
@ -315,6 +319,7 @@ class WalletOptions extends StatelessWidget {
child: Row(children: <Widget>[ child: Row(children: <Widget>[
Image.asset( Image.asset(
'assets/walletOptions/copy-white.png', 'assets/walletOptions/copy-white.png',
height: 25,
), ),
const SizedBox(width: 7), const SizedBox(width: 7),
Text( Text(
@ -341,6 +346,7 @@ class WalletOptions extends StatelessWidget {
const SizedBox(width: 30), const SizedBox(width: 30),
Image.asset( Image.asset(
'assets/walletOptions/clock.png', 'assets/walletOptions/clock.png',
height: 45,
), ),
const SizedBox(width: 22), const SizedBox(width: 22),
const Text('Historique des transactions', const Text('Historique des transactions',
@ -369,6 +375,7 @@ class WalletOptions extends StatelessWidget {
.grey[_walletOptions.isDefaultWallet ? 300 : 500], .grey[_walletOptions.isDefaultWallet ? 300 : 500],
child: Image.asset( child: Image.asset(
'assets/walletOptions/android-checkmark.png', 'assets/walletOptions/android-checkmark.png',
height: 25,
), ),
), ),
const SizedBox(width: 22), const SizedBox(width: 22),
@ -399,11 +406,12 @@ class WalletOptions extends StatelessWidget {
} }
: null, : null,
child: Row(children: <Widget>[ child: Row(children: <Widget>[
const SizedBox(width: 33), const SizedBox(width: 30),
Image.asset( Image.asset(
'assets/walletOptions/trash.png', 'assets/walletOptions/trash.png',
height: 45,
), ),
const SizedBox(width: 24), const SizedBox(width: 19),
const Text('Supprimer ce portefeuille', const Text('Supprimer ce portefeuille',
style: style:
TextStyle(fontSize: 20, color: Color(0xffD80000))), TextStyle(fontSize: 20, color: Color(0xffD80000))),

View File

@ -1,6 +1,5 @@
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:gecko/globals.dart'; import 'package:gecko/globals.dart';
import 'package:gecko/screens/home.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
// import 'package:gecko/models/home.dart'; // import 'package:gecko/models/home.dart';
// import 'package:provider/provider.dart'; // import 'package:provider/provider.dart';
@ -22,26 +21,6 @@ class TemplateScreen extends StatelessWidget {
height: 22, height: 22,
child: Text('Template screen'), child: Text('Template screen'),
)), )),
floatingActionButton: SizedBox(
height: 80.0,
width: 80.0,
child: FittedBox(
child: FloatingActionButton(
heroTag: "tplButton",
onPressed: () => Navigator.push(
context,
MaterialPageRoute(builder: (context) {
return const HomeScreen();
}),
),
child: SizedBox(
height: 40.0,
width: 40.0,
child: Icon(Icons.home, color: Colors.grey[850]),
),
backgroundColor:
floattingYellow, //smoothYellow, //Color.fromARGB(500, 204, 255, 255),
))),
body: SafeArea( body: SafeArea(
child: Column(children: <Widget>[ child: Column(children: <Widget>[
const SizedBox(height: 20), const SizedBox(height: 20),
@ -58,30 +37,6 @@ class TemplateScreen extends StatelessWidget {
color: Colors.black, color: Colors.black,
fontWeight: FontWeight.w400)), fontWeight: FontWeight.w400)),
const SizedBox(height: 20), const SizedBox(height: 20),
ElevatedButton(
style: ElevatedButton.styleFrom(
primary: yellowC, // background
onPrimary: Colors.black, // foreground
),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) {
return const HomeScreen();
}),
);
},
child: const Text('Retour Accueil',
style: TextStyle(fontSize: 20))),
const SizedBox(height: 20),
GestureDetector(
onTap: () {
Navigator.popUntil(
context,
ModalRoute.withName('/'),
);
},
child: const Icon(Icons.home))
]), ]),
)); ));
} }

View File

@ -5,6 +5,9 @@ import 'package:gecko/globals.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gecko/models/cesium_plus.dart'; import 'package:gecko/models/cesium_plus.dart';
import 'package:gecko/models/history.dart'; import 'package:gecko/models/history.dart';
import 'package:gecko/models/queries.dart';
import 'package:gecko/screens/avatar_fullscreen.dart';
import 'package:graphql_flutter/graphql_flutter.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
// import 'package:gecko/models/home.dart'; // import 'package:gecko/models/home.dart';
// import 'package:provider/provider.dart'; // import 'package:provider/provider.dart';
@ -34,7 +37,7 @@ class WalletViewScreen extends StatelessWidget {
body: SafeArea( body: SafeArea(
child: Column(children: <Widget>[ child: Column(children: <Widget>[
Container( Container(
height: isTall ? 30 : 10, height: 10,
color: yellowC, color: yellowC,
), ),
Container( Container(
@ -69,7 +72,36 @@ class WalletViewScreen extends StatelessWidget {
), ),
), ),
), ),
const SizedBox(height: 15), const SizedBox(height: 10),
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),
),
),
);
}
},
),
const SizedBox(height: 25),
FutureBuilder( FutureBuilder(
future: _cesiumPlusProvider future: _cesiumPlusProvider
.getName(_historyProvider.pubkey), .getName(_historyProvider.pubkey),
@ -80,7 +112,7 @@ class WalletViewScreen extends StatelessWidget {
child: Text( child: Text(
snapshot.data ?? '-', snapshot.data ?? '-',
style: const TextStyle( style: const TextStyle(
fontSize: 20, color: Color(0xff814C00)), fontSize: 18, color: Colors.black),
), ),
); );
}), }),
@ -113,8 +145,19 @@ class WalletViewScreen extends StatelessWidget {
]); ]);
} }
if (_avatar.hasData) { if (_avatar.hasData) {
return ClipOval( return GestureDetector(
child: _avatar.data, key: const Key('openAvatar'),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) {
return AvatarFullscreen(_avatar.data);
}),
);
},
child: ClipOval(
child: _avatar.data,
),
); );
} }
return ClipOval( return ClipOval(
@ -122,7 +165,7 @@ class WalletViewScreen extends StatelessWidget {
_cesiumPlusProvider.defaultAvatar(_avatarSize), _cesiumPlusProvider.defaultAvatar(_avatarSize),
); );
}), }),
const SizedBox(height: 30), const SizedBox(height: 25),
]), ]),
]), ]),
), ),